types

package
v0.0.0-...-5810448 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2024 License: AGPL-3.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const (
	TargetTypeUser   = "User"
	TargetTypeServer = "Server"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiError

type ApiError struct {
	Context map[string]string `json:"context,omitempty" description:"Context of the error. Usually used for validation error contexts"`
	Message string            `json:"message" description:"Message of the error"`
}

This represents a IBL Popplio API Error

type ApiErrorWith

type ApiErrorWith[T any] struct {
	Data    *T                `json:"data" description:"Any data the client should know about despite the error"`
	Context map[string]string `json:"context,omitempty" description:"Context of the error. Usually used for validation error contexts"`
	Message string            `json:"message" description:"Message of the error"`
}

type AppListResponse

type AppListResponse struct {
	Apps []AppResponse `json:"apps"`
}

type AppMeta

type AppMeta struct {
	Positions []Position `json:"positions"`
	Stable    bool       `json:"stable"` // Stable means that the list of apps is not pending big changes
}

type AppResponse

type AppResponse struct {
	AppID          string                  `db:"app_id" json:"app_id"`
	User           *dovetypes.PlatformUser `db:"-" json:"user,omitempty"`
	UserID         string                  `db:"user_id" json:"user_id"`
	Questions      []Question              `db:"questions" json:"questions"`
	Answers        map[string]string       `db:"answers" json:"answers"`
	State          string                  `db:"state" json:"state"`
	CreatedAt      time.Time               `db:"created_at" json:"created_at"`
	Position       string                  `db:"position" json:"position"`
	ReviewFeedback *string                 `db:"review_feedback" json:"review_feedback"`
}

type AuthorizeRequest

type AuthorizeRequest struct {
	Code        string `json:"code" validate:"required,min=5"`
	RedirectURI string `json:"redirect_uri" validate:"required"`
	Protocol    string `` /* 144-byte string literal not displayed */
	Scope       string `json:"scope" validate:"required,oneof=normal ban_exempt"`
}

type CreateUserSession

type CreateUserSession struct {
	Name       string   `json:"name" validate:"required" description:"The name of the session"`
	Type       string   `json:"type" validate:"oneof=api" description:"The type of session token. Must be 'api'"`
	PermLimits []string `json:"perm_limits" description:"The permissions the session will have"`
	Expiry     int64    `json:"expiry" validate:"required" description:"The time in seconds the session will last"`
}

type CreateUserSessionResponse

type CreateUserSessionResponse struct {
	Token     string `json:"token" description:"The token of the session"`
	SessionID string `json:"session_id" description:"The ID of the session"`
}

type DashboardGuild

type DashboardGuild struct {
	ID          string `json:"id" description:"The ID of the guild"`
	Name        string `json:"name" description:"The name of the guild"`
	Avatar      string `json:"avatar" description:"The avatar url of the guild"`
	Permissions int64  `json:"permissions" description:"The permissions the user has in the guild"`
}

type DashboardGuildData

type DashboardGuildData struct {
	Guilds        []*DashboardGuild `json:"guilds" description:"The guilds the user is in"`
	BotInGuilds   []string          `json:"has_bot" description:"A list of guild IDs that the user has the bot in"`
	UnknownGuilds []string          `json:"unknown_guilds" description:"A list of guild IDs where the bot is in an outage etc. in"`
}

type IOAuthDiscordError

type IOAuthDiscordError struct {
	Context map[string]any `json:"context" description:"The context of the error"`
	Message string         `json:"message" description:"The message of the error"`
}

type IOAuthOutput

type IOAuthOutput struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	ExpiresIn    int    `json:"expires_in"` // Seconds
	Scope        string `json:"scope"`      // Scopes as returned by discord

	Scopes      []string               `json:"scopes"`                 // Scopes as a slice
	DiscordUser *discordgo.User        `json:"discord_user,omitempty"` // The discord user
	UserGuilds  []*discordgo.UserGuild `json:"user_guilds,omitempty"`  // The guilds the user is in if 'guilds' is in the scopes
}

