Documentation
¶
Index ¶
- type CreateUser
- type CreateUserReq
- func (s *CreateUserReq) Decode(d *jx.Decoder) error
- func (s *CreateUserReq) Encode(e *jx.Encoder)
- func (s *CreateUserReq) GetEmail() string
- func (s *CreateUserReq) GetName() string
- func (s *CreateUserReq) MarshalJSON() ([]byte, error)
- func (s *CreateUserReq) SetEmail(val string)
- func (s *CreateUserReq) SetName(val string)
- func (s *CreateUserReq) UnmarshalJSON(data []byte) error
- func (s *CreateUserReq) Validate() error
- type Error
- type ErrorHandler
- type ErrorStatusCode
- type GetUserParams
- type Handler
- type Middleware
- type OperationName
- type Option
- type PingOK
- 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 User
- func (s *User) Decode(d *jx.Decoder) error
- func (s *User) Encode(e *jx.Encoder)
- func (s *User) GetEmail() string
- func (s *User) GetID() uuid.UUID
- func (s *User) GetIconUrl() string
- func (s *User) GetName() string
- func (s *User) MarshalJSON() ([]byte, error)
- func (s *User) SetEmail(val string)
- func (s *User) SetID(val uuid.UUID)
- func (s *User) SetIconUrl(val string)
- func (s *User) SetName(val string)
- func (s *User) UnmarshalJSON(data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateUser ¶
Ref: #/components/responses/CreateUser
func (*CreateUser) Decode ¶
func (s *CreateUser) Decode(d *jx.Decoder) error
Decode decodes CreateUser from json.
func (*CreateUser) Encode ¶
func (s *CreateUser) Encode(e *jx.Encoder)
Encode implements json.Marshaler.
func (*CreateUser) MarshalJSON ¶
func (s *CreateUser) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (*CreateUser) UnmarshalJSON ¶
func (s *CreateUser) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
type CreateUserReq ¶
func (*CreateUserReq) Decode ¶
func (s *CreateUserReq) Decode(d *jx.Decoder) error
Decode decodes CreateUserReq from json.
func (*CreateUserReq) Encode ¶
func (s *CreateUserReq) Encode(e *jx.Encoder)
Encode implements json.Marshaler.
func (*CreateUserReq) GetEmail ¶
func (s *CreateUserReq) GetEmail() string
GetEmail returns the value of Email.
func (*CreateUserReq) GetName ¶
func (s *CreateUserReq) GetName() string
GetName returns the value of Name.
func (*CreateUserReq) MarshalJSON ¶
func (s *CreateUserReq) MarshalJSON() ([]byte, error)
MarshalJSON implements stdjson.Marshaler.
func (*CreateUserReq) SetEmail ¶
func (s *CreateUserReq) SetEmail(val string)
SetEmail sets the value of Email.
func (*CreateUserReq) SetName ¶
func (s *CreateUserReq) SetName(val string)
SetName sets the value of Name.
func (*CreateUserReq) UnmarshalJSON ¶
func (s *CreateUserReq) UnmarshalJSON(data []byte) error
UnmarshalJSON implements stdjson.Unmarshaler.
func (*CreateUserReq) Validate ¶
func (s *CreateUserReq) Validate() error
type Error ¶
type Error struct {
Message string `json:"message"`
}
Ref: #/components/responses/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 GetUserParams ¶
GetUserParams is parameters of getUser operation.
type Handler ¶
type Handler interface {
// CreateUser implements createUser operation.
//
// Create a user.
//
// POST /api/v1/users
CreateUser(ctx context.Context, req *CreateUserReq) (*CreateUser, error)
// GetUser implements getUser operation.
//
// Get user by ID.
//
// GET /api/v1/users/{userID}
GetUser(ctx context.Context, params GetUserParams) (*User, error)
// GetUsers implements getUsers operation.
//
// Get all users.
//
// GET /api/v1/users
GetUsers(ctx context.Context) ([]User, error)
// Ping implements ping operation.
//
// Ping API.
//
// GET /api/v1/ping
Ping(ctx context.Context) (PingOK, 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 OperationName ¶
type OperationName = string
OperationName is the ogen operation name
const ( CreateUserOperation OperationName = "CreateUser" GetUserOperation OperationName = "GetUser" GetUsersOperation OperationName = "GetUsers" PingOperation OperationName = "Ping" )
type Route ¶
type Route struct {
// contains filtered or unexported fields
}
Route is route object.
func (Route) OperationGroup ¶
OperationGroup returns the x-ogen-operation-group value.
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 User ¶
type User struct {
ID uuid.UUID `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
IconUrl string `json:"iconUrl"`
}
Ref: #/components/schemas/User
func (*User) GetIconUrl ¶
GetIconUrl returns the value of IconUrl.
func (*User) MarshalJSON ¶
MarshalJSON implements stdjson.Marshaler.
func (*User) SetIconUrl ¶
SetIconUrl sets the value of IconUrl.
func (*User) UnmarshalJSON ¶
UnmarshalJSON implements stdjson.Unmarshaler.