Documentation ¶
Index ¶
- func WithServerURL(ctx context.Context, u *url.URL) context.Context
- type Client
- func (c *Client) CreateTodo(ctx context.Context, request *CreateTodoRequest) (*Todo, error)
- func (c *Client) DeleteTodo(ctx context.Context, params DeleteTodoParams) error
- func (c *Client) GetTodo(ctx context.Context, params GetTodoParams) (*Todo, error)
- func (c *Client) ListTodos(ctx context.Context) ([]Todo, error)
- func (c *Client) UpdateTodo(ctx context.Context, request *UpdateTodoRequest, params UpdateTodoParams) (*Todo, error)
- type ClientOption
- type CreateTodoRequest
- func (s *CreateTodoRequest) Decode(d *jx.Decoder) error
- func (s *CreateTodoRequest) Encode(e *jx.Encoder)
- func (s *CreateTodoRequest) GetTitle() string
- func (s *CreateTodoRequest) MarshalJSON() ([]byte, error)
- func (s *CreateTodoRequest) SetTitle(val string)
- func (s *CreateTodoRequest) UnmarshalJSON(data []byte) error
- type DeleteTodoNoContent
- type DeleteTodoParams
- type ErrorHandler
- type GetTodoParams
- type Handler
- type Invoker
- type Middleware
- 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 Todo
- func (s *Todo) Decode(d *jx.Decoder) error
- func (s *Todo) Encode(e *jx.Encoder)
- func (s *Todo) GetCompleted() bool
- func (s *Todo) GetCreatedAt() time.Time
- func (s *Todo) GetID() uuid.UUID
- func (s *Todo) GetTitle() string
- func (s *Todo) GetUpdatedAt() time.Time
- func (s *Todo) MarshalJSON() ([]byte, error)
- func (s *Todo) SetCompleted(val bool)
- func (s *Todo) SetCreatedAt(val time.Time)
- func (s *Todo) SetID(val uuid.UUID)
- func (s *Todo) SetTitle(val string)
- func (s *Todo) SetUpdatedAt(val time.Time)
- func (s *Todo) UnmarshalJSON(data []byte) error
- type UnimplementedHandler
- func (UnimplementedHandler) CreateTodo(ctx context.Context, req *CreateTodoRequest) (r *Todo, _ error)
- func (UnimplementedHandler) DeleteTodo(ctx context.Context, params DeleteTodoParams) error
- func (UnimplementedHandler) GetTodo(ctx context.Context, params GetTodoParams) (r *Todo, _ error)
- func (UnimplementedHandler) ListTodos(ctx context.Context) (r []Todo, _ error)
- func (UnimplementedHandler) UpdateTodo(ctx context.Context, req *UpdateTodoRequest, params UpdateTodoParams) (r *Todo, _ error)
- type UpdateTodoParams
- type UpdateTodoRequest
- func (s *UpdateTodoRequest) Decode(d *jx.Decoder) error
- func (s *UpdateTodoRequest) Encode(e *jx.Encoder)
- func (s *UpdateTodoRequest) GetCompleted() bool
- func (s *UpdateTodoRequest) GetTitle() string
- func (s *UpdateTodoRequest) MarshalJSON() ([]byte, error)
- func (s *UpdateTodoRequest) SetCompleted(val bool)
- func (s *UpdateTodoRequest) SetTitle(val string)
- func (s *UpdateTodoRequest) 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.
func (*Client) CreateTodo ¶
CreateTodo invokes createTodo operation.
Create a new TODO item.
POST /todos
func (*Client) DeleteTodo ¶
func (c *Client) DeleteTodo(ctx context.Context, params DeleteTodoParams) error
DeleteTodo invokes deleteTodo operation.
Delete a specific TODO item.
DELETE /todos/{id}
func (*Client) GetTodo ¶
GetTodo invokes getTodo operation.
Get a specific TODO item.
GET /todos/{id}
func (*Client) UpdateTodo ¶
func (c *Client) UpdateTodo(ctx context.Context, request *UpdateTodoRequest, params UpdateTodoParams) (*Todo, error)
UpdateTodo invokes updateTodo operation.
Update a specific TODO item.
PUT /todos/{id}
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 CreateTodoRequest ¶
type CreateTodoRequest struct { // The title of the TODO item. Title string `json:"title"` }
Ref: #/components/schemas/CreateTodoRequest
func (*CreateTodoRequest) Decode ¶
func (s *CreateTodoRequest) Decode(d *jx.Decoder) error
Decode decodes CreateTodoRequest from json.
func (*CreateTodoRequest) Encode ¶
func (s *CreateTodoRequest) Encode(e *jx.Encoder)
Encode implements json.Marshaler.
func (*CreateTodoRequest) GetTitle ¶
func (s *CreateTodoRequest) GetTitle() string
GetTitle returns the value of Title.
func (*CreateTodoRequest) MarshalJSON ¶
func (s *CreateTodoRequest) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (*CreateTodoRequest) SetTitle ¶
func (s *CreateTodoRequest) SetTitle(val string)
SetTitle sets the value of Title.
func (*CreateTodoRequest) UnmarshalJSON ¶
func (s *CreateTodoRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
type DeleteTodoNoContent ¶
type DeleteTodoNoContent struct{}
DeleteTodoNoContent is response for DeleteTodo operation.
type DeleteTodoParams ¶
type DeleteTodoParams struct {
ID string
}
DeleteTodoParams is parameters of deleteTodo operation.
type GetTodoParams ¶
type GetTodoParams struct {
ID string
}
GetTodoParams is parameters of getTodo operation.
type Handler ¶
type Handler interface { // CreateTodo implements createTodo operation. // // Create a new TODO item. // // POST /todos CreateTodo(ctx context.Context, req *CreateTodoRequest) (*Todo, error) // DeleteTodo implements deleteTodo operation. // // Delete a specific TODO item. // // DELETE /todos/{id} DeleteTodo(ctx context.Context, params DeleteTodoParams) error // GetTodo implements getTodo operation. // // Get a specific TODO item. // // GET /todos/{id} GetTodo(ctx context.Context, params GetTodoParams) (*Todo, error) // ListTodos implements listTodos operation. // // Get all TODO items. // // GET /todos ListTodos(ctx context.Context) ([]Todo, error) // UpdateTodo implements updateTodo operation. // // Update a specific TODO item. // // PUT /todos/{id} UpdateTodo(ctx context.Context, req *UpdateTodoRequest, params UpdateTodoParams) (*Todo, error) }
Handler handles operations described by OpenAPI v3 specification.
type Invoker ¶
type Invoker interface { // CreateTodo invokes createTodo operation. // // Create a new TODO item. // // POST /todos CreateTodo(ctx context.Context, request *CreateTodoRequest) (*Todo, error) // DeleteTodo invokes deleteTodo operation. // // Delete a specific TODO item. // // DELETE /todos/{id} DeleteTodo(ctx context.Context, params DeleteTodoParams) error // GetTodo invokes getTodo operation. // // Get a specific TODO item. // // GET /todos/{id} GetTodo(ctx context.Context, params GetTodoParams) (*Todo, error) // ListTodos invokes listTodos operation. // // Get all TODO items. // // GET /todos ListTodos(ctx context.Context) ([]Todo, error) // UpdateTodo invokes updateTodo operation. // // Update a specific TODO item. // // PUT /todos/{id} UpdateTodo(ctx context.Context, request *UpdateTodoRequest, params UpdateTodoParams) (*Todo, error) }
Invoker invokes operations described by OpenAPI v3 specification.
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) 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 Todo ¶
type Todo struct { // The ID of the TODO item. ID uuid.UUID `json:"id"` // The title of the TODO item. Title string `json:"title"` // Whether the TODO item is completed or not. Completed bool `json:"completed"` // The date and time when the TODO item was created. CreatedAt time.Time `json:"created_at"` // The date and time when the TODO item was updated. UpdatedAt time.Time `json:"updated_at"` }
Ref: #/components/schemas/Todo
func (*Todo) GetCompleted ¶
GetCompleted returns the value of Completed.
func (*Todo) GetCreatedAt ¶
GetCreatedAt returns the value of CreatedAt.
func (*Todo) GetUpdatedAt ¶
GetUpdatedAt returns the value of UpdatedAt.
func (*Todo) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*Todo) SetCompleted ¶
SetCompleted sets the value of Completed.
func (*Todo) SetCreatedAt ¶
SetCreatedAt sets the value of CreatedAt.
func (*Todo) SetUpdatedAt ¶
SetUpdatedAt sets the value of UpdatedAt.
func (*Todo) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type UnimplementedHandler ¶
type UnimplementedHandler struct{}
UnimplementedHandler is no-op Handler which returns http.ErrNotImplemented.
func (UnimplementedHandler) CreateTodo ¶
func (UnimplementedHandler) CreateTodo(ctx context.Context, req *CreateTodoRequest) (r *Todo, _ error)
CreateTodo implements createTodo operation.
Create a new TODO item.
POST /todos
func (UnimplementedHandler) DeleteTodo ¶
func (UnimplementedHandler) DeleteTodo(ctx context.Context, params DeleteTodoParams) error
DeleteTodo implements deleteTodo operation.
Delete a specific TODO item.
DELETE /todos/{id}
func (UnimplementedHandler) GetTodo ¶
func (UnimplementedHandler) GetTodo(ctx context.Context, params GetTodoParams) (r *Todo, _ error)
GetTodo implements getTodo operation.
Get a specific TODO item.
GET /todos/{id}
func (UnimplementedHandler) ListTodos ¶
func (UnimplementedHandler) ListTodos(ctx context.Context) (r []Todo, _ error)
ListTodos implements listTodos operation.
Get all TODO items.
GET /todos
func (UnimplementedHandler) UpdateTodo ¶
func (UnimplementedHandler) UpdateTodo(ctx context.Context, req *UpdateTodoRequest, params UpdateTodoParams) (r *Todo, _ error)
UpdateTodo implements updateTodo operation.
Update a specific TODO item.
PUT /todos/{id}
type UpdateTodoParams ¶
type UpdateTodoParams struct {
ID string
}
UpdateTodoParams is parameters of updateTodo operation.
type UpdateTodoRequest ¶
type UpdateTodoRequest struct { // The title of the TODO item. Title string `json:"title"` // Whether the TODO item is completed or not. Completed bool `json:"completed"` }
Ref: #/components/schemas/UpdateTodoRequest
func (*UpdateTodoRequest) Decode ¶
func (s *UpdateTodoRequest) Decode(d *jx.Decoder) error
Decode decodes UpdateTodoRequest from json.
func (*UpdateTodoRequest) Encode ¶
func (s *UpdateTodoRequest) Encode(e *jx.Encoder)
Encode implements json.Marshaler.
func (*UpdateTodoRequest) GetCompleted ¶
func (s *UpdateTodoRequest) GetCompleted() bool
GetCompleted returns the value of Completed.
func (*UpdateTodoRequest) GetTitle ¶
func (s *UpdateTodoRequest) GetTitle() string
GetTitle returns the value of Title.
func (*UpdateTodoRequest) MarshalJSON ¶
func (s *UpdateTodoRequest) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (*UpdateTodoRequest) SetCompleted ¶
func (s *UpdateTodoRequest) SetCompleted(val bool)
SetCompleted sets the value of Completed.
func (*UpdateTodoRequest) SetTitle ¶
func (s *UpdateTodoRequest) SetTitle(val string)
SetTitle sets the value of Title.
func (*UpdateTodoRequest) UnmarshalJSON ¶
func (s *UpdateTodoRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
Source Files ¶
- generate.go
- 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