Documentation
¶
Index ¶
- Constants
- func WithServerURL(ctx context.Context, u *url.URL) context.Context
- type Client
- type ClientOption
- type Color
- func (Color) AllValues() []Color
- func (s *Color) Decode(d *jx.Decoder) error
- func (s Color) Encode(e *jx.Encoder)
- func (s Color) MarshalJSON() ([]byte, error)
- func (s Color) MarshalText() ([]byte, error)
- func (s *Color) UnmarshalJSON(data []byte) error
- func (s *Color) UnmarshalText(data []byte) error
- func (s Color) Validate() error
- type ColorList
- type CreateItemsRequest
- func (s *CreateItemsRequest) Decode(d *jx.Decoder) error
- func (s *CreateItemsRequest) Encode(e *jx.Encoder)
- func (s *CreateItemsRequest) GetColors() ColorList
- func (s *CreateItemsRequest) GetItems() ItemList
- func (s *CreateItemsRequest) GetNullableTags() OptNilTagList
- func (s *CreateItemsRequest) GetTagLists() []TagList
- func (s *CreateItemsRequest) GetTags() TagList
- func (s *CreateItemsRequest) MarshalJSON() ([]byte, error)
- func (s *CreateItemsRequest) SetColors(val ColorList)
- func (s *CreateItemsRequest) SetItems(val ItemList)
- func (s *CreateItemsRequest) SetNullableTags(val OptNilTagList)
- func (s *CreateItemsRequest) SetTagLists(val []TagList)
- func (s *CreateItemsRequest) SetTags(val TagList)
- func (s *CreateItemsRequest) UnmarshalJSON(data []byte) error
- func (s *CreateItemsRequest) Validate() error
- type ErrorHandler
- type Handler
- type Invoker
- type Item
- type ItemList
- type Labeler
- type Middleware
- type OperationName
- type OptNilTagList
- func (o *OptNilTagList) Decode(d *jx.Decoder) error
- func (o OptNilTagList) Encode(e *jx.Encoder)
- func (o OptNilTagList) Get() (v TagList, ok bool)
- func (o OptNilTagList) IsEmpty() bool
- func (o OptNilTagList) IsNull() bool
- func (o OptNilTagList) IsSet() bool
- func (s OptNilTagList) MarshalJSON() ([]byte, error)
- func (o OptNilTagList) Or(d TagList) TagList
- func (o *OptNilTagList) Reset()
- func (o *OptNilTagList) SetTo(v TagList)
- func (o *OptNilTagList) SetToNull()
- func (s *OptNilTagList) UnmarshalJSON(data []byte) error
- type OptString
- func (o *OptString) Decode(d *jx.Decoder) error
- func (o OptString) Encode(e *jx.Encoder)
- func (o OptString) Get() (v string, ok bool)
- func (o OptString) IsSet() bool
- func (s OptString) MarshalJSON() ([]byte, error)
- func (o OptString) Or(d string) string
- func (o *OptString) Reset()
- func (o *OptString) SetTo(v string)
- func (s *OptString) UnmarshalJSON(data []byte) error
- type Option
- type Route
- type Server
- type ServerOption
- func WithErrorHandler(h ErrorHandler) ServerOption
- func WithMaxMultipartMemory(max int64) ServerOption
- func WithMethodNotAllowed(methodNotAllowed func(w http.ResponseWriter, r *http.Request, allowed string)) ServerOption
- func WithMiddleware(m ...Middleware) ServerOption
- func WithNotFound(notFound http.HandlerFunc) ServerOption
- func WithPathPrefix(prefix string) ServerOption
- type TagList
- type UnimplementedHandler
Constants ¶
const (
MediaTypeApplicationJSON string = "application/json"
)
Variables ¶
This section is empty.
Functions ¶
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) CreateItems ¶
func (c *Client) CreateItems(ctx context.Context, request *CreateItemsRequest) (*CreateItemsRequest, error)
CreateItems invokes createItems operation.
POST /items
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 Color ¶
type Color string
Ref: #/components/schemas/Color
func (Color) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (Color) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*Color) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
func (*Color) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type ColorList ¶
type ColorList []Color
func (ColorList) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*ColorList) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type CreateItemsRequest ¶
type CreateItemsRequest struct {
Tags TagList `json:"tags"`
NullableTags OptNilTagList `json:"nullableTags"`
Colors ColorList `json:"colors"`
Items ItemList `json:"items"`
TagLists []TagList `json:"tagLists"`
}
Ref: #/components/schemas/CreateItemsRequest
func (*CreateItemsRequest) Decode ¶
func (s *CreateItemsRequest) Decode(d *jx.Decoder) error
Decode decodes CreateItemsRequest from json.
func (*CreateItemsRequest) Encode ¶
func (s *CreateItemsRequest) Encode(e *jx.Encoder)
Encode implements json.Marshaler.
func (*CreateItemsRequest) GetColors ¶
func (s *CreateItemsRequest) GetColors() ColorList
GetColors returns the value of Colors.
func (*CreateItemsRequest) GetItems ¶
func (s *CreateItemsRequest) GetItems() ItemList
GetItems returns the value of Items.
func (*CreateItemsRequest) GetNullableTags ¶
func (s *CreateItemsRequest) GetNullableTags() OptNilTagList
GetNullableTags returns the value of NullableTags.
func (*CreateItemsRequest) GetTagLists ¶
func (s *CreateItemsRequest) GetTagLists() []TagList
GetTagLists returns the value of TagLists.
func (*CreateItemsRequest) GetTags ¶
func (s *CreateItemsRequest) GetTags() TagList
GetTags returns the value of Tags.
func (*CreateItemsRequest) MarshalJSON ¶
func (s *CreateItemsRequest) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (*CreateItemsRequest) SetColors ¶
func (s *CreateItemsRequest) SetColors(val ColorList)
SetColors sets the value of Colors.
func (*CreateItemsRequest) SetItems ¶
func (s *CreateItemsRequest) SetItems(val ItemList)
SetItems sets the value of Items.
func (*CreateItemsRequest) SetNullableTags ¶
func (s *CreateItemsRequest) SetNullableTags(val OptNilTagList)
SetNullableTags sets the value of NullableTags.
func (*CreateItemsRequest) SetTagLists ¶
func (s *CreateItemsRequest) SetTagLists(val []TagList)
SetTagLists sets the value of TagLists.
func (*CreateItemsRequest) SetTags ¶
func (s *CreateItemsRequest) SetTags(val TagList)
SetTags sets the value of Tags.
func (*CreateItemsRequest) UnmarshalJSON ¶
func (s *CreateItemsRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
func (*CreateItemsRequest) Validate ¶
func (s *CreateItemsRequest) Validate() error
type Handler ¶
type Handler interface {
// CreateItems implements createItems operation.
//
// POST /items
CreateItems(ctx context.Context, req *CreateItemsRequest) (*CreateItemsRequest, error)
}
Handler handles operations described by OpenAPI v3 specification.
type Invoker ¶
type Invoker interface {
// CreateItems invokes createItems operation.
//
// POST /items
CreateItems(ctx context.Context, request *CreateItemsRequest) (*CreateItemsRequest, error)
}
Invoker invokes operations described by OpenAPI v3 specification.
type Item ¶
type Item struct {
Name OptString `json:"name"`
}
Ref: #/components/schemas/Item
func (*Item) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*Item) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type ItemList ¶
type ItemList []Item
func (ItemList) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*ItemList) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
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 ¶
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) AttributeSet ¶
AttributeSet returns the attributes added to the Labeler as an attribute.Set.
type OperationName ¶
type OperationName = string
OperationName is the ogen operation name
const (
CreateItemsOperation OperationName = "CreateItems"
)
type OptNilTagList ¶
OptNilTagList is optional nullable TagList.
func NewOptNilTagList ¶
func NewOptNilTagList(v TagList) OptNilTagList
NewOptNilTagList returns new OptNilTagList with value set to v.
func (*OptNilTagList) Decode ¶
func (o *OptNilTagList) Decode(d *jx.Decoder) error
Decode decodes TagList from json.
func (OptNilTagList) Encode ¶
func (o OptNilTagList) Encode(e *jx.Encoder)
Encode encodes TagList as json.
func (OptNilTagList) Get ¶
func (o OptNilTagList) Get() (v TagList, ok bool)
Get returns value and boolean that denotes whether value was set.
func (OptNilTagList) IsEmpty ¶
func (o OptNilTagList) IsEmpty() bool
IsEmpty returns true if the field was omitted from the payload (not Set and not Null).
func (OptNilTagList) IsNull ¶
func (o OptNilTagList) IsNull() bool
IsNull returns true if value is Null.
func (OptNilTagList) IsSet ¶
func (o OptNilTagList) IsSet() bool
IsSet returns true if OptNilTagList was set.
func (OptNilTagList) MarshalJSON ¶
func (s OptNilTagList) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (OptNilTagList) Or ¶
func (o OptNilTagList) Or(d TagList) TagList
Or returns value if set, or given parameter if does not.
func (*OptNilTagList) UnmarshalJSON ¶
func (s *OptNilTagList) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
type OptString ¶
OptString is optional string.
func NewOptString ¶
NewOptString returns new OptString with value set to v.
func (OptString) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*OptString) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type Option ¶
type Option interface {
ServerOption
ClientOption
}
Option is config option.
func WithAttributes ¶
WithAttributes specifies default otel attributes.
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) OperationGroup ¶
OperationGroup returns the x-ogen-operation-group value.
func (Route) OperationID ¶
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 ...ServerOption) (*Server, error)
NewServer creates new Server.
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 TagList ¶
type TagList []string
func (TagList) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*TagList) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type UnimplementedHandler ¶
type UnimplementedHandler struct{}
UnimplementedHandler is no-op Handler which returns http.ErrNotImplemented.
func (UnimplementedHandler) CreateItems ¶
func (UnimplementedHandler) CreateItems(ctx context.Context, req *CreateItemsRequest) (r *CreateItemsRequest, _ error)
CreateItems implements createItems operation.
POST /items
Source Files
¶
- oas_cfg_gen.go
- oas_client_gen.go
- oas_defaults_gen.go
- oas_handlers_gen.go
- oas_json_gen.go
- oas_labeler_gen.go
- oas_mediatypes_gen.go
- oas_middleware_gen.go
- oas_operations_gen.go
- oas_request_decoders_gen.go
- oas_request_encoders_gen.go
- oas_response_decoders_gen.go
- oas_response_encoders_gen.go
- oas_router_gen.go
- oas_schemas_gen.go
- oas_server_gen.go
- oas_unimplemented_gen.go
- oas_validators_gen.go