Documentation
¶
Overview ¶
Package api provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT.
Index ¶
- Constants
- Variables
- func GetSwagger() (swagger *openapi3.T, err error)
- func Handler(si ServerInterface) http.Handler
- func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler
- func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler
- func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- type AuthResponse
- type BadRequest
- type ChiServerOptions
- type CreateUserJSONRequestBody
- type Error
- type Forbidden
- type InvalidParamFormatError
- type ListUsersParams
- type LoginRequest
- type LoginUserJSONRequestBody
- type MiddlewareFunc
- type NotFound
- type PasswordResetConfirmation
- type PasswordResetRequest
- type RefreshTokenJSONRequestBody
- type RefreshTokenRequest
- type RequestPasswordResetJSONRequestBody
- type RequiredHeaderError
- type RequiredParamError
- type ResetPasswordJSONRequestBody
- type Server
- func (s *Server) CreateUser(w http.ResponseWriter, r *http.Request)
- func (s *Server) DeleteUser(w http.ResponseWriter, r *http.Request, ID openapi_types.UUID)
- func (s *Server) GetCurrentUser(w http.ResponseWriter, r *http.Request)
- func (s *Server) ListUsers(w http.ResponseWriter, r *http.Request, params ListUsersParams)
- func (s *Server) LoginUser(w http.ResponseWriter, r *http.Request)
- func (s *Server) LogoutUser(w http.ResponseWriter, r *http.Request)
- func (s *Server) LookupUser(w http.ResponseWriter, r *http.Request, ID openapi_types.UUID)
- func (s *Server) RefreshToken(w http.ResponseWriter, r *http.Request)
- func (s *Server) RequestPasswordReset(w http.ResponseWriter, r *http.Request)
- func (s *Server) ResetPassword(w http.ResponseWriter, r *http.Request, token string)
- func (s *Server) UpdateCurrentUser(w http.ResponseWriter, r *http.Request)
- func (s *Server) UpdateUser(w http.ResponseWriter, r *http.Request, ID openapi_types.UUID)
- func (s *Server) VerifyAccount(w http.ResponseWriter, r *http.Request, token string)
- type ServerError
- type ServerInterface
- type ServerInterfaceWrapper
- func (siw *ServerInterfaceWrapper) CreateUser(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) DeleteUser(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetCurrentUser(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) ListUsers(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) LoginUser(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) LogoutUser(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) LookupUser(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) RefreshToken(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) RequestPasswordReset(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) ResetPassword(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) UpdateCurrentUser(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) UpdateUser(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) VerifyAccount(w http.ResponseWriter, r *http.Request)
- type TooManyValuesForParamError
- type Unauthorized
- type UnescapedCookieParamError
- type Unimplemented
- func (_ Unimplemented) CreateUser(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) DeleteUser(w http.ResponseWriter, r *http.Request, userId openapi_types.UUID)
- func (_ Unimplemented) GetCurrentUser(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) ListUsers(w http.ResponseWriter, r *http.Request, params ListUsersParams)
- func (_ Unimplemented) LoginUser(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) LogoutUser(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) LookupUser(w http.ResponseWriter, r *http.Request, userId openapi_types.UUID)
- func (_ Unimplemented) RefreshToken(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) RequestPasswordReset(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) ResetPassword(w http.ResponseWriter, r *http.Request, token string)
- func (_ Unimplemented) UpdateCurrentUser(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) UpdateUser(w http.ResponseWriter, r *http.Request, userId openapi_types.UUID)
- func (_ Unimplemented) VerifyAccount(w http.ResponseWriter, r *http.Request, token string)
- type UnmarshalingParamError
- type UpdateCurrentUserJSONRequestBody
- type UpdateUserJSONRequestBody
- type User
- type UserCreate
- type UserRole
- type UserStatus
- type UserUpdate
- type UserUpdateCurrent
- type UserUpdateRole
- type UserUpdateStatus
Constants ¶
const (
BearerAuthScopes = "BearerAuth.Scopes"
)
Variables ¶
var ErrInvalidToken = errors.New("invalid or expired token")
Functions ¶
func GetSwagger ¶
GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.
func Handler ¶
func Handler(si ServerInterface) http.Handler
Handler creates http.Handler with routing matching OpenAPI spec.
func HandlerFromMux ¶
func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler
HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.
func HandlerWithOptions ¶
func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
HandlerWithOptions creates http.Handler with additional options
Types ¶
type AuthResponse ¶
type AuthResponse struct {
// AccessToken JWT access token
AccessToken string `json:"accessToken"`
// ExpiresIn Token expiration time in seconds
ExpiresIn int `json:"expiresIn"`
// RefreshToken JWT refresh token
RefreshToken string `json:"refreshToken"`
}
AuthResponse defines model for AuthResponse.
func (AuthResponse) Render ¶
func (c AuthResponse) Render(w http.ResponseWriter, r *http.Request) error
type ChiServerOptions ¶
type ChiServerOptions struct {
BaseURL string
BaseRouter chi.Router
Middlewares []MiddlewareFunc
ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}
type CreateUserJSONRequestBody ¶
type CreateUserJSONRequestBody = UserCreate
CreateUserJSONRequestBody defines body for CreateUser for application/json ContentType.
type Error ¶
type Error struct {
Error *string `json:"error,omitempty"`
Status string `json:"status"`
StatusCode int32 `json:"statusCode"`
}
Error defines model for Error.
type InvalidParamFormatError ¶
func (*InvalidParamFormatError) Error ¶
func (e *InvalidParamFormatError) Error() string
func (*InvalidParamFormatError) Unwrap ¶
func (e *InvalidParamFormatError) Unwrap() error
type ListUsersParams ¶
type ListUsersParams struct {
Offset *int `form:"offset,omitempty" json:"offset,omitempty"`
Limit *int `form:"limit,omitempty" json:"limit,omitempty"`
}
ListUsersParams defines parameters for ListUsers.
type LoginRequest ¶
type LoginRequest struct {
// Email User's email address
Email openapi_types.Email `json:"email"`
// Password User's password
Password string `json:"password"`
}
LoginRequest defines model for LoginRequest.
type LoginUserJSONRequestBody ¶
type LoginUserJSONRequestBody = LoginRequest
LoginUserJSONRequestBody defines body for LoginUser for application/json ContentType.
type PasswordResetConfirmation ¶
type PasswordResetConfirmation struct {
// ConfirmPassword Confirm the new password
ConfirmPassword string `json:"confirmPassword"`
// NewPassword New password to set
NewPassword string `json:"newPassword"`
}
PasswordResetConfirmation defines model for PasswordResetConfirmation.
type PasswordResetRequest ¶
type PasswordResetRequest struct {
// Email The email address of the account to reset
Email openapi_types.Email `json:"email"`
}
PasswordResetRequest defines model for PasswordResetRequest.
type RefreshTokenJSONRequestBody ¶
type RefreshTokenJSONRequestBody = RefreshTokenRequest
RefreshTokenJSONRequestBody defines body for RefreshToken for application/json ContentType.
type RefreshTokenRequest ¶
type RefreshTokenRequest struct {
// RefreshToken JWT refresh token
RefreshToken string `json:"refreshToken"`
}
RefreshTokenRequest defines model for RefreshTokenRequest.
type RequestPasswordResetJSONRequestBody ¶
type RequestPasswordResetJSONRequestBody = PasswordResetRequest
RequestPasswordResetJSONRequestBody defines body for RequestPasswordReset for application/json ContentType.
type RequiredHeaderError ¶
func (*RequiredHeaderError) Error ¶
func (e *RequiredHeaderError) Error() string
func (*RequiredHeaderError) Unwrap ¶
func (e *RequiredHeaderError) Unwrap() error
type RequiredParamError ¶
type RequiredParamError struct {
ParamName string
}
func (*RequiredParamError) Error ¶
func (e *RequiredParamError) Error() string
type ResetPasswordJSONRequestBody ¶
type ResetPasswordJSONRequestBody = PasswordResetConfirmation
ResetPasswordJSONRequestBody defines body for ResetPassword for application/json ContentType.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) CreateUser ¶
func (s *Server) CreateUser(w http.ResponseWriter, r *http.Request)
func (*Server) DeleteUser ¶
func (s *Server) DeleteUser(w http.ResponseWriter, r *http.Request, ID openapi_types.UUID)
func (*Server) GetCurrentUser ¶
func (s *Server) GetCurrentUser(w http.ResponseWriter, r *http.Request)
func (*Server) ListUsers ¶
func (s *Server) ListUsers(w http.ResponseWriter, r *http.Request, params ListUsersParams)
func (*Server) LogoutUser ¶
func (s *Server) LogoutUser(w http.ResponseWriter, r *http.Request)
func (*Server) LookupUser ¶
func (s *Server) LookupUser(w http.ResponseWriter, r *http.Request, ID openapi_types.UUID)
func (*Server) RefreshToken ¶
func (s *Server) RefreshToken(w http.ResponseWriter, r *http.Request)
func (*Server) RequestPasswordReset ¶
func (s *Server) RequestPasswordReset(w http.ResponseWriter, r *http.Request)
func (*Server) ResetPassword ¶
func (*Server) UpdateCurrentUser ¶
func (s *Server) UpdateCurrentUser(w http.ResponseWriter, r *http.Request)
func (*Server) UpdateUser ¶
func (s *Server) UpdateUser(w http.ResponseWriter, r *http.Request, ID openapi_types.UUID)
func (*Server) VerifyAccount ¶
type ServerInterface ¶
type ServerInterface interface {
// User login
// (POST /auth/login)
LoginUser(w http.ResponseWriter, r *http.Request)
// User logout
// (POST /auth/logout)
LogoutUser(w http.ResponseWriter, r *http.Request)
// Request password reset
// (POST /auth/password-reset)
RequestPasswordReset(w http.ResponseWriter, r *http.Request)
// Reset password
// (POST /auth/password-reset/{token})
ResetPassword(w http.ResponseWriter, r *http.Request, token string)
// Refresh access token
// (POST /auth/refresh)
RefreshToken(w http.ResponseWriter, r *http.Request)
// Verify user account
// (GET /auth/verify/{token})
VerifyAccount(w http.ResponseWriter, r *http.Request, token string)
// Get all users
// (GET /users)
ListUsers(w http.ResponseWriter, r *http.Request, params ListUsersParams)
// Create a new user
// (POST /users)
CreateUser(w http.ResponseWriter, r *http.Request)
// Get current user
// (GET /users/me)
GetCurrentUser(w http.ResponseWriter, r *http.Request)
// Update current user
// (PUT /users/me)
UpdateCurrentUser(w http.ResponseWriter, r *http.Request)
// Delete user
// (DELETE /users/{userId})
DeleteUser(w http.ResponseWriter, r *http.Request, userId openapi_types.UUID)
// Get user by ID
// (GET /users/{userId})
LookupUser(w http.ResponseWriter, r *http.Request, userId openapi_types.UUID)
// Update user
// (PUT /users/{userId})
UpdateUser(w http.ResponseWriter, r *http.Request, userId openapi_types.UUID)
}
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct {
Handler ServerInterface
HandlerMiddlewares []MiddlewareFunc
ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}
ServerInterfaceWrapper converts contexts to parameters.
func (*ServerInterfaceWrapper) CreateUser ¶
func (siw *ServerInterfaceWrapper) CreateUser(w http.ResponseWriter, r *http.Request)
CreateUser operation middleware
func (*ServerInterfaceWrapper) DeleteUser ¶
func (siw *ServerInterfaceWrapper) DeleteUser(w http.ResponseWriter, r *http.Request)
DeleteUser operation middleware
func (*ServerInterfaceWrapper) GetCurrentUser ¶
func (siw *ServerInterfaceWrapper) GetCurrentUser(w http.ResponseWriter, r *http.Request)
GetCurrentUser operation middleware
func (*ServerInterfaceWrapper) ListUsers ¶
func (siw *ServerInterfaceWrapper) ListUsers(w http.ResponseWriter, r *http.Request)
ListUsers operation middleware
func (*ServerInterfaceWrapper) LoginUser ¶
func (siw *ServerInterfaceWrapper) LoginUser(w http.ResponseWriter, r *http.Request)
LoginUser operation middleware
func (*ServerInterfaceWrapper) LogoutUser ¶
func (siw *ServerInterfaceWrapper) LogoutUser(w http.ResponseWriter, r *http.Request)
LogoutUser operation middleware
func (*ServerInterfaceWrapper) LookupUser ¶
func (siw *ServerInterfaceWrapper) LookupUser(w http.ResponseWriter, r *http.Request)
LookupUser operation middleware
func (*ServerInterfaceWrapper) RefreshToken ¶
func (siw *ServerInterfaceWrapper) RefreshToken(w http.ResponseWriter, r *http.Request)
RefreshToken operation middleware
func (*ServerInterfaceWrapper) RequestPasswordReset ¶
func (siw *ServerInterfaceWrapper) RequestPasswordReset(w http.ResponseWriter, r *http.Request)
RequestPasswordReset operation middleware
func (*ServerInterfaceWrapper) ResetPassword ¶
func (siw *ServerInterfaceWrapper) ResetPassword(w http.ResponseWriter, r *http.Request)
ResetPassword operation middleware
func (*ServerInterfaceWrapper) UpdateCurrentUser ¶
func (siw *ServerInterfaceWrapper) UpdateCurrentUser(w http.ResponseWriter, r *http.Request)
UpdateCurrentUser operation middleware
func (*ServerInterfaceWrapper) UpdateUser ¶
func (siw *ServerInterfaceWrapper) UpdateUser(w http.ResponseWriter, r *http.Request)
UpdateUser operation middleware
func (*ServerInterfaceWrapper) VerifyAccount ¶
func (siw *ServerInterfaceWrapper) VerifyAccount(w http.ResponseWriter, r *http.Request)
VerifyAccount operation middleware
type TooManyValuesForParamError ¶
func (*TooManyValuesForParamError) Error ¶
func (e *TooManyValuesForParamError) Error() string
type UnescapedCookieParamError ¶
func (*UnescapedCookieParamError) Error ¶
func (e *UnescapedCookieParamError) Error() string
func (*UnescapedCookieParamError) Unwrap ¶
func (e *UnescapedCookieParamError) Unwrap() error
type Unimplemented ¶
type Unimplemented struct{}
func (Unimplemented) CreateUser ¶
func (_ Unimplemented) CreateUser(w http.ResponseWriter, r *http.Request)
Create a new user (POST /users)
func (Unimplemented) DeleteUser ¶
func (_ Unimplemented) DeleteUser(w http.ResponseWriter, r *http.Request, userId openapi_types.UUID)
Delete user (DELETE /users/{userId})
func (Unimplemented) GetCurrentUser ¶
func (_ Unimplemented) GetCurrentUser(w http.ResponseWriter, r *http.Request)
Get current user (GET /users/me)
func (Unimplemented) ListUsers ¶
func (_ Unimplemented) ListUsers(w http.ResponseWriter, r *http.Request, params ListUsersParams)
Get all users (GET /users)
func (Unimplemented) LoginUser ¶
func (_ Unimplemented) LoginUser(w http.ResponseWriter, r *http.Request)
User login (POST /auth/login)
func (Unimplemented) LogoutUser ¶
func (_ Unimplemented) LogoutUser(w http.ResponseWriter, r *http.Request)
User logout (POST /auth/logout)
func (Unimplemented) LookupUser ¶
func (_ Unimplemented) LookupUser(w http.ResponseWriter, r *http.Request, userId openapi_types.UUID)
Get user by ID (GET /users/{userId})
func (Unimplemented) RefreshToken ¶
func (_ Unimplemented) RefreshToken(w http.ResponseWriter, r *http.Request)
Refresh access token (POST /auth/refresh)
func (Unimplemented) RequestPasswordReset ¶
func (_ Unimplemented) RequestPasswordReset(w http.ResponseWriter, r *http.Request)
Request password reset (POST /auth/password-reset)
func (Unimplemented) ResetPassword ¶
func (_ Unimplemented) ResetPassword(w http.ResponseWriter, r *http.Request, token string)
Reset password (POST /auth/password-reset/{token})
func (Unimplemented) UpdateCurrentUser ¶
func (_ Unimplemented) UpdateCurrentUser(w http.ResponseWriter, r *http.Request)
Update current user (PUT /users/me)
func (Unimplemented) UpdateUser ¶
func (_ Unimplemented) UpdateUser(w http.ResponseWriter, r *http.Request, userId openapi_types.UUID)
Update user (PUT /users/{userId})
func (Unimplemented) VerifyAccount ¶
func (_ Unimplemented) VerifyAccount(w http.ResponseWriter, r *http.Request, token string)
Verify user account (GET /auth/verify/{token})
type UnmarshalingParamError ¶
func (*UnmarshalingParamError) Error ¶
func (e *UnmarshalingParamError) Error() string
func (*UnmarshalingParamError) Unwrap ¶
func (e *UnmarshalingParamError) Unwrap() error
type UpdateCurrentUserJSONRequestBody ¶
type UpdateCurrentUserJSONRequestBody = UserUpdateCurrent
UpdateCurrentUserJSONRequestBody defines body for UpdateCurrentUser for application/json ContentType.
type UpdateUserJSONRequestBody ¶
type UpdateUserJSONRequestBody = UserUpdate
UpdateUserJSONRequestBody defines body for UpdateUser for application/json ContentType.
type User ¶
type User struct {
// Email User's email address
Email openapi_types.Email `json:"email"`
// FirstName User's first name
FirstName string `json:"firstName"`
// Id Unique identifier for the user
Id openapi_types.UUID `json:"id"`
// LastName User's last name
LastName string `json:"lastName"`
// Role User's role in the system
Role UserRole `json:"role"`
// Status User's account status
Status UserStatus `json:"status"`
}
User defines model for User.
type UserCreate ¶
type UserCreate struct {
// Email User's email address
Email openapi_types.Email `json:"email"`
// FirstName User's first name
FirstName string `json:"firstName"`
// LastName User's last name
LastName string `json:"lastName"`
// Password User's password
Password string `json:"password"`
}
UserCreate defines model for UserCreate.
type UserStatus ¶
type UserStatus string
UserStatus User's account status
const ( UserStatusActive UserStatus = "active" UserStatusBanned UserStatus = "banned" UserStatusPending UserStatus = "pending" )
Defines values for UserStatus.
type UserUpdate ¶
type UserUpdate struct {
// Email User's email address
Email *openapi_types.Email `json:"email,omitempty"`
// FirstName User's first name
FirstName *string `json:"firstName,omitempty"`
// LastName User's last name
LastName *string `json:"lastName,omitempty"`
// Role User's role in the system
Role *UserUpdateRole `json:"role,omitempty"`
// Status User's account status
Status *UserUpdateStatus `json:"status,omitempty"`
}
UserUpdate defines model for UserUpdate.
type UserUpdateCurrent ¶
type UserUpdateCurrent struct {
// CurrentPassword User's current password (required when changing password)
CurrentPassword string `json:"currentPassword"`
// Email User's email address
Email *openapi_types.Email `json:"email,omitempty"`
// FirstName User's first name
FirstName *string `json:"firstName,omitempty"`
// LastName User's last name
LastName *string `json:"lastName,omitempty"`
// Password User's new password
Password *string `json:"password,omitempty"`
}
UserUpdateCurrent defines model for UserUpdateCurrent.
type UserUpdateRole ¶
type UserUpdateRole string
UserUpdateRole User's role in the system
const ( UserUpdateRoleAdmin UserUpdateRole = "admin" UserUpdateRoleUser UserUpdateRole = "user" )
Defines values for UserUpdateRole.
type UserUpdateStatus ¶
type UserUpdateStatus string
UserUpdateStatus User's account status
const ( UserUpdateStatusActive UserUpdateStatus = "active" UserUpdateStatusBanned UserUpdateStatus = "banned" UserUpdateStatusPending UserUpdateStatus = "pending" )
Defines values for UserUpdateStatus.