order_v1

package
v0.0.0-...-4b87c2c Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2025 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Code generated by ogen, DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithServerURL

func WithServerURL(ctx context.Context, u *url.URL) context.Context

WithServerURL sets context key to override server URL.

Types

type BadRequestError

type BadRequestError struct {
	// HTTP-код ошибки.
	Code int `json:"code"`
	// Описание ошибки.
	Message string `json:"message"`
}

Ref: #/components/schemas/bad_request_error

func (*BadRequestError) Decode

func (s *BadRequestError) Decode(d *jx.Decoder) error

Decode decodes BadRequestError from json.

func (*BadRequestError) Encode

func (s *BadRequestError) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*BadRequestError) GetCode

func (s *BadRequestError) GetCode() int

GetCode returns the value of Code.

func (*BadRequestError) GetMessage

func (s *BadRequestError) GetMessage() string

GetMessage returns the value of Message.

func (*BadRequestError) MarshalJSON

func (s *BadRequestError) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*BadRequestError) SetCode

func (s *BadRequestError) SetCode(val int)

SetCode sets the value of Code.

func (*BadRequestError) SetMessage

func (s *BadRequestError) SetMessage(val string)

SetMessage sets the value of Message.

func (*BadRequestError) UnmarshalJSON

func (s *BadRequestError) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type CancelOrderNoContent

type CancelOrderNoContent struct{}

CancelOrderNoContent is response for CancelOrder operation.

type CancelOrderParams

type CancelOrderParams struct {
	// UUID заказа.
	OrderUUID uuid.UUID
}

CancelOrderParams is parameters of CancelOrder operation.

type CancelOrderRes

type CancelOrderRes interface {
	// contains filtered or unexported methods
}

type Client

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

Client implements OAS client.

func NewClient

func NewClient(serverURL string, opts ...ClientOption) (*Client, error)

NewClient initializes new Client defined by OAS.

func (*Client) CancelOrder

func (c *Client) CancelOrder(ctx context.Context, params CancelOrderParams) (CancelOrderRes, error)

CancelOrder invokes CancelOrder operation.

Отменяет заказ, если он ещё не оплачен.

POST /orders/{order_uuid}/cancel

func (*Client) CreateOrder

func (c *Client) CreateOrder(ctx context.Context, request *CreateOrderRequest) (CreateOrderRes, error)

CreateOrder invokes CreateOrder operation.

Создаёт новый заказ на основе выбранных пользователем деталей.

POST /orders

func (*Client) GetOrder

func (c *Client) GetOrder(ctx context.Context, params GetOrderParams) (GetOrderRes, error)

GetOrder invokes GetOrder operation.

Возвращает информацию о заказе по его UUID.

GET /orders/{order_uuid}

func (*Client) PayOrder

func (c *Client) PayOrder(ctx context.Context, request *PayOrderRequest, params PayOrderParams) (PayOrderRes, error)

PayOrder invokes PayOrder operation.

Проводит оплату ранее созданного заказа.

POST /orders/{order_uuid}/pay

type ClientOption

type ClientOption interface {
	// contains filtered or unexported methods
}

ClientOption is client config option.

func WithClient

func WithClient(client ht.Client) ClientOption

WithClient specifies http client to use.

type ConflictError

type ConflictError struct {
	// HTTP-код ошибки.
	Code int `json:"code"`
	// Описание ошибки.
	Message string `json:"message"`
}

Ref: #/components/schemas/conflict_error

func (*ConflictError) Decode

func (s *ConflictError) Decode(d *jx.Decoder) error

Decode decodes ConflictError from json.

func (*ConflictError) Encode

func (s *ConflictError) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*ConflictError) GetCode

func (s *ConflictError) GetCode() int

GetCode returns the value of Code.

func (*ConflictError) GetMessage

func (s *ConflictError) GetMessage() string

GetMessage returns the value of Message.

func (*ConflictError) MarshalJSON

func (s *ConflictError) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*ConflictError) SetCode

func (s *ConflictError) SetCode(val int)

SetCode sets the value of Code.

func (*ConflictError) SetMessage

func (s *ConflictError) SetMessage(val string)

SetMessage sets the value of Message.

