rankade.api.Endpoint

Module Contents

Classes

Endpoint_Method

HTTP Request methods RFC2616 Section 5.1.1

Endpoint_Mixin

Stores the basic information needed for each endpoint.

Endpoint

Enum with information needed for each request. auth, paginated, method, base_path

Endpoint_Request

Full information needed for Api.request to make a request.

API

class Endpoint_Method(*args, **kwds)[source]

Bases: enum.Enum

HTTP Request methods RFC2616 Section 5.1.1

Initialization

GET = 'GET'
POST = 'POST'
PUT = 'PUT'
PATCH = 'PATCH'
DELETE = 'DELETE'
HEAD = 'HEAD'
OPTIONS = 'OPTIONS'
TRACE = 'TRACE'
CONNECT = 'CONNECT'
class Endpoint_Mixin[source]

Stores the basic information needed for each endpoint.

auth: bool = None

Does the request need authorisation before proceeding.

paginated: bool = None

Will the response be paginated.

method: Endpoint_Method = None

HTTP Method used in the request.

base_path: str = None

URL path to use in request.

class Endpoint(*args, **kwds)[source]

Bases: rankade.api.Endpoint.Endpoint_Mixin, enum.Enum

Enum with information needed for each request. auth, paginated, method, base_path

Initialization

AUTH = (False, False)

Authorisation returns JWT. GET /auth

GAME = (True, False)

Creates a new game by giving its bggId (BoardGameGeek game id) or a game name. POST /games/game

GAMES = (True, False)

Returns the list of the group’s games (i.e. games with at least one match played within the group). GET /games

Returns the list of rankade’s most popular games. GET /games/popular

Searches games by name. GET /games/search

MATCH = (True, False)

Adds one or more matches to the group. POST /matches/match

MATCH_EXISTS = (True, False)

Check if an accepted match exists by giving its external identifier. GET /matches/match/exists

MATCH_STATUS = (True, False)

Retrieves API-recorded matches status. GET /matches/status

MATCHES = (True, True)

Retrieve registered and processed matches. GET /matches

PLAYER = (True, False)

Create a ghost player within the group.POST /players/player

PLAYERS = (True, True)

Returns the list of the group’s players. GET /player

QUOTA = (True, False)

Returns quota usage details in percentage for the current client. [GET /quota] (https://rankade.com/api/#get-quota)

RANKINGS = (True, True)

Get a groups rankings, filter by subset, beginning with match number. GET /rankings

STATUS = (True, False)

Returns the status of the service. GET /status

SUBSET = (True, False)

Returns a list of the groups subsets. GET /subsets

_TEST = (False, False)

Endpoint used for unit tests.

class Endpoint_Request[source]

Full information needed for Api.request to make a request.

endpoint: Endpoint = None

Basic information for Endpoint

params: rankade.api.Api.PARAMS = 'field(...)'

Additional Parameters to be used in request

headers: rankade.api.Api.HEADERS = 'field(...)'

Additional Headers to be used in the request

json: rankade.api.Api.JSON = 'field(...)'

JSON to be sent as part of the request

page: Optional[int] = 'field(...)'

Page number to be requested

match: Optional[int] = 'field(...)'

Match number to be requested

subset: Optional[str] = 'field(...)'

Subset Id to be requested

__post_init__()[source]
property path: str

Builds the URL path to use, from the base path included in the Endpoint with {page}, {match}, & {subset} replaced with the appropriate value

property method: str

Returns the required HTTP method to be used for the endpoint.

property requires_auth: bool

Does the endpoint require authorisation before making the request.

property is_paginated: bool

Will the request return a paginated response.

add_parameter(name: str, value: str) MutableMapping[str, Union[str, int]][source]

Convenience method to add a custom parameter.

add_header(name: str, value: str) MutableMapping[str, str][source]

Convenience method to add a custom header.

set_json(json: rankade.api.Api.JSON) rankade.api.Api.JSON[source]

Convenience method to set the JSON body of the request.