model

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2024 License: Apache-2.0 Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidModel = errors.New("invalid model")

ErrInvalidModel is returned when a model is invalid.

Functions

This section is empty.

Types

type AdminCreateParams added in v0.6.0

type AdminCreateParams struct {
	APIKey                     uuid.UUID                  `json:"apiKey"`
	Aud                        uuid.UUID                  `json:"aud"`
	UUID                       uuid.UUID                  `json:"uuid"`
	ServiceAccountCreateParams ServiceAccountCreateParams `json:"serviceAccountCreateParams"`
}

func (AdminCreateParams) Validate added in v0.6.0

type Error

type Error struct {
	Code            int             `json:"code"`
	Message         string          `json:"message"`
	RequestMetadata RequestMetadata `json:"requestMetadata"`
}

Error is the model for an error.

func NewError

func NewError(ctx context.Context, code int, message string) Error

NewError creates a new error.

type JWTCreateParams added in v0.6.0

type JWTCreateParams struct {
	Alg             string `json:"alg"`
	Claims          any    `json:"claims"`
	LifespanSeconds int    `json:"lifespanSeconds"`
}

func (JWTCreateParams) Validate added in v0.6.0

func (j JWTCreateParams) Validate(config Validation) (ValidJWTCreateParams, error)

type JWTCreateRequest

type JWTCreateRequest struct {
	JWTCreateParams JWTCreateParams `json:"jwtCreateParams"`
}

func (JWTCreateRequest) Validate

type JWTCreateResponse

type JWTCreateResponse struct {
	JWTCreateResults JWTCreateResults `json:"jwtCreateResults"`
	RequestMetadata  RequestMetadata  `json:"requestMetadata"`
}

type JWTCreateResults

type JWTCreateResults struct {
	JWT string `json:"jwt"`
}

type JWTValidateParams added in v0.6.0

type JWTValidateParams struct {
	JWT string `json:"jwt"`
}

func (JWTValidateParams) Validate added in v0.6.0

type JWTValidateRequest

type JWTValidateRequest struct {
	JWTValidateParams JWTValidateParams `json:"jwtValidateParams"`
}

func (JWTValidateRequest) Validate

type JWTValidateResponse

type JWTValidateResponse struct {
	JWTValidateResults JWTValidateResults `json:"jwtValidateResults"`
	RequestMetadata    RequestMetadata    `json:"requestMetadata"`
}

type JWTValidateResults

type JWTValidateResults struct {
	JWTClaims json.RawMessage `json:"claims"`
}

type MagicLinkCreateParams added in v0.6.0

type MagicLinkCreateParams struct {
	JWTCreateParams  JWTCreateParams `json:"jwtCreateParams"`
	LifespanSeconds  int             `json:"lifespanSeconds"`
	RedirectQueryKey string          `json:"redirectQueryKey"`
	RedirectURL      string          `json:"redirectURL"`
}

func (MagicLinkCreateParams) Validate added in v0.6.0

type MagicLinkCreateRequest added in v0.6.0

type MagicLinkCreateRequest struct {
	MagicLinkCreateParams MagicLinkCreateParams `json:"magicLinkCreateParams"`
}

func (MagicLinkCreateRequest) Validate added in v0.6.0

type MagicLinkCreateResponse added in v0.6.0

type MagicLinkCreateResponse struct {
	MagicLinkCreateResults MagicLinkCreateResults `json:"magicLinkCreateResults"`
	RequestMetadata        RequestMetadata        `json:"requestMetadata"`
}

type MagicLinkCreateResults added in v0.6.0

type MagicLinkCreateResults struct {
	MagicLink string `json:"magicLink"`
	Secret    string `json:"secret"`
}

type MagicLinkEmailCreateParams added in v0.6.0

type MagicLinkEmailCreateParams struct {
	ButtonText   string `json:"buttonText"`
	Greeting     string `json:"greeting"`
	LogoClickURL string `json:"logoClickURL"`
	LogoImageURL string `json:"logoImageURL"`
	ServiceName  string `json:"serviceName"`
	Subject      string `json:"subject"`
	SubTitle     string `json:"subTitle"`
	Title        string `json:"title"`
	ToEmail      string `json:"toEmail"`
	ToName       string `json:"toName"`
}

func (MagicLinkEmailCreateParams) Validate added in v0.6.0

type MagicLinkEmailCreateRequest added in v0.6.0

type MagicLinkEmailCreateRequest struct {
	MagicLinkCreateParams      MagicLinkCreateParams      `json:"magicLinkCreateParams"`
	MagicLinkEmailCreateParams MagicLinkEmailCreateParams `json:"magicLinkEmailCreateParams"`
}

func (MagicLinkEmailCreateRequest) Validate added in v0.6.0

type MagicLinkEmailCreateResponse added in v0.6.0

