model

package
v0.0.0-...-b708652 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Unknown is the code used for unknown errors.
	Unknown = ErrorCode(0)

	// InvalidBody is the code used when we cannot decode the request body
	InvalidBody = ErrorCode(1)

	// ValidationError is the code used when the request body fails validation
	ValidationError = ErrorCode(2)

	// InvalidToken is the code used when the token is invalid.
	InvalidToken = ErrorCode(3)
)

Variables

View Source
var (
	// InvalidTokenError is returned when the session token is invalid
	InvalidTokenError = NewError(InvalidToken, "Invalid token")

	// InvalidBodyError is returned when we cannot decode the request body
	InvalidBodyError = NewError(InvalidBody, "Invalid body")

	// UnknownError is the error instance used as a fallback error
	UnknownError = NewError(Unknown, "Something went wrong, please try again later.")
)

Functions

This section is empty.

Types

type CreateUserInput

type CreateUserInput struct {
	CreateUserInput *ent.Users
}

type Error

type Error struct {
	Code     ErrorCode   `json:"code"`
	Message  string      `json:"message"`
	Metadata interface{} `json:"metadata,omitempty"`
}

Error defines the error body

func NewError

func NewError(code ErrorCode, message string, metadata ...interface{}) *Error

NewError creates a new error

type ErrorCode

type ErrorCode int

ErrorCode defines all available error codes

type LoginUserInput

type LoginUserInput struct {
	Id               string  `json:"id"`
	AccentColor      float64 `json:"accent_color"`
	Avatar           string  `json:"avatar"`
	AvatarDecoration string  `json:"avatar_decoratio_data"`
	Banner           string  `json:"banner"`
	BannerColor      string  `json:"banner_color"`
	Flags            float64 `json:"flags"`
	MfaEnabled       bool    `json:"mfa_enabled"`
	PremiumType      float64 `json:"premium_type"`
	PublicFlags      float64 `json:"public_flags"`
	Discriminator    string  `json:"discriminator"`
	GlobalName       string  `json:"global_name"`
	Locale           string  `json:"locale"`
	Username         string  `json:"username"`
}

func ParsingUserInput

func ParsingUserInput(input map[string]interface{}) (*LoginUserInput, error)

type NewLinkInput

type NewLinkInput struct {
	Id          string        `json:"id"`
	Title       string        `json:"title"`
	Url         templ.SafeURL `json:"url"`
	Image       string        `json:"image"`
	Author      string        `json:"author"`
	Order       int           `json:"order"`
	Description string        `json:"description"`
}

type Session

type Session struct {
	Session *ent.Session
}

func (*Session) Expired

func (m *Session) Expired() bool

Expired returns true if the session expired

type TokenInput

type TokenInput struct {
	AccessToken  string  `json:"access_token"`
	RefreshToken string  `json:"refresh_token"`
	ExpiresIn    float64 `json:"expires_in"`
	Scope        string  `json:"scope"`
	TokenType    string  `json:"token_type"`
}

func ParsingTokenInput

func ParsingTokenInput(input map[string]interface{}) (*TokenInput, error)

Jump to

Keyboard shortcuts

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