apiv1

package
v0.0.0-...-c201010 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnableToReadContentLength = errors.New("Unable to read content length")
	ErrUnableToReadPayload       = errors.New("Unable to read payload content")
)

Functions

func InitAPI

func InitAPI(ctx *structs.Context)

InitAPI generate an API v1 entry

@title API to learn how to use swagger and echo @version 1.0 @description The following project helps to learn echo and how to attach swagger to it. @license.name Mozilla Public License 2.0 @license.url https://www.mozilla.org/en-US/MPL/2.0/ @produce json @accept json @schemes http @BasePath /v1

Types

type APIv1

type APIv1 struct {
	// contains filtered or unexported fields
}

APIv1 supporting internal details

func (*APIv1) CreateUser

func (api *APIv1) CreateUser(ctx echo.Context) error

CreateUser is the Exported API request to create a user

@Summary Create a new user. @Description Create a new user and returns it's record on success. @Tags Users @Accept json @Produce json @Param user_details body structs.User true "User object" @Success 200 {object} models.Users "User details as returned by the saved record" @Failure 400 {object} structs.HTTPError "Something in the request is wrong/unexpected" @Failure 500 {object} structs.HTTPError "Something in internal operation was bad" @Router /users/add [put]

func (*APIv1) GetUserByID

func (api *APIv1) GetUserByID(ctx echo.Context) error

GetUserByID finds a user by a given user id.

@Summary Finds a user by a given user id, and returning the record @Description Finds a user by a given user id, and returning the record @Tags Users @Accept json @Produce json @Param id path int true "User ID" @Success 200 {object} models.Users "User details as returned by the saved record" @Failure 400 {object} structs.HTTPError "Something in the request is wrong/unexpected" @Failure 404 {object} structs.HTTPError "User was not found by provided ID" @Failure 500 {object} structs.HTTPError "Something in internal operation was bad" @Router /users/get/by_id/{id} [GET]

Directories

Path Synopsis
Package docs Code generated by swaggo/swag at 2023-11-30 10:08:01.180247473 +0200 IST m=+2.307011843.
Package docs Code generated by swaggo/swag at 2023-11-30 10:08:01.180247473 +0200 IST m=+2.307011843.

Jump to

Keyboard shortcuts

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