server

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package server provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen version v1.12.4 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTP

func NewHTTP(cfg entity.Config, router *Router) http.Handler

func RegisterHandlers

func RegisterHandlers(router *gin.Engine, si ServerInterface) *gin.Engine

RegisterHandlers creates http.Handler with routing matching OpenAPI spec.

func RegisterHandlersWithOptions

func RegisterHandlersWithOptions(router *gin.Engine, si ServerInterface, options GinServerOptions) *gin.Engine

RegisterHandlersWithOptions creates http.Handler with additional options

Types

type CreateJSONRequestBody

type CreateJSONRequestBody = User

CreateJSONRequestBody defines body for Create for application/json ContentType.

type ErrorResponse

type ErrorResponse struct {
	Error *string `json:"error,omitempty"`
}

ErrorResponse defines model for ErrorResponse.

type GinServerOptions

type GinServerOptions struct {
	BaseURL      string
	Middlewares  []MiddlewareFunc
	ErrorHandler func(*gin.Context, error, int)
}

GinServerOptions provides options for the Gin server.

type Id

type Id = string

Id defines model for id.

type LoginData

type LoginData struct {
	Login    *string `json:"login,omitempty"`
	Password *string `json:"password,omitempty"`
}

LoginData defines model for LoginData.

type LoginJSONRequestBody

type LoginJSONRequestBody = LoginData

LoginJSONRequestBody defines body for Login for application/json ContentType.

type MiddlewareFunc

type MiddlewareFunc func(c *gin.Context)

type Router

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

Router ...

func NewRouter

func NewRouter(api app.API, cfg entity.Config) *Router

NewRouter ...

func (*Router) Access

func (r *Router) Access(c *gin.Context, operationID string, id int) error

func (*Router) Check

func (r *Router) Check(c *gin.Context)

func (*Router) CheckAuth

func (r *Router) CheckAuth(c *gin.Context)

func (*Router) Create

func (r *Router) Create(c *gin.Context)

Create entity user

func (*Router) Delete

func (r *Router) Delete(c *gin.Context, ids string)

Delete entity user

func (*Router) Get

func (r *Router) Get(c *gin.Context, ids string)

Get entity user

func (*Router) List

func (r *Router) List(c *gin.Context)

List entity users

func (*Router) Login

func (r *Router) Login(c *gin.Context)

func (*Router) Logout

func (r *Router) Logout(c *gin.Context)

func (*Router) Update

func (r *Router) Update(c *gin.Context, ids string)

Update entity user

type ServerInterface

type ServerInterface interface {
	// check server
	// (GET /check/)
	Check(c *gin.Context)
	// Login and get tokens
	// (POST /login/)
	Login(c *gin.Context)
	// Spoil tokens
	// (POST /logout/)
	Logout(c *gin.Context)
	// User
	// (GET /users/)
	List(c *gin.Context)
	// Create
	// (POST /users/)
	Create(c *gin.Context)
	// Delete user
	// (DELETE /users/{id}/)
	Delete(c *gin.Context, id Id)
	// User
	// (GET /users/{id}/)
	Get(c *gin.Context, id Id)
	// Update user
	// (PATCH /users/{id}/)
	Update(c *gin.Context, id Id)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandler       func(*gin.Context, error, int)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) Check

func (siw *ServerInterfaceWrapper) Check(c *gin.Context)

Check operation middleware

func (*ServerInterfaceWrapper) Create

func (siw *ServerInterfaceWrapper) Create(c *gin.Context)

Create operation middleware

func (*ServerInterfaceWrapper) Delete

func (siw *ServerInterfaceWrapper) Delete(c *gin.Context)

Delete operation middleware

func (*ServerInterfaceWrapper) Get

func (siw *ServerInterfaceWrapper) Get(c *gin.Context)

Get operation middleware

func (*ServerInterfaceWrapper) List

func (siw *ServerInterfaceWrapper) List(c *gin.Context)

List operation middleware

func (*ServerInterfaceWrapper) Login

func (siw *ServerInterfaceWrapper) Login(c *gin.Context)

Login operation middleware

func (*ServerInterfaceWrapper) Logout

func (siw *ServerInterfaceWrapper) Logout(c *gin.Context)

Logout operation middleware

func (*ServerInterfaceWrapper) Update

func (siw *ServerInterfaceWrapper) Update(c *gin.Context)

Update operation middleware

type SuccessResponse

type SuccessResponse = map[string]interface{}

SuccessResponse defines model for SuccessResponse.

type UpdateJSONRequestBody

type UpdateJSONRequestBody = User

UpdateJSONRequestBody defines body for Update for application/json ContentType.

type User

type User struct {
	Login    *string                 `json:"login,omitempty"`
	Option   *map[string]interface{} `json:"option,omitempty"`
	Password *string                 `json:"password,omitempty"`
	Token    *string                 `json:"token,omitempty"`
}

User defines model for User.

Jump to

Keyboard shortcuts

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