api

package
v0.80.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

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 AnyOfIntegerNumberString

type AnyOfIntegerNumberString struct {
	Type    AnyOfIntegerNumberStringType // switch on this field
	Int     int
	Float64 float64
	String  string
}

Ref: #/components/schemas/AnyOfIntegerNumberString AnyOfIntegerNumberString represents sum type.

func NewFloat64AnyOfIntegerNumberString

func NewFloat64AnyOfIntegerNumberString(v float64) AnyOfIntegerNumberString

NewFloat64AnyOfIntegerNumberString returns new AnyOfIntegerNumberString from float64.

func NewIntAnyOfIntegerNumberString

func NewIntAnyOfIntegerNumberString(v int) AnyOfIntegerNumberString

NewIntAnyOfIntegerNumberString returns new AnyOfIntegerNumberString from int.

func NewStringAnyOfIntegerNumberString

func NewStringAnyOfIntegerNumberString(v string) AnyOfIntegerNumberString

NewStringAnyOfIntegerNumberString returns new AnyOfIntegerNumberString from string.

func (*AnyOfIntegerNumberString) Decode

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

Decode decodes AnyOfIntegerNumberString from json.

func (AnyOfIntegerNumberString) Encode

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

Encode encodes AnyOfIntegerNumberString as json.

func (AnyOfIntegerNumberString) GetFloat64

func (s AnyOfIntegerNumberString) GetFloat64() (v float64, ok bool)

GetFloat64 returns float64 and true boolean if AnyOfIntegerNumberString is float64.

func (AnyOfIntegerNumberString) GetInt

func (s AnyOfIntegerNumberString) GetInt() (v int, ok bool)

GetInt returns int and true boolean if AnyOfIntegerNumberString is int.

func (AnyOfIntegerNumberString) GetString

func (s AnyOfIntegerNumberString) GetString() (v string, ok bool)

GetString returns string and true boolean if AnyOfIntegerNumberString is string.

func (AnyOfIntegerNumberString) IsFloat64

func (s AnyOfIntegerNumberString) IsFloat64() bool

IsFloat64 reports whether AnyOfIntegerNumberString is float64.

func (AnyOfIntegerNumberString) IsInt

func (s AnyOfIntegerNumberString) IsInt() bool

IsInt reports whether AnyOfIntegerNumberString is int.

func (AnyOfIntegerNumberString) IsString

func (s AnyOfIntegerNumberString) IsString() bool

IsString reports whether AnyOfIntegerNumberString is string.

func (AnyOfIntegerNumberString) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*AnyOfIntegerNumberString) SetFake

func (s *AnyOfIntegerNumberString) SetFake()

SetFake set fake values.

func (*AnyOfIntegerNumberString) SetFloat64

func (s *AnyOfIntegerNumberString) SetFloat64(v float64)

SetFloat64 sets AnyOfIntegerNumberString to float64.

func (*AnyOfIntegerNumberString) SetInt

func (s *AnyOfIntegerNumberString) SetInt(v int)

SetInt sets AnyOfIntegerNumberString to int.

func (*AnyOfIntegerNumberString) SetString

func (s *AnyOfIntegerNumberString) SetString(v string)

SetString sets AnyOfIntegerNumberString to string.

func (*AnyOfIntegerNumberString) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (AnyOfIntegerNumberString) Validate

func (s AnyOfIntegerNumberString) Validate() error

type AnyOfIntegerNumberStringType

type AnyOfIntegerNumberStringType string

AnyOfIntegerNumberStringType is oneOf type of AnyOfIntegerNumberString.

const (
	IntAnyOfIntegerNumberString     AnyOfIntegerNumberStringType = "int"
	Float64AnyOfIntegerNumberString AnyOfIntegerNumberStringType = "float64"
	StringAnyOfIntegerNumberString  AnyOfIntegerNumberStringType = "string"
)

Possible values for AnyOfIntegerNumberStringType.

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

func (c *Client) IntegerNumber(ctx context.Context) (*IntegerNumber, error)

IntegerNumber invokes integerNumber operation.

GET /integerNumber

func (*Client) JaegerAnyOf

func (c *Client) JaegerAnyOf(ctx context.Context) (*JaegerAnyOf, error)

JaegerAnyOf invokes jaegerAnyOf operation.

GET /jaegerAnyOf

func (*Client) OneUUID

func (c *Client) OneUUID(ctx context.Context) (*OneUUID, error)

OneUUID invokes oneUUID operation.