type IOAuthRedirect

type IOAuthRedirect struct {
	Dest   string   `json:"dest"`
	Scopes []string `json:"scopes"`
}
type Link struct {
	Name  string `json:"name" description:"Name of the link. Links starting with an underscore are 'asset links' and are not visible"`
	Value string `json:"value" description:"Value of the link. Must normally be HTTPS with the exception of 'asset links'"`
}

A link is any extra link

type PagedResult

type PagedResult[T any] struct {
	Count   uint64 `json:"count"`
	PerPage uint64 `json:"per_page"`
	Results T      `json:"results"`
}

Paged result common

type PartialTask

type PartialTask struct {
	TaskID    string         `db:"task_id" json:"task_id" validate:"required" description:"The task ID."`
	TaskName  string         `db:"task_name" json:"task_name" validate:"required" description:"The task name."`
	Expiry    *time.Duration `db:"expiry" json:"expiry" validate:"required" description:"The task expiry."`
	State     string         `db:"state" json:"state" validate:"required" description:"The tasks current state (pending/completed etc)."`
	CreatedAt time.Time      `db:"created_at" json:"created_at" description:"The time the task was created."`
}

@ci table=tasks unfilled=1

Tasks are background processes that can be run on a coordinator server.

A PartialTask represents a partial representation of a task.

type Position

type Position struct {
	ID        string     `json:"id" validate:"required"`
	Tags      []string   `json:"tags" validate:"required"`
	Info      string     `json:"info" validate:"required"`
	Name      string     `json:"name" validate:"required"`
	Questions []Question `json:"questions" validate:"gt=0,required"`
	Hidden    bool       `json:"hidden"`
	Closed    bool       `json:"closed"`

	// Internal fields
	Channel             func() string                                                                `json:"-"`
	ExtraLogic          func(d uapi.RouteData, p Position, answers map[string]string) error          `json:"-"`
	PositionDescription func(d uapi.RouteData, p Position) string                                    `json:"-"` // Used for custom position descriptions
	AllowedForBanned    bool                                                                         `json:"-"` // If true, banned users can apply for this position
	BannedOnly          bool                                                                         `json:"-"` // If true, only banned users can apply for this position
	ReviewLogic         func(d uapi.RouteData, resp AppResponse, reason string, approved bool) error `json:"-"` // If set, this function will be called when the position is reviewed. If it returns true, the app will be approved/denied
}

type Question

type Question struct {
	ID          string `json:"id" validate:"required"`
	Question    string `json:"question" validate:"required"`
	Paragraph   string `json:"paragraph" validate:"required"`
	Placeholder string `json:"placeholder" validate:"required"`
	Short       bool   `json:"short" validate:"required"`
}

type SEO

type SEO struct {
	Name   string `json:"name" description:"Name of the entity"`
	ID     string `json:"id" description:"ID of the entity"`
	Avatar string `json:"avatar" description:"The entities resolved avatar URL (not just hash)"`
	Short  string `json:"short" description:"Short description of the entity"`
}

SEO object (minified bot/user/server for seo purposes)

type Task

type Task struct {
	TaskID     string           `db:"task_id" json:"task_id" validate:"required" description:"The task ID."`
	TaskName   string           `db:"task_name" json:"task_name" validate:"required" description:"The task name."`
	Output     *TaskOutput      `db:"output" json:"output" description:"The task output."`
	TaskFields map[string]any   `` /* 135-byte string literal not displayed */
	Statuses   []map[string]any `db:"statuses" json:"statuses" validate:"required" description:"The task statuses."`
	TaskForRaw *string          `db:"task_for" json:"-" description:"The entity this task is for." ci:"internal"`
	TaskFor    *TaskFor         `db:"-" json:"task_for" description:"The entity this task is for."`
	Expiry     *time.Duration   `db:"expiry" json:"expiry" validate:"required" description:"The task expiry."`
	State      string           `db:"state" json:"state" validate:"required" description:"The tasks current state (pending/completed etc)."`
	Resumable  bool             `db:"resumable" json:"resumable" description:"Whether the task is resumable."`
	CreatedAt  time.Time        `db:"created_at" json:"created_at" description:"The time the task was created."`
}

