oas

package
v0.0.0-...-bb37284 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Code generated by ogen, DO NOT EDIT.

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 Client

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

Client implements OAS client.

func NewClient

func NewClient(serverURL string, sec SecuritySource, opts ...ClientOption) (*Client, error)

NewClient initializes new Client defined by OAS.

func (*Client) CreateTask

func (c *Client) CreateTask(ctx context.Context, request *NewTask) (*Task, error)

CreateTask invokes createTask operation.

Creates a new task.

POST /tasks

func (*Client) DeleteTask

func (c *Client) DeleteTask(ctx context.Context, params DeleteTaskParams) (DeleteTaskRes, error)

DeleteTask invokes deleteTask operation.

Deletes a specific task by its ID.

DELETE /tasks/{id}

func (*Client) GetTaskById

func (c *Client) GetTaskById(ctx context.Context, params GetTaskByIdParams) (GetTaskByIdRes, error)

GetTaskById invokes getTaskById operation.

Retrieves a specific task by its ID.

GET /tasks/{id}

func (*Client) GetTasks

func (c *Client) GetTasks(ctx context.Context) ([]Task, error)

GetTasks invokes getTasks operation.

Retrieves a list of all tasks.

GET /tasks

func (*Client) UpdateTask

func (c *Client) UpdateTask(ctx context.Context, request *UpdateTask, params UpdateTaskParams) (UpdateTaskRes, error)

UpdateTask invokes updateTask operation.

Updates a specific task by its ID.

PUT /tasks/{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 CompletedEnum

type CompletedEnum string

Indicates whether the task is completed or not. Ref: #/components/schemas/CompletedEnum

const (
	CompletedEnumYes       CompletedEnum = "yes"
	CompletedEnumNo        CompletedEnum = "no"
	CompletedEnumCancelled CompletedEnum = "cancelled"
)

func (CompletedEnum) AllValues

func (CompletedEnum) AllValues() []CompletedEnum

AllValues returns all CompletedEnum values.

func (*CompletedEnum) Decode

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

Decode decodes CompletedEnum from json.

func (CompletedEnum) Encode

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

Encode encodes CompletedEnum as json.

func (CompletedEnum) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (CompletedEnum) MarshalText

func (s CompletedEnum) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*CompletedEnum) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*CompletedEnum) UnmarshalText

func (s *CompletedEnum) UnmarshalText(data []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

func (CompletedEnum) Validate

func (s CompletedEnum) Validate() error

type Counter

type Counter struct {
	// The value of the counter.
	Value float64 `json:"value"`
	// The scale of the counter.
	Scale string `json:"scale"`
	// The max value of the counter.
	MaxValue float64 `json:"max_value"`
}

Ref: #/components/schemas/Counter

func (*Counter) Decode

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

Decode decodes Counter from json.

func (*Counter) Encode

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

Encode implements json.Marshaler.

func (*Counter) GetMaxValue

func (s *Counter) GetMaxValue() float64

GetMaxValue returns the value of MaxValue.

func (*Counter) GetScale

func (s *Counter) GetScale() string

GetScale returns the value of Scale.

func (*Counter) GetValue

func (s *Counter) GetValue() float64

GetValue returns the value of Value.

func (*Counter) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*Counter) SetMaxValue

func (s *Counter) SetMaxValue(val float64)

SetMaxValue sets the value of MaxValue.

func (*Counter) SetScale

func (s *Counter) SetScale(val string)

SetScale sets the value of Scale.

func (*Counter) SetValue

func (s *Counter) SetValue(val float64)

SetValue sets the value of Value.

func (*Counter) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*Counter) Validate

func (s *Counter) Validate() error

type DeleteTaskNoContent

type DeleteTaskNoContent struct{}

DeleteTaskNoContent is response for DeleteTask operation.

type DeleteTaskParams

type DeleteTaskParams struct {
	// ID of the task to retrieve or update.
	ID int64
}

DeleteTaskParams is parameters of deleteTask operation.

type DeleteTaskRes

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

type Error

type Error struct {
	Code    int64  `json:"code"`
	Message string `json:"message"`
}

Represents error object. Ref: #/components/schemas/Error

