Documentation ¶
Index ¶
- func WithServerURL(ctx context.Context, u *url.URL) context.Context
- type Client
- type ClientOption
- type ErrorHandler
- type Handler
- type Invoker
- type Middleware
- type OptHex
- func (o *OptHex) Decode(d *jx.Decoder, format func(*jx.Decoder) (int64, error)) error
- func (o OptHex) Encode(e *jx.Encoder, format func(*jx.Encoder, int64))
- func (o OptHex) Get() (v int64, ok bool)
- func (o OptHex) IsSet() bool
- func (s OptHex) MarshalJSON() ([]byte, error)
- func (o OptHex) Or(d int64) int64
- func (o *OptHex) Reset()
- func (o *OptHex) SetTo(v int64)
- func (s *OptHex) UnmarshalJSON(data []byte) error
- type OptPhone
- func (o *OptPhone) Decode(d *jx.Decoder, format func(*jx.Decoder) (custom2.Phone, error)) error
- func (o OptPhone) Encode(e *jx.Encoder, format func(*jx.Encoder, custom2.Phone))
- func (o OptPhone) Get() (v custom2.Phone, ok bool)
- func (o OptPhone) IsSet() bool
- func (s OptPhone) MarshalJSON() ([]byte, error)
- func (o OptPhone) Or(d custom2.Phone) custom2.Phone
- func (o *OptPhone) Reset()
- func (o *OptPhone) SetTo(v custom2.Phone)
- func (s *OptPhone) UnmarshalJSON(data []byte) error
- type OptRgba
- func (o *OptRgba) Decode(d *jx.Decoder, format func(*jx.Decoder) (custom3.RGBA, error)) error
- func (o OptRgba) Encode(e *jx.Encoder, format func(*jx.Encoder, custom3.RGBA))
- func (o OptRgba) Get() (v custom3.RGBA, ok bool)
- func (o OptRgba) IsSet() bool
- func (s OptRgba) MarshalJSON() ([]byte, error)
- func (o OptRgba) Or(d custom3.RGBA) custom3.RGBA
- func (o *OptRgba) Reset()
- func (o *OptRgba) SetTo(v custom3.RGBA)
- func (s *OptRgba) UnmarshalJSON(data []byte) error
- type Option
- type PhoneGetParams
- 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 UnimplementedHandler
- type User
- func (s *User) Decode(d *jx.Decoder) error
- func (s *User) Encode(e *jx.Encoder)
- func (s *User) GetBackgroundColor() OptRgba
- func (s *User) GetHexColor() OptHex
- func (s *User) GetHomePhone() OptPhone
- func (s *User) GetID() int64
- func (s *User) GetPhone() custom2.Phone
- func (s *User) GetProfileColor() custom3.RGBA
- func (s *User) MarshalJSON() ([]byte, error)
- func (s *User) SetBackgroundColor(val OptRgba)
- func (s *User) SetHexColor(val OptHex)
- func (s *User) SetHomePhone(val OptPhone)
- func (s *User) SetID(val int64)
- func (s *User) SetPhone(val custom2.Phone)
- func (s *User) SetProfileColor(val custom3.RGBA)
- func (s *User) UnmarshalJSON(data []byte) error
Constants ¶
This section is empty.
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.
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 Handler ¶
type Handler interface { // EventPost implements POST /event operation. // // POST /event EventPost(ctx context.Context, req any) (any, error) // PhoneGet implements GET /phone operation. // // GET /phone PhoneGet(ctx context.Context, req *User, params PhoneGetParams) (*User, error) }
Handler handles operations described by OpenAPI v3 specification.
type Invoker ¶ added in v0.75.0
type Invoker interface { // EventPost invokes POST /event operation. // // POST /event EventPost(ctx context.Context, request any) (any, error) // PhoneGet invokes GET /phone operation. // // GET /phone PhoneGet(ctx context.Context, request *User, params PhoneGetParams) (*User, error) }
Invoker invokes operations described by OpenAPI v3 specification.
type OptHex ¶
OptHex is optional int64.
func (OptHex) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*OptHex) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type OptPhone ¶
OptPhone is optional custom2.Phone.
func NewOptPhone ¶
NewOptPhone returns new OptPhone with value set to v.
func (OptPhone) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*OptPhone) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type OptRgba ¶
OptRgba is optional custom3.RGBA.
func NewOptRgba ¶
NewOptRgba returns new OptRgba with value set to v.
func (OptRgba) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*OptRgba) UnmarshalJSON ¶
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 PhoneGetParams ¶
type PhoneGetParams struct { // Phone number. Phone custom2.Phone // Color. Color OptRgba // Hex. Hex OptHex }
PhoneGetParams is parameters of GET /phone operation.
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
Route is route object.
func (Route) OperationID ¶
OperationID returns OpenAPI operationId.
func (Route) PathPattern ¶ added in v0.58.0
PathPattern returns OpenAPI path.
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 UnimplementedHandler ¶
type UnimplementedHandler struct{}
UnimplementedHandler is no-op Handler which returns http.ErrNotImplemented.
func (UnimplementedHandler) PhoneGet ¶
func (UnimplementedHandler) PhoneGet(ctx context.Context, req *User, params PhoneGetParams) (r *User, _ error)
PhoneGet implements GET /phone operation.
GET /phone
type User ¶
type User struct { ID int64 `json:"id"` Phone custom2.Phone `json:"phone"` HomePhone OptPhone `json:"home_phone"` ProfileColor custom3.RGBA `json:"profile_color"` BackgroundColor OptRgba `json:"background_color"` HexColor OptHex `json:"hex_color"` }
Ref: #/components/schemas/User
func (*User) GetBackgroundColor ¶
GetBackgroundColor returns the value of BackgroundColor.
func (*User) GetHexColor ¶
GetHexColor returns the value of HexColor.
func (*User) GetHomePhone ¶
GetHomePhone returns the value of HomePhone.
func (*User) GetProfileColor ¶
GetProfileColor returns the value of ProfileColor.
func (*User) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*User) SetBackgroundColor ¶
SetBackgroundColor sets the value of BackgroundColor.
func (*User) SetHexColor ¶
SetHexColor sets the value of HexColor.
func (*User) SetHomePhone ¶
SetHomePhone sets the value of HomePhone.
func (*User) SetProfileColor ¶
SetProfileColor sets the value of ProfileColor.
func (*User) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
Source Files ¶
- oas_cfg_gen.go
- oas_client_gen.go
- oas_handlers_gen.go
- oas_json_gen.go
- oas_middleware_gen.go
- oas_parameters_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