func (*ConflictError) UnmarshalJSON

func (s *ConflictError) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type CreateOrderRequest

type CreateOrderRequest struct {
	// UUID пользователя.
	UserUUID uuid.UUID `json:"user_uuid"`
	// Список UUID деталей.
	PartUuids []uuid.UUID `json:"part_uuids"`
}

Ref: #/components/schemas/create_order_request

func (*CreateOrderRequest) Decode

func (s *CreateOrderRequest) Decode(d *jx.Decoder) error

Decode decodes CreateOrderRequest from json.

func (*CreateOrderRequest) Encode

func (s *CreateOrderRequest) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*CreateOrderRequest) GetPartUuids

func (s *CreateOrderRequest) GetPartUuids() []uuid.UUID

GetPartUuids returns the value of PartUuids.

func (*CreateOrderRequest) GetUserUUID

func (s *CreateOrderRequest) GetUserUUID() uuid.UUID

GetUserUUID returns the value of UserUUID.

func (*CreateOrderRequest) MarshalJSON

func (s *CreateOrderRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*CreateOrderRequest) SetPartUuids

func (s *CreateOrderRequest) SetPartUuids(val []uuid.UUID)

SetPartUuids sets the value of PartUuids.

func (*CreateOrderRequest) SetUserUUID

func (s *CreateOrderRequest) SetUserUUID(val uuid.UUID)

SetUserUUID sets the value of UserUUID.

func (*CreateOrderRequest) UnmarshalJSON

func (s *CreateOrderRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*CreateOrderRequest) Validate

func (s *CreateOrderRequest) Validate() error

type CreateOrderRes

type CreateOrderRes interface {
	// contains filtered or unexported methods
}

type CreateOrderResponse

type CreateOrderResponse struct {
	// UUID созданного заказа.
	OrderUUID uuid.UUID `json:"order_uuid"`
	// Общая стоимость заказа.
	TotalPrice float32 `json:"total_price"`
}

Ref: #/components/schemas/create_order_response

func (*CreateOrderResponse) Decode

func (s *CreateOrderResponse) Decode(d *jx.Decoder) error

Decode decodes CreateOrderResponse from json.

func (*CreateOrderResponse) Encode

func (s *CreateOrderResponse) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*CreateOrderResponse) GetOrderUUID

func (s *CreateOrderResponse) GetOrderUUID() uuid.UUID

GetOrderUUID returns the value of OrderUUID.

func (*CreateOrderResponse) GetTotalPrice

func (s *CreateOrderResponse) GetTotalPrice() float32

GetTotalPrice returns the value of TotalPrice.

func (*CreateOrderResponse) MarshalJSON

func (s *CreateOrderResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*CreateOrderResponse) SetOrderUUID

func (s *CreateOrderResponse) SetOrderUUID(val uuid.UUID)

SetOrderUUID sets the value of OrderUUID.

func (*CreateOrderResponse) SetTotalPrice

func (s *CreateOrderResponse) SetTotalPrice(val float32)

SetTotalPrice sets the value of TotalPrice.

func (*CreateOrderResponse) UnmarshalJSON

func (s *CreateOrderResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*CreateOrderResponse) Validate

func (s *CreateOrderResponse) Validate() error

type ErrorHandler

type ErrorHandler = ogenerrors.ErrorHandler

ErrorHandler is error handler.

type GetOrderParams

type GetOrderParams struct {
	// UUID заказа.
	OrderUUID uuid.UUID
}

GetOrderParams is parameters of GetOrder operation.

type GetOrderRes

type GetOrderRes interface {
	// contains filtered or unexported methods
}

type Handler

