api

package
v0.0.0-...-2b4f61d Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// URLParamsRegex is a regular expression to match URL parameters in the openapi spec format (e.g. {id}).
	// It allows to replace the parameters with the gin-gonic format (e.g. :id).
	URLParamsRegex = regexp.MustCompile(`\{([a-zA-Z0-9]+)\}`)
)

Functions

func Annotate

func Annotate(t *openapi3.T)

func GetParams

func GetParams[T interface{}](c *gin.Context) *T

func GetPayload

func GetPayload[T interface{}](c *gin.Context) *T

func GetQuery

func GetQuery[T interface{}](c *gin.Context) *T

func Handle_CreateNewUserRequest

func Handle_CreateNewUserRequest(c *gin.Context)

func Handle_GetUserRequest

func Handle_GetUserRequest(c *gin.Context)

func Handle_GetUsersRequest

func Handle_GetUsersRequest(c *gin.Context)

func Handle_UpdateUserRequest

func Handle_UpdateUserRequest(c *gin.Context)

func Mount

func Mount(r *gin.Engine)

Types

type CreateNewUserRequest

type CreateNewUserRequest struct {
	Name string `json:"name" validate:"required"`
}

type CreateNewUserResponse

type CreateNewUserResponse struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Nick string `json:"nick"`
}

type DetailedURLParameters

type DetailedURLParameters struct {
	UserID string `json:"id" validate:"required"`
}

type GetUserResponse

type GetUserResponse struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Nick string `json:"nick"`
}

type GetUsersQueryParameters

type GetUsersQueryParameters struct {
	Offset int `json:"offset"`
	Limit  int `json:"limit"`
}

type GetUsersResponse

type GetUsersResponse struct {
	Total int               `json:"total"`
	Docs  []GetUserResponse `json:"items"`
}

type UpdateUserRequest

type UpdateUserRequest struct {
	Name string `json:"name"`
}

type UpdateUserResponse

type UpdateUserResponse struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Nick string `json:"nick"`
}

Jump to

Keyboard shortcuts

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