api

package
v0.0.0-...-5415eb5 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: Apache-2.0 Imports: 29 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 AllRequestBodiesApplicationJSON

type AllRequestBodiesApplicationJSON SimpleObject

func (*AllRequestBodiesApplicationJSON) Decode

Decode decodes AllRequestBodiesApplicationJSON from json.

func (*AllRequestBodiesApplicationJSON) Encode

Encode encodes AllRequestBodiesApplicationJSON as json.

func (*AllRequestBodiesApplicationJSON) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*AllRequestBodiesApplicationJSON) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type AllRequestBodiesApplicationXWwwFormUrlencoded

type AllRequestBodiesApplicationXWwwFormUrlencoded SimpleObject

func (*AllRequestBodiesApplicationXWwwFormUrlencoded) Decode

Decode decodes AllRequestBodiesApplicationXWwwFormUrlencoded from json.

func (*AllRequestBodiesApplicationXWwwFormUrlencoded) Encode

Encode encodes AllRequestBodiesApplicationXWwwFormUrlencoded as json.

func (*AllRequestBodiesApplicationXWwwFormUrlencoded) MarshalJSON

MarshalJSON implements stdjson.Marshaler.

func (*AllRequestBodiesApplicationXWwwFormUrlencoded) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type AllRequestBodiesOK

type AllRequestBodiesOK struct {
	Data io.Reader
}

func (AllRequestBodiesOK) Read

func (s AllRequestBodiesOK) Read(p []byte) (n int, err error)

Read reads data from the Data reader.

Kept to satisfy the io.Reader interface.

type AllRequestBodiesOptionalApplicationJSON

type AllRequestBodiesOptionalApplicationJSON SimpleObject

func (*AllRequestBodiesOptionalApplicationJSON) Decode

Decode decodes AllRequestBodiesOptionalApplicationJSON from json.

func (*AllRequestBodiesOptionalApplicationJSON) Encode

Encode encodes AllRequestBodiesOptionalApplicationJSON as json.

func (*AllRequestBodiesOptionalApplicationJSON) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*AllRequestBodiesOptionalApplicationJSON) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type AllRequestBodiesOptionalApplicationXWwwFormUrlencoded

type AllRequestBodiesOptionalApplicationXWwwFormUrlencoded SimpleObject

func (*AllRequestBodiesOptionalApplicationXWwwFormUrlencoded) Decode

Decode decodes AllRequestBodiesOptionalApplicationXWwwFormUrlencoded from json.

func (*AllRequestBodiesOptionalApplicationXWwwFormUrlencoded) Encode

Encode encodes AllRequestBodiesOptionalApplicationXWwwFormUrlencoded as json.

func (*AllRequestBodiesOptionalApplicationXWwwFormUrlencoded) MarshalJSON

MarshalJSON implements stdjson.Marshaler.

func (*AllRequestBodiesOptionalApplicationXWwwFormUrlencoded) UnmarshalJSON

UnmarshalJSON implements stdjson.Unmarshaler.

type AllRequestBodiesOptionalOK

type AllRequestBodiesOptionalOK struct {
	Data io.Reader
}

func (AllRequestBodiesOptionalOK) Read

func (s AllRequestBodiesOptionalOK) Read(p []byte) (n int, err error)

Read reads data from the Data reader.

Kept to satisfy the io.Reader interface.

type AllRequestBodiesOptionalReq

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

type AllRequestBodiesOptionalReqApplicationOctetStream

type AllRequestBodiesOptionalReqApplicationOctetStream struct {
	Data io.Reader
}

func (AllRequestBodiesOptionalReqApplicationOctetStream) Read

Read reads data from the Data reader.

Kept to satisfy the io.Reader interface.

type AllRequestBodiesOptionalReqEmptyBody

type AllRequestBodiesOptionalReqEmptyBody struct{}

type AllRequestBodiesOptionalReqTextPlain

type AllRequestBodiesOptionalReqTextPlain struct {
	Data io.Reader
}