type Handler interface {
	// CancelOrder implements CancelOrder operation.
	//
	// Отменяет заказ, если он ещё не оплачен.
	//
	// POST /orders/{order_uuid}/cancel
	CancelOrder(ctx context.Context, params CancelOrderParams) (CancelOrderRes, error)
	// CreateOrder implements CreateOrder operation.
	//
	// Создаёт новый заказ на основе выбранных
	// пользователем деталей.
	//
	// POST /orders
	CreateOrder(ctx context.Context, req *CreateOrderRequest) (CreateOrderRes, error)
	// GetOrder implements GetOrder operation.
	//
	// Возвращает информацию о заказе по его UUID.
	//
	// GET /orders/{order_uuid}
	GetOrder(ctx context.Context, params GetOrderParams) (GetOrderRes, error)
	// PayOrder implements PayOrder operation.
	//
	// Проводит оплату ранее созданного заказа.
	//
	// POST /orders/{order_uuid}/pay
	PayOrder(ctx context.Context, req *PayOrderRequest, params PayOrderParams) (PayOrderRes, error)
}

Handler handles operations described by OpenAPI v3 specification.

type InternalServerError

type InternalServerError struct {
	// HTTP-код ошибки.
	Code int `json:"code"`
	// Описание ошибки.
	Message string `json:"message"`
}

Ref: #/components/schemas/internal_server_error

func (*InternalServerError) Decode

func (s *InternalServerError) Decode(d *jx.Decoder) error

Decode decodes InternalServerError from json.

func (*InternalServerError) Encode

func (s *InternalServerError) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*InternalServerError) GetCode

func (s *InternalServerError) GetCode() int

GetCode returns the value of Code.

func (*InternalServerError) GetMessage

func (s *InternalServerError) GetMessage() string

GetMessage returns the value of Message.

func (*InternalServerError) MarshalJSON

func (s *InternalServerError) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*InternalServerError) SetCode

func (s *InternalServerError) SetCode(val int)

SetCode sets the value of Code.

func (*InternalServerError) SetMessage

func (s *InternalServerError) SetMessage(val string)

SetMessage sets the value of Message.

func (*InternalServerError) UnmarshalJSON

func (s *InternalServerError) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type Invoker

type Invoker interface {
	// CancelOrder invokes CancelOrder operation.
	//
	// Отменяет заказ, если он ещё не оплачен.
	//
	// POST /orders/{order_uuid}/cancel
	CancelOrder(ctx context.Context, params CancelOrderParams) (CancelOrderRes, error)
	// CreateOrder invokes CreateOrder operation.
	//
	// Создаёт новый заказ на основе выбранных
	// пользователем деталей.
	//
	// POST /orders
	CreateOrder(ctx context.Context, request *CreateOrderRequest) (CreateOrderRes, error)
	// GetOrder invokes GetOrder operation.
	//
	// Возвращает информацию о заказе по его UUID.
	//
	// GET /orders/{order_uuid}
	GetOrder(ctx context.Context, params GetOrderParams) (GetOrderRes, error)
	// PayOrder invokes PayOrder operation.
	//
	// Проводит оплату ранее созданного заказа.
	//
	// POST /orders/{order_uuid}/pay
	PayOrder(ctx context.Context, request *PayOrderRequest, params PayOrderParams) (PayOrderRes, error)
}

Invoker invokes operations described by OpenAPI v3 specification.

type Labeler

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

Labeler is used to allow adding custom attributes to the server request metrics.

func LabelerFromContext

func LabelerFromContext(ctx context.Context) (*Labeler, bool)

LabelerFromContext retrieves the Labeler from the provided context, if present.

If no Labeler was found in the provided context a new, empty Labeler is returned and the second return value is false. In this case it is safe to use the Labeler but any attributes added to it will not be used.

func (*Labeler) Add

func (l *Labeler) Add(attrs ...attribute.KeyValue)

Add attributes to the Labeler.

func (*Labeler) AttributeSet

func (l *Labeler) AttributeSet() attribute.Set

AttributeSet returns the attributes added to the Labeler as an attribute.Set.

type Middleware

type Middleware = middleware.Middleware

Middleware is middleware type.

type NotFoundError

type NotFoundError struct {
	// HTTP-код ошибки.
	Code int `json:"code"`
	// Описание ошибки.
	Message string `json:"message"`
}

Ref: #/components/schemas/not_found_error

func (*NotFoundError) Decode

func (s *NotFoundError) Decode(d *jx.Decoder) error

Decode decodes NotFoundError from json.

func (*NotFoundError) Encode

func (s *NotFoundError) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*NotFoundError) GetCode

func (s *NotFoundError) GetCode() int