type MagicLinkEmailCreateResponse struct {
	MagicLinkEmailCreateResults MagicLinkEmailCreateResults `json:"magicLinkEmailCreateResults"`
	RequestMetadata             RequestMetadata             `json:"requestMetadata"`
}

type MagicLinkEmailCreateResults added in v0.6.0

type MagicLinkEmailCreateResults struct {
	MagicLinkCreateResults MagicLinkCreateResults `json:"magicLinkCreateResults"`
}

type OTPCreateParams added in v0.6.0

type OTPCreateParams struct {
	CharSetAlphaLower bool `json:"charSetAlphaLower"`
	CharSetAlphaUpper bool `json:"charSetAlphaUpper"`
	CharSetNumeric    bool `json:"charSetNumeric"`
	Length            uint `json:"length"`
	LifespanSeconds   int  `json:"lifespanSeconds"`
}

func (OTPCreateParams) Validate added in v0.6.0

func (o OTPCreateParams) Validate(config Validation) (ValidOTPCreateParams, error)

type OTPCreateRequest added in v0.6.0

type OTPCreateRequest struct {
	OTPCreateParams OTPCreateParams `json:"otpCreateParams"`
}

func (OTPCreateRequest) Validate added in v0.6.0

type OTPCreateResponse added in v0.6.0

type OTPCreateResponse struct {
	OTPCreateResults OTPCreateResults `json:"otpCreateResults"`
	RequestMetadata  RequestMetadata  `json:"requestMetadata"`
}

type OTPCreateResults added in v0.6.0

type OTPCreateResults struct {
	ID  string `json:"id"`
	OTP string `json:"otp"`
}

type OTPEmailCreateParams added in v0.6.0

type OTPEmailCreateParams struct {
	Greeting     string `json:"greeting"`
	LogoClickURL string `json:"logoClickURL"`
	LogoImageURL string `json:"logoImageURL"`
	ServiceName  string `json:"serviceName"`
	Subject      string `json:"subject"`
	SubTitle     string `json:"subTitle"`
	Title        string `json:"title"`
	ToEmail      string `json:"toEmail"`
	ToName       string `json:"toName"`
}

func (OTPEmailCreateParams) Validate added in v0.6.0

type OTPEmailCreateRequest added in v0.6.0

type OTPEmailCreateRequest struct {
	OTPCreateParams      OTPCreateParams      `json:"otpCreateParams"`
	OTPEmailCreateParams OTPEmailCreateParams `json:"otpEmailCreateParams"`
}

func (OTPEmailCreateRequest) Validate added in v0.6.0

type OTPEmailCreateResponse added in v0.6.0

type OTPEmailCreateResponse struct {
	OTPEmailCreateResults OTPEmailCreateResults `json:"otpEmailCreateResults"`
	RequestMetadata       RequestMetadata       `json:"requestMetadata"`
}

type OTPEmailCreateResults added in v0.6.0

type OTPEmailCreateResults struct {
	OTPCreateResults OTPCreateResults `json:"otpCreateResults"`
}

type OTPValidateParams added in v0.6.0

type OTPValidateParams struct {
	ID  string `json:"id"`
	OTP string `json:"otp"`
}

func (OTPValidateParams) Validate added in v0.6.0

type OTPValidateRequest added in v0.6.0

type OTPValidateRequest struct {
	OTPValidateParams OTPValidateParams `json:"otpValidateParams"`
}

func (OTPValidateRequest) Validate added in v0.6.0

type OTPValidateResponse added in v0.6.0

type OTPValidateResponse struct {
	OTPValidateResults OTPValidateResults `json:"otpValidateResults"`
	RequestMetadata    RequestMetadata    `json:"requestMetadata"`
}

type OTPValidateResults added in v0.6.0

type OTPValidateResults struct{}

type RequestMetadata

type RequestMetadata struct {
	UUID uuid.UUID `json:"uuid"`
}

RequestMetadata is the model for request metadata.

type ServiceAccount

type ServiceAccount struct {
	UUID   uuid.UUID `json:"uuid"`
	APIKey uuid.UUID `json:"apiKey"`
	Aud    uuid.UUID `json:"aud"`
	Admin  bool      `json:"admin"`
}

ServiceAccount is the model for a service account and its metadata.

type ServiceAccountCreateParams added in v0.6.0

type ServiceAccountCreateParams struct{}

func (ServiceAccountCreateParams) Validate added in v0.6.0

type ServiceAccountCreateRequest

type ServiceAccountCreateRequest struct {
	ServiceAccountCreateParams ServiceAccountCreateParams `json:"serviceAccountCreateParams"`
}

func (ServiceAccountCreateRequest) Validate

type ServiceAccountCreateResponse