GET /oneUUID

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 {
	// IntegerNumber implements integerNumber operation.
	//
	// GET /integerNumber
	IntegerNumber(ctx context.Context) (*IntegerNumber, error)
	// JaegerAnyOf implements jaegerAnyOf operation.
	//
	// GET /jaegerAnyOf
	JaegerAnyOf(ctx context.Context) (*JaegerAnyOf, error)
	// OneUUID implements oneUUID operation.
	//
	// GET /oneUUID
	OneUUID(ctx context.Context) (*OneUUID, error)
}

Handler handles operations described by OpenAPI v3 specification.

type IntegerNumber

type IntegerNumber struct {
	Plain AnyOfIntegerNumberString `json:"plain"`
}

Ref: #/components/schemas/IntegerNumber

func (*IntegerNumber) Decode

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

Decode decodes IntegerNumber from json.

func (*IntegerNumber) Encode

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

Encode implements json.Marshaler.

func (*IntegerNumber) GetPlain

GetPlain returns the value of Plain.

func (*IntegerNumber) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*IntegerNumber) SetFake

func (s *IntegerNumber) SetFake()

SetFake set fake values.

func (*IntegerNumber) SetPlain

func (s *IntegerNumber) SetPlain(val AnyOfIntegerNumberString)

SetPlain sets the value of Plain.

func (*IntegerNumber) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*IntegerNumber) Validate

func (s *IntegerNumber) Validate() error

type Invoker added in v0.75.0

type Invoker interface {
	// IntegerNumber invokes integerNumber operation.
	//
	// GET /integerNumber
	IntegerNumber(ctx context.Context) (*IntegerNumber, error)
	// JaegerAnyOf invokes jaegerAnyOf operation.
	//
	// GET /jaegerAnyOf
	JaegerAnyOf(ctx context.Context) (*JaegerAnyOf, error)
	// OneUUID invokes oneUUID operation.
	//
	// GET /oneUUID
	OneUUID(ctx context.Context) (*OneUUID, error)
}

Invoker invokes operations described by OpenAPI v3 specification.

type JaegerAnyOf

type JaegerAnyOf struct {
	Medium    string               `json:"medium"`
	SizeLimit JaegerAnyOfSizeLimit `json:"sizeLimit"`
}

Ref: #/components/schemas/JaegerAnyOf

func (*JaegerAnyOf) Decode

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

Decode decodes JaegerAnyOf from json.

func (*JaegerAnyOf) Encode

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

Encode implements json.Marshaler.

func (*JaegerAnyOf) GetMedium

func (s *JaegerAnyOf) GetMedium() string

GetMedium returns the value of Medium.

func (*JaegerAnyOf) GetSizeLimit

func (s *JaegerAnyOf) GetSizeLimit() JaegerAnyOfSizeLimit

GetSizeLimit returns the value of SizeLimit.

func (*JaegerAnyOf) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*JaegerAnyOf) SetFake

func (s *JaegerAnyOf) SetFake()

SetFake set fake values.

func (*JaegerAnyOf) SetMedium

func (s *JaegerAnyOf) SetMedium(val string)

SetMedium sets the value of Medium.

func (*JaegerAnyOf) SetSizeLimit

func (s *JaegerAnyOf) SetSizeLimit(val JaegerAnyOfSizeLimit)

SetSizeLimit sets the value of SizeLimit.

func (*JaegerAnyOf) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*JaegerAnyOf) Validate

func (s *JaegerAnyOf) Validate() error

type JaegerAnyOfSizeLimit

type JaegerAnyOfSizeLimit struct {
	Type   JaegerAnyOfSizeLimitType // switch on this field
	Int    int
	String string
}

JaegerAnyOfSizeLimit represents sum type.

func NewIntJaegerAnyOfSizeLimit

func NewIntJaegerAnyOfSizeLimit(v int) JaegerAnyOfSizeLimit

NewIntJaegerAnyOfSizeLimit returns new JaegerAnyOfSizeLimit from int.

func NewStringJaegerAnyOfSizeLimit

func NewStringJaegerAnyOfSizeLimit(v string) JaegerAnyOfSizeLimit

NewStringJaegerAnyOfSizeLimit returns new JaegerAnyOfSizeLimit from string.

func (*JaegerAnyOfSizeLimit) Decode

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

Decode decodes JaegerAnyOfSizeLimit from json.

func (JaegerAnyOfSizeLimit) Encode

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

Encode encodes JaegerAnyOfSizeLimit as json.

func (JaegerAnyOfSizeLimit) GetInt