func (*Error) Decode

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

Decode decodes Error from json.

func (*Error) Encode

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

Encode implements json.Marshaler.

func (*Error) GetCode

func (s *Error) GetCode() int64

GetCode returns the value of Code.

func (*Error) GetMessage

func (s *Error) GetMessage() string

GetMessage returns the value of Message.

func (*Error) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*Error) SetCode

func (s *Error) SetCode(val int64)

SetCode sets the value of Code.

func (*Error) SetMessage

func (s *Error) SetMessage(val string)

SetMessage sets the value of Message.

func (*Error) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type ErrorHandler

type ErrorHandler = ogenerrors.ErrorHandler

ErrorHandler is error handler.

type ErrorStatusCode

type ErrorStatusCode struct {
	StatusCode int
	Response   Error
}

ErrorStatusCode wraps Error with StatusCode.

func (*ErrorStatusCode) Error

func (s *ErrorStatusCode) Error() string

func (*ErrorStatusCode) GetResponse

func (s *ErrorStatusCode) GetResponse() Error

GetResponse returns the value of Response.

func (*ErrorStatusCode) GetStatusCode

func (s *ErrorStatusCode) GetStatusCode() int

GetStatusCode returns the value of StatusCode.

func (*ErrorStatusCode) SetResponse

func (s *ErrorStatusCode) SetResponse(val Error)

SetResponse sets the value of Response.

func (*ErrorStatusCode) SetStatusCode

func (s *ErrorStatusCode) SetStatusCode(val int)

SetStatusCode sets the value of StatusCode.

type GetTaskByIdParams

type GetTaskByIdParams struct {
	// ID of the task to retrieve or update.
	ID int64
}

GetTaskByIdParams is parameters of getTaskById operation.

type GetTaskByIdRes

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

type Handler

type Handler interface {
	// CreateTask implements createTask operation.
	//
	// Creates a new task.
	//
	// POST /tasks
	CreateTask(ctx context.Context, req *NewTask) (*Task, error)
	// DeleteTask implements deleteTask operation.
	//
	// Deletes a specific task by its ID.
	//
	// DELETE /tasks/{id}
	DeleteTask(ctx context.Context, params DeleteTaskParams) (DeleteTaskRes, error)
	// GetTaskById implements getTaskById operation.
	//
	// Retrieves a specific task by its ID.
	//
	// GET /tasks/{id}
	GetTaskById(ctx context.Context, params GetTaskByIdParams) (GetTaskByIdRes, error)
	// GetTasks implements getTasks operation.
	//
	// Retrieves a list of all tasks.
	//
	// GET /tasks
	GetTasks(ctx context.Context) ([]Task, error)
	// UpdateTask implements updateTask operation.
	//
	// Updates a specific task by its ID.
	//
	// PUT /tasks/{id}
	UpdateTask(ctx context.Context, req *UpdateTask, params UpdateTaskParams) (UpdateTaskRes, error)
	// NewError creates *ErrorStatusCode from error returned by handler.
	//
	// Used for common default response.
	NewError(ctx context.Context, err error) *ErrorStatusCode
}

Handler handles operations described by OpenAPI v3 specification.

type Invoker

type Invoker interface {
	// CreateTask invokes createTask operation.
	//
	// Creates a new task.
	//
	// POST /tasks
	CreateTask(ctx context.Context, request *NewTask) (*Task, error)
	// DeleteTask invokes deleteTask operation.
	//
	// Deletes a specific task by its ID.
	//
	// DELETE /tasks/{id}
	DeleteTask(ctx context.Context, params DeleteTaskParams) (DeleteTaskRes, error)
	// GetTaskById invokes getTaskById operation.
	//
	// Retrieves a specific task by its ID.
	//
	// GET /tasks/{id}
	GetTaskById(ctx context.Context, params GetTaskByIdParams) (GetTaskByIdRes, error)
	// GetTasks invokes getTasks operation.
	//
	// Retrieves a list of all tasks.
	//
	// GET /tasks
	GetTasks(ctx context.Context) ([]Task, error)
	// UpdateTask invokes updateTask operation.
	//
	// Updates a specific task by its ID.
	//
	// PUT /tasks/{id}
	UpdateTask(ctx context.Context, request *UpdateTask, params UpdateTaskParams) (UpdateTaskRes, error)
}