GetCode returns the value of Code.

func (*NotFoundError) GetMessage

func (s *NotFoundError) GetMessage() string

GetMessage returns the value of Message.

func (*NotFoundError) MarshalJSON

func (s *NotFoundError) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*NotFoundError) SetCode

func (s *NotFoundError) SetCode(val int)

SetCode sets the value of Code.

func (*NotFoundError) SetMessage

func (s *NotFoundError) SetMessage(val string)

SetMessage sets the value of Message.

func (*NotFoundError) UnmarshalJSON

func (s *NotFoundError) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OperationName

type OperationName = string

OperationName is the ogen operation name

const (
	CancelOrderOperation OperationName = "CancelOrder"
	CreateOrderOperation OperationName = "CreateOrder"
	GetOrderOperation    OperationName = "GetOrder"
	PayOrderOperation    OperationName = "PayOrder"
)

type OptNilUUID

type OptNilUUID struct {
	Value uuid.UUID
	Set   bool
	Null  bool
}

OptNilUUID is optional nullable uuid.UUID.

func NewOptNilUUID

func NewOptNilUUID(v uuid.UUID) OptNilUUID

NewOptNilUUID returns new OptNilUUID with value set to v.

func (*OptNilUUID) Decode

func (o *OptNilUUID) Decode(d *jx.Decoder) error

Decode decodes uuid.UUID from json.

func (OptNilUUID) Encode

func (o OptNilUUID) Encode(e *jx.Encoder)

Encode encodes uuid.UUID as json.

func (OptNilUUID) Get

func (o OptNilUUID) Get() (v uuid.UUID, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptNilUUID) IsNull

func (o OptNilUUID) IsNull() bool

IsNull returns true if value is Null.

func (OptNilUUID) IsSet

func (o OptNilUUID) IsSet() bool

IsSet returns true if OptNilUUID was set.

func (OptNilUUID) MarshalJSON

func (s OptNilUUID) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptNilUUID) Or

func (o OptNilUUID) Or(d uuid.UUID) uuid.UUID

Or returns value if set, or given parameter if does not.

func (*OptNilUUID) Reset

func (o *OptNilUUID) Reset()

Reset unsets value.

func (*OptNilUUID) SetTo

func (o *OptNilUUID) SetTo(v uuid.UUID)

SetTo sets value to v.

func (*OptNilUUID) SetToNull

func (o *OptNilUUID) SetToNull()

SetToNull sets value to null.

func (*OptNilUUID) UnmarshalJSON

func (s *OptNilUUID) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type OptPaymentMethod

type OptPaymentMethod struct {
	Value PaymentMethod
	Set   bool
}

OptPaymentMethod is optional PaymentMethod.

func NewOptPaymentMethod

func NewOptPaymentMethod(v PaymentMethod) OptPaymentMethod

NewOptPaymentMethod returns new OptPaymentMethod with value set to v.

func (*OptPaymentMethod) Decode

func (o *OptPaymentMethod) Decode(d *jx.Decoder) error

Decode decodes PaymentMethod from json.

func (OptPaymentMethod) Encode

func (o OptPaymentMethod) Encode(e *jx.Encoder)

Encode encodes PaymentMethod as json.

func (OptPaymentMethod) Get

func (o OptPaymentMethod) Get() (v PaymentMethod, ok bool)

Get returns value and boolean that denotes whether value was set.

func (OptPaymentMethod) IsSet

func (o OptPaymentMethod) IsSet() bool

IsSet returns true if OptPaymentMethod was set.

func (OptPaymentMethod) MarshalJSON

func (s OptPaymentMethod) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OptPaymentMethod) Or

Or returns value if set, or given parameter if does not.

func (*OptPaymentMethod) Reset

func (o *OptPaymentMethod) Reset()

Reset unsets value.

func (*OptPaymentMethod) SetTo

func (o *OptPaymentMethod) SetTo(v PaymentMethod)

SetTo sets value to v.

func (*OptPaymentMethod) UnmarshalJSON

func (s *OptPaymentMethod) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type Option

type Option interface {
	ServerOption
	ClientOption
}

Option is config option.

func WithMeterProvider

