api

package
v0.49.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2022 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Code generated by ogen, DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client implements OAS client.

func NewClient

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

NewClient initializes new Client defined by OAS.

func (*Client) TestFormURLEncoded

func (c *Client) TestFormURLEncoded(ctx context.Context, request TestForm) (res TestFormURLEncodedOK, err error)

TestFormURLEncoded invokes testFormURLEncoded operation.

POST /testFormURLEncoded

func (*Client) TestMultipart

func (c *Client) TestMultipart(ctx context.Context, request TestForm) (res TestMultipartOK, err error)

TestMultipart invokes testMultipart operation.

POST /testMultipart

func (*Client) TestMultipartUpload

func (c *Client) TestMultipartUpload(ctx context.Context, request TestMultipartUploadReqForm) (res TestMultipartUploadOK, err error)

TestMultipartUpload invokes testMultipartUpload operation.

POST /testMultipartUpload

func (*Client) TestShareFormSchema

func (c *Client) TestShareFormSchema(ctx context.Context, request TestShareFormSchemaReq) (res TestShareFormSchemaOK, err error)

TestShareFormSchema invokes testShareFormSchema operation.

POST /testShareFormSchema

type ErrorHandler

type ErrorHandler = ogenerrors.ErrorHandler

ErrorHandler is error handler.

type Handler

type Handler interface {
	// TestFormURLEncoded implements testFormURLEncoded operation.
	//
	// POST /testFormURLEncoded
	TestFormURLEncoded(ctx context.Context, req TestForm) (TestFormURLEncodedOK, error)
	// TestMultipart implements testMultipart operation.
	//
	// POST /testMultipart
	TestMultipart(ctx context.Context, req TestForm) (TestMultipartOK, error)
	// TestMultipartUpload implements testMultipartUpload operation.
	//
	// POST /testMultipartUpload
	TestMultipartUpload(ctx context.Context, req TestMultipartUploadReqForm) (TestMultipartUploadOK, error)
	// TestShareFormSchema implements testShareFormSchema operation.
	//
	// POST /testShareFormSchema
	TestShareFormSchema(ctx context.Context, req TestShareFormSchemaReq) (TestShareFormSchemaOK, error)
}

Handler handles operations described by OpenAPI v3 specification.

type Middleware added in v0.49.0

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 OptMultipartFile

type OptMultipartFile struct {
	Value ht.MultipartFile
	Set   bool
}

OptMultipartFile is optional ht.MultipartFile.

func NewOptMultipartFile

func NewOptMultipartFile(v ht.MultipartFile) OptMultipartFile

NewOptMultipartFile returns new OptMultipartFile with value set to v.

func (OptMultipartFile) Get

func (o OptMultipartFile) Get() (v ht.MultipartFile, ok bool)

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

func (OptMultipartFile) IsSet

func (o OptMultipartFile) IsSet() bool

IsSet returns true if OptMultipartFile was set.

func (OptMultipartFile) Or

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

func (*OptMultipartFile) Reset

func (o *OptMultipartFile) Reset()

Reset unsets value.

func (*OptMultipartFile) SetTo

func (o *OptMultipartFile) SetTo(v ht.MultipartFile)

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 OptTestFormDeepObject

type OptTestFormDeepObject struct {
	Value TestFormDeepObject
	Set   bool
}

OptTestFormDeepObject is optional TestFormDeepObject.

func NewOptTestFormDeepObject

func NewOptTestFormDeepObject(v TestFormDeepObject) OptTestFormDeepObject

NewOptTestFormDeepObject returns new OptTestFormDeepObject with value set to v.

func (OptTestFormDeepObject) Get

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

func (OptTestFormDeepObject) IsSet

func (o OptTestFormDeepObject) IsSet() bool

IsSet returns true if OptTestFormDeepObject was set.

func (OptTestFormDeepObject) Or

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

func (*OptTestFormDeepObject) Reset

func (o *OptTestFormDeepObject) Reset()

Reset unsets value.

func (*OptTestFormDeepObject) SetTo

SetTo sets value to v.

type OptTestFormObject

type OptTestFormObject struct {
	Value TestFormObject
	Set   bool
}

OptTestFormObject is optional TestFormObject.

func NewOptTestFormObject

func NewOptTestFormObject(v TestFormObject) OptTestFormObject

NewOptTestFormObject returns new OptTestFormObject with value set to v.

func (OptTestFormObject) Get

func (o OptTestFormObject) Get() (v TestFormObject, ok bool)

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

func (OptTestFormObject) IsSet

func (o OptTestFormObject) IsSet() bool

IsSet returns true if OptTestFormObject was set.

func (OptTestFormObject) Or

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

func (*OptTestFormObject) Reset

func (o *OptTestFormObject) Reset()

Reset unsets value.

func (*OptTestFormObject) SetTo

func (o *OptTestFormObject) SetTo(v TestFormObject)

SetTo sets value to v.

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

type Option

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

func WithClient

func WithClient(client ht.Client) Option

WithClient specifies http client to use.

func WithErrorHandler

func WithErrorHandler(h ErrorHandler) Option

WithErrorHandler specifies error handler to use.

func WithMaxMultipartMemory

func WithMaxMultipartMemory(max int64) Option

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 WithMeterProvider

func WithMeterProvider(provider metric.MeterProvider) Option

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

If none is specified, the metric.NewNoopMeterProvider is used.

