Documentation
¶
Index ¶
- func WithServerURL(ctx context.Context, u *url.URL) context.Context
- type Client
- type ClientOption
- type CodeforcesLanguage
- func (s *CodeforcesLanguage) Decode(d *jx.Decoder) error
- func (s *CodeforcesLanguage) Encode(e *jx.Encoder)
- func (s *CodeforcesLanguage) GetID() float64
- func (s *CodeforcesLanguage) GetName() string
- func (s *CodeforcesLanguage) MarshalJSON() ([]byte, error)
- func (s *CodeforcesLanguage) SetID(val float64)
- func (s *CodeforcesLanguage) SetName(val string)
- func (s *CodeforcesLanguage) UnmarshalJSON(data []byte) error
- func (s *CodeforcesLanguage) Validate() error
- type CodeforcesProblem
- func (s *CodeforcesProblem) Decode(d *jx.Decoder) error
- func (s *CodeforcesProblem) Encode(e *jx.Encoder)
- func (s *CodeforcesProblem) GetContestID() float64
- func (s *CodeforcesProblem) GetExamples() []CodeforcesTestcase
- func (s *CodeforcesProblem) GetIndex() string
- func (s *CodeforcesProblem) GetInput() string
- func (s *CodeforcesProblem) GetInteraction() OptString
- func (s *CodeforcesProblem) GetLanguages() []CodeforcesLanguage
- func (s *CodeforcesProblem) GetLegend() string
- func (s *CodeforcesProblem) GetMemoryLimit() int
- func (s *CodeforcesProblem) GetName() string
- func (s *CodeforcesProblem) GetNotes() string
- func (s *CodeforcesProblem) GetOutput() string
- func (s *CodeforcesProblem) GetScoring() OptString
- func (s *CodeforcesProblem) GetTags() []string
- func (s *CodeforcesProblem) GetTimeLimit() int
- func (s *CodeforcesProblem) MarshalJSON() ([]byte, error)
- func (s *CodeforcesProblem) SetContestID(val float64)
- func (s *CodeforcesProblem) SetExamples(val []CodeforcesTestcase)
- func (s *CodeforcesProblem) SetIndex(val string)
- func (s *CodeforcesProblem) SetInput(val string)
- func (s *CodeforcesProblem) SetInteraction(val OptString)
- func (s *CodeforcesProblem) SetLanguages(val []CodeforcesLanguage)
- func (s *CodeforcesProblem) SetLegend(val string)
- func (s *CodeforcesProblem) SetMemoryLimit(val int)
- func (s *CodeforcesProblem) SetName(val string)
- func (s *CodeforcesProblem) SetNotes(val string)
- func (s *CodeforcesProblem) SetOutput(val string)
- func (s *CodeforcesProblem) SetScoring(val OptString)
- func (s *CodeforcesProblem) SetTags(val []string)
- func (s *CodeforcesProblem) SetTimeLimit(val int)
- func (s *CodeforcesProblem) UnmarshalJSON(data []byte) error
- func (s *CodeforcesProblem) Validate() error
- type CodeforcesTestcase
- func (s *CodeforcesTestcase) Decode(d *jx.Decoder) error
- func (s *CodeforcesTestcase) Encode(e *jx.Encoder)
- func (s *CodeforcesTestcase) GetInput() string
- func (s *CodeforcesTestcase) GetOutput() string
- func (s *CodeforcesTestcase) MarshalJSON() ([]byte, error)
- func (s *CodeforcesTestcase) SetInput(val string)
- func (s *CodeforcesTestcase) SetOutput(val string)
- func (s *CodeforcesTestcase) UnmarshalJSON(data []byte) error
- type Error
- func (s *Error) Decode(d *jx.Decoder) error
- func (s *Error) Encode(e *jx.Encoder)
- func (s *Error) GetCode() string
- func (s *Error) GetMessage() string
- func (s *Error) MarshalJSON() ([]byte, error)
- func (s *Error) SetCode(val string)
- func (s *Error) SetMessage(val string)
- func (s *Error) UnmarshalJSON(data []byte) error
- type ErrorHandler
- type ErrorStatusCode
- type GetCodeforcesProblemParams
- type Handler
- type Invoker
- type Labeler
- type Middleware
- 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 UnimplementedHandler
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) GetCodeforcesProblem ¶
func (c *Client) GetCodeforcesProblem(ctx context.Context, params GetCodeforcesProblemParams) (*CodeforcesProblem, error)
GetCodeforcesProblem invokes get-codeforces-problem operation.
Get Codeforces Problem.
GET /codeforces/problems/{contest_id}/{index}
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 CodeforcesLanguage ¶
Ref: #/components/schemas/CodeforcesLanguage
func (*CodeforcesLanguage) Decode ¶
func (s *CodeforcesLanguage) Decode(d *jx.Decoder) error
Decode decodes CodeforcesLanguage from json.
func (*CodeforcesLanguage) Encode ¶
func (s *CodeforcesLanguage) Encode(e *jx.Encoder)
Encode implements json.Marshaler.
func (*CodeforcesLanguage) GetID ¶
func (s *CodeforcesLanguage) GetID() float64
GetID returns the value of ID.
func (*CodeforcesLanguage) GetName ¶
func (s *CodeforcesLanguage) GetName() string
GetName returns the value of Name.
func (*CodeforcesLanguage) MarshalJSON ¶
func (s *CodeforcesLanguage) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (*CodeforcesLanguage) SetID ¶
func (s *CodeforcesLanguage) SetID(val float64)
SetID sets the value of ID.
func (*CodeforcesLanguage) SetName ¶
func (s *CodeforcesLanguage) SetName(val string)
SetName sets the value of Name.
func (*CodeforcesLanguage) UnmarshalJSON ¶
func (s *CodeforcesLanguage) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
func (*CodeforcesLanguage) Validate ¶
func (s *CodeforcesLanguage) Validate() error
type CodeforcesProblem ¶
type CodeforcesProblem struct {
ContestID float64 `json:"contest_id"`
Index string `json:"index"`
Name string `json:"name"`
TimeLimit int `json:"time_limit"`
MemoryLimit int `json:"memory_limit"`
Tags []string `json:"tags"`
Languages []CodeforcesLanguage `json:"languages"`
Legend string `json:"legend"`
Input string `json:"input"`
Output string `json:"output"`
Interaction OptString `json:"interaction"`
Scoring OptString `json:"scoring"`
Notes string `json:"notes"`
Examples []CodeforcesTestcase `json:"examples"`
}
Ref: #/components/schemas/CodeforcesProblem
func (*CodeforcesProblem) Decode ¶
func (s *CodeforcesProblem) Decode(d *jx.Decoder) error
Decode decodes CodeforcesProblem from json.
func (*CodeforcesProblem) Encode ¶
func (s *CodeforcesProblem) Encode(e *jx.Encoder)
Encode implements json.Marshaler.
func (*CodeforcesProblem) GetContestID ¶
func (s *CodeforcesProblem) GetContestID() float64
GetContestID returns the value of ContestID.
func (*CodeforcesProblem) GetExamples ¶
func (s *CodeforcesProblem) GetExamples() []CodeforcesTestcase
GetExamples returns the value of Examples.
func (*CodeforcesProblem) GetIndex ¶
func (s *CodeforcesProblem) GetIndex() string
GetIndex returns the value of Index.
func (*CodeforcesProblem) GetInput ¶
func (s *CodeforcesProblem) GetInput() string
GetInput returns the value of Input.
func (*CodeforcesProblem) GetInteraction ¶
func (s *CodeforcesProblem) GetInteraction() OptString
GetInteraction returns the value of Interaction.
func (*CodeforcesProblem) GetLanguages ¶
func (s *CodeforcesProblem) GetLanguages() []CodeforcesLanguage
GetLanguages returns the value of Languages.
func (*CodeforcesProblem) GetLegend ¶
func (s *CodeforcesProblem) GetLegend() string
GetLegend returns the value of Legend.
func (*CodeforcesProblem) GetMemoryLimit ¶
func (s *CodeforcesProblem) GetMemoryLimit() int
GetMemoryLimit returns the value of MemoryLimit.
func (*CodeforcesProblem) GetName ¶
func (s *CodeforcesProblem) GetName() string
GetName returns the value of Name.
func (*CodeforcesProblem) GetNotes ¶
func (s *CodeforcesProblem) GetNotes() string
GetNotes returns the value of Notes.
func (*CodeforcesProblem) GetOutput ¶
func (s *CodeforcesProblem) GetOutput() string
GetOutput returns the value of Output.
func (*CodeforcesProblem) GetScoring ¶
func (s *CodeforcesProblem) GetScoring() OptString
GetScoring returns the value of Scoring.
func (*CodeforcesProblem) GetTags ¶
func (s *CodeforcesProblem) GetTags() []string
GetTags returns the value of Tags.
func (*CodeforcesProblem) GetTimeLimit ¶
func (s *CodeforcesProblem) GetTimeLimit() int
GetTimeLimit returns the value of TimeLimit.
func (*CodeforcesProblem) MarshalJSON ¶
func (s *CodeforcesProblem) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (*CodeforcesProblem) SetContestID ¶
func (s *CodeforcesProblem) SetContestID(val float64)
SetContestID sets the value of ContestID.
func (*CodeforcesProblem) SetExamples ¶
func (s *CodeforcesProblem) SetExamples(val []CodeforcesTestcase)
SetExamples sets the value of Examples.
func (*CodeforcesProblem) SetIndex ¶
func (s *CodeforcesProblem) SetIndex(val string)
SetIndex sets the value of Index.
func (*CodeforcesProblem) SetInput ¶
func (s *CodeforcesProblem) SetInput(val string)
SetInput sets the value of Input.
func (*CodeforcesProblem) SetInteraction ¶
func (s *CodeforcesProblem) SetInteraction(val OptString)
SetInteraction sets the value of Interaction.
func (*CodeforcesProblem) SetLanguages ¶
func (s *CodeforcesProblem) SetLanguages(val []CodeforcesLanguage)
SetLanguages sets the value of Languages.
func (*CodeforcesProblem) SetLegend ¶
func (s *CodeforcesProblem) SetLegend(val string)
SetLegend sets the value of Legend.
func (*CodeforcesProblem) SetMemoryLimit ¶
func (s *CodeforcesProblem) SetMemoryLimit(val int)
SetMemoryLimit sets the value of MemoryLimit.
func (*CodeforcesProblem) SetName ¶
func (s *CodeforcesProblem) SetName(val string)
SetName sets the value of Name.
func (*CodeforcesProblem) SetNotes ¶
func (s *CodeforcesProblem) SetNotes(val string)
SetNotes sets the value of Notes.
func (*CodeforcesProblem) SetOutput ¶
func (s *CodeforcesProblem) SetOutput(val string)
SetOutput sets the value of Output.
func (*CodeforcesProblem) SetScoring ¶
func (s *CodeforcesProblem) SetScoring(val OptString)
SetScoring sets the value of Scoring.
func (*CodeforcesProblem) SetTags ¶
func (s *CodeforcesProblem) SetTags(val []string)
SetTags sets the value of Tags.
func (*CodeforcesProblem) SetTimeLimit ¶
func (s *CodeforcesProblem) SetTimeLimit(val int)
SetTimeLimit sets the value of TimeLimit.
func (*CodeforcesProblem) UnmarshalJSON ¶
func (s *CodeforcesProblem) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
func (*CodeforcesProblem) Validate ¶
func (s *CodeforcesProblem) Validate() error
type CodeforcesTestcase ¶
Ref: #/components/schemas/CodeforcesTestcase
func (*CodeforcesTestcase) Decode ¶
func (s *CodeforcesTestcase) Decode(d *jx.Decoder) error
Decode decodes CodeforcesTestcase from json.
func (*CodeforcesTestcase) Encode ¶
func (s *CodeforcesTestcase) Encode(e *jx.Encoder)
Encode implements json.Marshaler.
func (*CodeforcesTestcase) GetInput ¶
func (s *CodeforcesTestcase) GetInput() string
GetInput returns the value of Input.
func (*CodeforcesTestcase) GetOutput ¶
func (s *CodeforcesTestcase) GetOutput() string
GetOutput returns the value of Output.
func (*CodeforcesTestcase) MarshalJSON ¶
func (s *CodeforcesTestcase) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (*CodeforcesTestcase) SetInput ¶
func (s *CodeforcesTestcase) SetInput(val string)
SetInput sets the value of Input.
func (*CodeforcesTestcase) SetOutput ¶
func (s *CodeforcesTestcase) SetOutput(val string)
SetOutput sets the value of Output.
func (*CodeforcesTestcase) UnmarshalJSON ¶
func (s *CodeforcesTestcase) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
type Error ¶
Ref: #/components/schemas/Error
func (*Error) GetMessage ¶
GetMessage returns the value of Message.
func (*Error) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*Error) SetMessage ¶
SetMessage sets the value of Message.
func (*Error) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type ErrorStatusCode ¶
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 GetCodeforcesProblemParams ¶
type GetCodeforcesProblemParams struct {
// Contest ID.
ContestID int
// Problem Index. Usually, a letter or letter with digit(s) indicating the problem index in a contest.
Index string
}
GetCodeforcesProblemParams is parameters of get-codeforces-problem operation.
type Handler ¶
type Handler interface {
// GetCodeforcesProblem implements get-codeforces-problem operation.
//
// Get Codeforces Problem.
//
// GET /codeforces/problems/{contest_id}/{index}
GetCodeforcesProblem(ctx context.Context, params GetCodeforcesProblemParams) (*CodeforcesProblem, 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 {
// GetCodeforcesProblem invokes get-codeforces-problem operation.
//
// Get Codeforces Problem.
//
// GET /codeforces/problems/{contest_id}/{index}
GetCodeforcesProblem(ctx context.Context, params GetCodeforcesProblemParams) (*CodeforcesProblem, error)
}
Invoker invokes operations described by OpenAPI v3 specification.
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 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 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 UnimplementedHandler ¶
type UnimplementedHandler struct{}
UnimplementedHandler is no-op Handler which returns http.ErrNotImplemented.
func (UnimplementedHandler) GetCodeforcesProblem ¶
func (UnimplementedHandler) GetCodeforcesProblem(ctx context.Context, params GetCodeforcesProblemParams) (r *CodeforcesProblem, _ error)
GetCodeforcesProblem implements get-codeforces-problem operation.
Get Codeforces Problem.
GET /codeforces/problems/{contest_id}/{index}
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.
Source Files
¶
- oas_cfg_gen.go
- oas_client_gen.go
- oas_handlers_gen.go
- oas_json_gen.go
- oas_labeler_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
- oas_validators_gen.go