func WithMeterProvider(provider metric.MeterProvider) Option

WithMeterProvider specifies a meter provider to use for creating a meter.

If none is specified, the otel.GetMeterProvider() is used.

func WithTracerProvider

func WithTracerProvider(provider trace.TracerProvider) Option

WithTracerProvider specifies a tracer provider to use for creating a tracer.

If none is specified, the global provider is used.

type OrderDto

type OrderDto struct {
	// UUID заказа.
	OrderUUID uuid.UUID `json:"order_uuid"`
	// UUID пользователя.
	UserUUID uuid.UUID `json:"user_uuid"`
	// Список UUID деталей.
	PartUuids []uuid.UUID `json:"part_uuids"`
	// Общая стоимость.
	TotalPrice float32 `json:"total_price"`
	// UUID транзакции (если есть).
	TransactionUUID OptNilUUID `json:"transaction_uuid"`
	// Способ оплаты (если есть).
	PaymentMethod OptPaymentMethod `json:"payment_method"`
	Status        OrderStatus      `json:"status"`
}

Ref: #/components/schemas/order_dto

func (*OrderDto) Decode

func (s *OrderDto) Decode(d *jx.Decoder) error

Decode decodes OrderDto from json.

func (*OrderDto) Encode

func (s *OrderDto) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*OrderDto) GetOrderUUID

func (s *OrderDto) GetOrderUUID() uuid.UUID

GetOrderUUID returns the value of OrderUUID.

func (*OrderDto) GetPartUuids

func (s *OrderDto) GetPartUuids() []uuid.UUID

GetPartUuids returns the value of PartUuids.

func (*OrderDto) GetPaymentMethod

func (s *OrderDto) GetPaymentMethod() OptPaymentMethod

GetPaymentMethod returns the value of PaymentMethod.

func (*OrderDto) GetStatus

func (s *OrderDto) GetStatus() OrderStatus

GetStatus returns the value of Status.

func (*OrderDto) GetTotalPrice

func (s *OrderDto) GetTotalPrice() float32

GetTotalPrice returns the value of TotalPrice.

func (*OrderDto) GetTransactionUUID

func (s *OrderDto) GetTransactionUUID() OptNilUUID

GetTransactionUUID returns the value of TransactionUUID.

func (*OrderDto) GetUserUUID

func (s *OrderDto) GetUserUUID() uuid.UUID

GetUserUUID returns the value of UserUUID.

func (*OrderDto) MarshalJSON

func (s *OrderDto) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*OrderDto) SetOrderUUID

func (s *OrderDto) SetOrderUUID(val uuid.UUID)

SetOrderUUID sets the value of OrderUUID.

func (*OrderDto) SetPartUuids

func (s *OrderDto) SetPartUuids(val []uuid.UUID)

SetPartUuids sets the value of PartUuids.

func (*OrderDto) SetPaymentMethod

func (s *OrderDto) SetPaymentMethod(val OptPaymentMethod)

SetPaymentMethod sets the value of PaymentMethod.

func (*OrderDto) SetStatus

func (s *OrderDto) SetStatus(val OrderStatus)

SetStatus sets the value of Status.

func (*OrderDto) SetTotalPrice

func (s *OrderDto) SetTotalPrice(val float32)

SetTotalPrice sets the value of TotalPrice.

func (*OrderDto) SetTransactionUUID

func (s *OrderDto) SetTransactionUUID(val OptNilUUID)

SetTransactionUUID sets the value of TransactionUUID.

func (*OrderDto) SetUserUUID

func (s *OrderDto) SetUserUUID(val uuid.UUID)

SetUserUUID sets the value of UserUUID.

func (*OrderDto) UnmarshalJSON

func (s *OrderDto) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*OrderDto) Validate

func (s *OrderDto) Validate() error

type OrderStatus

type OrderStatus string

Статус заказа. Ref: #/components/schemas/order_status

const (
	OrderStatusUNKNOWN        OrderStatus = "UNKNOWN"
	OrderStatusPENDINGPAYMENT OrderStatus = "PENDING_PAYMENT"
	OrderStatusPAID           OrderStatus = "PAID"
	OrderStatusCANCELLED      OrderStatus = "CANCELLED"
	OrderStatusFULFILLED      OrderStatus = "FULFILLED"
)

