Back to godoc.org
github.com/KnutZuidema/golio/api

package api

v0.0.0 (181b8e8)
Latest Go to latest
Published: May 27, 2020 | License: MIT | Module: github.com/KnutZuidema/golio

Overview

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

Index

Constants

const (
	RegionBrasil            Region = "br1"
	RegionEuropeNorthEast          = "eun1"
	RegionEuropeWest               = "euw1"
	RegionJapan                    = "jp1"
	RegionKorea                    = "kr"
	RegionLatinAmericaNorth        = "la1"
	RegionLatinAmericaSouth        = "la2"
	RegionNorthAmerica             = "na1"
	RegionOceania                  = "oc1"
	RegionTurkey                   = "tr1"
	RegionRussia                   = "ru"
	RegionPBE                      = "pbe1"
)

All existing regions

Variables

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

var (
	// Regions is a list of all available regions
	Regions = []Region{
		RegionBrasil,
		RegionEuropeNorthEast,
		RegionEuropeWest,
		RegionJapan,
		RegionKorea,
		RegionLatinAmericaNorth,
		RegionLatinAmericaSouth,
		RegionNorthAmerica,
		RegionOceania,
		RegionTurkey,
		RegionRussia,
		RegionPBE,
	}
)

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

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
f or F : Jump to identifier