func (AllRequestBodiesOptionalReqTextPlain) Read

func (s AllRequestBodiesOptionalReqTextPlain) Read(p []byte) (n int, err error)

Read reads data from the Data reader.

Kept to satisfy the io.Reader interface.

type AllRequestBodiesReq

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

type AllRequestBodiesReqApplicationOctetStream

type AllRequestBodiesReqApplicationOctetStream struct {
	Data io.Reader
}

func (AllRequestBodiesReqApplicationOctetStream) Read

Read reads data from the Data reader.

Kept to satisfy the io.Reader interface.

type AllRequestBodiesReqTextPlain

type AllRequestBodiesReqTextPlain struct {
	Data io.Reader
}

func (AllRequestBodiesReqTextPlain) Read

func (s AllRequestBodiesReqTextPlain) Read(p []byte) (n int, err error)

Read reads data from the Data reader.

Kept to satisfy the io.Reader interface.

type Base64RequestOK

type Base64RequestOK struct {
	Data io.Reader
}

func (Base64RequestOK) Read

func (s Base64RequestOK) Read(p []byte) (n int, err error)

Read reads data from the Data reader.

Kept to satisfy the io.Reader interface.

type Base64RequestReq

type Base64RequestReq struct {
	Data io.Reader
}

func (Base64RequestReq) Read

func (s Base64RequestReq) Read(p []byte) (n int, err error)

Read reads data from the Data reader.

Kept to satisfy the io.Reader interface.

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

func (c *Client) AllRequestBodies(ctx context.Context, request AllRequestBodiesReq) (AllRequestBodiesOK, error)

AllRequestBodies invokes allRequestBodies operation.

POST /allRequestBodies

func (*Client) AllRequestBodiesOptional

func (c *Client) AllRequestBodiesOptional(ctx context.Context, request AllRequestBodiesOptionalReq) (AllRequestBodiesOptionalOK, error)

AllRequestBodiesOptional invokes allRequestBodiesOptional operation.

POST /allRequestBodiesOptional

func (*Client) Base64Request

func (c *Client) Base64Request(ctx context.Context, request Base64RequestReq) (Base64RequestOK, error)

Base64Request invokes base64Request operation.

POST /base64Request

func (*Client) MaskContentType

func (c *Client) MaskContentType(ctx context.Context, request *MaskContentTypeReqWithContentType) (*MaskResponse, error)

MaskContentType invokes maskContentType operation.

POST /maskContentType

func (*Client) MaskContentTypeOptional

func (c *Client) MaskContentTypeOptional(ctx context.Context, request *MaskContentTypeOptionalReqWithContentType) (*MaskResponse, error)

MaskContentTypeOptional invokes maskContentTypeOptional operation.

POST /maskContentTypeOptional

func (*Client) StreamJSON

func (c *Client) StreamJSON(ctx context.Context, request []float64) (float64, error)

StreamJSON invokes streamJSON operation.

POST /streamJSON

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 ErrorHandler

type ErrorHandler = ogenerrors.ErrorHandler

ErrorHandler is error handler.

type Handler

type Handler interface {
	// AllRequestBodies implements allRequestBodies operation.
	//
	// POST /allRequestBodies
	AllRequestBodies(ctx context.Context, req AllRequestBodiesReq) (AllRequestBodiesOK, error)
	// AllRequestBodiesOptional implements allRequestBodiesOptional operation.
	//
	// POST /allRequestBodiesOptional
	AllRequestBodiesOptional(ctx context.Context, req AllRequestBodiesOptionalReq) (AllRequestBodiesOptionalOK, error)
	// Base64Request implements base64Request operation.
	//
	// POST /base64Request
	Base64Request(ctx context.Context, req Base64RequestReq) (Base64RequestOK, error)
	// MaskContentType implements maskContentType operation.
	//
	// POST /maskContentType
	MaskContentType(ctx context.Context, req *MaskContentTypeReqWithContentType) (*MaskResponse, error)
	// MaskContentTypeOptional implements maskContentTypeOptional operation.
	//
	// POST /maskContentTypeOptional
	MaskContentTypeOptional(ctx context.Context, req *MaskContentTypeOptionalReqWithContentType) (*MaskResponse, error)
	// StreamJSON implements streamJSON operation.
	//
	// POST /streamJSON
	StreamJSON(ctx context.Context, req []float64) (float64, error)
}

