Documentation ¶
Index ¶
- type Account
- type CreateRequest
- type CreateResponse
- type DeleteRequest
- type DeleteResponse
- type LoginRequest
- type LoginResponse
- type LogoutRequest
- type LogoutResponse
- type ReadRequest
- type ReadResponse
- type ReadSessionRequest
- type ReadSessionResponse
- type SendVerificationEmailRequest
- type SendVerificationEmailResponse
- type Session
- type UpdatePasswordRequest
- type UpdatePasswordResponse
- type UpdateRequest
- type UpdateResponse
- type UserService
- func (t *UserService) Create(request *CreateRequest) (*CreateResponse, error)
- func (t *UserService) Delete(request *DeleteRequest) (*DeleteResponse, error)
- func (t *UserService) Login(request *LoginRequest) (*LoginResponse, error)
- func (t *UserService) Logout(request *LogoutRequest) (*LogoutResponse, error)
- func (t *UserService) Read(request *ReadRequest) (*ReadResponse, error)
- func (t *UserService) ReadSession(request *ReadSessionRequest) (*ReadSessionResponse, error)
- func (t *UserService) SendVerificationEmail(request *SendVerificationEmailRequest) (*SendVerificationEmailResponse, error)
- func (t *UserService) Update(request *UpdateRequest) (*UpdateResponse, error)
- func (t *UserService) UpdatePassword(request *UpdatePasswordRequest) (*UpdatePasswordResponse, error)
- func (t *UserService) VerifyEmail(request *VerifyEmailRequest) (*VerifyEmailResponse, error)
- type VerifyEmailRequest
- type VerifyEmailResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { // unix timestamp Created int64 `json:"created"` // an email address Email string `json:"email"` // unique account id Id string `json:"id"` // Store any custom data you want about your users in this fields. Profile map[string]string `json:"profile"` // unix timestamp Updated int64 `json:"updated"` // alphanumeric username Username string `json:"username"` VerificationDate int64 `json:"verificationDate"` Verified bool `json:"verified"` }
type CreateRequest ¶
type CreateRequest struct { // the email address Email string `json:"email"` // optional account id Id string `json:"id"` // the user password Password string `json:"password"` // optional user profile as map<string,string> Profile map[string]string `json:"profile"` // the username Username string `json:"username"` }
type CreateResponse ¶
type CreateResponse struct {
Account *Account `json:"account"`
}
type DeleteRequest ¶
type DeleteRequest struct { // the account id Id string `json:"id"` }
type DeleteResponse ¶
type DeleteResponse struct { }
type LoginRequest ¶
type LoginResponse ¶
type LoginResponse struct { // The session of the logged in user Session *Session `json:"session"` }
type LogoutRequest ¶
type LogoutRequest struct {
SessionId string `json:"sessionId"`
}
type LogoutResponse ¶
type LogoutResponse struct { }
type ReadRequest ¶
type ReadResponse ¶
type ReadResponse struct {
Account *Account `json:"account"`
}
type ReadSessionRequest ¶
type ReadSessionRequest struct { // The unique session id SessionId string `json:"sessionId"` }
type ReadSessionResponse ¶
type ReadSessionResponse struct {
Session *Session `json:"session"`
}
type SendVerificationEmailRequest ¶
type SendVerificationEmailRequest struct { Email string `json:"email"` FailureRedirectUrl string `json:"failureRedirectUrl"` // Display name of the sender for the email. Note: the email address will still be 'support@m3o.com' FromName string `json:"fromName"` RedirectUrl string `json:"redirectUrl"` Subject string `json:"subject"` // Text content of the email. Don't forget to include the string '$micro_verification_link' which will be replaced by the real verification link // HTML emails are not available currently. TextContent string `json:"textContent"` }
type SendVerificationEmailResponse ¶
type SendVerificationEmailResponse struct { }
type UpdatePasswordRequest ¶
type UpdatePasswordResponse ¶
type UpdatePasswordResponse struct { }
type UpdateRequest ¶
type UpdateResponse ¶
type UpdateResponse struct { }
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
func NewUserService ¶
func NewUserService(token string) *UserService
func (*UserService) Create ¶
func (t *UserService) Create(request *CreateRequest) (*CreateResponse, error)
Create a new user account. The email address and username for the account must be unique.
func (*UserService) Delete ¶
func (t *UserService) Delete(request *DeleteRequest) (*DeleteResponse, error)
Delete an account by id
func (*UserService) Login ¶
func (t *UserService) Login(request *LoginRequest) (*LoginResponse, error)
Login using username or email. The response will return a new session for successful login, 401 in the case of login failure and 500 for any other error
func (*UserService) Logout ¶
func (t *UserService) Logout(request *LogoutRequest) (*LogoutResponse, error)
Logout a user account
func (*UserService) Read ¶
func (t *UserService) Read(request *ReadRequest) (*ReadResponse, error)
Read an account by id, username or email. Only one need to be specified.
func (*UserService) ReadSession ¶
func (t *UserService) ReadSession(request *ReadSessionRequest) (*ReadSessionResponse, error)
Read a session by the session id. In the event it has expired or is not found and error is returned.
func (*UserService) SendVerificationEmail ¶
func (t *UserService) SendVerificationEmail(request *SendVerificationEmailRequest) (*SendVerificationEmailResponse, error)
Send a verification email to the user being signed up. Email from will be from 'support@m3o.com', but you can provide the title and contents. The verification link will be injected in to the email as a template variable, $micro_verification_link. Example: 'Hi there, welcome onboard! Use the link below to verify your email: $micro_verification_link' The variable will be replaced with an actual url that will look similar to this: 'https://user.m3o.com/user/verify?token=a-verification-token&rediretUrl=your-redir-url'
func (*UserService) Update ¶
func (t *UserService) Update(request *UpdateRequest) (*UpdateResponse, error)
Update the account username or email
func (*UserService) UpdatePassword ¶
func (t *UserService) UpdatePassword(request *UpdatePasswordRequest) (*UpdatePasswordResponse, error)
Update the account password
func (*UserService) VerifyEmail ¶
func (t *UserService) VerifyEmail(request *VerifyEmailRequest) (*VerifyEmailResponse, error)
Verify the email address of an account from a token sent in an email to the user.
type VerifyEmailRequest ¶
type VerifyEmailRequest struct { // The token from the verification email Token string `json:"token"` }
type VerifyEmailResponse ¶
type VerifyEmailResponse struct { }