models

package
v0.0.0-...-e3cadf0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 22, 2024 License: GPL-3.0 Imports: 2 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
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 is returned when the user credentials are invalid.
	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 {
	// in: body
	Body ioutil.GenericError
}

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.

type UserInfo

type UserInfo struct {
	ID       int
	Username string
	Email    string
}

UserInfo is a struct that defines the user info model.

type Users

type Users []User

Users is a struct that defines a slice of User.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL