Documentation
¶
Overview ¶
Code generated by ogen, DO NOT EDIT.
Index ¶
- func WithServerURL(ctx context.Context, u *url.URL) context.Context
- type BearerAuth
- type Client
- func (c *Client) GetCurrentUser(ctx context.Context) (GetCurrentUserRes, error)
- func (c *Client) HealthLiveness(ctx context.Context) error
- func (c *Client) HealthReadiness(ctx context.Context) (HealthReadinessRes, error)
- func (c *Client) Login(ctx context.Context, request *LoginRequest) (LoginRes, error)
- type ClientOption
- type CurrentUserResponse
- func (s *CurrentUserResponse) Decode(d *jx.Decoder) error
- func (s *CurrentUserResponse) Encode(e *jx.Encoder)
- func (s *CurrentUserResponse) GetEmail() OptString
- func (s *CurrentUserResponse) GetFirstName() OptString
- func (s *CurrentUserResponse) GetLastName() OptString
- func (s *CurrentUserResponse) GetSubject() string
- func (s *CurrentUserResponse) MarshalJSON() ([]byte, error)
- func (s *CurrentUserResponse) SetEmail(val OptString)
- func (s *CurrentUserResponse) SetFirstName(val OptString)
- func (s *CurrentUserResponse) SetLastName(val OptString)
- func (s *CurrentUserResponse) SetSubject(val string)
- func (s *CurrentUserResponse) UnmarshalJSON(data []byte) error
- type ErrorHandler
- type GenericResponse
- func (s *GenericResponse) Decode(d *jx.Decoder) error
- func (s *GenericResponse) Encode(e *jx.Encoder)
- func (s *GenericResponse) GetCode() OptInt
- func (s *GenericResponse) GetData() *GenericResponseData
- func (s *GenericResponse) GetMessage() OptString
- func (s *GenericResponse) GetStatus() OptGenericResponseStatus
- func (s *GenericResponse) MarshalJSON() ([]byte, error)
- func (s *GenericResponse) SetCode(val OptInt)
- func (s *GenericResponse) SetData(val *GenericResponseData)
- func (s *GenericResponse) SetMessage(val OptString)
- func (s *GenericResponse) SetStatus(val OptGenericResponseStatus)
- func (s *GenericResponse) UnmarshalJSON(data []byte) error
- func (s *GenericResponse) Validate() error
- type GenericResponseData
- type GenericResponseHeaders
- type GenericResponseStatus
- func (GenericResponseStatus) AllValues() []GenericResponseStatus
- func (s *GenericResponseStatus) Decode(d *jx.Decoder) error
- func (s GenericResponseStatus) Encode(e *jx.Encoder)
- func (s GenericResponseStatus) MarshalJSON() ([]byte, error)
- func (s GenericResponseStatus) MarshalText() ([]byte, error)
- func (s *GenericResponseStatus) UnmarshalJSON(data []byte) error
- func (s *GenericResponseStatus) UnmarshalText(data []byte) error
- func (s GenericResponseStatus) Validate() error
- type GetCurrentUserRes
- type GetCurrentUserUnauthorized
- type Handler
- type HealthLivenessOK
- type HealthReadinessOK
- type HealthReadinessRes
- type HealthReadinessServiceUnavailable
- type Invoker
- type Labeler
- type LoginRequest
- func (s *LoginRequest) Decode(d *jx.Decoder) error
- func (s *LoginRequest) Encode(e *jx.Encoder)
- func (s *LoginRequest) GetEmail() string
- func (s *LoginRequest) GetPassword() string
- func (s *LoginRequest) MarshalJSON() ([]byte, error)
- func (s *LoginRequest) SetEmail(val string)
- func (s *LoginRequest) SetPassword(val string)
- func (s *LoginRequest) UnmarshalJSON(data []byte) error
- func (s *LoginRequest) Validate() error
- type LoginRes
- type LoginResponse
- type LoginUnauthorized
- type Middleware
- type OperationName
- type OptGenericResponseStatus
- func (o *OptGenericResponseStatus) Decode(d *jx.Decoder) error
- func (o OptGenericResponseStatus) Encode(e *jx.Encoder)
- func (o OptGenericResponseStatus) Get() (v GenericResponseStatus, ok bool)
- func (o OptGenericResponseStatus) IsSet() bool
- func (s OptGenericResponseStatus) MarshalJSON() ([]byte, error)
- func (o OptGenericResponseStatus) Or(d GenericResponseStatus) GenericResponseStatus
- func (o *OptGenericResponseStatus) Reset()
- func (o *OptGenericResponseStatus) SetTo(v GenericResponseStatus)
- func (s *OptGenericResponseStatus) UnmarshalJSON(data []byte) error
- type OptInt
- func (o *OptInt) Decode(d *jx.Decoder) error
- func (o OptInt) Encode(e *jx.Encoder)
- func (o OptInt) Get() (v int, ok bool)
- func (o OptInt) IsSet() bool
- func (s OptInt) MarshalJSON() ([]byte, error)
- func (o OptInt) Or(d int) int
- func (o *OptInt) Reset()
- func (o *OptInt) SetTo(v int)
- func (s *OptInt) UnmarshalJSON(data []byte) error
- 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 SecurityHandler
- type SecuritySource
- 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
- func (UnimplementedHandler) GetCurrentUser(ctx context.Context) (r GetCurrentUserRes, _ error)
- func (UnimplementedHandler) HealthLiveness(ctx context.Context) error
- func (UnimplementedHandler) HealthReadiness(ctx context.Context) (r HealthReadinessRes, _ error)
- func (UnimplementedHandler) Login(ctx context.Context, req *LoginRequest) (r LoginRes, _ error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BearerAuth ¶
func (*BearerAuth) GetRoles ¶
func (s *BearerAuth) GetRoles() []string
GetRoles returns the value of Roles.
func (*BearerAuth) GetToken ¶
func (s *BearerAuth) GetToken() string
GetToken returns the value of Token.
func (*BearerAuth) SetRoles ¶
func (s *BearerAuth) SetRoles(val []string)
SetRoles sets the value of Roles.
func (*BearerAuth) SetToken ¶
func (s *BearerAuth) SetToken(val string)
SetToken sets the value of Token.
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) GetCurrentUser ¶
func (c *Client) GetCurrentUser(ctx context.Context) (GetCurrentUserRes, error)
GetCurrentUser invokes GetCurrentUser operation.
Example protected endpoint. Requires a valid bearer token and returns the subject encoded in it.
GET /me
func (*Client) HealthLiveness ¶
HealthLiveness invokes HealthLiveness operation.
Liveness probe.
GET /healthz/liveness
func (*Client) HealthReadiness ¶
func (c *Client) HealthReadiness(ctx context.Context) (HealthReadinessRes, error)
HealthReadiness invokes HealthReadiness operation.
Readiness probe for kubernetes health check. Returns 200 if the service is ready to serve requests. Returns 503 if the service is not ready to serve requests (starting up or shutting down).
GET /healthz/readiness
func (*Client) Login ¶
Login invokes Login operation.
Verifies the supplied email and password and, on success, returns a signed JWT bearer token to send as the Authorization header on subsequent requests. Unknown emails, wrong passwords, and a server with login disabled (no JWT secret configured) all return the same 401 so a client cannot distinguish them.
POST /login
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 CurrentUserResponse ¶
type CurrentUserResponse struct {
Subject string `json:"subject"`
Email OptString `json:"email"`
FirstName OptString `json:"firstName"`
LastName OptString `json:"lastName"`
}
Ref: #/components/schemas/currentUserResponse
func (*CurrentUserResponse) Decode ¶
func (s *CurrentUserResponse) Decode(d *jx.Decoder) error
Decode decodes CurrentUserResponse from json.
func (*CurrentUserResponse) Encode ¶
func (s *CurrentUserResponse) Encode(e *jx.Encoder)
Encode implements json.Marshaler.
func (*CurrentUserResponse) GetEmail ¶
func (s *CurrentUserResponse) GetEmail() OptString
GetEmail returns the value of Email.
func (*CurrentUserResponse) GetFirstName ¶
func (s *CurrentUserResponse) GetFirstName() OptString
GetFirstName returns the value of FirstName.
func (*CurrentUserResponse) GetLastName ¶
func (s *CurrentUserResponse) GetLastName() OptString
GetLastName returns the value of LastName.
func (*CurrentUserResponse) GetSubject ¶
func (s *CurrentUserResponse) GetSubject() string
GetSubject returns the value of Subject.
func (*CurrentUserResponse) MarshalJSON ¶
func (s *CurrentUserResponse) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (*CurrentUserResponse) SetEmail ¶
func (s *CurrentUserResponse) SetEmail(val OptString)
SetEmail sets the value of Email.
func (*CurrentUserResponse) SetFirstName ¶
func (s *CurrentUserResponse) SetFirstName(val OptString)
SetFirstName sets the value of FirstName.
func (*CurrentUserResponse) SetLastName ¶
func (s *CurrentUserResponse) SetLastName(val OptString)
SetLastName sets the value of LastName.
func (*CurrentUserResponse) SetSubject ¶
func (s *CurrentUserResponse) SetSubject(val string)
SetSubject sets the value of Subject.
func (*CurrentUserResponse) UnmarshalJSON ¶
func (s *CurrentUserResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
type GenericResponse ¶
type GenericResponse struct {
Code OptInt `json:"code"`
Data *GenericResponseData `json:"data"`
Message OptString `json:"message"`
Status OptGenericResponseStatus `json:"status"`
}
Ref: #/components/schemas/genericResponse
func (*GenericResponse) Decode ¶
func (s *GenericResponse) Decode(d *jx.Decoder) error
Decode decodes GenericResponse from json.
func (*GenericResponse) Encode ¶
func (s *GenericResponse) Encode(e *jx.Encoder)
Encode implements json.Marshaler.
func (*GenericResponse) GetCode ¶
func (s *GenericResponse) GetCode() OptInt
GetCode returns the value of Code.
func (*GenericResponse) GetData ¶
func (s *GenericResponse) GetData() *GenericResponseData
GetData returns the value of Data.
func (*GenericResponse) GetMessage ¶
func (s *GenericResponse) GetMessage() OptString
GetMessage returns the value of Message.
func (*GenericResponse) GetStatus ¶
func (s *GenericResponse) GetStatus() OptGenericResponseStatus
GetStatus returns the value of Status.
func (*GenericResponse) MarshalJSON ¶
func (s *GenericResponse) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (*GenericResponse) SetCode ¶
func (s *GenericResponse) SetCode(val OptInt)
SetCode sets the value of Code.
func (*GenericResponse) SetData ¶
func (s *GenericResponse) SetData(val *GenericResponseData)
SetData sets the value of Data.
func (*GenericResponse) SetMessage ¶
func (s *GenericResponse) SetMessage(val OptString)
SetMessage sets the value of Message.
func (*GenericResponse) SetStatus ¶
func (s *GenericResponse) SetStatus(val OptGenericResponseStatus)
SetStatus sets the value of Status.
func (*GenericResponse) UnmarshalJSON ¶
func (s *GenericResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
func (*GenericResponse) Validate ¶
func (s *GenericResponse) Validate() error
type GenericResponseData ¶
type GenericResponseData struct{}
func (*GenericResponseData) Decode ¶
func (s *GenericResponseData) Decode(d *jx.Decoder) error
Decode decodes GenericResponseData from json.
func (*GenericResponseData) Encode ¶
func (s *GenericResponseData) Encode(e *jx.Encoder)
Encode implements json.Marshaler.
func (*GenericResponseData) MarshalJSON ¶
func (s *GenericResponseData) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (*GenericResponseData) UnmarshalJSON ¶
func (s *GenericResponseData) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
type GenericResponseHeaders ¶
type GenericResponseHeaders struct {
RetryAfter int
Response GenericResponse
}
GenericResponseHeaders wraps GenericResponse with response headers.
func (*GenericResponseHeaders) GetResponse ¶
func (s *GenericResponseHeaders) GetResponse() GenericResponse
GetResponse returns the value of Response.
func (*GenericResponseHeaders) GetRetryAfter ¶
func (s *GenericResponseHeaders) GetRetryAfter() int
GetRetryAfter returns the value of RetryAfter.
func (*GenericResponseHeaders) SetResponse ¶
func (s *GenericResponseHeaders) SetResponse(val GenericResponse)
SetResponse sets the value of Response.
func (*GenericResponseHeaders) SetRetryAfter ¶
func (s *GenericResponseHeaders) SetRetryAfter(val int)
SetRetryAfter sets the value of RetryAfter.
func (*GenericResponseHeaders) Validate ¶
func (s *GenericResponseHeaders) Validate() error
type GenericResponseStatus ¶
type GenericResponseStatus string
const ( GenericResponseStatusSuccess GenericResponseStatus = "success" GenericResponseStatusFail GenericResponseStatus = "fail" GenericResponseStatusError GenericResponseStatus = "error" )
func (GenericResponseStatus) AllValues ¶
func (GenericResponseStatus) AllValues() []GenericResponseStatus
AllValues returns all GenericResponseStatus values.
func (*GenericResponseStatus) Decode ¶
func (s *GenericResponseStatus) Decode(d *jx.Decoder) error
Decode decodes GenericResponseStatus from json.
func (GenericResponseStatus) Encode ¶
func (s GenericResponseStatus) Encode(e *jx.Encoder)
Encode encodes GenericResponseStatus as json.
func (GenericResponseStatus) MarshalJSON ¶
func (s GenericResponseStatus) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (GenericResponseStatus) MarshalText ¶
func (s GenericResponseStatus) MarshalText() ([]byte, error)
MarshalText implements encoding.TextMarshaler.
func (*GenericResponseStatus) UnmarshalJSON ¶
func (s *GenericResponseStatus) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
func (*GenericResponseStatus) UnmarshalText ¶
func (s *GenericResponseStatus) UnmarshalText(data []byte) error
UnmarshalText implements encoding.TextUnmarshaler.
func (GenericResponseStatus) Validate ¶
func (s GenericResponseStatus) Validate() error
type GetCurrentUserRes ¶
type GetCurrentUserRes interface {
// contains filtered or unexported methods
}
type GetCurrentUserUnauthorized ¶
type GetCurrentUserUnauthorized struct{}
GetCurrentUserUnauthorized is response for GetCurrentUser operation.
type Handler ¶
type Handler interface {
// GetCurrentUser implements GetCurrentUser operation.
//
// Example protected endpoint. Requires a valid bearer token and returns the subject encoded in it.
//
// GET /me
GetCurrentUser(ctx context.Context) (GetCurrentUserRes, error)
// HealthLiveness implements HealthLiveness operation.
//
// Liveness probe.
//
// GET /healthz/liveness
HealthLiveness(ctx context.Context) error
// HealthReadiness implements HealthReadiness operation.
//
// Readiness probe for kubernetes health check. Returns 200 if the service is ready to serve requests.
// Returns 503 if the service is not ready to serve requests (starting up or shutting down).
//
// GET /healthz/readiness
HealthReadiness(ctx context.Context) (HealthReadinessRes, error)
// Login implements Login operation.
//
// Verifies the supplied email and password and, on success, returns a signed JWT bearer token to
// send as the Authorization header on subsequent requests. Unknown emails, wrong passwords, and a
// server with login disabled (no JWT secret configured) all return the same 401 so a client cannot
// distinguish them.
//
// POST /login
Login(ctx context.Context, req *LoginRequest) (LoginRes, error)
}
Handler handles operations described by OpenAPI v3 specification.
type HealthLivenessOK ¶
type HealthLivenessOK struct{}
HealthLivenessOK is response for HealthLiveness operation.
type HealthReadinessOK ¶
type HealthReadinessOK struct{}
HealthReadinessOK is response for HealthReadiness operation.
type HealthReadinessRes ¶
type HealthReadinessRes interface {
// contains filtered or unexported methods
}
type HealthReadinessServiceUnavailable ¶
type HealthReadinessServiceUnavailable struct{}
HealthReadinessServiceUnavailable is response for HealthReadiness operation.
type Invoker ¶
type Invoker interface {
// GetCurrentUser invokes GetCurrentUser operation.
//
// Example protected endpoint. Requires a valid bearer token and returns the subject encoded in it.
//
// GET /me
GetCurrentUser(ctx context.Context) (GetCurrentUserRes, error)
// HealthLiveness invokes HealthLiveness operation.
//
// Liveness probe.
//
// GET /healthz/liveness
HealthLiveness(ctx context.Context) error
// HealthReadiness invokes HealthReadiness operation.
//
// Readiness probe for kubernetes health check. Returns 200 if the service is ready to serve requests.
// Returns 503 if the service is not ready to serve requests (starting up or shutting down).
//
// GET /healthz/readiness
HealthReadiness(ctx context.Context) (HealthReadinessRes, error)
// Login invokes Login operation.
//
// Verifies the supplied email and password and, on success, returns a signed JWT bearer token to
// send as the Authorization header on subsequent requests. Unknown emails, wrong passwords, and a
// server with login disabled (no JWT secret configured) all return the same 401 so a client cannot
// distinguish them.
//
// POST /login
Login(ctx context.Context, request *LoginRequest) (LoginRes, 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 LoginRequest ¶
Ref: #/components/schemas/loginRequest
func (*LoginRequest) Decode ¶
func (s *LoginRequest) Decode(d *jx.Decoder) error
Decode decodes LoginRequest from json.
func (*LoginRequest) Encode ¶
func (s *LoginRequest) Encode(e *jx.Encoder)
Encode implements json.Marshaler.
func (*LoginRequest) GetEmail ¶
func (s *LoginRequest) GetEmail() string
GetEmail returns the value of Email.
func (*LoginRequest) GetPassword ¶
func (s *LoginRequest) GetPassword() string
GetPassword returns the value of Password.
func (*LoginRequest) MarshalJSON ¶
func (s *LoginRequest) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (*LoginRequest) SetEmail ¶
func (s *LoginRequest) SetEmail(val string)
SetEmail sets the value of Email.
func (*LoginRequest) SetPassword ¶
func (s *LoginRequest) SetPassword(val string)
SetPassword sets the value of Password.
func (*LoginRequest) UnmarshalJSON ¶
func (s *LoginRequest) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
func (*LoginRequest) Validate ¶
func (s *LoginRequest) Validate() error
type LoginResponse ¶
type LoginResponse struct {
Token string `json:"token"`
}
Ref: #/components/schemas/loginResponse
func (*LoginResponse) Decode ¶
func (s *LoginResponse) Decode(d *jx.Decoder) error
Decode decodes LoginResponse from json.
func (*LoginResponse) Encode ¶
func (s *LoginResponse) Encode(e *jx.Encoder)
Encode implements json.Marshaler.
func (*LoginResponse) GetToken ¶
func (s *LoginResponse) GetToken() string
GetToken returns the value of Token.
func (*LoginResponse) MarshalJSON ¶
func (s *LoginResponse) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (*LoginResponse) SetToken ¶
func (s *LoginResponse) SetToken(val string)
SetToken sets the value of Token.
func (*LoginResponse) UnmarshalJSON ¶
func (s *LoginResponse) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
type LoginUnauthorized ¶
type LoginUnauthorized struct{}
LoginUnauthorized is response for Login operation.
type OperationName ¶
type OperationName = string
OperationName is the ogen operation name
const ( GetCurrentUserOperation OperationName = "GetCurrentUser" HealthLivenessOperation OperationName = "HealthLiveness" HealthReadinessOperation OperationName = "HealthReadiness" LoginOperation OperationName = "Login" )
type OptGenericResponseStatus ¶
type OptGenericResponseStatus struct {
Value GenericResponseStatus
Set bool
}
OptGenericResponseStatus is optional GenericResponseStatus.
func NewOptGenericResponseStatus ¶
func NewOptGenericResponseStatus(v GenericResponseStatus) OptGenericResponseStatus
NewOptGenericResponseStatus returns new OptGenericResponseStatus with value set to v.
func (*OptGenericResponseStatus) Decode ¶
func (o *OptGenericResponseStatus) Decode(d *jx.Decoder) error
Decode decodes GenericResponseStatus from json.
func (OptGenericResponseStatus) Encode ¶
func (o OptGenericResponseStatus) Encode(e *jx.Encoder)
Encode encodes GenericResponseStatus as json.
func (OptGenericResponseStatus) Get ¶
func (o OptGenericResponseStatus) Get() (v GenericResponseStatus, ok bool)
Get returns value and boolean that denotes whether value was set.
func (OptGenericResponseStatus) IsSet ¶
func (o OptGenericResponseStatus) IsSet() bool
IsSet returns true if OptGenericResponseStatus was set.
func (OptGenericResponseStatus) MarshalJSON ¶
func (s OptGenericResponseStatus) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (OptGenericResponseStatus) Or ¶
func (o OptGenericResponseStatus) Or(d GenericResponseStatus) GenericResponseStatus
Or returns value if set, or given parameter if does not.
func (*OptGenericResponseStatus) Reset ¶
func (o *OptGenericResponseStatus) Reset()
Reset unsets value.
func (*OptGenericResponseStatus) SetTo ¶
func (o *OptGenericResponseStatus) SetTo(v GenericResponseStatus)
SetTo sets value to v.
func (*OptGenericResponseStatus) UnmarshalJSON ¶
func (s *OptGenericResponseStatus) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
type OptInt ¶
OptInt is optional int.
func (OptInt) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*OptInt) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.
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 SecurityHandler ¶
type SecurityHandler interface {
// HandleBearerAuth handles bearerAuth security.
// JWT bearer token passed in the Authorization header.
HandleBearerAuth(ctx context.Context, operationName OperationName, t BearerAuth) (context.Context, error)
}
SecurityHandler is handler for security parameters.
type SecuritySource ¶
type SecuritySource interface {
// BearerAuth provides bearerAuth security value.
// JWT bearer token passed in the Authorization header.
BearerAuth(ctx context.Context, operationName OperationName) (BearerAuth, 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.
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) GetCurrentUser ¶
func (UnimplementedHandler) GetCurrentUser(ctx context.Context) (r GetCurrentUserRes, _ error)
GetCurrentUser implements GetCurrentUser operation.
Example protected endpoint. Requires a valid bearer token and returns the subject encoded in it.
GET /me
func (UnimplementedHandler) HealthLiveness ¶
func (UnimplementedHandler) HealthLiveness(ctx context.Context) error
HealthLiveness implements HealthLiveness operation.
Liveness probe.
GET /healthz/liveness
func (UnimplementedHandler) HealthReadiness ¶
func (UnimplementedHandler) HealthReadiness(ctx context.Context) (r HealthReadinessRes, _ error)
HealthReadiness implements HealthReadiness operation.
Readiness probe for kubernetes health check. Returns 200 if the service is ready to serve requests. Returns 503 if the service is not ready to serve requests (starting up or shutting down).
GET /healthz/readiness
func (UnimplementedHandler) Login ¶
func (UnimplementedHandler) Login(ctx context.Context, req *LoginRequest) (r LoginRes, _ error)
Login implements Login operation.
Verifies the supplied email and password and, on success, returns a signed JWT bearer token to send as the Authorization header on subsequent requests. Unknown emails, wrong passwords, and a server with login disabled (no JWT secret configured) all return the same 401 so a client cannot distinguish them.
POST /login
Source Files
¶
- oas_cfg_gen.go
- oas_client_gen.go
- oas_handlers_gen.go
- oas_interfaces_gen.go
- oas_json_gen.go
- oas_labeler_gen.go
- oas_middleware_gen.go
- oas_operations_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_security_gen.go
- oas_server_gen.go
- oas_unimplemented_gen.go
- oas_validators_gen.go