func (s JaegerAnyOfSizeLimit) GetInt() (v int, ok bool)

GetInt returns int and true boolean if JaegerAnyOfSizeLimit is int.

func (JaegerAnyOfSizeLimit) GetString

func (s JaegerAnyOfSizeLimit) GetString() (v string, ok bool)

GetString returns string and true boolean if JaegerAnyOfSizeLimit is string.

func (JaegerAnyOfSizeLimit) IsInt

func (s JaegerAnyOfSizeLimit) IsInt() bool

IsInt reports whether JaegerAnyOfSizeLimit is int.

func (JaegerAnyOfSizeLimit) IsString

func (s JaegerAnyOfSizeLimit) IsString() bool

IsString reports whether JaegerAnyOfSizeLimit is string.

func (JaegerAnyOfSizeLimit) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*JaegerAnyOfSizeLimit) SetFake

func (s *JaegerAnyOfSizeLimit) SetFake()

SetFake set fake values.

func (*JaegerAnyOfSizeLimit) SetInt

func (s *JaegerAnyOfSizeLimit) SetInt(v int)

SetInt sets JaegerAnyOfSizeLimit to int.

func (*JaegerAnyOfSizeLimit) SetString

func (s *JaegerAnyOfSizeLimit) SetString(v string)

SetString sets JaegerAnyOfSizeLimit to string.

func (*JaegerAnyOfSizeLimit) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (JaegerAnyOfSizeLimit) Validate

func (s JaegerAnyOfSizeLimit) Validate() error

type JaegerAnyOfSizeLimitType

type JaegerAnyOfSizeLimitType string

JaegerAnyOfSizeLimitType is oneOf type of JaegerAnyOfSizeLimit.

const (
	IntJaegerAnyOfSizeLimit    JaegerAnyOfSizeLimitType = "int"
	StringJaegerAnyOfSizeLimit JaegerAnyOfSizeLimitType = "string"
)

Possible values for JaegerAnyOfSizeLimitType.

type Middleware

type Middleware = middleware.Middleware

Middleware is middleware type.

type OneUUID

type OneUUID struct {
	Owner          string                `json:"owner"`
	Version        int32                 `json:"version"`
	SubscriptionID OneUUIDSubscriptionID `json:"subscription_id"`
}

Ref: #/components/schemas/OneUUID

func (*OneUUID) Decode

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

Decode decodes OneUUID from json.

func (*OneUUID) Encode

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

Encode implements json.Marshaler.

func (*OneUUID) GetOwner

func (s *OneUUID) GetOwner() string

GetOwner returns the value of Owner.

func (*OneUUID) GetSubscriptionID

func (s *OneUUID) GetSubscriptionID() OneUUIDSubscriptionID

GetSubscriptionID returns the value of SubscriptionID.

func (*OneUUID) GetVersion

func (s *OneUUID) GetVersion() int32

GetVersion returns the value of Version.

func (*OneUUID) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*OneUUID) SetFake

func (s *OneUUID) SetFake()

SetFake set fake values.

func (*OneUUID) SetOwner

func (s *OneUUID) SetOwner(val string)

SetOwner sets the value of Owner.

func (*OneUUID) SetSubscriptionID

func (s *OneUUID) SetSubscriptionID(val OneUUIDSubscriptionID)

SetSubscriptionID sets the value of SubscriptionID.

func (*OneUUID) SetVersion

func (s *OneUUID) SetVersion(val int32)

SetVersion sets the value of Version.

func (*OneUUID) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*OneUUID) Validate

func (s *OneUUID) Validate() error

type OneUUIDSubscriptionID

type OneUUIDSubscriptionID struct {
	Type             OneUUIDSubscriptionIDType // switch on this field
	SubscriptionUUID SubscriptionUUID
}

OneUUIDSubscriptionID represents sum type.

func NewSubscriptionUUIDOneUUIDSubscriptionID

func NewSubscriptionUUIDOneUUIDSubscriptionID(v SubscriptionUUID) OneUUIDSubscriptionID

NewSubscriptionUUIDOneUUIDSubscriptionID returns new OneUUIDSubscriptionID from SubscriptionUUID.

func (*OneUUIDSubscriptionID) Decode

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

Decode decodes OneUUIDSubscriptionID from json.

func (OneUUIDSubscriptionID) Encode

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

Encode encodes OneUUIDSubscriptionID as json.

func (OneUUIDSubscriptionID) GetSubscriptionUUID