Handler handles operations described by OpenAPI v3 specification.

type Invoker

type Invoker interface {
	// AllRequestBodies invokes allRequestBodies operation.
	//
	// POST /allRequestBodies
	AllRequestBodies(ctx context.Context, request AllRequestBodiesReq) (AllRequestBodiesOK, error)
	// AllRequestBodiesOptional invokes allRequestBodiesOptional operation.
	//
	// POST /allRequestBodiesOptional
	AllRequestBodiesOptional(ctx context.Context, request AllRequestBodiesOptionalReq) (AllRequestBodiesOptionalOK, error)
	// Base64Request invokes base64Request operation.
	//
	// POST /base64Request
	Base64Request(ctx context.Context, request Base64RequestReq) (Base64RequestOK, error)
	// MaskContentType invokes maskContentType operation.
	//
	// POST /maskContentType
	MaskContentType(ctx context.Context, request *MaskContentTypeReqWithContentType) (*MaskResponse, error)
	// MaskContentTypeOptional invokes maskContentTypeOptional operation.
	//
	// POST /maskContentTypeOptional
	MaskContentTypeOptional(ctx context.Context, request *MaskContentTypeOptionalReqWithContentType) (*MaskResponse, error)
	// StreamJSON invokes streamJSON operation.
	//
	// POST /streamJSON
	StreamJSON(ctx context.Context, request []float64) (float64, 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 MaskContentTypeOptionalReq

type MaskContentTypeOptionalReq struct {
	Data io.Reader
}

func (MaskContentTypeOptionalReq) Read

func (s MaskContentTypeOptionalReq) Read(p []byte) (n int, err error)

Read reads data from the Data reader.

Kept to satisfy the io.Reader interface.

type MaskContentTypeOptionalReqWithContentType

type MaskContentTypeOptionalReqWithContentType struct {
	ContentType string
	Content     MaskContentTypeOptionalReq
}

MaskContentTypeOptionalReqWithContentType wraps MaskContentTypeOptionalReq with Content-Type.

func (*MaskContentTypeOptionalReqWithContentType) GetContent

GetContent returns the value of Content.

func (*MaskContentTypeOptionalReqWithContentType) GetContentType

GetContentType returns the value of ContentType.

func (*MaskContentTypeOptionalReqWithContentType) SetContent

SetContent sets the value of Content.

func (*MaskContentTypeOptionalReqWithContentType) SetContentType

func (s *MaskContentTypeOptionalReqWithContentType) SetContentType(val string)

SetContentType sets the value of ContentType.

type MaskContentTypeReq

type MaskContentTypeReq struct {
	Data io.Reader
}

func (MaskContentTypeReq) Read

func (s MaskContentTypeReq) Read(p []byte) (n int, err error)

Read reads data from the Data reader.

Kept to satisfy the io.Reader interface.

type MaskContentTypeReqWithContentType

type MaskContentTypeReqWithContentType struct {
	ContentType string
	Content     MaskContentTypeReq
}

MaskContentTypeReqWithContentType wraps MaskContentTypeReq with Content-Type.

func (*MaskContentTypeReqWithContentType) GetContent

GetContent returns the value of Content.

func (*MaskContentTypeReqWithContentType) GetContentType

func (s *MaskContentTypeReqWithContentType) GetContentType() string

GetContentType returns the value of ContentType.

func (*MaskContentTypeReqWithContentType) SetContent

SetContent sets the value of Content.

func (*MaskContentTypeReqWithContentType) SetContentType

func (s *MaskContentTypeReqWithContentType) SetContentType(val string)

SetContentType sets the value of ContentType.

type MaskResponse

type MaskResponse struct {
	ContentType string `json:"contentType"`
	Content     string `json:"content"`
}

Ref: #/components/schemas/MaskResponse

func (*MaskResponse) Decode

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

Decode decodes MaskResponse from json.

func (*MaskResponse) Encode

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

Encode implements json.Marshaler.

func (*MaskResponse) GetContent

func (s *MaskResponse) GetContent() string

GetContent returns the value of Content.

func (*MaskResponse) GetContentType

func (s *MaskResponse) GetContentType() string

GetContentType returns the value of ContentType.

func (*MaskResponse) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*MaskResponse) SetContent

func (s *MaskResponse) SetContent(val string)

SetContent sets the value of Content.

func (*MaskResponse) SetContentType

func (s *MaskResponse) SetContentType(val string)

SetContentType sets the value of ContentType.

func (*MaskResponse) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

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

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

Decode decodes int from json.

func (OptInt) Encode

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

Encode encodes int as json.

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

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

MarshalJSON implements stdjson.Marshaler.

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.

func (*OptInt) UnmarshalJSON

func (s *OptInt) 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 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 SimpleObject

type SimpleObject struct {
	Name string `json:"name"`
	Age  OptInt `json:"age"`
}

Ref: #/components/schemas/SimpleObject

func (*SimpleObject) Decode

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

Decode decodes SimpleObject from json.

func (*SimpleObject) Encode

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

Encode implements json.Marshaler.

func (*SimpleObject) GetAge

func (s *SimpleObject) GetAge() OptInt

GetAge returns the value of Age.

func (*SimpleObject) GetName

func (s *SimpleObject) GetName() string

GetName returns the value of Name.

func (*SimpleObject) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*SimpleObject) SetAge

