Documentation ¶
Index ¶
- func Deserialize[T Deserializable](body []byte) (*T, error)
- type ApiPayload
- type ApiResponseBody
- type Auth
- type ChatResponseBody
- type Comment
- type CookieOpts
- type Country
- type Deserializable
- type NewUser
- type Result
- type SessionAuth
- type SocketError
- type SocketMessage
- type UpdateMessage
- type User
- type UserAvatar
- type Vote
- type VoteSingle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Deserialize ¶
func Deserialize[T Deserializable](body []byte) (*T, error)
Types ¶
type ApiPayload ¶
type ApiPayload[T ApiResponseBody] struct { Body T `json:"body"` Error string `json:"error"` }
func NewApiPayload ¶
func NewApiPayload[T ApiResponseBody](payload T, error string) ApiPayload[T]
type ApiResponseBody ¶
type Auth ¶
type Auth struct { Token string //session token Expiration time.Time UserId uuid.UUID AuthLvl enum.AuthLvl }
Auth is used internally to verify a user, auth level, and expiration of session. The token refers to a session token, not auth token. It should never be returned to a user
type ChatResponseBody ¶
type ChatResponseBody interface { *Comment | []Comment | SocketError | UpdateMessage | *NewUser }
type Comment ¶
type CookieOpts ¶
type Deserializable ¶
type Deserializable interface { Country | User | Vote | VoteSingle }
type NewUser ¶
type SessionAuth ¶
type SessionAuth struct { Name string SessionToken string `json:"token"` CookieOpts CookieOpts `json:"opts"` User User `json:"user"` Bot uuid.UUID `json:"botId"` }
SessionAuth gets returned to users when they log in
type SocketError ¶
type SocketError string
type SocketMessage ¶
type SocketMessage struct { Category enum.ChatMsgType `json:"category"` Body json.RawMessage `json:"body"` }
func NewSocketErrorMessage ¶
func NewSocketErrorMessage(message string) SocketMessage
NewSocketErrorMessage can be passed an empty string to get the default message
func NewSocketMessage ¶
func NewSocketMessage[T ChatResponseBody](category enum.ChatMsgType, payload T) SocketMessage
type UpdateMessage ¶
type User ¶
type UserAvatar ¶
type VoteSingle ¶
type VoteSingle struct { UserId uuid.UUID `json:"userId"` CountrySlug string `json:"countrySlug"` Cat enum.Categories `json:"cat"` Score uint8 `json:"score"` }
func (VoteSingle) Validate ¶
func (v VoteSingle) Validate() *errs.AppError
Click to show internal directories.
Click to hide internal directories.