ogen

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: MIT Imports: 32 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 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) CreateHuman

func (c *Client) CreateHuman(ctx context.Context, request *CreateHuman) (CreateHumanRes, error)

CreateHuman invokes createHuman operation.

Create a new Human and persists it to storage.

POST /human

func (*Client) DeleteHuman

func (c *Client) DeleteHuman(ctx context.Context, params DeleteHumanParams) (DeleteHumanRes, error)

DeleteHuman invokes deleteHuman operation.

Delete Human.

DELETE /human/{id}

func (*Client) ListHuman

func (c *Client) ListHuman(ctx context.Context, params ListHumanParams) (ListHumanRes, error)

ListHuman invokes listHuman operation.

List for Humans.

GET /human

func (*Client) ReadHuman

func (c *Client) ReadHuman(ctx context.Context, params ReadHumanParams) (ReadHumanRes, error)

ReadHuman invokes readHuman operation.

Finds the Human with the requested ID and returns it.

GET /human/{id}

func (*Client) UpdateHuman

func (c *Client) UpdateHuman(ctx context.Context, request *UpdateHuman, params UpdateHumanParams) (UpdateHumanRes, error)

UpdateHuman invokes updateHuman operation.

Update Human and persists it to storage.

PUT /human/{id}

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 CreateHuman

type CreateHuman struct {
	ID   uuid.UUID `json:"id"`
	Name string    `json:"name"`
}

Ref: #/components/schemas/CreateHuman

func (*CreateHuman) Decode

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

Decode decodes CreateHuman from json.

func (*CreateHuman) Encode

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

Encode implements json.Marshaler.

func (*CreateHuman) GetID

func (s *CreateHuman) GetID() uuid.UUID

GetID returns the value of ID.

func (*CreateHuman) GetName

func (s *CreateHuman) GetName() string

GetName returns the value of Name.

func (*CreateHuman) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*CreateHuman) SetID

func (s *CreateHuman) SetID(val uuid.UUID)

SetID sets the value of ID.

func (*CreateHuman) SetName

func (s *CreateHuman) SetName(val string)

SetName sets the value of Name.

func (*CreateHuman) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type CreateHumanRes

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

type DeleteHumanOK

type DeleteHumanOK struct {
	Status OptString `json:"status"`
}

func (*DeleteHumanOK) Decode

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

Decode decodes DeleteHumanOK from json.

func (*DeleteHumanOK) Encode

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

Encode implements json.Marshaler.

func (*DeleteHumanOK) GetStatus

func (s *DeleteHumanOK) GetStatus() OptString

GetStatus returns the value of Status.

func (*DeleteHumanOK) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*DeleteHumanOK) SetStatus

func (s *DeleteHumanOK) SetStatus(val OptString)

SetStatus sets the value of Status.

func (*DeleteHumanOK) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type DeleteHumanParams

type DeleteHumanParams struct {
	// ID of the Human.
	ID uuid.UUID
}

DeleteHumanParams is parameters of deleteHuman operation.

type DeleteHumanRes

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

type ErrorHandler

type ErrorHandler = ogenerrors.ErrorHandler

ErrorHandler is error handler.

type ErrorItem

type ErrorItem struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

func (*ErrorItem) Decode

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

Decode decodes ErrorItem from json.

func (*ErrorItem) Encode

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

Encode implements json.Marshaler.

func (*ErrorItem) GetCode

func (s *ErrorItem) GetCode() int

GetCode returns the value of Code.

func (*ErrorItem) GetMessage

func (s *ErrorItem) GetMessage() string

GetMessage returns the value of Message.

func (*ErrorItem) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*ErrorItem) SetCode

func (s *ErrorItem) SetCode(val int)

SetCode sets the value of Code.

func (*ErrorItem) SetMessage

func (s *ErrorItem) SetMessage(val string)

SetMessage sets the value of Message.

func (*ErrorItem) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type ErrorStatusCode

type ErrorStatusCode struct {
	StatusCode int
	Response   []ErrorItem
}

ErrorStatusCode wraps []ErrorItem with StatusCode.

func (*ErrorStatusCode) Error

func (s *ErrorStatusCode) Error() string

func (*ErrorStatusCode) GetResponse

func (s *ErrorStatusCode) GetResponse() []ErrorItem

GetResponse returns the value of Response.

func (*ErrorStatusCode) GetStatusCode

func (s *ErrorStatusCode) GetStatusCode() int

GetStatusCode returns the value of StatusCode.

func (*ErrorStatusCode) SetResponse

func (s *ErrorStatusCode) SetResponse(val []ErrorItem)

SetResponse sets the value of Response.

func (*ErrorStatusCode) SetStatusCode

func (s *ErrorStatusCode) SetStatusCode(val int)

SetStatusCode sets the value of StatusCode.

func (*ErrorStatusCode) Validate

func (s *ErrorStatusCode) Validate() error

type Handler

type Handler interface {
	// CreateHuman implements createHuman operation.
	//
	// Create a new Human  and persists it to storage.
	//
	// POST /human
	CreateHuman(ctx context.Context, req *CreateHuman) (CreateHumanRes, error)
	// DeleteHuman implements deleteHuman operation.
	//
	// Delete Human.
	//
	// DELETE /human/{id}
	DeleteHuman(ctx context.Context, params DeleteHumanParams) (DeleteHumanRes, error)
	// ListHuman implements listHuman operation.
	//
	// List for Humans.
	//
	// GET /human
	ListHuman(ctx context.Context, params ListHumanParams) (ListHumanRes, error)
	// ReadHuman implements readHuman operation.
	//
	// Finds the Human with the requested ID and returns it.
	//
	// GET /human/{id}
	ReadHuman(ctx context.Context, params ReadHumanParams) (ReadHumanRes, error)
	// UpdateHuman implements updateHuman operation.
	//
	// Update Human  and persists it to storage.
	//
	// PUT /human/{id}
	UpdateHuman(ctx context.Context, req *UpdateHuman, params UpdateHumanParams) (UpdateHumanRes, error)
	// NewError creates *ErrorStatusCode from error returned by handler.
	//
	// Used for common default response.
	NewError(ctx context.Context, err error) *ErrorStatusCode
}

Handler handles operations described by OpenAPI v3 specification.

type HandlerImpl

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

func NewHandler

func NewHandler(
	client *gen.Client,
	srvc *service.Service, logger *zap.Logger,
) *HandlerImpl

func (*HandlerImpl) CreateHuman

func (h *HandlerImpl) CreateHuman(ctx context.Context, req *CreateHuman) (CreateHumanRes, error)

func (*HandlerImpl) DeleteHuman

func (h *HandlerImpl) DeleteHuman(ctx context.Context, params DeleteHumanParams) (DeleteHumanRes, error)

DeleteHuman handles DELETE /human/{id} requests.

func (*HandlerImpl) ListHuman

func (h *HandlerImpl) ListHuman(ctx context.Context, params ListHumanParams) (ListHumanRes, error)

func (*HandlerImpl) NewError

func (h *HandlerImpl) NewError(ctx context.Context, err error) *ErrorStatusCode

func (*HandlerImpl) ReadHuman

func (h *HandlerImpl) ReadHuman(ctx context.Context, params ReadHumanParams) (ReadHumanRes, error)

func (*HandlerImpl) UpdateHuman

func (h *HandlerImpl) UpdateHuman(ctx context.Context, req *UpdateHuman, params UpdateHumanParams) (UpdateHumanRes, error)

type Human

type Human struct {
	ID   uuid.UUID `json:"id"`
	Name string    `json:"name"`
}

Ref: #/components/schemas/Human

func NewHuman

func NewHuman(e service.Human) *Human

func NewHumanList

func NewHumanList(es []service.Human) []Human

func (*Human) Decode

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

Decode decodes Human from json.

func (*Human) Encode

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

Encode implements json.Marshaler.

func (*Human) GetID

func (s *Human) GetID() uuid.UUID

GetID returns the value of ID.

func (*Human) GetName

func (s *Human) GetName() string

GetName returns the value of Name.

func (*Human) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*Human) SetID

func (s *Human) SetID(val uuid.UUID)

SetID sets the value of ID.

func (*Human) SetName

func (s *Human) SetName(val string)

SetName sets the value of Name.

