api

package
v0.0.0-...-1b42d7b Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2025 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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 Error

type Error struct {
	Message string `json:"message"`
}

Error defines model for Error.

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 GetPvzResponse struct {
	Pvz        PVZ `json:"pvz"`
	Receptions []struct {
		Reception Reception `json:"reception"`
		Products  []Product `json:"products"`
	} `json:"receptions"`
}

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

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 PVZCity

type PVZCity string

PVZCity defines model for PVZ.City.

const (
	Казань         PVZCity = "Казань"
	Москва         PVZCity = "Москва"
	СанктПетербург PVZCity = "Санкт-Петербург"
)

Defines values for PVZCity.

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

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

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

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

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 Token

type Token = string

Token defines model for Token.

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type UnmarshalingParamError

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

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.

type UserRole

type UserRole string

UserRole defines model for User.Role.

const (
	UserRoleEmployee  UserRole = "employee"
	UserRoleModerator UserRole = "moderator"
)

Defines values for UserRole.

Jump to

Keyboard shortcuts

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