func WithMethodNotAllowed added in v0.46.0

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

WithMethodNotAllowed specifies Method Not Allowed handler to use.

func WithMiddleware added in v0.49.0

func WithMiddleware(m ...Middleware) Option

WithMiddleware specifies middlewares to use.

func WithNotFound

func WithNotFound(notFound http.HandlerFunc) Option

WithNotFound specifies Not Found handler to use.

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 added in v0.46.0

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.

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 ...Option) (*Server, error)

NewServer creates new Server.

func (*Server) FindRoute

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

FindRoute finds Route for given method and path.

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 SharedRequest

type SharedRequest struct {
	Filename OptString "json:\"filename\""
	File     OptString "json:\"file\""
}

Ref: #/components/schemas/SharedRequest

func (*SharedRequest) Decode

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

Decode decodes SharedRequest from json.

func (SharedRequest) Encode

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

Encode implements json.Marshaler.

func (SharedRequest) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*SharedRequest) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type SharedRequestForm

type SharedRequestForm struct {
	Filename OptString        "json:\"filename\""
	File     OptMultipartFile "json:\"file\""
}

Ref: #/components/schemas/SharedRequest

type TestForm

type TestForm struct {
	ID          OptInt                "json:\"id\""
	UUID        OptUUID               "json:\"uuid\""
	Description string                "json:\"description\""
	Array       []string              "json:\"array\""
	Object      OptTestFormObject     "json:\"object\""
	DeepObject  OptTestFormDeepObject "json:\"deepObject\""
}

Ref: #/components/schemas/TestForm

type TestFormDeepObject

type TestFormDeepObject struct {
	Min OptInt "json:\"min\""
	Max int    "json:\"max\""
}

func (*TestFormDeepObject) DecodeURI

func (s *TestFormDeepObject) DecodeURI(d uri.Decoder) error

DecodeURI decodes TestFormDeepObject from URI form.

func (TestFormDeepObject) EncodeURI

func (s TestFormDeepObject) EncodeURI(e uri.Encoder) error

EncodeURI encodes TestFormDeepObject as URI form.

type TestFormObject

type TestFormObject struct {
	Min OptInt "json:\"min\""
	Max int    "json:\"max\""
}

func (*TestFormObject) DecodeURI

func (s *TestFormObject) DecodeURI(d uri.Decoder) error

DecodeURI decodes TestFormObject from URI form.

func (TestFormObject) EncodeURI

func (s TestFormObject) EncodeURI(e uri.Encoder) error

EncodeURI encodes TestFormObject as URI form.

type TestFormURLEncodedOK

type TestFormURLEncodedOK struct{}

TestFormURLEncodedOK is response for TestFormURLEncoded operation.

type TestMultipartOK

type TestMultipartOK struct{}

TestMultipartOK is response for TestMultipart operation.

type TestMultipartUploadOK

type TestMultipartUploadOK struct {
	File         string    "json:\"file\""
	OptionalFile OptString "json:\"optional_file\""
	Files        []string  "json:\"files\""
}

func (*TestMultipartUploadOK) Decode

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

Decode decodes TestMultipartUploadOK from json.

func (TestMultipartUploadOK) Encode

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

Encode implements json.Marshaler.

func (TestMultipartUploadOK) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*TestMultipartUploadOK) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (TestMultipartUploadOK) Validate

func (s TestMultipartUploadOK) Validate() error

type TestMultipartUploadReq

type TestMultipartUploadReq struct {
	OrderId      OptInt    "json:\"orderId\""
	UserId       OptInt    "json:\"userId\""
	File         string    "json:\"file\""
	OptionalFile OptString "json:\"optional_file\""
	Files        []string  "json:\"files\""
}

func (TestMultipartUploadReq) Validate

func (s TestMultipartUploadReq) Validate() error

type TestMultipartUploadReqForm

type TestMultipartUploadReqForm struct {
	OrderId      OptInt             "json:\"orderId\""
	UserId       OptInt             "json:\"userId\""
	File         ht.MultipartFile   "json:\"file\""
	OptionalFile OptMultipartFile   "json:\"optional_file\""
	Files        []ht.MultipartFile "json:\"files\""
}

func (TestMultipartUploadReqForm) Validate

func (s TestMultipartUploadReqForm) Validate() error

type TestShareFormSchemaOK

type TestShareFormSchemaOK struct{}

TestShareFormSchemaOK is response for TestShareFormSchema operation.

type TestShareFormSchemaReq

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

type UnimplementedHandler

type UnimplementedHandler struct{}

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

func (UnimplementedHandler) TestFormURLEncoded

func (UnimplementedHandler) TestFormURLEncoded(ctx context.Context, req TestForm) (r TestFormURLEncodedOK, _ error)

TestFormURLEncoded implements testFormURLEncoded operation.

POST /testFormURLEncoded

func (UnimplementedHandler) TestMultipart

func (UnimplementedHandler) TestMultipart(ctx context.Context, req TestForm) (r TestMultipartOK, _ error)

TestMultipart implements testMultipart operation.

POST /testMultipart

func (UnimplementedHandler) TestMultipartUpload

TestMultipartUpload implements testMultipartUpload operation.

POST /testMultipartUpload

func (UnimplementedHandler) TestShareFormSchema

TestShareFormSchema implements testShareFormSchema operation.

POST /testShareFormSchema

Jump to

Keyboard shortcuts

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