Documentation ¶
Index ¶
- Constants
- type ApiError
- type ApiErrorWith
- type AppListResponse
- type AppMeta
- type AppResponse
- type AuthorizeRequest
- type CreateUserSession
- type CreateUserSessionResponse
- type DashboardGuild
- type DashboardGuildData
- type IOAuthDiscordError
- type IOAuthOutput
- type IOAuthRedirect
- type Link
- type PagedResult
- type PartialTask
- type Position
- type Question
- type SEO
- type Task
- type TaskCreateResponse
- type TaskFor
- type TaskListResponse
- type TaskOutput
- type TestAuth
- type User
- type UserGuildBaseData
- type UserLogin
- type UserSession
- type UserSessionList
- type Vanity
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 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 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 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 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 Link ¶
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 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 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 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"` }
Click to show internal directories.
Click to hide internal directories.