Documentation
¶
Overview ¶
Package api provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT.
Package api provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT.
Index ¶
- Constants
- func Handler(si ServerInterface) http.Handler
- func HandlerFromMux(si ServerInterface, m ServeMux) http.Handler
- func HandlerFromMuxWithBaseURL(si ServerInterface, m ServeMux, baseURL string) http.Handler
- func HandlerWithOptions(si ServerInterface, options StdHTTPServerOptions) http.Handler
- type Error
- type GetPvzParams
- type GetPvzResponse
- type InvalidParamFormatError
- type MiddlewareFunc
- type PVZ
- type PVZCity
- type PostDummyLoginJSONBody
- type PostDummyLoginJSONBodyRole
- type PostDummyLoginJSONRequestBody
- type PostLoginJSONBody
- type PostLoginJSONRequestBody
- type PostProductsJSONBody
- type PostProductsJSONBodyType
- type PostProductsJSONRequestBody
- type PostPvzJSONRequestBody
- type PostReceptionsJSONBody
- type PostReceptionsJSONRequestBody
- type PostRegisterJSONBody
- type PostRegisterJSONBodyRole
- type PostRegisterJSONRequestBody
- type Product
- type ProductType
- type Reception
- type ReceptionStatus
- type RequiredHeaderError
- type RequiredParamError
- type ServeMux
- type ServerInterface
- type ServerInterfaceWrapper
- func (siw *ServerInterfaceWrapper) GetPvz(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostDummyLogin(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostLogin(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostProducts(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostPvz(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostPvzPvzIdCloseLastReception(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostPvzPvzIdDeleteLastProduct(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostReceptions(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostRegister(w http.ResponseWriter, r *http.Request)
- type StdHTTPServerOptions
- type Token
- type TooManyValuesForParamError
- type UnescapedCookieParamError
- type UnmarshalingParamError
- type User
- type UserRole
Constants ¶
const (
BearerAuthScopes = "bearerAuth.Scopes"
)
Variables ¶
This section is empty.
Functions ¶
func Handler ¶
func Handler(si ServerInterface) http.Handler
Handler creates http.Handler with routing matching OpenAPI spec.
func HandlerFromMux ¶
func HandlerFromMux(si ServerInterface, m ServeMux) http.Handler
HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.
func HandlerFromMuxWithBaseURL ¶
func HandlerFromMuxWithBaseURL(si ServerInterface, m ServeMux, baseURL string) http.Handler
func HandlerWithOptions ¶
func HandlerWithOptions(si ServerInterface, options StdHTTPServerOptions) http.Handler
HandlerWithOptions creates http.Handler with additional options
Types ¶
type GetPvzParams ¶
type GetPvzParams struct {
// StartDate Начальная дата диапазона
StartDate *time.Time `form:"startDate,omitempty" json:"startDate,omitempty"`
// EndDate Конечная дата диапазона
EndDate *time.Time `form:"endDate,omitempty" json:"endDate,omitempty"`
// Page Номер страницы
Page *int `form:"page,omitempty" json:"page,omitempty"`
// Limit Количество элементов на странице
Limit *int `form:"limit,omitempty" json:"limit,omitempty"`
}
GetPvzParams defines parameters for GetPvz.
type GetPvzResponse ¶
type InvalidParamFormatError ¶
func (*InvalidParamFormatError) Error ¶
func (e *InvalidParamFormatError) Error() string
func (*InvalidParamFormatError) Unwrap ¶
func (e *InvalidParamFormatError) Unwrap() error
type PVZ ¶
type PVZ struct {
City PVZCity `json:"city"`
Id *openapi_types.UUID `json:"id,omitempty"`
RegistrationDate *time.Time `json:"registrationDate,omitempty"`
}
PVZ defines model for PVZ.
type PostDummyLoginJSONBody ¶
type PostDummyLoginJSONBody struct {
Role PostDummyLoginJSONBodyRole `json:"role"`
}
PostDummyLoginJSONBody defines parameters for PostDummyLogin.
type PostDummyLoginJSONBodyRole ¶
type PostDummyLoginJSONBodyRole string
PostDummyLoginJSONBodyRole defines parameters for PostDummyLogin.
const ( PostDummyLoginJSONBodyRoleEmployee PostDummyLoginJSONBodyRole = "employee" PostDummyLoginJSONBodyRoleModerator PostDummyLoginJSONBodyRole = "moderator" )
Defines values for PostDummyLoginJSONBodyRole.
type PostDummyLoginJSONRequestBody ¶
type PostDummyLoginJSONRequestBody PostDummyLoginJSONBody
PostDummyLoginJSONRequestBody defines body for PostDummyLogin for application/json ContentType.
type PostLoginJSONBody ¶
type PostLoginJSONBody struct {
Email openapi_types.Email `json:"email"`
Password string `json:"password"`
}
PostLoginJSONBody defines parameters for PostLogin.
type PostLoginJSONRequestBody ¶
type PostLoginJSONRequestBody PostLoginJSONBody
PostLoginJSONRequestBody defines body for PostLogin for application/json ContentType.
type PostProductsJSONBody ¶
type PostProductsJSONBody struct {
PvzId openapi_types.UUID `json:"pvzId"`
Type PostProductsJSONBodyType `json:"type"`
}
PostProductsJSONBody defines parameters for PostProducts.
type PostProductsJSONBodyType ¶
type PostProductsJSONBodyType string
PostProductsJSONBodyType defines parameters for PostProducts.
const ( PostProductsJSONBodyTypeОбувь PostProductsJSONBodyType = "обувь" PostProductsJSONBodyTypeОдежда PostProductsJSONBodyType = "одежда" PostProductsJSONBodyTypeЭлектроника PostProductsJSONBodyType = "электроника" )
Defines values for PostProductsJSONBodyType.
type PostProductsJSONRequestBody ¶
type PostProductsJSONRequestBody PostProductsJSONBody
PostProductsJSONRequestBody defines body for PostProducts for application/json ContentType.
type PostPvzJSONRequestBody ¶
type PostPvzJSONRequestBody = PVZ
PostPvzJSONRequestBody defines body for PostPvz for application/json ContentType.
type PostReceptionsJSONBody ¶
type PostReceptionsJSONBody struct {
PvzId openapi_types.UUID `json:"pvzId"`
}
PostReceptionsJSONBody defines parameters for PostReceptions.
type PostReceptionsJSONRequestBody ¶
type PostReceptionsJSONRequestBody PostReceptionsJSONBody
PostReceptionsJSONRequestBody defines body for PostReceptions for application/json ContentType.
type PostRegisterJSONBody ¶
type PostRegisterJSONBody struct {
Email openapi_types.Email `json:"email"`
Password string `json:"password"`
Role PostRegisterJSONBodyRole `json:"role"`
}
PostRegisterJSONBody defines parameters for PostRegister.
type PostRegisterJSONBodyRole ¶
type PostRegisterJSONBodyRole string
PostRegisterJSONBodyRole defines parameters for PostRegister.
const ( Employee PostRegisterJSONBodyRole = "employee" Moderator PostRegisterJSONBodyRole = "moderator" )
Defines values for PostRegisterJSONBodyRole.
type PostRegisterJSONRequestBody ¶
type PostRegisterJSONRequestBody PostRegisterJSONBody
PostRegisterJSONRequestBody defines body for PostRegister for application/json ContentType.
type Product ¶
type Product struct {
DateTime *time.Time `json:"dateTime,omitempty"`
Id *openapi_types.UUID `json:"id,omitempty"`
ReceptionId openapi_types.UUID `json:"receptionId"`
Type ProductType `json:"type"`
}
Product defines model for Product.
type ProductType ¶
type ProductType string
ProductType defines model for Product.Type.
const ( ProductTypeОбувь ProductType = "обувь" ProductTypeОдежда ProductType = "одежда" ProductTypeЭлектроника ProductType = "электроника" )
Defines values for ProductType.
type Reception ¶
type Reception struct {
DateTime time.Time `json:"dateTime"`
Id *openapi_types.UUID `json:"id,omitempty"`
PvzId openapi_types.UUID `json:"pvzId"`
Status ReceptionStatus `json:"status"`
}
Reception defines model for Reception.
type ReceptionStatus ¶
type ReceptionStatus string
ReceptionStatus defines model for Reception.Status.
const ( Close ReceptionStatus = "close" InProgress ReceptionStatus = "in_progress" )
Defines values for ReceptionStatus.
type RequiredHeaderError ¶
func (*RequiredHeaderError) Error ¶
func (e *RequiredHeaderError) Error() string
func (*RequiredHeaderError) Unwrap ¶
func (e *RequiredHeaderError) Unwrap() error
type RequiredParamError ¶
type RequiredParamError struct {
ParamName string
}
func (*RequiredParamError) Error ¶
func (e *RequiredParamError) Error() string
type ServeMux ¶
type ServeMux interface {
HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
ServeHTTP(w http.ResponseWriter, r *http.Request)
}
ServeMux is an abstraction of http.ServeMux.
type ServerInterface ¶
type ServerInterface interface {
// Получение тестового токена
// (POST /dummyLogin)
PostDummyLogin(w http.ResponseWriter, r *http.Request)
// Авторизация пользователя
// (POST /login)
PostLogin(w http.ResponseWriter, r *http.Request)
// Добавление товара в текущую приемку (только для сотрудников ПВЗ)
// (POST /products)
PostProducts(w http.ResponseWriter, r *http.Request)
// Получение списка ПВЗ с фильтрацией по дате приемки и пагинацией
// (GET /pvz)
GetPvz(w http.ResponseWriter, r *http.Request, params GetPvzParams)
// Создание ПВЗ (только для модераторов)
// (POST /pvz)
PostPvz(w http.ResponseWriter, r *http.Request)
// Закрытие последней открытой приемки товаров в рамках ПВЗ
// (POST /pvz/{pvzId}/close_last_reception)
PostPvzPvzIdCloseLastReception(w http.ResponseWriter, r *http.Request, pvzId openapi_types.UUID)
// Удаление последнего добавленного товара из текущей приемки (LIFO, только для сотрудников ПВЗ)
// (POST /pvz/{pvzId}/delete_last_product)
PostPvzPvzIdDeleteLastProduct(w http.ResponseWriter, r *http.Request, pvzId openapi_types.UUID)
// Создание новой приемки товаров (только для сотрудников ПВЗ)
// (POST /receptions)
PostReceptions(w http.ResponseWriter, r *http.Request)
// Регистрация пользователя
// (POST /register)
PostRegister(w http.ResponseWriter, r *http.Request)
}
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct {
Handler ServerInterface
HandlerMiddlewares []MiddlewareFunc
ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}
ServerInterfaceWrapper converts contexts to parameters.
func (*ServerInterfaceWrapper) GetPvz ¶
func (siw *ServerInterfaceWrapper) GetPvz(w http.ResponseWriter, r *http.Request)
GetPvz operation middleware
func (*ServerInterfaceWrapper) PostDummyLogin ¶
func (siw *ServerInterfaceWrapper) PostDummyLogin(w http.ResponseWriter, r *http.Request)
PostDummyLogin operation middleware
func (*ServerInterfaceWrapper) PostLogin ¶
func (siw *ServerInterfaceWrapper) PostLogin(w http.ResponseWriter, r *http.Request)
PostLogin operation middleware
func (*ServerInterfaceWrapper) PostProducts ¶
func (siw *ServerInterfaceWrapper) PostProducts(w http.ResponseWriter, r *http.Request)
PostProducts operation middleware
func (*ServerInterfaceWrapper) PostPvz ¶
func (siw *ServerInterfaceWrapper) PostPvz(w http.ResponseWriter, r *http.Request)
PostPvz operation middleware
func (*ServerInterfaceWrapper) PostPvzPvzIdCloseLastReception ¶
func (siw *ServerInterfaceWrapper) PostPvzPvzIdCloseLastReception(w http.ResponseWriter, r *http.Request)
PostPvzPvzIdCloseLastReception operation middleware
func (*ServerInterfaceWrapper) PostPvzPvzIdDeleteLastProduct ¶
func (siw *ServerInterfaceWrapper) PostPvzPvzIdDeleteLastProduct(w http.ResponseWriter, r *http.Request)
PostPvzPvzIdDeleteLastProduct operation middleware
func (*ServerInterfaceWrapper) PostReceptions ¶
func (siw *ServerInterfaceWrapper) PostReceptions(w http.ResponseWriter, r *http.Request)
PostReceptions operation middleware
func (*ServerInterfaceWrapper) PostRegister ¶
func (siw *ServerInterfaceWrapper) PostRegister(w http.ResponseWriter, r *http.Request)
PostRegister operation middleware
type StdHTTPServerOptions ¶
type StdHTTPServerOptions struct {
BaseURL string
BaseRouter ServeMux
Middlewares []MiddlewareFunc
ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}
type TooManyValuesForParamError ¶
func (*TooManyValuesForParamError) Error ¶
func (e *TooManyValuesForParamError) Error() string
type UnescapedCookieParamError ¶
func (*UnescapedCookieParamError) Error ¶
func (e *UnescapedCookieParamError) Error() string
func (*UnescapedCookieParamError) Unwrap ¶
func (e *UnescapedCookieParamError) Unwrap() error
type UnmarshalingParamError ¶
func (*UnmarshalingParamError) Error ¶
func (e *UnmarshalingParamError) Error() string
func (*UnmarshalingParamError) Unwrap ¶
func (e *UnmarshalingParamError) Unwrap() error
type User ¶
type User struct {
Email openapi_types.Email `json:"email"`
Id *openapi_types.UUID `json:"id,omitempty"`
Role UserRole `json:"role"`
}
User defines model for User.