Documentation ¶
Index ¶
- func WithServerURL(ctx context.Context, u *url.URL) context.Context
- type Client
- type ClientOption
- type Error
- type ErrorHandler
- type ErrorStatusCode
- type GetTelegramBadgeParams
- type GetTelegramOnlineBadgeParams
- type Handler
- type Invoker
- type Labeler
- type Middleware
- type OperationName
- type OptString
- type Option
- type Route
- type SVG
- type SVGHeaders
- 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 Statistics
- func (s *Statistics) Decode(d *jx.Decoder) error
- func (s *Statistics) Encode(e *jx.Encoder)
- func (s *Statistics) GetTopUsers() []UserStat
- func (s *Statistics) GetTotalCommits() int
- func (s *Statistics) MarshalJSON() ([]byte, error)
- func (s *Statistics) SetFake()
- func (s *Statistics) SetTopUsers(val []UserStat)
- func (s *Statistics) SetTotalCommits(val int)
- func (s *Statistics) UnmarshalJSON(data []byte) error
- func (s *Statistics) Validate() error
- type Status
- func (s *Status) Decode(d *jx.Decoder) error
- func (s *Status) Encode(e *jx.Encoder)
- func (s *Status) GetMessage() string
- func (s *Status) GetStat() Statistics
- func (s *Status) MarshalJSON() ([]byte, error)
- func (s *Status) SetFake()
- func (s *Status) SetMessage(val string)
- func (s *Status) SetStat(val Statistics)
- func (s *Status) UnmarshalJSON(data []byte) error
- func (s *Status) Validate() error
- type UnimplementedHandler
- func (UnimplementedHandler) GetTelegramBadge(ctx context.Context, params GetTelegramBadgeParams) (r *SVGHeaders, _ error)
- func (UnimplementedHandler) GetTelegramOnlineBadge(ctx context.Context, params GetTelegramOnlineBadgeParams) (r *SVGHeaders, _ error)
- func (UnimplementedHandler) NewError(ctx context.Context, err error) (r *ErrorStatusCode)
- func (UnimplementedHandler) Status(ctx context.Context) (r *Status, _ error)
- type User
- func (s *User) Decode(d *jx.Decoder) error
- func (s *User) Encode(e *jx.Encoder)
- func (s *User) GetAvatarURL() url.URL
- func (s *User) GetFullName() string
- func (s *User) GetHTMLURL() url.URL
- func (s *User) GetID() int64
- func (s *User) GetNickname() string
- func (s *User) MarshalJSON() ([]byte, error)
- func (s *User) SetAvatarURL(val url.URL)
- func (s *User) SetFake()
- func (s *User) SetFullName(val string)
- func (s *User) SetHTMLURL(val url.URL)
- func (s *User) SetID(val int64)
- func (s *User) SetNickname(val string)
- func (s *User) UnmarshalJSON(data []byte) error
- type UserStat
- func (s *UserStat) Decode(d *jx.Decoder) error
- func (s *UserStat) Encode(e *jx.Encoder)
- func (s *UserStat) GetTotalCommits() int
- func (s *UserStat) GetUser() User
- func (s *UserStat) MarshalJSON() ([]byte, error)
- func (s *UserStat) SetFake()
- func (s *UserStat) SetTotalCommits(val int)
- func (s *UserStat) SetUser(val User)
- func (s *UserStat) 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) GetTelegramBadge ¶
func (c *Client) GetTelegramBadge(ctx context.Context, params GetTelegramBadgeParams) (*SVGHeaders, error)
GetTelegramBadge invokes getTelegramBadge operation.
Get svg badge for telegram group.
GET /badge/telegram/{group_name}
func (*Client) GetTelegramOnlineBadge ¶
func (c *Client) GetTelegramOnlineBadge(ctx context.Context, params GetTelegramOnlineBadgeParams) (*SVGHeaders, error)
GetTelegramOnlineBadge invokes getTelegramOnlineBadge operation.
GET /badge/telegram/online
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 Error ¶
type Error struct {
Message string `json:"message"`
}
Error description. 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 GetTelegramBadgeParams ¶
GetTelegramBadgeParams is parameters of getTelegramBadge operation.
type GetTelegramOnlineBadgeParams ¶
type GetTelegramOnlineBadgeParams struct {
Groups []string
}
GetTelegramOnlineBadgeParams is parameters of getTelegramOnlineBadge operation.
type Handler ¶
type Handler interface { // GetTelegramBadge implements getTelegramBadge operation. // // Get svg badge for telegram group. // // GET /badge/telegram/{group_name} GetTelegramBadge(ctx context.Context, params GetTelegramBadgeParams) (*SVGHeaders, error) // GetTelegramOnlineBadge implements getTelegramOnlineBadge operation. // // GET /badge/telegram/online GetTelegramOnlineBadge(ctx context.Context, params GetTelegramOnlineBadgeParams) (*SVGHeaders, error) // Status implements status operation. // // Get status. // // GET /status Status(ctx context.Context) (*Status, 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 { // GetTelegramBadge invokes getTelegramBadge operation. // // Get svg badge for telegram group. // // GET /badge/telegram/{group_name} GetTelegramBadge(ctx context.Context, params GetTelegramBadgeParams) (*SVGHeaders, error) // GetTelegramOnlineBadge invokes getTelegramOnlineBadge operation. // // GET /badge/telegram/online GetTelegramOnlineBadge(ctx context.Context, params GetTelegramOnlineBadgeParams) (*SVGHeaders, error) // Status invokes status operation. // // Get status. // // GET /status Status(ctx context.Context) (*Status, 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 OperationName ¶
type OperationName = string
OperationName is the ogen operation name
const ( GetTelegramBadgeOperation OperationName = "GetTelegramBadge" GetTelegramOnlineBadgeOperation OperationName = "GetTelegramOnlineBadge" StatusOperation OperationName = "Status" )
type OptString ¶
OptString is optional string.
func NewOptString ¶
NewOptString returns new OptString with value set to v.
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 SVGHeaders ¶
SVGHeaders wraps SVG with response headers.
func (*SVGHeaders) GetCacheControl ¶
func (s *SVGHeaders) GetCacheControl() OptString
GetCacheControl returns the value of CacheControl.
func (*SVGHeaders) GetETag ¶
func (s *SVGHeaders) GetETag() OptString
GetETag returns the value of ETag.
func (*SVGHeaders) GetResponse ¶
func (s *SVGHeaders) GetResponse() SVG
GetResponse returns the value of Response.
func (*SVGHeaders) SetCacheControl ¶
func (s *SVGHeaders) SetCacheControl(val OptString)
SetCacheControl sets the value of CacheControl.
func (*SVGHeaders) SetETag ¶
func (s *SVGHeaders) SetETag(val OptString)
SetETag sets the value of ETag.
func (*SVGHeaders) SetResponse ¶
func (s *SVGHeaders) SetResponse(val SVG)
SetResponse sets the value of Response.
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 Statistics ¶
type Statistics struct { // Total commits. TotalCommits int `json:"total_commits"` // Top users. TopUsers []UserStat `json:"top_users"` }
Statistics. Ref: #/components/schemas/Statistics
func (*Statistics) Decode ¶
func (s *Statistics) Decode(d *jx.Decoder) error
Decode decodes Statistics from json.
func (*Statistics) Encode ¶
func (s *Statistics) Encode(e *jx.Encoder)
Encode implements json.Marshaler.
func (*Statistics) GetTopUsers ¶
func (s *Statistics) GetTopUsers() []UserStat
GetTopUsers returns the value of TopUsers.
func (*Statistics) GetTotalCommits ¶
func (s *Statistics) GetTotalCommits() int
GetTotalCommits returns the value of TotalCommits.
func (*Statistics) MarshalJSON ¶
func (s *Statistics) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (*Statistics) SetTopUsers ¶
func (s *Statistics) SetTopUsers(val []UserStat)
SetTopUsers sets the value of TopUsers.
func (*Statistics) SetTotalCommits ¶
func (s *Statistics) SetTotalCommits(val int)
SetTotalCommits sets the value of TotalCommits.
func (*Statistics) UnmarshalJSON ¶
func (s *Statistics) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
func (*Statistics) Validate ¶
func (s *Statistics) Validate() error
type Status ¶
type Status struct { // Message. Message string `json:"message"` Stat Statistics `json:"stat"` }
Status. Ref: #/components/schemas/Status
func (*Status) GetMessage ¶
GetMessage returns the value of Message.
func (*Status) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*Status) SetMessage ¶
SetMessage sets the value of Message.
func (*Status) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type UnimplementedHandler ¶
type UnimplementedHandler struct{}
UnimplementedHandler is no-op Handler which returns http.ErrNotImplemented.
func (UnimplementedHandler) GetTelegramBadge ¶
func (UnimplementedHandler) GetTelegramBadge(ctx context.Context, params GetTelegramBadgeParams) (r *SVGHeaders, _ error)
GetTelegramBadge implements getTelegramBadge operation.
Get svg badge for telegram group.
GET /badge/telegram/{group_name}
func (UnimplementedHandler) GetTelegramOnlineBadge ¶
func (UnimplementedHandler) GetTelegramOnlineBadge(ctx context.Context, params GetTelegramOnlineBadgeParams) (r *SVGHeaders, _ error)
GetTelegramOnlineBadge implements getTelegramOnlineBadge operation.
GET /badge/telegram/online
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.
type User ¶
type User struct { // User ID. ID int64 `json:"id"` // User name. Nickname string `json:"nickname"` // User full name. FullName string `json:"full_name"` // User avatar URL. AvatarURL url.URL `json:"avatar_url"` // User profile URL. HTMLURL url.URL `json:"html_url"` }
Ref: #/components/schemas/User
func (*User) GetAvatarURL ¶
GetAvatarURL returns the value of AvatarURL.
func (*User) GetFullName ¶
GetFullName returns the value of FullName.
func (*User) GetHTMLURL ¶
GetHTMLURL returns the value of HTMLURL.
func (*User) GetNickname ¶
GetNickname returns the value of Nickname.
func (*User) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*User) SetAvatarURL ¶
SetAvatarURL sets the value of AvatarURL.
func (*User) SetFullName ¶
SetFullName sets the value of FullName.
func (*User) SetHTMLURL ¶
SetHTMLURL sets the value of HTMLURL.
func (*User) SetNickname ¶
SetNickname sets the value of Nickname.
func (*User) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
type UserStat ¶
type UserStat struct { User User `json:"user"` // Total commits. TotalCommits int `json:"total_commits"` }
User statistics. Ref: #/components/schemas/UserStat
func (*UserStat) GetTotalCommits ¶
GetTotalCommits returns the value of TotalCommits.
func (*UserStat) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*UserStat) SetTotalCommits ¶
SetTotalCommits sets the value of TotalCommits.
func (*UserStat) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
Source Files ¶
- oas_cfg_gen.go
- oas_client_gen.go
- oas_faker_gen.go
- oas_handlers_gen.go
- oas_json_gen.go
- oas_labeler_gen.go
- oas_middleware_gen.go
- oas_operations_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