Invoker invokes operations described by OpenAPI v3 specification.

type Middleware

type Middleware = middleware.Middleware

Middleware is middleware type.

type NewTask

type NewTask struct {
	// The title of the new task.
	Title string `json:"title"`
	// The description of the task.
	Text      OptString        `json:"text"`
	Completed OptCompletedEnum `json:"completed"`
	Counter   OptCounter       `json:"counter"`
}

Ref: #/components/schemas/NewTask

func (*NewTask) Decode

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

Decode decodes NewTask from json.

func (*NewTask) Encode

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

Encode implements json.Marshaler.

func (*NewTask) GetCompleted

func (s *NewTask) GetCompleted() OptCompletedEnum

GetCompleted returns the value of Completed.

func (*NewTask) GetCounter

func (s *NewTask) GetCounter() OptCounter

GetCounter returns the value of Counter.

func (*NewTask) GetText

func (s *NewTask) GetText() OptString

GetText returns the value of Text.

func (*NewTask) GetTitle

func (s *NewTask) GetTitle() string

GetTitle returns the value of Title.

func (*NewTask) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*NewTask) SetCompleted

func (s *NewTask) SetCompleted(val OptCompletedEnum)

SetCompleted sets the value of Completed.

func (*NewTask) SetCounter

func (s *NewTask) SetCounter(val OptCounter)

SetCounter sets the value of Counter.

func (*NewTask) SetText

func (s *NewTask) SetText(val OptString)

SetText sets the value of Text.

func (*NewTask) SetTitle

func (s *NewTask) SetTitle(val string)

SetTitle sets the value of Title.

func (*NewTask) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*NewTask) Validate

func (s *NewTask) Validate() error

type OptCompletedEnum

type OptCompletedEnum struct {
	Value CompletedEnum
	Set   bool
}

OptCompletedEnum is optional CompletedEnum.

func NewOptCompletedEnum

func NewOptCompletedEnum(v CompletedEnum) OptCompletedEnum

NewOptCompletedEnum returns new OptCompletedEnum with value set to v.

func (*OptCompletedEnum) Decode

func (o *OptCompletedEnum) Decode(d *jx.Decoder) error

Decode decodes CompletedEnum from json.

func (OptCompletedEnum) Encode

func (o OptCompletedEnum) Encode(e *jx.Encoder)

Encode encodes CompletedEnum as json.

func (OptCompletedEnum) Get

func (o OptCompletedEnum) Get() (v CompletedEnum, ok bool)

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

func (OptCompletedEnum) IsSet

func (o OptCompletedEnum) IsSet() bool

IsSet returns true if OptCompletedEnum was set.

func (OptCompletedEnum) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptCompletedEnum) Or

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

func (*OptCompletedEnum) Reset

func (o *OptCompletedEnum) Reset()

Reset unsets value.

func (*OptCompletedEnum) SetTo

func (o *OptCompletedEnum) SetTo(v CompletedEnum)

SetTo sets value to v.

func (*OptCompletedEnum) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptCounter

type OptCounter struct {
	Value Counter
	Set   bool
}

OptCounter is optional Counter.

func NewOptCounter

func NewOptCounter(v Counter) OptCounter

NewOptCounter returns new OptCounter with value set to v.

func (*OptCounter) Decode

func (o *OptCounter) Decode(d *jx.Decoder) error

Decode decodes Counter from json.

func (OptCounter) Encode

func (o OptCounter) Encode(e *jx.Encoder)

Encode encodes Counter as json.

func (OptCounter) Get

func (o OptCounter) Get() (v Counter, ok bool)

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

func (OptCounter) IsSet

func (o OptCounter) IsSet() bool

IsSet returns true if OptCounter was set.

func (OptCounter) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptCounter) Or

func (o OptCounter) Or(d Counter) Counter

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

func (*OptCounter) Reset

func (o *OptCounter) Reset()

Reset unsets value.

func (*OptCounter) SetTo

func (o *OptCounter) SetTo(v Counter)