func (*Human) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type HumanList

type HumanList []Human

func (*HumanList) Decode

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

Decode decodes HumanList from json.

func (HumanList) Encode

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

Encode encodes HumanList as json.

func (HumanList) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*HumanList) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (HumanList) Validate

func (s HumanList) Validate() error

type HumanListHeaders

type HumanListHeaders struct {
	ContentRange int
	Response     HumanList
}

HumanListHeaders wraps HumanList with response headers.

func (*HumanListHeaders) GetContentRange

func (s *HumanListHeaders) GetContentRange() int

GetContentRange returns the value of ContentRange.

func (*HumanListHeaders) GetResponse

func (s *HumanListHeaders) GetResponse() HumanList

GetResponse returns the value of Response.

func (*HumanListHeaders) SetContentRange

func (s *HumanListHeaders) SetContentRange(val int)

SetContentRange sets the value of ContentRange.

func (*HumanListHeaders) SetResponse

func (s *HumanListHeaders) SetResponse(val HumanList)

SetResponse sets the value of Response.

func (*HumanListHeaders) Validate

func (s *HumanListHeaders) Validate() error

type Invoker

type Invoker interface {
	// CreateHuman invokes createHuman operation.
	//
	// Create a new Human  and persists it to storage.
	//
	// POST /human
	CreateHuman(ctx context.Context, request *CreateHuman) (CreateHumanRes, error)
	// DeleteHuman invokes deleteHuman operation.
	//
	// Delete Human.
	//
	// DELETE /human/{id}
	DeleteHuman(ctx context.Context, params DeleteHumanParams) (DeleteHumanRes, error)
	// ListHuman invokes listHuman operation.
	//
	// List for Humans.
	//
	// GET /human
	ListHuman(ctx context.Context, params ListHumanParams) (ListHumanRes, error)
	// ReadHuman invokes readHuman operation.
	//
	// Finds the Human with the requested ID and returns it.
	//
	// GET /human/{id}
	ReadHuman(ctx context.Context, params ReadHumanParams) (ReadHumanRes, error)
	// UpdateHuman invokes updateHuman operation.
	//
	// Update Human  and persists it to storage.
	//
	// PUT /human/{id}
	UpdateHuman(ctx context.Context, request *UpdateHuman, params UpdateHumanParams) (UpdateHumanRes, error)
}

Invoker invokes operations described by OpenAPI v3 specification.

type ListHumanBadRequestApplicationJSON

type ListHumanBadRequestApplicationJSON []R400Item

func (*ListHumanBadRequestApplicationJSON) Decode

Decode decodes ListHumanBadRequestApplicationJSON from json.

func (ListHumanBadRequestApplicationJSON) Encode

Encode encodes ListHumanBadRequestApplicationJSON as json.

func (ListHumanBadRequestApplicationJSON) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*ListHumanBadRequestApplicationJSON) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (ListHumanBadRequestApplicationJSON) Validate

type ListHumanConflictApplicationJSON

type ListHumanConflictApplicationJSON []R409Item

func (*ListHumanConflictApplicationJSON) Decode

Decode decodes ListHumanConflictApplicationJSON from json.

func (ListHumanConflictApplicationJSON) Encode

Encode encodes ListHumanConflictApplicationJSON as json.

func (ListHumanConflictApplicationJSON) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*ListHumanConflictApplicationJSON) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (ListHumanConflictApplicationJSON) Validate

type ListHumanInternalServerErrorApplicationJSON

type ListHumanInternalServerErrorApplicationJSON []R500Item

func (*ListHumanInternalServerErrorApplicationJSON) Decode

Decode decodes ListHumanInternalServerErrorApplicationJSON from json.

func (ListHumanInternalServerErrorApplicationJSON) Encode

Encode encodes ListHumanInternalServerErrorApplicationJSON as json.

func (ListHumanInternalServerErrorApplicationJSON) MarshalJSON

MarshalJSON implements stdjson.Marshaler.

func (*ListHumanInternalServerErrorApplicationJSON) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (ListHumanInternalServerErrorApplicationJSON) Validate

type ListHumanNotFoundApplicationJSON

type ListHumanNotFoundApplicationJSON []R404Item