func (OrderStatus) AllValues

func (OrderStatus) AllValues() []OrderStatus

AllValues returns all OrderStatus values.

func (*OrderStatus) Decode

func (s *OrderStatus) Decode(d *jx.Decoder) error

Decode decodes OrderStatus from json.

func (OrderStatus) Encode

func (s OrderStatus) Encode(e *jx.Encoder)

Encode encodes OrderStatus as json.

func (OrderStatus) MarshalJSON

func (s OrderStatus) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (OrderStatus) MarshalText

func (s OrderStatus) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*OrderStatus) UnmarshalJSON

func (s *OrderStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*OrderStatus) UnmarshalText

func (s *OrderStatus) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (OrderStatus) Validate

func (s OrderStatus) Validate() error

type PayOrderParams

type PayOrderParams struct {
	// UUID заказа.
	OrderUUID uuid.UUID
}

PayOrderParams is parameters of PayOrder operation.

type PayOrderRequest

type PayOrderRequest struct {
	// Выбранный способ оплаты.
	PaymentMethod PaymentMethod `json:"payment_method"`
}

Ref: #/components/schemas/pay_order_request

func (*PayOrderRequest) Decode

func (s *PayOrderRequest) Decode(d *jx.Decoder) error

Decode decodes PayOrderRequest from json.

func (*PayOrderRequest) Encode

func (s *PayOrderRequest) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*PayOrderRequest) GetPaymentMethod

func (s *PayOrderRequest) GetPaymentMethod() PaymentMethod

GetPaymentMethod returns the value of PaymentMethod.

func (*PayOrderRequest) MarshalJSON

func (s *PayOrderRequest) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*PayOrderRequest) SetPaymentMethod

func (s *PayOrderRequest) SetPaymentMethod(val PaymentMethod)

SetPaymentMethod sets the value of PaymentMethod.

func (*PayOrderRequest) UnmarshalJSON

func (s *PayOrderRequest) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*PayOrderRequest) Validate

func (s *PayOrderRequest) Validate() error

type PayOrderRes

type PayOrderRes interface {
	// contains filtered or unexported methods
}

type PayOrderResponse

type PayOrderResponse struct {
	// UUID созданной транзакции.
	TransactionUUID uuid.UUID `json:"transaction_uuid"`
}

Ref: #/components/schemas/pay_order_response

func (*PayOrderResponse) Decode

func (s *PayOrderResponse) Decode(d *jx.Decoder) error

Decode decodes PayOrderResponse from json.

func (*PayOrderResponse) Encode

func (s *PayOrderResponse) Encode(e *jx.Encoder)

Encode implements json.Marshaler.

func (*PayOrderResponse) GetTransactionUUID

func (s *PayOrderResponse) GetTransactionUUID() uuid.UUID

GetTransactionUUID returns the value of TransactionUUID.

func (*PayOrderResponse) MarshalJSON

func (s *PayOrderResponse) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (*PayOrderResponse) SetTransactionUUID

func (s *PayOrderResponse) SetTransactionUUID(val uuid.UUID)

SetTransactionUUID sets the value of TransactionUUID.

func (*PayOrderResponse) UnmarshalJSON

func (s *PayOrderResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

type PaymentMethod

type PaymentMethod string

Способ оплаты. Ref: #/components/schemas/payment_method

const (
	PaymentMethodUNKNOWN                    PaymentMethod = "UNKNOWN"
	PaymentMethodPAYMENTMETHODCARD          PaymentMethod = "PAYMENT_METHOD_CARD"
	PaymentMethodPAYMENTMETHODSBP           PaymentMethod = "PAYMENT_METHOD_SBP"
	PaymentMethodPAYMENTMETHODCREDITCARD    PaymentMethod = "PAYMENT_METHOD_CREDIT_CARD"
	PaymentMethodPAYMENTMETHODINVESTORMONEY PaymentMethod = "PAYMENT_METHOD_INVESTOR_MONEY"
)

func (PaymentMethod) AllValues

func (PaymentMethod) AllValues() []PaymentMethod

AllValues returns all PaymentMethod values.

func (*PaymentMethod) Decode

func (s *PaymentMethod) Decode(d *jx.Decoder) error

Decode decodes PaymentMethod from json.

func (PaymentMethod) Encode

func (s PaymentMethod) Encode(e *jx.Encoder)

Encode encodes PaymentMethod as json.

func (PaymentMethod) MarshalJSON

func (s PaymentMethod) MarshalJSON() ([]byte, error)

MarshalJSON implements stdjson.Marshaler.

func (PaymentMethod) MarshalText

func (s PaymentMethod) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*PaymentMethod) UnmarshalJSON