SetTo sets value to v.

func (*OptCounter) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type OptInt64

type OptInt64 struct {
	Value int64
	Set   bool
}

OptInt64 is optional int64.

func NewOptInt64

func NewOptInt64(v int64) OptInt64

NewOptInt64 returns new OptInt64 with value set to v.

func (*OptInt64) Decode

func (o *OptInt64) Decode(d *jx.Decoder) error

Decode decodes int64 from json.

func (OptInt64) Encode

func (o OptInt64) Encode(e *jx.Encoder)

Encode encodes int64 as json.

func (OptInt64) Get

func (o OptInt64) Get() (v int64, ok bool)

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

func (OptInt64) IsSet

func (o OptInt64) IsSet() bool

IsSet returns true if OptInt64 was set.

func (OptInt64) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (OptInt64) Or

func (o OptInt64) Or(d int64) int64

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

func (*OptInt64) Reset

func (o *OptInt64) Reset()

Reset unsets value.

func (*OptInt64) SetTo

func (o *OptInt64) SetTo(v int64)

SetTo sets value to v.

func (*OptInt64) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

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 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 RemoteUserAuth

type RemoteUserAuth struct {
	APIKey string
}

func (*RemoteUserAuth) GetAPIKey

func (s *RemoteUserAuth) GetAPIKey() string

GetAPIKey returns the value of APIKey.

func (*RemoteUserAuth) SetAPIKey

func (s *RemoteUserAuth) SetAPIKey(val string)

SetAPIKey sets the value of APIKey.

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

func (r Route) PathPattern() string

PathPattern returns OpenAPI path.

func (Route) Summary

func (r Route) Summary() string

Summary returns OpenAPI summary.

type SecurityHandler

type SecurityHandler interface {
	// HandleRemoteUserAuth handles RemoteUserAuth security.
	HandleRemoteUserAuth(ctx context.Context, operationName string, t RemoteUserAuth) (context.Context, error)
}

SecurityHandler is handler for security parameters.

type SecuritySource

type SecuritySource interface {
	// RemoteUserAuth provides RemoteUserAuth security value.
	RemoteUserAuth(ctx context.Context, operationName string) (RemoteUserAuth, error)
}

SecuritySource is provider of security values (tokens, passwords, etc.).

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, sec SecurityHandler, 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 Task

type Task struct {
	// The unique identifier for the task.
	ID OptInt64 `json:"id"`
	// The title of the task.
	Title string `json:"title"`
	// The description of the task.
	Text      string        `json:"text"`
	Completed CompletedEnum `json:"completed"`
	Counter   OptCounter    `json:"counter"`
}

Ref: #/components/schemas/Task

func (*Task) Decode

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

Decode decodes Task from json.

func (*Task) Encode

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

Encode implements json.Marshaler.

func (*Task) GetCompleted

func (s *Task) GetCompleted() CompletedEnum

GetCompleted returns the value of Completed.

func (*Task) GetCounter

func (s *Task) GetCounter() OptCounter

GetCounter returns the value of Counter.

func (*Task) GetID

func (s *Task) GetID() OptInt64

GetID returns the value of ID.

func (*Task) GetText

func (s *Task) GetText() string

GetText returns the value of Text.

func (*Task) GetTitle

func (s *Task) GetTitle() string

GetTitle returns the value of Title.

func (*Task) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*Task) SetCompleted

func (s *Task) SetCompleted(val CompletedEnum)

SetCompleted sets the value of Completed.

func (*Task) SetCounter

func (s *Task) SetCounter(val OptCounter)

SetCounter sets the value of Counter.

func (*Task) SetID

func (s *Task) SetID(val OptInt64)

SetID sets the value of ID.

func (*Task) SetText

func (s *Task) SetText(val string)

SetText sets the value of Text.

func (*Task) SetTitle

func (s *Task) SetTitle(val string)

SetTitle sets the value of Title.

func (*Task) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*Task) Validate

func (s *Task) Validate() error

type TaskNotFound

type TaskNotFound struct {
	Error OptString `json:"error"`
}

func (*TaskNotFound) Decode

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

Decode decodes TaskNotFound from json.

func (*TaskNotFound) Encode

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