func (*ListHumanNotFoundApplicationJSON) Decode

Decode decodes ListHumanNotFoundApplicationJSON from json.

func (ListHumanNotFoundApplicationJSON) Encode

Encode encodes ListHumanNotFoundApplicationJSON as json.

func (ListHumanNotFoundApplicationJSON) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*ListHumanNotFoundApplicationJSON) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (ListHumanNotFoundApplicationJSON) Validate

type ListHumanParams

type ListHumanParams struct {
	// What page to render.
	Page OptInt
	// Item count to render per page.
	ItemsPerPage OptInt
}

ListHumanParams is parameters of listHuman operation.

type ListHumanRes

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

type Middleware

type Middleware = middleware.Middleware

Middleware is middleware type.

type OptInt

type OptInt struct {
	Value int
	Set   bool
}

OptInt is optional int.

func NewOptInt

func NewOptInt(v int) OptInt

NewOptInt returns new OptInt with value set to v.

func (OptInt) Get

func (o OptInt) Get() (v int, ok bool)

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

func (OptInt) IsSet

func (o OptInt) IsSet() bool

IsSet returns true if OptInt was set.

func (OptInt) Or

func (o OptInt) Or(d int) int

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

func (*OptInt) Reset

func (o *OptInt) Reset()

Reset unsets value.

func (*OptInt) SetTo

func (o *OptInt) SetTo(v int)

SetTo sets value to v.

type OptString

type OptString struct {
	Value string
	Set   bool
}

OptString is optional string.

func NewOptString

func NewOptString(v string) OptString

NewOptString returns new OptString with value set to v.

func (*OptString) Decode

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

Decode decodes string from json.

func (OptString) Encode

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

Encode encodes string as json.

func (OptString) Get

func (o OptString) Get() (v string, ok bool)

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

func (OptString) IsSet

func (o OptString) IsSet() bool

IsSet returns true if OptString was set.

func (OptString) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptString) Or

func (o OptString) Or(d string) string

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

func (*OptString) Reset

func (o *OptString) Reset()

Reset unsets value.

func (*OptString) SetTo

func (o *OptString) SetTo(v string)

SetTo sets value to v.

func (*OptString) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptUUID

type OptUUID struct {
	Value uuid.UUID
	Set   bool
}

OptUUID is optional uuid.UUID.

func NewOptUUID

func NewOptUUID(v uuid.UUID) OptUUID

NewOptUUID returns new OptUUID with value set to v.

func (*OptUUID) Decode

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

Decode decodes uuid.UUID from json.

func (OptUUID) Encode

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

Encode encodes uuid.UUID as json.

func (OptUUID) Get

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

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

func (OptUUID) IsSet

func (o OptUUID) IsSet() bool

IsSet returns true if OptUUID was set.

func (OptUUID) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptUUID) Or

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

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

func (*OptUUID) Reset

func (o *OptUUID) Reset()

Reset unsets value.

func (*OptUUID) SetTo

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

SetTo sets value to v.

func (*OptUUID) UnmarshalJSON

func (s *OptUUID) 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 R400Item

type R400Item struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

func (*R400Item) Decode

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

Decode decodes R400Item from json.

func (*R400Item) Encode

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

Encode implements json.Marshaler.

func (*R400Item) GetCode

func (s *R400Item) GetCode() int

GetCode returns the value of Code.

func (*R400Item) GetMessage

func (s *R400Item) GetMessage() string

GetMessage returns the value of Message.

func (*R400Item) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*R400Item) SetCode

func (s *R400Item) SetCode(val int)

SetCode sets the value of Code.

func (*R400Item) SetMessage

func (s *R400Item) SetMessage(val string)

SetMessage sets the value of Message.

func (*R400Item) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type R404Item

type R404Item struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

func (*R404Item) Decode

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

Decode decodes R404Item from json.

func (*R404Item) Encode

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

Encode implements json.Marshaler.

func (*R404Item) GetCode

func (s *R404Item) GetCode() int

GetCode returns the value of Code.

func (*R404Item) GetMessage

func (s *R404Item) GetMessage() string

GetMessage returns the value of Message.

func (*R404Item) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*R404Item) SetCode

