api

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2022 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

View Source
const (
	BaseURLFormat = "https://%s.api.riotgames.com"
)

Base API URL format.

Variables

View Source
var (
	BadRequestError = ErrorResponse{
		Status: Status{
			Message:    "Bad Request",
			StatusCode: http.StatusBadRequest,
		},
	}

	UnauthorizedError = ErrorResponse{
		Status: Status{
			Message:    "Unauthorized",
			StatusCode: http.StatusUnauthorized,
		},
	}

	ForbiddenError = ErrorResponse{
		Status: Status{
			Message:    "Forbidden",
			StatusCode: http.StatusForbidden,
		},
	}

	NotFoundError = ErrorResponse{
		Status: Status{
			Message:    "Not Found",
			StatusCode: http.StatusNotFound,
		},
	}

	MethodNotAllowedError = ErrorResponse{
		Status: Status{
			Message:    "Method not allowed",
			StatusCode: http.StatusMethodNotAllowed,
		},
	}

	UnsupportedMediaTypeError = ErrorResponse{
		Status: Status{
			Message:    "Unsupported media type",
			StatusCode: http.StatusUnsupportedMediaType,
		},
	}

	RateLimitedError = ErrorResponse{
		Status: Status{
			Message:    "Rate limited",
			StatusCode: http.StatusTooManyRequests,
		},
	}

	InternalServerError = ErrorResponse{
		Status: Status{
			Message:    "Internal server error",
			StatusCode: http.StatusInternalServerError,
		},
	}

	BadGatewayError = ErrorResponse{
		Status: Status{
			Message:    "Bad gateway",
			StatusCode: http.StatusBadGateway,
		},
	}

	ServiceUnavailableError = ErrorResponse{
		Status: Status{
			Message:    "Service unavailable",
			StatusCode: http.StatusServiceUnavailable,
		},
	}

	GatewayTimeoutError = ErrorResponse{
		Status: Status{
			Message:    "Gateway timeout",
			StatusCode: http.StatusGatewayTimeout,
		},
	}

	StatusCodeToError = map[int]ErrorResponse{
		http.StatusBadRequest:           BadRequestError,
		http.StatusUnauthorized:         UnauthorizedError,
		http.StatusForbidden:            ForbiddenError,
		http.StatusNotFound:             NotFoundError,
		http.StatusMethodNotAllowed:     MethodNotAllowedError,
		http.StatusUnsupportedMediaType: UnsupportedMediaTypeError,
		http.StatusTooManyRequests:      RateLimitedError,
		http.StatusInternalServerError:  InternalServerError,
		http.StatusBadGateway:           BadGatewayError,
		http.StatusServiceUnavailable:   ServiceUnavailableError,
		http.StatusGatewayTimeout:       GatewayTimeoutError,
	}
)

Functions

This section is empty.

Types

type Cluster added in v0.7.1

type Cluster string
const (
	AmericasCluster Cluster = "americas"
	EuropeCluster   Cluster = "europe"
	AsiaCluster     Cluster = "asia"
)

Riot API clusters, used in RiotClient and LOLClient.Tournament/LOLClient.TournamentStub.

type ContentDTO added in v0.7.2

type ContentDTO struct {
	Content string `json:"content"`
	Locale  string `json:"locale"`
}

type Division added in v0.6.0

type Division string
const (
	I   Division = "I"
	II  Division = "II"
	III Division = "III"
	IV  Division = "IV"
)

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. Defaults to api.FatalLevel
	LogLevel LogLevel
	// Timeout for HTTP Request in seconds, 0 disables it. Defaults to 10
	Timeout int
	// TTL for the cache in seconds, 0 disables caching. Defaults to 120 seconds
	TTL int
	// Retry request if it returns a 429 status code. Defaults to true
	Retry bool
	// Disables rate limiting. Defaults to false
	RateLimit bool
}

An config object for the EquinoxClient.

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 Game added in v0.7.1

type Game string
const (
	LOR Game = "lor"
	VAL Game = "val"
)

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 (
	DebugLevel LogLevel = -1
	InfoLevel  LogLevel = 0
	WarnLevel  LogLevel = 1
	ErrorLevel LogLevel = 2
	FatalLevel LogLevel = 5
)

type PlainTextResponse added in v0.7.4

type PlainTextResponse struct {
	Response interface{} `json:"response"`
}

type Platform added in v0.7.2

type Platform string
const (
	WindowsPlatform Platform = "windows"
	MacOSPlatform   Platform = "macos"
	AndroidPlatform Platform = "android"
	IOSPlatform     Platform = "ios"
	PS4Platform     Platform = "ps4"
	XboxOnePlatform Platform = "xbone"
	SwitchPlatform  Platform = "switch"
)

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"`
}

type PublishLocation added in v0.7.2

type PublishLocation string
const (
	RiotClientLocation PublishLocation = "riotclient"
	RiotStatusLocation PublishLocation = "riotstatus"
	GameLocation       PublishLocation = "game"
)

type Status added in v0.3.0

type Status struct {
	Message    string `json:"message"`
	StatusCode int    `json:"status_code"`
}

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"`
}

Jump to

Keyboard shortcuts

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