func (s *PaymentMethod) UnmarshalJSON(data []byte) error

UnmarshalJSON implements stdjson.Unmarshaler.

func (*PaymentMethod) UnmarshalText

func (s *PaymentMethod) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (PaymentMethod) Validate

func (s PaymentMethod) Validate() error

type Route

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

Route is route object.

func (Route) Args

func (r Route) Args() []string

Args returns parsed arguments.

func (Route) Name

func (r Route) Name() string

Name returns ogen operation name.

It is guaranteed to be unique and not empty.

func (Route) OperationID

func (r Route) OperationID() string

OperationID returns OpenAPI operationId.

func (Route) PathPattern

func (r Route) PathPattern() string

PathPattern returns OpenAPI path.

func (Route) Summary

func (r Route) Summary() string

Summary returns OpenAPI summary.

type Server

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

Server implements http server based on OpenAPI v3 specification and calls Handler to handle requests.

func NewServer

func NewServer(h Handler, opts ...ServerOption) (*Server, error)

NewServer creates new Server.

func (*Server) FindPath

func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool)

FindPath finds Route for given method and URL.

func (*Server) FindRoute

func (s *Server) FindRoute(method, path string) (Route, bool)

FindRoute finds Route for given method and path.

Note: this method does not unescape path or handle reserved characters in path properly. Use FindPath instead.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves http request as defined by OpenAPI v3 specification, calling handler that matches the path or returning not found error.

type ServerOption

type ServerOption interface {
	// contains filtered or unexported methods
}

ServerOption is server config option.

func WithErrorHandler

func WithErrorHandler(h ErrorHandler) ServerOption

WithErrorHandler specifies error handler to use.

func WithMaxMultipartMemory

func WithMaxMultipartMemory(max int64) ServerOption

WithMaxMultipartMemory specifies limit of memory for storing file parts. File parts which can't be stored in memory will be stored on disk in temporary files.

func WithMethodNotAllowed

func WithMethodNotAllowed(methodNotAllowed func(w http.ResponseWriter, r *http.Request, allowed string)) ServerOption

WithMethodNotAllowed specifies Method Not Allowed handler to use.

func WithMiddleware

func WithMiddleware(m ...Middleware) ServerOption

WithMiddleware specifies middlewares to use.

func WithNotFound

func WithNotFound(notFound http.HandlerFunc) ServerOption

WithNotFound specifies Not Found handler to use.

func WithPathPrefix

func WithPathPrefix(prefix string) ServerOption

WithPathPrefix specifies server path prefix.

type UnimplementedHandler

type UnimplementedHandler struct{}

UnimplementedHandler is no-op Handler which returns http.ErrNotImplemented.

func (UnimplementedHandler) CancelOrder

CancelOrder implements CancelOrder operation.

Отменяет заказ, если он ещё не оплачен.

POST /orders/{order_uuid}/cancel

func (UnimplementedHandler) CreateOrder

CreateOrder implements CreateOrder operation.

Создаёт новый заказ на основе выбранных пользователем деталей.

POST /orders

func (UnimplementedHandler) GetOrder

func (UnimplementedHandler) GetOrder(ctx context.Context, params GetOrderParams) (r GetOrderRes, _ error)

GetOrder implements GetOrder operation.

Возвращает информацию о заказе по его UUID.

GET /orders/{order_uuid}

func (UnimplementedHandler) PayOrder

PayOrder implements PayOrder operation.

Проводит оплату ранее созданного заказа.

POST /orders/{order_uuid}/pay

Jump to

Keyboard shortcuts

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