func (s *R404Item) SetCode(val int)

SetCode sets the value of Code.

func (*R404Item) SetMessage

func (s *R404Item) SetMessage(val string)

SetMessage sets the value of Message.

func (*R404Item) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type R409Item

type R409Item struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

func (*R409Item) Decode

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

Decode decodes R409Item from json.

func (*R409Item) Encode

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

Encode implements json.Marshaler.

func (*R409Item) GetCode

func (s *R409Item) GetCode() int

GetCode returns the value of Code.

func (*R409Item) GetMessage

func (s *R409Item) GetMessage() string

GetMessage returns the value of Message.

func (*R409Item) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*R409Item) SetCode

func (s *R409Item) SetCode(val int)

SetCode sets the value of Code.

func (*R409Item) SetMessage

func (s *R409Item) SetMessage(val string)

SetMessage sets the value of Message.

func (*R409Item) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type R500Item

type R500Item struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

func (*R500Item) Decode

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

Decode decodes R500Item from json.

func (*R500Item) Encode

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

Encode implements json.Marshaler.

func (*R500Item) GetCode

func (s *R500Item) GetCode() int

GetCode returns the value of Code.

func (*R500Item) GetMessage

func (s *R500Item) GetMessage() string

GetMessage returns the value of Message.

func (*R500Item) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*R500Item) SetCode

func (s *R500Item) SetCode(val int)

SetCode sets the value of Code.

func (*R500Item) SetMessage

func (s *R500Item) SetMessage(val string)

SetMessage sets the value of Message.

func (*R500Item) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type ReadHumanParams

type ReadHumanParams struct {
	// ID of the Human.
	ID uuid.UUID
}

ReadHumanParams is parameters of readHuman operation.

type ReadHumanRes

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

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) CreateHuman

func (UnimplementedHandler) CreateHuman(ctx context.Context, req *CreateHuman) (r CreateHumanRes, _ error)

CreateHuman implements createHuman operation.

Create a new Human and persists it to storage.

POST /human

func (UnimplementedHandler) DeleteHuman

DeleteHuman implements deleteHuman operation.

Delete Human.

DELETE /human/{id}

func (UnimplementedHandler) ListHuman

func (UnimplementedHandler) ListHuman(ctx context.Context, params ListHumanParams) (r ListHumanRes, _ error)

ListHuman implements listHuman operation.

List for Humans.

GET /human

func (UnimplementedHandler) NewError

func (UnimplementedHandler) NewError(ctx context.Context, err error) (r *ErrorStatusCode)

NewError creates *ErrorStatusCode from error returned by handler.

Used for common default response.

func (UnimplementedHandler) ReadHuman

func (UnimplementedHandler) ReadHuman(ctx context.Context, params ReadHumanParams) (r ReadHumanRes, _ error)

ReadHuman implements readHuman operation.

Finds the Human with the requested ID and returns it.

GET /human/{id}

func (UnimplementedHandler) UpdateHuman

UpdateHuman implements updateHuman operation.

Update Human and persists it to storage.

PUT /human/{id}

type UpdateHuman

type UpdateHuman struct {
	ID   OptUUID   `json:"id"`
	Name OptString `json:"name"`
}

Ref: #/components/schemas/UpdateHuman

func (*UpdateHuman) Decode

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

Decode decodes UpdateHuman from json.

func (*UpdateHuman) Encode

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

Encode implements json.Marshaler.

func (*UpdateHuman) GetID

func (s *UpdateHuman) GetID() OptUUID

GetID returns the value of ID.

func (*UpdateHuman) GetName

func (s *UpdateHuman) GetName() OptString

GetName returns the value of Name.

func (*UpdateHuman) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*UpdateHuman) SetID

func (s *UpdateHuman) SetID(val OptUUID)

SetID sets the value of ID.

func (*UpdateHuman) SetName

func (s *UpdateHuman) SetName(val OptString)

SetName sets the value of Name.

func (*UpdateHuman) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type UpdateHumanParams

type UpdateHumanParams struct {
	// ID of the Human.
	ID uuid.UUID
}

UpdateHumanParams is parameters of updateHuman operation.

type UpdateHumanRes

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

Jump to

Keyboard shortcuts

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