Documentation ¶
Overview ¶
Package models provides the data models for the application.
Package models describes models for application.
Documentation for MADR API.
Schemes: http BasePath: / Version: 0.0.1 Contact: Dmitriy Krasnov<dk.peyuaa@gmail.com>
Consumes: - application/json
Produces: - application/json
swagger:meta
Index ¶
- Variables
- type AuthorizationToken
- type GetUserInfoRequest
- type GetUserInfoResponse
- type SignInRequest
- type SignInResponse
- type SignUpRequest
- type SwaggerGetUserInfoBadRequestError
- type SwaggerGetUserInfoInternalServerError
- type SwaggerGetUserInfoNotFoundError
- type SwaggerInternalServerError
- type SwaggerSignInBadRequestError
- type SwaggerSignInOkResponse
- type SwaggerSignInUnauthorizedError
- type SwaggerSignUpBadRequestError
- type SwaggerSignUpConflictError
- type SwaggerSignUpCreatedResponse
- type SwaggersignInInternalServerError
- type User
- type UserInfo
- type Users
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInternalServer is a generic error message returned by a server // in case of an internal server error when we don't want to expose // the real error to the client. All the internal server errors // should be logged and fixed. Don't use this error if it's // something that can be fixed by the client. ErrInternalServer = errors.New("don't worry, we are working on it") ErrUnauthorized = errors.New("invalid credentials") // ErrUserNotFound is returned when the user is not found in the database. ErrUserNotFound = errors.New("user with specified id not found") )
Functions ¶
This section is empty.
Types ¶
type AuthorizationToken ¶
type AuthorizationToken string
AuthorizationToken is a type that defines the authorization token.
type GetUserInfoRequest ¶
type GetUserInfoRequest struct { }
swagger:model getUserInfoRequest GetUserInfoRequest is a struct that defines the request body for the getUserInfo endpoint.
type GetUserInfoResponse ¶
type GetUserInfoResponse struct { ID int `json:"id"` Username string `json:"username"` Email string `json:"email"` }
swagger:model getUserInfoResponse GetUserInfoResponse is a struct that defines the response body for the getUserInfo endpoint.
type SignInRequest ¶
type SignInRequest struct { // Username of the user. // // required: true // example: user123 Username string `json:"username"` // Password of the user. // // required: true // example: myVerySecurePassword123 Password string `json:"password"` }
swagger:model signInRequest SignInRequest is a struct that defines the request body for the sign-in endpoint.
type SignInResponse ¶
type SignInResponse struct { // Authorization token. // // example: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJleHAiOjkxOTU0Nzk4MDksInVzZXJfaWQiOjEsInVzZXJuYW1lIjoidXNlcjEyMyJ9.fHSoS6ZFf1TU4AmcqNeqpEDo6hdU6uLr2-PRAd0MKzAKDvDtGafuV6X6W8HSXAgwraXZ0_3qS8CmrUQW6am8Hg Authorization string `json:"authorization"` }
SignInResponse is a struct that defines the response body for the sign-in endpoint.
type SignUpRequest ¶
type SignUpRequest struct { // Username of the user. // // required: true // example: user123 Username string `json:"username"` // Email of the user. // // required: true // example: user@example.com Email string `json:"email"` // Password of the user. // // required: true // example: myVerySecurePassword123 Password string `json:"password"` }
swagger:model signUpRequest SignUpRequest is a struct that defines the request body for the sign-up endpoint.
type SwaggerGetUserInfoBadRequestError ¶
type SwaggerGetUserInfoBadRequestError struct { // in: body Body ioutil.GenericError }
swagger:response getUserInfoBadRequestError
type SwaggerGetUserInfoInternalServerError ¶
type SwaggerGetUserInfoInternalServerError struct { // in: body Body ioutil.GenericError }
swagger:response getUserInfoInternalServerError
type SwaggerGetUserInfoNotFoundError ¶
type SwaggerGetUserInfoNotFoundError struct { // in: body Body ioutil.GenericError }
swagger:response getUserInfoNotFoundError
type SwaggerInternalServerError ¶
type SwaggerInternalServerError struct { // in: body Body ioutil.GenericError }
swagger:response signUpInternalServerError
type SwaggerSignInBadRequestError ¶
type SwaggerSignInBadRequestError struct { // in: body Body ioutil.GenericError }
swagger:response signInBadRequestError
type SwaggerSignInOkResponse ¶
type SwaggerSignInOkResponse struct { // Response with the authorization token. // in: body Body SignInResponse }
swagger:response signInOkResponse
type SwaggerSignInUnauthorizedError ¶
type SwaggerSignInUnauthorizedError struct { ioutil.GenericError }Body
swagger:response signInUnauthorizedError
type SwaggerSignUpBadRequestError ¶
type SwaggerSignUpBadRequestError struct { // in: body Body ioutil.GenericError }
swagger:response signUpBadRequestError
type SwaggerSignUpConflictError ¶
type SwaggerSignUpConflictError struct { // in: body Body ioutil.GenericError }
swagger:response signUpConflictError
type SwaggerSignUpCreatedResponse ¶
type SwaggerSignUpCreatedResponse struct{}
swagger:response signUpCreatedResponse
type SwaggersignInInternalServerError ¶
type SwaggersignInInternalServerError struct { // in: body Body ioutil.GenericError }
swagger:response signInInternalServerError
type User ¶
type User struct { ID int `json:"id"` Username string `json:"username"` Email string `json:"email"` Password string `json:"password"` }
User is a struct that defines the user model.