Documentation
¶
Index ¶
- func ErrorResponse(c echo.Context, status int, err error) error
- func GetAuthorizationEndpoint(c echo.Context) error
- func LoginConfirmationEndpoint(c echo.Context) error
- func LoginRequestEndpoint(c echo.Context) error
- func LogoutRequestEndpoint(c echo.Context) error
- func StandardResponse(c echo.Context, status int, res interface{}) error
- type StatusObject
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorResponse ¶
ErrorResponse reports the error and responds with an ErrorObject
func GetAuthorizationEndpoint ¶ added in v2.4.0
func GetAuthorizationEndpoint(c echo.Context) error
GetAuthorizationEndpoint exchanges a temporary confirmation token for a 'real' token.
POST /auth status 200: success, the real token is in the response status 401: token is expired or has already been used, token and user_id do not match status 404: token was not found
func LoginConfirmationEndpoint ¶ added in v2.4.0
func LoginConfirmationEndpoint(c echo.Context) error
LoginConfirmationEndpoint validates an email.
GET /login/:token status 307: account is confirmed, redirect to podops.dev/confirmed status 400: the request could not be understood by the server due to malformed syntax status 401: token is wrong status 403: token is expired or has already been used status 404: token was not found
func LoginRequestEndpoint ¶ added in v2.4.0
func LoginRequestEndpoint(c echo.Context) error
LoginRequestEndpoint initiates the login process.
It creates a new account if the user does not exist and sends confirmation request. Once the account is conformed, it will send the confirmation token that can be swapped for a real login token.
POST /login status 201: new account, account confirmation sent status 204: existing account, email with auth token sent status 400: invalid request data status 403: only logged-out and confirmed users can proceed
func LogoutRequestEndpoint ¶ added in v2.4.0
func LogoutRequestEndpoint(c echo.Context) error
func StandardResponse ¶
StandardResponse is the default way to respond to API requests
Types ¶
type StatusObject ¶
type StatusObject struct { Status int `json:"status" binding:"required"` Message string `json:"message" binding:"required"` RootError error `json:"-"` }
StatusObject is used to report operation status and errors in an API request. The struct can be used as a response object or be treated as an error object
func NewErrorStatus ¶
func NewErrorStatus(s int, e error) StatusObject
NewErrorStatus initializes a new StatusObject from an error
func NewStatus ¶
func NewStatus(s int, m string) StatusObject
NewStatus initializes a new StatusObject
func (*StatusObject) Error ¶
func (so *StatusObject) Error() string