responses

package
v0.0.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthResponse

type AuthResponse struct {
	User         *user.User       `json:"user"`
	Session      *session.Session `json:"session,omitempty"`
	Token        string           `json:"token,omitempty"`
	RequireTwoFA bool             `json:"requireTwofa,omitempty"`
}

AuthResponse represents a successful authentication response with user, session, and token

type ErrorResponse

type ErrorResponse = errs.AuthsomeError

ErrorResponse is an alias to errs.AuthsomeError for consistency across the codebase. Instead of using &ErrorResponse{Error: "message"}, use the errs package constructors:

  • errs.New(code, message, httpStatus)
  • errs.BadRequest(message)
  • errs.Unauthorized()
  • errs.NotFound(message)
  • etc.

See internal/errs/errors.go for all available error constructors.

type MessageResponse

type MessageResponse struct {
	Message string `json:"message"`
}

MessageResponse represents a simple message response

type RefreshSessionResponse added in v0.0.3

type RefreshSessionResponse struct {
	User             *user.User       `json:"user"`
	Session          *session.Session `json:"session"`
	AccessToken      string           `json:"accessToken"`
	RefreshToken     string           `json:"refreshToken"`
	ExpiresAt        string           `json:"expiresAt"`
	RefreshExpiresAt string           `json:"refreshExpiresAt"`
}

RefreshSessionResponse represents a refresh token response

type ResponseWithWarnings added in v0.0.2

type ResponseWithWarnings struct {
	Data     interface{} `json:"data"`
	Warnings []Warning   `json:"warnings,omitempty"`
}

ResponseWithWarnings wraps any response data with optional warnings

func NewResponseWithWarnings added in v0.0.2

func NewResponseWithWarnings(data interface{}, warnings ...Warning) *ResponseWithWarnings

NewResponseWithWarnings creates a new response with warnings

func (*ResponseWithWarnings) AddWarning added in v0.0.2

func (r *ResponseWithWarnings) AddWarning(code, message string)

AddWarning adds a warning to the response

func (*ResponseWithWarnings) HasWarnings added in v0.0.2

func (r *ResponseWithWarnings) HasWarnings() bool

HasWarnings returns true if the response has any warnings

type SessionResponse

type SessionResponse struct {
	User    *user.User       `json:"user"`
	Session *session.Session `json:"session,omitempty"`
}

SessionResponse represents a session query response

type StatusResponse

type StatusResponse struct {
	Status string `json:"status"`
}

StatusResponse represents a status response

type SuccessResponse

type SuccessResponse struct {
	Success bool `json:"success"`
}

SuccessResponse represents a success boolean response

type TwoFARequiredResponse

type TwoFARequiredResponse struct {
	User         *user.User `json:"user"`
	RequireTwoFA bool       `json:"requireTwofa,omitempty"`
	DeviceID     string     `json:"deviceId,omitempty"`
}

TwoFARequiredResponse indicates that two-factor authentication is required

type VerifyResponse

type VerifyResponse struct {
	User    interface{} `json:"user"`
	Session interface{} `json:"session"`
	Token   string      `json:"token,omitempty"`
}

VerifyResponse represents a verification response (used by emailotp, magiclink, phone plugins) Uses interface{} for flexibility across different plugin implementations

type Warning added in v0.0.2

type Warning struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

Warning represents a single warning message

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL