repo

package
v0.0.0-...-724633c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2022 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProviderSet = wire.NewSet(NewImpl)

ProviderSet is a provider set for wire

Functions

This section is empty.

Types

type GetUserProfileResponse

type GetUserProfileResponse struct {
	// UserID: Identifier of the user
	UserID string `json:"userId"`

	// DisplayName: User's display name
	DisplayName string `json:"displayName"`

	// PictureURL: Profile image URL. "https" image URL. Not included in the response if the user doesn't have a profile image.
	PictureURL string `json:"pictureUrl"`

	// StatusMessage: User's status message. Not included in the response if the user doesn't have a status message.
	StatusMessage string `json:"statusMessage"`
}

GetUserProfileResponse ...

type IRepo

type IRepo interface {
	// GetAccessToken serve caller to given request to get access token
	GetAccessToken(ctx contextx.Contextx, req *http.Request) (info *TokenResponse, err error)

	// GetUserProfile serve caller to given request to get user profile
	GetUserProfile(ctx contextx.Contextx, req *http.Request) (info *GetUserProfileResponse, err error)

	// GetUserByOpenID serve caller to given line open id to get user profile
	GetUserByOpenID(ctx contextx.Contextx, oid string) (info *user.Profile, err error)

	// RegisterUser serve caller to given user profile to insert into database
	RegisterUser(ctx contextx.Contextx, newUser *user.Profile) (info *user.Profile, err error)
}

IRepo declare user's repository functions

func CreateIRepo

func CreateIRepo(logger *zap.Logger, client *mongo.Client) (IRepo, error)

func NewImpl

func NewImpl(logger *zap.Logger, client *mongo.Client) IRepo

NewImpl an IRepo

type TokenRefreshResponse

type TokenRefreshResponse struct {
	// TokenType: Bearer
	TokenType string `json:"token_type"`

	// Scope: Permissions granted by the user. For more information, see Scopes.
	// profile: Permission to get the user's profile information.
	// openid: Used to retrieve an ID token. For more information, see ID tokens.
	// email: Permission to get the user's email address. openid must be specified at the same time. For more information, see ID tokens.
	Scope string `json:"scope"`

	// AccessToken: Access token. Valid for 30 days.
	AccessToken string `json:"access_token"`

	// ExpiresIn: Amount of time in seconds until the access token expires
	ExpiresIn int `json:"expires_in"`

	// RefreshToken: Which token you want to refresh.
	// Token used to get a new access token. Valid up until 10 days after the access token expires.
	RefreshToken string `json:"refresh_token"`
}

TokenRefreshResponse ...

type TokenResponse

type TokenResponse struct {
	// AccessToken: Access token. Valid for 30 days.
	AccessToken string `json:"access_token"`

	// ExpiresIn: Amount of time in seconds until the access token expires
	ExpiresIn int `json:"expires_in"`

	// IDToken: JSON Web Token (JWT) that includes information about the user.
	// This field is returned only if openid is specified in the scope. For more information, see ID tokens.
	IDToken string `json:"id_token"`

	// RefreshToken: Which token you want to refresh.
	// Token used to get a new access token. Valid up until 10 days after the access token expires.
	RefreshToken string `json:"refresh_token"`

	// Scope: Permissions granted by the user. For more information, see Scopes.
	// profile: Permission to get the user's profile information.
	// openid: Used to retrieve an ID token. For more information, see ID tokens.
	// email: Permission to get the user's email address. openid must be specified at the same time. For more information, see ID tokens.
	Scope string `json:"scope"`

	// TokenType: Bearer
	TokenType string `json:"token_type"`
}

TokenResponse ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL