http
import "github.com/prescriptoo/prescriptoo-api/services/identity/internal/presentation/http"Package http exposes the identity API through Huma.
Index
- type ChangePasswordInput
- type ChangePasswordOutput
- type ForgotPasswordInput
- type ForgotPasswordOutput
- type GetMeInput
- type GetMeOutput
- type Handler
- type ListSessionsInput
- type ListSessionsOutput
- type LoginInput
- type LoginOutput
- type LogoutAllInput
- type LogoutAllOutput
- type LogoutInput
- type LogoutOutput
- type RefreshInput
- type RefreshOutput
- type RegisterInput
- type RegisterOutput
- type RequestEmailVerificationInput
- type RequestEmailVerificationOutput
- type ResetPasswordInput
- type ResetPasswordOutput
- type RevokeSessionInput
- type RevokeSessionOutput
- type UpdateMeInput
- type UpdateMeOutput
- type VerifyEmailInput
- type VerifyEmailOutput
type ChangePasswordInput
ChangePasswordInput carries authentication and the current and replacement passwords.
type ChangePasswordInput struct {
Authorization string `header:"Authorization" hidden:"true"`
Body struct {
CurrentPassword string `json:"currentPassword" minLength:"1" maxLength:"128" writeOnly:"true" example:"ExamplePassword123!" doc:"Current password, required to authorize the change."`
NewPassword string `json:"newPassword" minLength:"8" maxLength:"128" writeOnly:"true" example:"NewExamplePassword123!" doc:"Replacement password, 8–128 characters."`
}
}type ChangePasswordOutput
ChangePasswordOutput represents a successful password change with an empty data object.
type ChangePasswordOutput struct {
Body types.SuccessResponse[types.Empty]
}type ForgotPasswordInput
ForgotPasswordInput contains the email address for a password reset request.
type ForgotPasswordInput struct {
Body struct {
Email string `json:"email" format:"email" maxLength:"255" example:"user@example.com" doc:"Email to which the token should be sent, if eligible."`
}
}type ForgotPasswordOutput
ForgotPasswordOutput wraps the password reset request acknowledgment.
type ForgotPasswordOutput struct {
Body types.SuccessResponse[types.Empty]
}type GetMeInput
GetMeInput carries authentication for retrieving the current user's profile.
type GetMeInput struct {
Authorization string `header:"Authorization" hidden:"true"`
}type GetMeOutput
GetMeOutput wraps the current user's profile.
type GetMeOutput struct {
Body types.SuccessResponse[usecase.User]
}type Handler
Handler wires each endpoint to its dedicated application use case.
type Handler struct {
// contains filtered or unexported fields
}func NewHandler
func NewHandler(auth *usecase.Auth) *HandlerNewHandler wires HTTP operations to their application use cases.
func (*Handler) RegisterHuma
func (h *Handler) RegisterHuma(api huma.API)RegisterHuma registers both the routes and their OpenAPI contracts.
type ListSessionsInput
ListSessionsInput carries authentication for listing the current user's sessions.
type ListSessionsInput struct {
Authorization string `header:"Authorization" hidden:"true"`
}type ListSessionsOutput
ListSessionsOutput wraps the current user's active sessions.
type ListSessionsOutput struct {
Body types.SuccessResponse[[]usecase.Session]
}type LoginInput
LoginInput contains the email and password used to authenticate an account.
type LoginInput struct {
Body struct {
Email string `json:"email" format:"email" maxLength:"255" example:"user@example.com" doc:"Registered email address."`
Password string `json:"password" minLength:"1" maxLength:"128" writeOnly:"true" example:"ExamplePassword123!" doc:"Current account password."`
}
}type LoginOutput
LoginOutput wraps the access and refresh tokens issued at login.
type LoginOutput struct {
Body types.SuccessResponse[usecase.TokenPair]
}type LogoutAllInput
LogoutAllInput carries authentication for revoking all of the user's sessions.
type LogoutAllInput struct {
Authorization string `header:"Authorization" hidden:"true"`
}type LogoutAllOutput
LogoutAllOutput represents a successful logout from all sessions with an empty data object.
type LogoutAllOutput struct {
Body types.SuccessResponse[types.Empty]
}type LogoutInput
LogoutInput contains the refresh token identifying the session to revoke.
type LogoutInput struct {
Body struct {
RefreshToken string `json:"refreshToken" minLength:"1" maxLength:"512" writeOnly:"true" example:"refresh-token-example" doc:"Secret refresh token issued by login or the most recent refresh."`
}
}type LogoutOutput
LogoutOutput represents a successful logout with an empty data object.
type LogoutOutput struct {
Body types.SuccessResponse[types.Empty]
}type RefreshInput
RefreshInput contains the refresh token to exchange for new credentials.
type RefreshInput struct {
Body struct {
RefreshToken string `json:"refreshToken" minLength:"1" maxLength:"512" writeOnly:"true" example:"refresh-token-example" doc:"Secret refresh token issued by login or the most recent refresh."`
}
}type RefreshOutput
RefreshOutput wraps the replacement access and refresh tokens.
type RefreshOutput struct {
Body types.SuccessResponse[usecase.TokenPair]
}type RegisterInput
RegisterInput contains the email, password, and name for a new account.
type RegisterInput struct {
Body struct {
Email string `json:"email" format:"email" maxLength:"255" example:"user@example.com" doc:"Unique account email address."`
Password string `json:"password" minLength:"8" maxLength:"128" writeOnly:"true" example:"ExamplePassword123!" doc:"Account password, 8–128 characters."`
Name string `json:"name" minLength:"1" maxLength:"255" example:"Jane Doe" doc:"User display name."`
}
}type RegisterOutput
RegisterOutput wraps the newly registered user's profile.
type RegisterOutput struct {
Body types.SuccessResponse[usecase.User]
}type RequestEmailVerificationInput
RequestEmailVerificationInput contains the email address for a verification request.
type RequestEmailVerificationInput struct {
Body struct {
Email string `json:"email" format:"email" maxLength:"255" example:"user@example.com" doc:"Email to which the token should be sent, if eligible."`
}
}type RequestEmailVerificationOutput
RequestEmailVerificationOutput wraps the email verification request acknowledgment.
type RequestEmailVerificationOutput struct {
Body types.SuccessResponse[types.Empty]
}type ResetPasswordInput
ResetPasswordInput contains a password reset token and the replacement password.
type ResetPasswordInput struct {
Body struct {
Token string `json:"token" minLength:"1" maxLength:"512" writeOnly:"true" example:"single-use-reset-token-example" doc:"Single-use password-reset token received by email."`
NewPassword string `json:"newPassword" minLength:"8" maxLength:"128" writeOnly:"true" example:"NewExamplePassword123!" doc:"Replacement password, 8–128 characters."`
}
}type ResetPasswordOutput
ResetPasswordOutput represents a successful password reset with an empty data object.
type ResetPasswordOutput struct {
Body types.SuccessResponse[types.Empty]
}type RevokeSessionInput
RevokeSessionInput carries authentication and the ID of the session to revoke.
type RevokeSessionInput struct {
Authorization string `header:"Authorization" hidden:"true"`
SessionID string `path:"sessionId" format:"uuid" example:"cd20a97b-5107-44db-bf05-66c86c54aa91" doc:"ID of a session owned by the authenticated user."`
}type RevokeSessionOutput
RevokeSessionOutput represents successful session revocation with an empty data object.
type RevokeSessionOutput struct {
Body types.SuccessResponse[types.Empty]
}type UpdateMeInput
UpdateMeInput carries authentication and replacement profile details.
type UpdateMeInput struct {
Authorization string `header:"Authorization" hidden:"true"`
Body struct {
Name string `json:"name" minLength:"1" maxLength:"255" example:"Jane Doe" doc:"Replacement display name."`
Phone string `json:"phone,omitempty" maxLength:"20" example:"+8801700000000" doc:"Replacement phone number. Omit or send an empty string to clear."`
AvatarURL string `json:"avatarUrl,omitempty" maxLength:"2048" example:"https://example.com/avatar.png" doc:"Replacement absolute HTTP or HTTPS avatar URL. Omit or send an empty string to clear."`
}
}type UpdateMeOutput
UpdateMeOutput wraps the updated user profile.
type UpdateMeOutput struct {
Body types.SuccessResponse[usecase.User]
}type VerifyEmailInput
VerifyEmailInput contains the email verification token to confirm.
type VerifyEmailInput struct {
Body struct {
Token string `json:"token" minLength:"1" maxLength:"512" writeOnly:"true" example:"single-use-token-example" doc:"Single-use verification token received by email."`
}
}type VerifyEmailOutput
VerifyEmailOutput represents successful email verification with an empty data object.
type VerifyEmailOutput struct {
Body types.SuccessResponse[types.Empty]
}Generated by gomarkdoc