Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrAccountMismatch ... ErrAccountMismatch = errors.New("Account mismatch") )
Functions ¶
func RegisterRoutes ¶
func RegisterRoutes(router *mux.Router, service ServiceInterface)
RegisterRoutes registers route handlers for the accounts service
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter ...
func NewAdapter ¶
NewAdapter starts a new Adapter instance
func (*Adapter) AuthCodeURL ¶
AuthCodeURL generates an authorisation URL
type AdapterInterface ¶
type AdapterInterface interface {
// Exported methods
AuthCodeURL(state string) string
Exchange(code string) (*oauth2.Token, error)
GetMe(accessToken string) (fb.Result, error)
}
AdapterInterface defines exported methods
type AdapterMock ¶
AdapterMock is a mocked object implementing AdapterInterface
func (*AdapterMock) AuthCodeURL ¶
func (_m *AdapterMock) AuthCodeURL(state string) string
AuthCodeURL ...
type ProfilePicture ¶
type ProfilePicture struct {
Data *ProfilePictureData `json:"data"`
}
ProfilePicture ...
type ProfilePictureData ¶
type ProfilePictureData struct {
Width int `json:"width"`
Height int `json:"height"`
IsSilhouette bool `json:"is_silhouette"`
URL string `json:"url"`
}
ProfilePictureData ...
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service struct keeps objects to avoid passing them around
func NewService ¶
func NewService(cnf *config.Config, db *gorm.DB, accountsService accounts.ServiceInterface, adapter AdapterInterface) *Service
NewService starts a new Service instance
func (*Service) GetAccountsService ¶
func (s *Service) GetAccountsService() accounts.ServiceInterface
GetAccountsService returns accounts.Service instance
func (*Service) GetAdapter ¶
func (s *Service) GetAdapter() AdapterInterface
GetAdapter returns Adapter instance
func (*Service) LoginHandler ¶
func (s *Service) LoginHandler(w http.ResponseWriter, r *http.Request)
LoginHandler - requests to login with Facebook access token (POST /v1/facebook/login)
type ServiceInterface ¶
type ServiceInterface interface {
// Exported methods
GetAccountsService() accounts.ServiceInterface
// Needed for the NewRoutes to be able to register handlers
LoginHandler(w http.ResponseWriter, r *http.Request)
}
ServiceInterface defines exported methods
type UserProfile ¶
type UserProfile struct {
ID string `json:"id"`
Name string `json:"name"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Email *string `json:"email"`
Picture *ProfilePicture `json:"picture"`
}
UserProfile ...
Click to show internal directories.
Click to hide internal directories.