golio: github.com/KnutZuidema/golio/api Index | Files

package api

import "github.com/KnutZuidema/golio/api"

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

Index

Package Files

constants.go docs.go error.go

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 Uses

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 Uses

func (e Error) Error() string

type Region Uses

type Region string

Region represents a server region

Package api imports 1 packages (graph) and is imported by 4 packages. Updated 2020-03-19. Refresh now. Tools for package owners.