Encode implements json.Marshaler.

func (*TaskNotFound) GetError

func (s *TaskNotFound) GetError() OptString

GetError returns the value of Error.

func (*TaskNotFound) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*TaskNotFound) SetError

func (s *TaskNotFound) SetError(val OptString)

SetError sets the value of Error.

func (*TaskNotFound) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

type UnimplementedHandler

type UnimplementedHandler struct{}

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

func (UnimplementedHandler) CreateTask

func (UnimplementedHandler) CreateTask(ctx context.Context, req *NewTask) (r *Task, _ error)

CreateTask implements createTask operation.

Creates a new task.

POST /tasks

func (UnimplementedHandler) DeleteTask

DeleteTask implements deleteTask operation.

Deletes a specific task by its ID.

DELETE /tasks/{id}

func (UnimplementedHandler) GetTaskById

GetTaskById implements getTaskById operation.

Retrieves a specific task by its ID.

GET /tasks/{id}

func (UnimplementedHandler) GetTasks

func (UnimplementedHandler) GetTasks(ctx context.Context) (r []Task, _ error)

GetTasks implements getTasks operation.

Retrieves a list of all tasks.

GET /tasks

func (UnimplementedHandler) NewError

func (UnimplementedHandler) NewError(ctx context.Context, err error) (r *ErrorStatusCode)

NewError creates *ErrorStatusCode from error returned by handler.

Used for common default response.

func (UnimplementedHandler) UpdateTask

func (UnimplementedHandler) UpdateTask(ctx context.Context, req *UpdateTask, params UpdateTaskParams) (r UpdateTaskRes, _ error)

UpdateTask implements updateTask operation.

Updates a specific task by its ID.

PUT /tasks/{id}

type UpdateTask

type UpdateTask struct {
	// The unique identifier for the task.
	ID OptInt64 `json:"id"`
	// The title of the new task.
	Title string `json:"title"`
	// The description of the task.
	Text      OptString        `json:"text"`
	Completed OptCompletedEnum `json:"completed"`
	Counter   OptCounter       `json:"counter"`
}

Ref: #/components/schemas/UpdateTask

func (*UpdateTask) Decode

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

Decode decodes UpdateTask from json.

func (*UpdateTask) Encode

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

Encode implements json.Marshaler.

func (*UpdateTask) GetCompleted

func (s *UpdateTask) GetCompleted() OptCompletedEnum

GetCompleted returns the value of Completed.

func (*UpdateTask) GetCounter

func (s *UpdateTask) GetCounter() OptCounter

GetCounter returns the value of Counter.

func (*UpdateTask) GetID

func (s *UpdateTask) GetID() OptInt64

GetID returns the value of ID.

func (*UpdateTask) GetText

func (s *UpdateTask) GetText() OptString

GetText returns the value of Text.

func (*UpdateTask) GetTitle

func (s *UpdateTask) GetTitle() string

GetTitle returns the value of Title.

func (*UpdateTask) MarshalJSON

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

MarshalJSON implements stdjson.Marshaler.

func (*UpdateTask) SetCompleted

func (s *UpdateTask) SetCompleted(val OptCompletedEnum)

SetCompleted sets the value of Completed.

func (*UpdateTask) SetCounter

func (s *UpdateTask) SetCounter(val OptCounter)

SetCounter sets the value of Counter.

func (*UpdateTask) SetID

func (s *UpdateTask) SetID(val OptInt64)

SetID sets the value of ID.

func (*UpdateTask) SetText

func (s *UpdateTask) SetText(val OptString)

SetText sets the value of Text.

func (*UpdateTask) SetTitle

func (s *UpdateTask) SetTitle(val string)

SetTitle sets the value of Title.

func (*UpdateTask) UnmarshalJSON

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

UnmarshalJSON implements stdjson.Unmarshaler.

func (*UpdateTask) Validate

func (s *UpdateTask) Validate() error

type UpdateTaskParams

type UpdateTaskParams struct {
	// ID of the task to retrieve or update.
	ID int64
}

UpdateTaskParams is parameters of updateTask operation.

type UpdateTaskRes

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

Jump to

Keyboard shortcuts

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