Documentation ¶
Index ¶
- Variables
- func AddMongoLookupTime(col, id string, lookup int64, unmarshal int64)
- func AddRedisLookupTime(col, id string, lookup int64, unmarshal int64)
- func BadAuth(w http.ResponseWriter, _ *http.Request)
- func NotFound(w http.ResponseWriter, _ *http.Request)
- func PopulateDevCache()
- func RequestLogger(handler http.Handler) http.Handler
- func TokenValidator(next http.Handler) http.Handler
- func WriteBotResponse(w http.ResponseWriter, bot *Bot)
- func WriteErrorResponse(w http.ResponseWriter, err error)
- func WriteJson(status int, writer http.ResponseWriter, v interface{})
- func WriteNotImplementedResponse(w http.ResponseWriter)
- func WritePrettyJson(status int, writer http.ResponseWriter, v interface{})
- func WriteServerResponse(w http.ResponseWriter, server *Server)
- func WriteTemplateResponse(w http.ResponseWriter, template *ServerTemplate)
- func WriteUserResponse(w http.ResponseWriter, user *User)
- type APIHealthResponse
- type APIResponse
- type APIResponseBots
- type APIStatsResponse
- type APIStatsResponseBots
- type APIStatsResponseServers
- type APIStatsResponseStaff
- type APIStatsResponseUsers
- type Avatar
- type Bot
- type BotLinks
- type BotSocial
- type BotStatus
- type BotTheme
- type BotVotes
- type DebugStatistics
- type GuildChannel
- type LookupTimes
- type Owner
- type PermissionsOverwrite
- type ResponseTime
- type Role
- type Server
- type ServerLinks
- type ServerStatus
- type ServerTemplate
- type ServerTemplateLinks
- type StaffTracking
- type Strike
- type SubHandled
- type User
- type UserGame
- type UserPreferences
- type UserProfile
- type UserProfileLinks
- type UserRank
- type WidgetBot
Constants ¶
This section is empty.
Variables ¶
View Source
var ( MongoLookupTimes = make(map[string]map[string][]ResponseTime) RedisLookupTimes = make(map[string]map[string][]ResponseTime) ResponseTimes []ResponseTime )
View Source
var ( RatelimitedError = buildInternal(true, 429, "Too Many Requests", nil, nil, nil, nil) TempBannedError = buildInternal(true, 403, "You've been temporarily API banned!", nil, nil, nil, nil) PermBannedError = buildInternal(true, 403, "You've been permanently API banned!", nil, nil, nil, nil) NotFoundError = buildInternal(true, 404, "Not Found", nil, nil, nil, nil) NoAuthError = buildInternal(true, 403, `No "Authorization" header specified, or it was invalid!`, nil, nil, nil, nil) LookupError = errors.New("an error occurred when looking up this resource") ReadFailed = errors.New("failed to read request body") GetServersFailed = buildInternal(true, 500, "An error occurred when getting all servers, try again later!", nil, nil, nil, nil) GetBotsFailed = buildInternal(true, 500, "An error occurred when getting all bots, try again later!", nil, nil, nil, nil) GetUsersFailed = buildInternal(true, 500, "An error occurred when getting all users, try again later!", nil, nil, nil, nil) GetTemplatesFailed = buildInternal(true, 500, "An error occurred when getting all templates, try again later!", nil, nil, nil, nil) BadContentType = buildInternal(true, 415, "Unsupported Content Type, or non was provided!", nil, nil, nil, nil) )
Functions ¶
func AddMongoLookupTime ¶
func AddRedisLookupTime ¶
func PopulateDevCache ¶
func PopulateDevCache()
func TokenValidator ¶
DELAPI_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-000000000000000000
func WriteBotResponse ¶
func WriteBotResponse(w http.ResponseWriter, bot *Bot)
func WriteErrorResponse ¶
func WriteErrorResponse(w http.ResponseWriter, err error)
func WriteJson ¶
func WriteJson(status int, writer http.ResponseWriter, v interface{})
func WriteNotImplementedResponse ¶
func WriteNotImplementedResponse(w http.ResponseWriter)
func WritePrettyJson ¶
func WritePrettyJson(status int, writer http.ResponseWriter, v interface{})
func WriteServerResponse ¶
func WriteServerResponse(w http.ResponseWriter, server *Server)
func WriteTemplateResponse ¶
func WriteTemplateResponse(w http.ResponseWriter, template *ServerTemplate)
func WriteUserResponse ¶
func WriteUserResponse(w http.ResponseWriter, user *User)
Types ¶
type APIHealthResponse ¶
type APIResponse ¶
type APIResponseBots ¶
type APIStatsResponse ¶
type APIStatsResponse struct { Status int `json:"status"` Error bool `json:"error"` Servers APIStatsResponseServers `json:"servers"` Bots APIStatsResponseBots `json:"bots"` Users APIStatsResponseUsers `json:"users"` Templates int `json:"templates"` }
type APIStatsResponseBots ¶
type APIStatsResponseServers ¶
type APIStatsResponseServers struct {
Total int `json:"total"`
}
type APIStatsResponseStaff ¶
type APIStatsResponseUsers ¶
type APIStatsResponseUsers struct { Total int `json:"total"` Premium int `json:"premium"` Staff APIStatsResponseStaff `json:"staff"` }
type Bot ¶
type Bot struct { MongoID string `json:"_id,omitempty"` ID string `bson:"_id" json:"id"` Name string `json:"name"` Prefix string `json:"prefix"` Library string `json:"library"` Tags []string `json:"tags"` VanityURL string `json:"vanityUrl"` ServerCount int `json:"serverCount"` ShardCount int `json:"shardCount"` Token string `json:"token,omitempty"` Flags int `json:"flags"` ShortDesc string `json:"shortDesc"` LongDesc string `json:"longDesc"` ModNotes string `json:"modNotes,omitempty"` Editors []string `json:"editors"` Owner Owner `json:"owner"` Avatar Avatar `json:"avatar"` Votes *BotVotes `json:"votes,omitempty"` Links BotLinks `json:"links"` Social BotSocial `json:"social"` Theme *BotTheme `json:"theme,omitempty"` WidgetBot *WidgetBot `json:"widgetbot,omitempty"` Status BotStatus `json:"status"` }
func CleanupBot ¶
func GetAllBots ¶
type DebugStatistics ¶
type DebugStatistics struct { MongoPing int64 `json:"mongo_ping"` RedisPing int64 `json:"redis_ping"` Node string `json:"node"` LookupTimes LookupTimes `json:"lookup_times"` ResponseTimes []ResponseTime `json:"response_times"` Hostname string `json:"hostname"` }
type GuildChannel ¶
type GuildChannel struct { Type int `json:"type"` Position int `json:"position,omitempty"` Name string `json:"name"` NSFW *bool `json:"nsfw,omitempty"` Topic *string `json:"topic,omitempty"` PermissionsOverwrites []PermissionsOverwrite `json:"permissions_overwrites"` RateLimitPerUser int `json:"rate_limit_per_user"` LastMessageID string `json:"last_message_id"` Bitrate *int `json:"bitrate,omitempty"` UserLimit *int `json:"user_limit,omitempty"` LastPinTimestamp *int `json:"last_pin_timestamp"` }
type LookupTimes ¶
type LookupTimes struct { Mongo map[string]map[string][]ResponseTime `json:"mongo"` Redis map[string]map[string][]ResponseTime `json:"redis"` }
type PermissionsOverwrite ¶
type ResponseTime ¶
type Server ¶
type Server struct { MongoID string `json:"_id,omitempty"` ID string `bson:"_id" json:"id"` InviteCode string `json:"inviteCode,omitempty"` Name string `json:"name"` ShortDesc string `json:"shortDesc"` LongDesc string `json:"longDesc"` Tags []string `json:"tags"` PreviewChannel string `json:"previewChannel"` Owner Owner `json:"owner"` Icon Avatar `json:"icon"` Links ServerLinks `json:"links"` Status ServerStatus `json:"status"` }
func CleanupServer ¶
func GetAllServers ¶
type ServerLinks ¶
type ServerStatus ¶
type ServerStatus struct {
ReviewRequired bool `json:"reviewRequired"`
}
type ServerTemplate ¶
type ServerTemplate struct { MongoID string `json:"_id,omitempty"` ID string `bson:"_id" json:"id"` Name string `json:"name"` Region string `json:"region"` Locale string `json:"locale"` AfkTimeout int `json:"afkTimeout"` VerificationLevel int `json:"verificationLevel"` DefaultMessageNotifications int `json:"defaultMessageNotifications"` ExplicitContent int `json:"explicitContent"` Roles []Role `json:"roles"` Channels []GuildChannel `json:"channels"` UsageCount int `json:"usageCount"` ShortDesc string `json:"shortDesc"` LongDesc string `json:"longDesc"` Tags []string `json:"tags"` FromGuild string `json:"fromGuild"` Owner Owner `json:"owner"` Icon Avatar `json:"icon"` Links ServerTemplateLinks `json:"links"` }
func GetAllTemplates ¶
func GetAllTemplates() (error, []ServerTemplate)
func LookupTemplate ¶
func LookupTemplate(id string) (error, *ServerTemplate)
type ServerTemplateLinks ¶
type StaffTracking ¶
type StaffTracking struct { Details struct { Away struct { Status bool `json:"status"` Message string `json:"message"` } `json:"away"` Standing string `json:"standing"` Country string `json:"country"` Timezone string `json:"timezone"` ManagementNotes string `json:"managementNotes"` } `json:"details"` LastLogin int `json:"lastLogin"` LastAccessed struct { Time int `json:"time"` Page string `json:"page"` } `json:"lastAccessed"` Punishments struct { Strikes []Strike `json:"strikes"` Warnings []Strike `json:"warnings"` } `json:"punishments"` HandledBots struct { AllTime SubHandled `json:"allTime"` PrevWeek SubHandled `json:"prevWeek"` ThisWeek SubHandled `json:"thisWeek"` } `json:"handledBots"` HandledServers struct { AllTime SubHandled `json:"allTime"` PrevWeek SubHandled `json:"prevWeek"` ThisWeek SubHandled `json:"thisWeek"` } `json:"handledServers"` HandledTemplates struct { AllTime SubHandled `json:"allTime"` PrevWeek SubHandled `json:"prevWeek"` ThisWeek SubHandled `json:"thisWeek"` } `json:"handledTemplates"` }
type SubHandled ¶
type User ¶
type User struct { MongoID string `json:"_id,omitempty"` ID string `bson:"_id" json:"id"` Token string `json:"token,omitempty"` Name string `json:"name"` Discrim string `json:"discrim"` FullUsername string `json:"fullUsername"` Locale string `json:"locale,omitempty"` Flags int `json:"flags"` Avatar Avatar `json:"avatar"` Preferences *UserPreferences `json:"preferences,omitempty"` Profile UserProfile `json:"profile"` Game UserGame `json:"game"` Rank UserRank `json:"rank"` StaffTracking *StaffTracking `json:"staffTracking,omitempty"` }
func CleanupUser ¶
func GetAllUsers ¶
type UserGame ¶
type UserGame struct { Snakes struct { MaxScore int `json:"maxScore"` } `json:"snakes"` }
type UserPreferences ¶
type UserProfile ¶
type UserProfile struct { Bio string `json:"bio"` CSS string `json:"css,omitempty"` Links UserProfileLinks `json:"links"` }
type UserProfileLinks ¶
Click to show internal directories.
Click to hide internal directories.