restutil

package
v0.0.0-...-870ec01 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownEmote       = func() *ErrorResponse { return createErrorResponse(404, "Unknown Emote") }
	ErrUnknownUser        = func() *ErrorResponse { return createErrorResponse(404, "Unknown User") }
	MalformedObjectId     = func() *ErrorResponse { return createErrorResponse(400, "Malformed Object ID") }
	ErrInternalServer     = func() *ErrorResponse { return createErrorResponse(500, "Internal Server Error (%s)") }
	ErrBadRequest         = func() *ErrorResponse { return createErrorResponse(400, "Bad Request (%s)") }
	ErrLoginRequired      = func() *ErrorResponse { return createErrorResponse(403, "Authentication Required") }
	ErrAccessDenied       = func() *ErrorResponse { return createErrorResponse(403, "Insufficient Privilege") }
	ErrMissingQueryParams = func() *ErrorResponse { return createErrorResponse(400, "Missing Query Params (%s)") }
)

Functions

This section is empty.

Types

type BadgeCosmeticResponse

type BadgeCosmeticResponse struct {
	ID      string     `json:"id"`
	Name    string     `json:"name"`
	Tooltip string     `json:"tooltip"`
	URLs    [][]string `json:"urls"`
	Users   []string   `json:"users"`
	Misc    bool       `json:"misc,omitempty"`
}

func CreateBadgeResponse

func CreateBadgeResponse(badge *datastructure.Cosmetic, users []*datastructure.User, idType string) *BadgeCosmeticResponse

type EmoteResponse

type EmoteResponse struct {
	ID               string        `json:"id"`
	Name             string        `json:"name"`
	Owner            *UserResponse `json:"owner"`
	Visibility       int32         `json:"visibility"`
	VisibilitySimple *[]string     `json:"visibility_simple"`
	Mime             string        `json:"mime"`
	Status           int32         `json:"status"`
	Tags             []string      `json:"tags"`
	Width            [4]int16      `json:"width"`
	Height           [4]int16      `json:"height"`
	URLs             [][]string    `json:"urls"`
}

func CreateEmoteResponse

func CreateEmoteResponse(emote *datastructure.Emote, owner *datastructure.User) EmoteResponse

type ErrorResponse

type ErrorResponse struct {
	Status  int    `json:"status"`
	Message string `json:"message"`
	Reason  string `json:"reason"`
}

func (*ErrorResponse) Send

func (e *ErrorResponse) Send(c *fiber.Ctx, placeholders ...string) error

type PaintCosmeticResponse

type PaintCosmeticResponse struct {
	ID          string                                    `json:"id"`
	Name        string                                    `json:"name"`
	Users       []string                                  `json:"users"`
	Function    string                                    `json:"function"`
	Color       *int32                                    `json:"color"`
	Stops       []datastructure.CosmeticPaintGradientStop `json:"stops"`
	Repeat      bool                                      `json:"repeat"`
	Angle       int32                                     `json:"angle"`
	Shape       string                                    `json:"shape,omitempty"`
	ImageURL    string                                    `json:"image_url,omitempty"`
	DropShadow  datastructure.CosmeticPaintDropShadow     `json:"drop_shadow,omitempty"`
	DropShadows []datastructure.CosmeticPaintDropShadow   `json:"drop_shadows,omitempty"`
	Animation   datastructure.CosmeticPaintAnimation      `json:"animation,omitempty"`
}

func CreatePaintResponse

func CreatePaintResponse(paint *datastructure.Cosmetic, users []*datastructure.User, idType string) *PaintCosmeticResponse

type UserResponse

type UserResponse struct {
	ID               string             `json:"id"`
	TwitchID         string             `json:"twitch_id"`
	Login            string             `json:"login"`
	DisplayName      string             `json:"display_name"`
	Role             datastructure.Role `json:"role"`
	EmoteAliases     map[string]string  `json:"emote_aliases,omitempty"`
	ProfilePictureID string             `json:"profile_picture_id,omitempty"`
}

func CreateUserResponse

func CreateUserResponse(user *datastructure.User, opt ...UserResponseOptions) *UserResponse

type UserResponseOptions

type UserResponseOptions struct {
	IncludeAliases bool
}

Jump to

Keyboard shortcuts

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