Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type I ¶
type I interface { GetSession(c *gin.Context) PostSession(c *gin.Context) DelSession(c *gin.Context) }
I is interface of authentication.
type Options ¶
type Options struct { Env env.Environments VaccineClient *vaccineclient.VaccineClient }
Options provides interface to change behavior of User.
type PostSessionRequest ¶
type PostSessionRequest struct { // in: body // required: true Body *PostSessionRequestModel `json:"body"` }
PostSessionRequest is the request of PostSession.
swagger:parameters PostSessionRequest
type PostSessionRequestModel ¶
type PostSessionRequestModel struct { // The user's nationID // example: A123456789 // required: true NationID string `json:"nationID" binding:"required"` // The user's healthCardID // example: 000011112222 // required: true HealthCardID string `json:"healthCardID" binding:"required"` }
PostSessionRequestModel is the body format of PostSessionRequest.
swagger:model PostSessionRequestModel
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session handles all
func (*Session) DelSession ¶
DelSession deletes the session. swagger:route DELETE /api/session Session DelSession
Logout the user.
Responses:
204: NoContentResponse
func (*Session) GetSession ¶
GetSession returns the user information. swagger:route GET /api/session Session GetSession
Get the user information.
Responses:
200: UserResponse 400: BadRequestErrorResponse 401: UnauthorizedErrorResponse 404: NotFoundErrorResponse 500: InternalServerErrorResponse
func (*Session) PostSession ¶
PostSession lets user login. swagger:route POST /api/sessions Session PostSessionRequest
Login.
Responses:
200: SessionResponse 400: BadRequestErrorResponse 500: InternalServerErrorResponse
type SessionResponse ¶
type SessionResponse struct { // The session info // in: body User *models.UserModel `json:"user"` }
SessionResponse is the response of GetSession/PostSession.
swaggger: response SessionResponse