@ci table=tasks

Tasks are background processes that can be run on a coordinator server.

type TaskCreateResponse

type TaskCreateResponse struct {
	TaskID string `json:"task_id" description:"The task ID. Get Task can then be used to get the task data"`
}

type TaskFor

type TaskFor struct {
	ID         string `json:"id" description:"The ID of the entity the task is for"`
	TargetType string `json:"target_type" description:"The type of the entity the task is for"`
}

TaskFor is a struct containing the internal representation of who a task is for

type TaskListResponse

type TaskListResponse struct {
	Tasks []PartialTask `json:"tasks" description:"The list of (partial) tasks"`
}

type TaskOutput

type TaskOutput struct {
	Filename   string        `json:"filename"`
	Segregated bool          `json:"segregated"` // If this flag is set, then the stored output will be stored in $taskForSimplexFormat/$taskName/$taskId/$filename instead of $taskId/$filename
	Buffer     *bytes.Buffer `json:"-"`
}

TaskOutput is the output of a task

type TestAuth

type TestAuth struct {
	AuthType string `json:"auth_type"`
	TargetID string `json:"target_id"`
	Token    string `json:"token"`
}

type User

type User struct {
	User       *dovetypes.PlatformUser `json:"user" description:"The user object of the user"`
	State      string                  `db:"state" json:"state" description:"The state of the user"`
	VoteBanned bool                    `db:"vote_banned" json:"vote_banned" description:"Whether or not the user is banned from recieving rewards from voting"`
	CreatedAt  time.Time               `db:"created_at" json:"created_at" description:"The time the user was created"`
	UpdatedAt  time.Time               `db:"updated_at" json:"updated_at" description:"The time the user was last updated"`
}

Represents a user on Antiraid

type UserGuildBaseData

type UserGuildBaseData struct {
	OwnerID   string                       `json:"owner_id"`
	Name      string                       `json:"name"`
	Icon      *string                      `json:"icon"`
	Roles     map[string]*ext.SerenityRole `json:"roles"`
	UserRoles []string                     `json:"user_roles"`
	BotRoles  []string                     `json:"bot_roles"`
}

type UserLogin

type UserLogin struct {
	Token  string `json:"token" description:"The users token"`
	UserID string `json:"user_id" description:"The users ID"`
}

type UserSession

type UserSession struct {
	ID         string      `db:"id" json:"id" description:"The ID of the session"`
	Name       pgtype.Text `db:"name" json:"name,omitempty" description:"The name of the session. Login sessions do not have any names by default"`
	UserID     string      `db:"user_id" json:"user_id" description:"The users ID"`
	CreatedAt  time.Time   `db:"created_at" json:"created_at" description:"The time the session was created"`
	Type       string      `db:"type" json:"type" description:"The type of session token"`
	PermLimits []string    `db:"perm_limits" json:"perm_limits" description:"The permissions the session has"`
	Expiry     time.Time   `db:"expiry" json:"expiry" description:"The time the session expires"`
}

type UserSessionList

type UserSessionList struct {
	Sessions []*UserSession `json:"sessions" description:"The list of sessions"`
}

type Vanity

type Vanity struct {
	ITag       pgtype.UUID `db:"itag" json:"itag" description:"The vanities internal ID."`
	TargetID   string      `db:"target_id" json:"target_id" description:"The ID of the entity"`
	TargetType string      `db:"target_type" json:"target_type" description:"The type of the entity"`
	Code       string      `db:"code" json:"code" description:"The code of the vanity"`
	CreatedAt  time.Time   `db:"created_at" json:"created_at" description:"The time the vanity was created"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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