api

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: MIT Imports: 1 Imported by: 6

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"
	RegionNorthAmerica      Region = "na1"
	RegionOceania           Region = "oc1"
	RegionPBE               Region = "pbe1"
	RegionPhilippines       Region = "ph2"
	RegionRussia            Region = "ru"
	RegionSingapore         Region = "sg2"
	RegionThailand          Region = "th2"
	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