func (s OneUUIDSubscriptionID) GetSubscriptionUUID() (v SubscriptionUUID, ok bool)

GetSubscriptionUUID returns SubscriptionUUID and true boolean if OneUUIDSubscriptionID is SubscriptionUUID.

func (OneUUIDSubscriptionID) IsSubscriptionUUID

func (s OneUUIDSubscriptionID) IsSubscriptionUUID() bool

IsSubscriptionUUID reports whether OneUUIDSubscriptionID is SubscriptionUUID.

func (OneUUIDSubscriptionID) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*OneUUIDSubscriptionID) SetFake

func (s *OneUUIDSubscriptionID) SetFake()

SetFake set fake values.

func (*OneUUIDSubscriptionID) SetSubscriptionUUID

func (s *OneUUIDSubscriptionID) SetSubscriptionUUID(v SubscriptionUUID)

SetSubscriptionUUID sets OneUUIDSubscriptionID to SubscriptionUUID.

func (*OneUUIDSubscriptionID) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OneUUIDSubscriptionIDType

type OneUUIDSubscriptionIDType string

OneUUIDSubscriptionIDType is oneOf type of OneUUIDSubscriptionID.

const (
	SubscriptionUUIDOneUUIDSubscriptionID OneUUIDSubscriptionIDType = "SubscriptionUUID"
)

Possible values for OneUUIDSubscriptionIDType.

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

func (r Route) PathPattern() string

PathPattern returns OpenAPI path.

func (Route) Summary added in v0.76.0

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 SubscriptionUUID

type SubscriptionUUID struct {
	Type   SubscriptionUUIDType // switch on this field
	UUIDv4 UUIDv4
}

Ref: #/components/schemas/SubscriptionUUID SubscriptionUUID represents sum type.

func NewUUIDv4SubscriptionUUID

func NewUUIDv4SubscriptionUUID(v UUIDv4) SubscriptionUUID

NewUUIDv4SubscriptionUUID returns new SubscriptionUUID from UUIDv4.

func (*SubscriptionUUID) Decode

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

Decode decodes SubscriptionUUID from json.

func (SubscriptionUUID) Encode

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

Encode encodes SubscriptionUUID as json.

func (SubscriptionUUID) GetUUIDv4

func (s SubscriptionUUID) GetUUIDv4() (v UUIDv4, ok bool)

GetUUIDv4 returns UUIDv4 and true boolean if SubscriptionUUID is UUIDv4.

func (SubscriptionUUID) IsUUIDv4

func (s SubscriptionUUID) IsUUIDv4() bool

IsUUIDv4 reports whether SubscriptionUUID is UUIDv4.

func (SubscriptionUUID) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*SubscriptionUUID) SetFake

func (s *SubscriptionUUID) SetFake()

SetFake set fake values.

func (*SubscriptionUUID) SetUUIDv4

func (s *SubscriptionUUID) SetUUIDv4(v UUIDv4)

SetUUIDv4 sets SubscriptionUUID to UUIDv4.

func (*SubscriptionUUID) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type SubscriptionUUIDType

type SubscriptionUUIDType string

SubscriptionUUIDType is oneOf type of SubscriptionUUID.

const (
	UUIDv4SubscriptionUUID SubscriptionUUIDType = "UUIDv4"
)

Possible values for SubscriptionUUIDType.

type UUIDv4

type UUIDv4 uuid.UUID

func (*UUIDv4) Decode

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

Decode decodes UUIDv4 from json.

func (UUIDv4) Encode

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

Encode encodes UUIDv4 as json.

func (UUIDv4) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*UUIDv4) SetFake

func (s *UUIDv4) SetFake()

SetFake set fake values.

func (*UUIDv4) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type UnimplementedHandler

type UnimplementedHandler struct{}

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

func (UnimplementedHandler) IntegerNumber

func (UnimplementedHandler) IntegerNumber(ctx context.Context) (r *IntegerNumber, _ error)

IntegerNumber implements integerNumber operation.

GET /integerNumber

func (UnimplementedHandler) JaegerAnyOf

func (UnimplementedHandler) JaegerAnyOf(ctx context.Context) (r *JaegerAnyOf, _ error)

JaegerAnyOf implements jaegerAnyOf operation.

GET /jaegerAnyOf

func (UnimplementedHandler) OneUUID

func (UnimplementedHandler) OneUUID(ctx context.Context) (r *OneUUID, _ error)

OneUUID implements oneUUID operation.

GET /oneUUID

Jump to

Keyboard shortcuts

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