api

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package api contains constant values for regions and error values for known error return codes from the various APIs

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadRequest = Error{
		Message:    "bad request",
		StatusCode: http.StatusBadRequest,
	}
	ErrUnauthorized = Error{
		Message:    "unauthorized",
		StatusCode: http.StatusUnauthorized,
	}
	ErrForbidden = Error{
		Message:    "forbidden",
		StatusCode: http.StatusForbidden,
	}
	ErrNotFound = Error{
		Message:    "not found",
		StatusCode: http.StatusNotFound,
	}
	ErrMethodNotAllowed = Error{
		Message:    "method not allowed",
		StatusCode: http.StatusMethodNotAllowed,
	}
	ErrUnsupportedMediaType = Error{
		Message:    "unsupported media type",
		StatusCode: http.StatusUnsupportedMediaType,
	}
	ErrRateLimitExceeded = Error{
		Message:    "rate limit exceeded",
		StatusCode: http.StatusTooManyRequests,
	}
	ErrInternalServerError = Error{
		Message:    "internal server error",
		StatusCode: http.StatusInternalServerError,
	}
	ErrBadGateway = Error{
		Message:    "bad gateway",
		StatusCode: http.StatusBadGateway,
	}
	ErrServiceUnavailable = Error{
		Message:    "service unavailable",
		StatusCode: http.StatusServiceUnavailable,
	}
	ErrGatewayTimeout = Error{
		Message:    "gateway timeout",
		StatusCode: http.StatusGatewayTimeout,
	}
	StatusToError = map[int]Error{
		http.StatusBadRequest:           ErrBadRequest,
		http.StatusUnauthorized:         ErrUnauthorized,
		http.StatusForbidden:            ErrForbidden,
		http.StatusNotFound:             ErrNotFound,
		http.StatusMethodNotAllowed:     ErrMethodNotAllowed,
		http.StatusUnsupportedMediaType: ErrUnsupportedMediaType,
		http.StatusTooManyRequests:      ErrRateLimitExceeded,
		http.StatusInternalServerError:  ErrInternalServerError,
		http.StatusBadGateway:           ErrBadGateway,
		http.StatusServiceUnavailable:   ErrServiceUnavailable,
		http.StatusGatewayTimeout:       ErrGatewayTimeout,
	}
)

All regularly returned errors by the Riot API

Functions

This section is empty.

Types

type Error

type Error struct {
	Message    string
	StatusCode int
}

Error is a custom error type used by the API to signal http error responses

func (Error) Error

func (e Error) Error() string

type Region

type Region string

Region represents a server region

const (
	RegionBrasil            Region = "br1"
	RegionEuropeNorthEast   Region = "eun1"
	RegionEuropeWest        Region = "euw1"
	RegionJapan             Region = "jp1"
	RegionKorea             Region = "kr"
	RegionLatinAmericaNorth Region = "la1"
	RegionLatinAmericaSouth Region = "la2"
	RegionMiddleEast        Region = "me1"
	RegionNorthAmerica      Region = "na1"
	RegionOceania           Region = "oc1"
	RegionPBE               Region = "pbe1"
	// Deprecated: Use api.RegionSouthEastAsia instead. PH2 got merged into the SEA server on 8th of Jan, 2025.
	RegionPhilippines Region = "sg2" // PH2 got merged into SG2 on Jan. 8th, 2025. Replaced for backwards compatability.
	RegionRussia      Region = "ru"
	// Deprecated: Use api.RegionSouthEastAsia instead. SG2 is now called SEA
	RegionSingapore     Region = "sg2" // SG2 is now called SEA while still running on SG2.
	RegionSouthEastAsia Region = "sg2"
	// Deprecated: Use api.RegionSouthEastAsia instead. TH2 got merged into the SEA server on 8th of Jan, 2025.
	RegionThailand Region = "sg2" // TH2 got merged into SG2 on Jan. 8th, 2025. Replaced for backwards compatability.
	RegionTurkey   Region = "tr1"
	RegionTaiwan   Region = "tw2"
	RegionVietnam  Region = "vn2"
)

All existing regions

type Route

type Route string

Route represents a server region's route

const (
	RouteAmericas Route = "americas"
	RouteAsia     Route = "asia"
	RouteEurope   Route = "europe"
	RouteSEA      Route = "sea"
)

All existing routes

Jump to

Keyboard shortcuts

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