func (s *SimpleObject) SetAge(val OptInt)

SetAge sets the value of Age.

func (*SimpleObject) SetName

func (s *SimpleObject) SetName(val string)

SetName sets the value of Name.

func (*SimpleObject) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type SimpleObjectMultipart

type SimpleObjectMultipart struct {
	Name string `json:"name"`
	Age  OptInt `json:"age"`
}

Ref: #/components/schemas/SimpleObject

func (*SimpleObjectMultipart) GetAge

func (s *SimpleObjectMultipart) GetAge() OptInt

GetAge returns the value of Age.

func (*SimpleObjectMultipart) GetName

func (s *SimpleObjectMultipart) GetName() string

GetName returns the value of Name.

func (*SimpleObjectMultipart) SetAge

func (s *SimpleObjectMultipart) SetAge(val OptInt)

SetAge sets the value of Age.

func (*SimpleObjectMultipart) SetName

func (s *SimpleObjectMultipart) SetName(val string)

SetName sets the value of Name.

type UnimplementedHandler

type UnimplementedHandler struct{}

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

func (UnimplementedHandler) AllRequestBodies

AllRequestBodies implements allRequestBodies operation.

POST /allRequestBodies

func (UnimplementedHandler) AllRequestBodiesOptional

AllRequestBodiesOptional implements allRequestBodiesOptional operation.

POST /allRequestBodiesOptional

func (UnimplementedHandler) Base64Request

Base64Request implements base64Request operation.

POST /base64Request

func (UnimplementedHandler) MaskContentType

MaskContentType implements maskContentType operation.

POST /maskContentType

func (UnimplementedHandler) MaskContentTypeOptional

MaskContentTypeOptional implements maskContentTypeOptional operation.

POST /maskContentTypeOptional

func (UnimplementedHandler) StreamJSON

func (UnimplementedHandler) StreamJSON(ctx context.Context, req []float64) (r float64, _ error)

StreamJSON implements streamJSON operation.

POST /streamJSON

Jump to

Keyboard shortcuts

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