Documentation ¶
Index ¶
- Constants
- Variables
- type CacheConfig
- type Cluster
- type ContentDTO
- type Division
- type EquinoxConfig
- type ErrorResponse
- type Game
- type IncidentSeverity
- type LogLevel
- type PlainTextResponse
- type Platform
- type PlatformDataDTO
- type PublishLocation
- type RateConfig
- type Status
- type StatusDTO
- type UpdateDTO
Constants ¶
View Source
const ( BaseURLFormat = "https://%s.api.riotgames.com" DataDragonURLFormat = "https://ddragon.leagueoflegends.com%s" )
Base API URLs formats.
Variables ¶
View Source
var ( ErrRetryAfterHeaderNotFound = errors.New("rate limited but no Retry-After header was found, stopping") ErrBadRequest = ErrorResponse{ Status: Status{ Message: "Bad Request", StatusCode: http.StatusBadRequest, }, } Status: Status{ Message: "Unauthorized", StatusCode: http.StatusUnauthorized, }, } ErrForbidden = ErrorResponse{ Status: Status{ Message: "Forbidden", StatusCode: http.StatusForbidden, }, } ErrNotFound = ErrorResponse{ Status: Status{ Message: "Not Found", StatusCode: http.StatusNotFound, }, } ErrMethodNotAllowed = ErrorResponse{ Status: Status{ Message: "Method not allowed", StatusCode: http.StatusMethodNotAllowed, }, } ErrUnsupportedMediaType = ErrorResponse{ Status: Status{ Message: "Unsupported media type", StatusCode: http.StatusUnsupportedMediaType, }, } ErrTooManyRequests = ErrorResponse{ Status: Status{ Message: "Rate limited", StatusCode: http.StatusTooManyRequests, }, } ErrInternalServer = ErrorResponse{ Status: Status{ Message: "Internal server error", StatusCode: http.StatusInternalServerError, }, } ErrBadGateway = ErrorResponse{ Status: Status{ Message: "Bad gateway", StatusCode: http.StatusBadGateway, }, } Status: Status{ Message: "Service unavailable", StatusCode: http.StatusServiceUnavailable, }, } ErrGatewayTimeout = ErrorResponse{ Status: Status{ Message: "Gateway timeout", StatusCode: http.StatusGatewayTimeout, }, } StatusCodeToError = map[int]ErrorResponse{ http.StatusBadRequest: ErrBadRequest, http.StatusUnauthorized: ErrUnauthorized, http.StatusForbidden: ErrForbidden, http.StatusNotFound: ErrNotFound, http.StatusMethodNotAllowed: ErrMethodNotAllowed, http.StatusUnsupportedMediaType: ErrUnsupportedMediaType, http.StatusTooManyRequests: ErrTooManyRequests, http.StatusInternalServerError: ErrInternalServer, http.StatusBadGateway: ErrBadGateway, http.StatusServiceUnavailable: ErrServiceUnavailable, http.StatusGatewayTimeout: ErrGatewayTimeout, } )
Functions ¶
This section is empty.
Types ¶
type CacheConfig ¶ added in v0.14.1
func (CacheConfig) MarshalLogObject ¶ added in v0.14.1
func (c CacheConfig) MarshalLogObject(encoder zapcore.ObjectEncoder) error
type ContentDTO ¶ added in v0.7.2
type EquinoxConfig ¶ added in v0.3.0
type EquinoxConfig struct { // Riot API Key. Key string // Cluster name, using the nearest cluster to you is recommended. Cluster Cluster // Log level, api.NopLevel disables logging. LogLevel LogLevel // Timeout for the internal http.Client in seconds, 0 disables the timeout. Timeout int // Allows retrying a request if it returns a 429 status code. Retry bool // The cache used to store all GET requests done by the client. Cache *cache.Cache // The rate limit store. RateLimit *rate_limit.RateLimit }
Configuration for the Equinox client.
func (*EquinoxConfig) MarshalLogObject ¶ added in v0.7.0
func (c *EquinoxConfig) MarshalLogObject(encoder zapcore.ObjectEncoder) error
type ErrorResponse ¶ added in v0.3.0
type ErrorResponse struct {
Status Status `json:"status"`
}
func (ErrorResponse) Error ¶ added in v0.3.0
func (e ErrorResponse) Error() string
type IncidentSeverity ¶ added in v0.7.2
type IncidentSeverity string
const ( InfoSeverity IncidentSeverity = "info" WarningSeverity IncidentSeverity = "warning" CriticalSeverity IncidentSeverity = "critical" )
type LogLevel ¶ added in v0.7.0
type LogLevel int8
const ( // NopLevel won't log anything, this is the default behaviour for the Default client. NopLevel LogLevel = iota - 2 // DebugLevel will log everything. DebugLevel // InfoLevel will log the requests being made and if they were successful. InfoLevel // WarnLevel will log when a request was rate limited. WarnLevel // ErrorLevel will log every error. ErrorLevel )
type PlainTextResponse ¶ added in v0.7.4
type PlainTextResponse struct {
Response interface{} `json:"response"`
}
type PlatformDataDTO ¶ added in v0.7.2
type PlatformDataDTO struct { ID string `json:"id"` Name string `json:"name"` Locales []string `json:"locales"` Maintenances []StatusDTO `json:"maintenances"` Incidents []StatusDTO `json:"incidents"` }
The PlatformDataDTO is used in multiple clients.
type PublishLocation ¶ added in v0.7.2
type PublishLocation string
const ( RiotClientLocation PublishLocation = "riotclient" RiotStatusLocation PublishLocation = "riotstatus" GameLocation PublishLocation = "game" )
type RateConfig ¶ added in v0.14.1
type RateConfig struct {
Store string
}
func (RateConfig) MarshalLogObject ¶ added in v0.14.1
func (c RateConfig) MarshalLogObject(encoder zapcore.ObjectEncoder) error
type StatusDTO ¶ added in v0.7.2
type StatusDTO struct { ArchiveAt time.Time `json:"archive_at"` Titles []ContentDTO `json:"titles"` UpdatedAt time.Time `json:"updated_at"` IncidentSeverity IncidentSeverity `json:"incident_severity"` Platforms []Platform `json:"platforms"` Updates []UpdateDTO `json:"updates"` CreatedAt time.Time `json:"created_at"` ID int `json:"id"` MaintenanceStatus string `json:"maintenance_status"` }
type UpdateDTO ¶ added in v0.7.2
type UpdateDTO struct { UpdatedAt time.Time `json:"updated_at"` Translations []ContentDTO `json:"translations"` Author string `json:"author"` Publish bool `json:"publish"` CreatedAt time.Time `json:"created_at"` ID int `json:"id"` PublishLocations []PublishLocation `json:"publish_locations"` }
Click to show internal directories.
Click to hide internal directories.