type ServiceAccountCreateResponse struct {
	ServiceAccountCreateResults ServiceAccountCreateResults `json:"serviceAccountCreateResults"`
	RequestMetadata             RequestMetadata             `json:"requestMetadata"`
}

type ServiceAccountCreateResults

type ServiceAccountCreateResults struct {
	ServiceAccount ServiceAccount `json:"serviceAccount"`
}

type ValidAdminCreateParams added in v0.6.0

type ValidAdminCreateParams struct {
	APIKey                          uuid.UUID
	Aud                             uuid.UUID
	UUID                            uuid.UUID
	ValidServiceAccountCreateParams ValidServiceAccountCreateParams
}

type ValidJWTCreateParams added in v0.6.0

type ValidJWTCreateParams struct {
	Alg      string
	Claims   json.RawMessage
	Lifespan time.Duration
}

type ValidJWTCreateRequest

type ValidJWTCreateRequest struct {
	JWTCreateParams ValidJWTCreateParams
}

type ValidJWTValidateParams added in v0.6.0

type ValidJWTValidateParams struct {
	JWT string
}

type ValidJWTValidateRequest

type ValidJWTValidateRequest struct {
	JWTValidateParams ValidJWTValidateParams
}

type ValidMagicLinkCreateParams added in v0.6.0

type ValidMagicLinkCreateParams struct {
	Lifespan         time.Duration
	JWTCreateParams  ValidJWTCreateParams
	RedirectQueryKey string
	RedirectURL      *url.URL
}

type ValidMagicLinkCreateRequest added in v0.6.0

type ValidMagicLinkCreateRequest struct {
	MagicLinkParams ValidMagicLinkCreateParams
}

type ValidMagicLinkEmailCreateParams added in v0.6.0

type ValidMagicLinkEmailCreateParams struct {
	ButtonText   string
	Greeting     string
	LogoClickURL string
	LogoImageURL string
	ServiceName  string
	Subject      string
	SubTitle     string
	Title        string
	ToEmail      *mail.Address
}

type ValidMagicLinkEmailCreateRequest added in v0.6.0

type ValidMagicLinkEmailCreateRequest struct {
	MagicLinkCreateParams      ValidMagicLinkCreateParams
	MagicLinkEmailCreateParams ValidMagicLinkEmailCreateParams
}

type ValidOTPCreateParams added in v0.6.0

type ValidOTPCreateParams struct {
	CharSetAlphaLower bool
	CharSetAlphaUpper bool
	CharSetNumeric    bool
	Length            uint
	Lifespan          time.Duration
}

type ValidOTPCreateRequest added in v0.6.0

type ValidOTPCreateRequest struct {
	OTPCreateParams ValidOTPCreateParams
}

type ValidOTPEmailCreateParams added in v0.6.0

type ValidOTPEmailCreateParams struct {
	Greeting     string
	LogoClickURL string
	LogoImageURL string
	ServiceName  string
	Subject      string
	SubTitle     string
	Title        string
	ToEmail      *mail.Address
}

type ValidOTPEmailCreateRequest added in v0.6.0

type ValidOTPEmailCreateRequest struct {
	OTPCreateParams      ValidOTPCreateParams
	OTPEmailCreateParams ValidOTPEmailCreateParams
}

type ValidOTPValidateParams added in v0.6.0

type ValidOTPValidateParams struct {
	ID  string
	OTP string
}

type ValidOTPValidateRequest added in v0.6.0

type ValidOTPValidateRequest struct {
	OTPValidateParams ValidOTPValidateParams
}

type ValidServiceAccountCreateParams added in v0.6.0

type ValidServiceAccountCreateParams struct{}

type ValidServiceAccountCreateRequest

type ValidServiceAccountCreateRequest struct {
	ServiceAccountCreateParams ValidServiceAccountCreateParams
}

type Validation

type Validation struct {
	LinkLifespanDefault *jt.JSONType[time.Duration] `json:"linkLifespanDefault"`
	LifeSpanSeconds     *jt.JSONType[time.Duration] `json:"maxLinkLifespan"`
	JWTClaimsMaxBytes   uint                        `json:"maxJWTClaimsBytes"`
	JWTLifespanDefault  *jt.JSONType[time.Duration] `json:"jwtLifespanDefault"`
	JWTLifespanMax      *jt.JSONType[time.Duration] `json:"maxJWTLifespan"`
	ServiceNameMinUTF8  uint                        `json:"serviceNameMinUTF8"`
	ServiceNameMaxUTF8  uint                        `json:"serviceNameMaxUTF8"`
	URLMaxLength        uint                        `json:"urlMaxLength"`
}

Validation contains information on how to validate models.

func (Validation) DefaultsAndValidate

func (v Validation) DefaultsAndValidate() (Validation, error)

Jump to

Keyboard shortcuts

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