Module aoe2netwrapper.models.leaderboard
aoe2netwrapper.models.leaderboard
This module contains the model objects to encapsulate the responses from the endpoint at https://aoe2.net/api/leaderboard
View Source
"""
aoe2netwrapper.models.leaderboard
---------------------------------
This module contains the model objects to encapsulate the responses from the endpoint at
https://aoe2.net/api/leaderboard
"""
from typing import Any, List, Optional
from pydantic import BaseModel, Field
class LeaderBoardSpot(BaseModel):
"""An object to encapsulate any entry in the leaderboard ranking."""
profile_id: Optional[int] = Field(None, description="The ID attributed to the player by AoE II")
rank: Optional[int] = Field(None, description="The player's rank on the ladder")
rating: Optional[int] = Field(None, description="The player's rating in the ELO system")
steam_id: Optional[int] = Field(None, description="ID of the player on the Steam platform")
icon: Optional[Any] = Field(None, description="The player's icon")
name: Optional[str] = Field(None, description="The player's in-game name")
clan: Optional[str] = Field(None, description="The player's clan / team")
country: Optional[str] = Field(None, description="Country the player connected from")
previous_rating: Optional[int] = Field(None, description="Player's rating at their last match")
highest_rating: Optional[int] = Field(None, description="Highest rating achieved by the player")
streak: Optional[int] = Field(None, description="Current number of consecutive wins")
lowest_streak: Optional[int] = Field(None, description="Lowest streak achieved by this player")
highest_streak: Optional[int] = Field(None, description="Highest streak achieved by this player")
games: Optional[int] = Field(None, description="The total amount of games played by the player")
wins: Optional[int] = Field(None, description="Total amount of wins")
losses: Optional[int] = Field(None, description="Total amount of losses")
drops: Optional[int] = Field(None, description="Number of games the player dropped out of")
last_match: Optional[int] = Field(None, description="Timestamp of the last game played")
last_match_time: Optional[int] = Field(None, description="Timestamp of the last game played")
class LeaderBoardResponse(BaseModel):
"""An object to encapsulate the response from the leaderboard API."""
total: Optional[int] = Field(None, description="Total number of entries in the leaderboard")
leaderboard_id: Optional[int] = Field(None, description="ID of the leaderboard queried, aka game type")
start: Optional[int] = Field(None, description="Starting rank of the first entry in the response")
count: Optional[int] = Field(None, description="Number of entries returned")
leaderboard: Optional[List[LeaderBoardSpot]] = Field(None, description="List of LeaderBoardSport entries")
Classes
LeaderBoardResponse
class LeaderBoardResponse(
__pydantic_self__,
**data: Any
)
View Source
class LeaderBoardResponse(BaseModel):
"""An object to encapsulate the response from the leaderboard API."""
total: Optional[int] = Field(None, description="Total number of entries in the leaderboard")
leaderboard_id: Optional[int] = Field(None, description="ID of the leaderboard queried, aka game type")
start: Optional[int] = Field(None, description="Starting rank of the first entry in the response")
count: Optional[int] = Field(None, description="Number of entries returned")
leaderboard: Optional[List[LeaderBoardSpot]] = Field(None, description="List of LeaderBoardSport entries")
Ancestors (in MRO)
- pydantic.main.BaseModel
- pydantic.utils.Representation
Class variables
Config
Static methods
construct
def construct(
_fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
**values: Any
) -> 'Model'
Creates a new model setting dict and fields_set from trusted or pre-validated data.
Default values are respected, but no other validation is performed.
Behaves as if Config.extra = 'allow'
was set since it adds all passed values
from_orm
def from_orm(
obj: Any
) -> 'Model'
parse_file
def parse_file(
path: Union[str, pathlib.Path],
*,
content_type: 'unicode' = None,
encoding: 'unicode' = 'utf8',
proto: pydantic.parse.Protocol = None,
allow_pickle: bool = False
) -> 'Model'
parse_obj
def parse_obj(
obj: Any
) -> 'Model'
parse_raw
def parse_raw(
b: Union[str, bytes],
*,
content_type: 'unicode' = None,
encoding: 'unicode' = 'utf8',
proto: pydantic.parse.Protocol = None,
allow_pickle: bool = False
) -> 'Model'
schema
def schema(
by_alias: bool = True,
ref_template: 'unicode' = '#/definitions/{model}'
) -> 'DictStrAny'
schema_json
def schema_json(
*,
by_alias: bool = True,
ref_template: 'unicode' = '#/definitions/{model}',
**dumps_kwargs: Any
) -> 'unicode'
update_forward_refs
def update_forward_refs(
**localns: Any
) -> None
Try to update ForwardRefs on fields based on this Model, globalns and localns.
validate
def validate(
value: Any
) -> 'Model'
Methods
copy
def copy(
self: 'Model',
*,
include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny')] = None,
exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny')] = None,
update: 'DictStrAny' = None,
deep: bool = False
) -> 'Model'
Duplicate a model, optionally choose which fields to include, exclude and change.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
include | None | fields to include in new model | None |
exclude | None | fields to exclude from new model, as with values this takes precedence over include | None |
update | None | values to change/add in the new model. Note: the data is not validated before creating | |
the new model: you should trust this data | None | ||
deep | None | set to True to make a deep copy of the model |
None |
Returns:
Type | Description |
---|---|
None | new model instance |
dict
def dict(
self,
*,
include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny')] = None,
exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny')] = None,
by_alias: bool = False,
skip_defaults: bool = None,
exclude_unset: bool = False,
exclude_defaults: bool = False,
exclude_none: bool = False
) -> 'DictStrAny'
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
json
def json(
self,
*,
include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny')] = None,
exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny')] = None,
by_alias: bool = False,
skip_defaults: bool = None,
exclude_unset: bool = False,
exclude_defaults: bool = False,
exclude_none: bool = False,
encoder: Union[Callable[[Any], Any], NoneType] = None,
models_as_dict: bool = True,
**dumps_kwargs: Any
) -> 'unicode'
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.
LeaderBoardSpot
class LeaderBoardSpot(
__pydantic_self__,
**data: Any
)
View Source
class LeaderBoardSpot(BaseModel):
"""An object to encapsulate any entry in the leaderboard ranking."""
profile_id: Optional[int] = Field(None, description="The ID attributed to the player by AoE II")
rank: Optional[int] = Field(None, description="The player's rank on the ladder")
rating: Optional[int] = Field(None, description="The player's rating in the ELO system")
steam_id: Optional[int] = Field(None, description="ID of the player on the Steam platform")
icon: Optional[Any] = Field(None, description="The player's icon")
name: Optional[str] = Field(None, description="The player's in-game name")
clan: Optional[str] = Field(None, description="The player's clan / team")
country: Optional[str] = Field(None, description="Country the player connected from")
previous_rating: Optional[int] = Field(None, description="Player's rating at their last match")
highest_rating: Optional[int] = Field(None, description="Highest rating achieved by the player")
streak: Optional[int] = Field(None, description="Current number of consecutive wins")
lowest_streak: Optional[int] = Field(None, description="Lowest streak achieved by this player")
highest_streak: Optional[int] = Field(None, description="Highest streak achieved by this player")
games: Optional[int] = Field(None, description="The total amount of games played by the player")
wins: Optional[int] = Field(None, description="Total amount of wins")
losses: Optional[int] = Field(None, description="Total amount of losses")
drops: Optional[int] = Field(None, description="Number of games the player dropped out of")
last_match: Optional[int] = Field(None, description="Timestamp of the last game played")
last_match_time: Optional[int] = Field(None, description="Timestamp of the last game played")
Ancestors (in MRO)
- pydantic.main.BaseModel
- pydantic.utils.Representation
Class variables
Config
Static methods
construct
def construct(
_fields_set: Union[ForwardRef('SetStr'), NoneType] = None,
**values: Any
) -> 'Model'
Creates a new model setting dict and fields_set from trusted or pre-validated data.
Default values are respected, but no other validation is performed.
Behaves as if Config.extra = 'allow'
was set since it adds all passed values
from_orm
def from_orm(
obj: Any
) -> 'Model'
parse_file
def parse_file(
path: Union[str, pathlib.Path],
*,
content_type: 'unicode' = None,
encoding: 'unicode' = 'utf8',
proto: pydantic.parse.Protocol = None,
allow_pickle: bool = False
) -> 'Model'
parse_obj
def parse_obj(
obj: Any
) -> 'Model'
parse_raw
def parse_raw(
b: Union[str, bytes],
*,
content_type: 'unicode' = None,
encoding: 'unicode' = 'utf8',
proto: pydantic.parse.Protocol = None,
allow_pickle: bool = False
) -> 'Model'
schema
def schema(
by_alias: bool = True,
ref_template: 'unicode' = '#/definitions/{model}'
) -> 'DictStrAny'
schema_json
def schema_json(
*,
by_alias: bool = True,
ref_template: 'unicode' = '#/definitions/{model}',
**dumps_kwargs: Any
) -> 'unicode'
update_forward_refs
def update_forward_refs(
**localns: Any
) -> None
Try to update ForwardRefs on fields based on this Model, globalns and localns.
validate
def validate(
value: Any
) -> 'Model'
Methods
copy
def copy(
self: 'Model',
*,
include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny')] = None,
exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny')] = None,
update: 'DictStrAny' = None,
deep: bool = False
) -> 'Model'
Duplicate a model, optionally choose which fields to include, exclude and change.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
include | None | fields to include in new model | None |
exclude | None | fields to exclude from new model, as with values this takes precedence over include | None |
update | None | values to change/add in the new model. Note: the data is not validated before creating | |
the new model: you should trust this data | None | ||
deep | None | set to True to make a deep copy of the model |
None |
Returns:
Type | Description |
---|---|
None | new model instance |
dict
def dict(
self,
*,
include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny')] = None,
exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny')] = None,
by_alias: bool = False,
skip_defaults: bool = None,
exclude_unset: bool = False,
exclude_defaults: bool = False,
exclude_none: bool = False
) -> 'DictStrAny'
Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.
json
def json(
self,
*,
include: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny')] = None,
exclude: Union[ForwardRef('AbstractSetIntStr'), ForwardRef('MappingIntStrAny')] = None,
by_alias: bool = False,
skip_defaults: bool = None,
exclude_unset: bool = False,
exclude_defaults: bool = False,
exclude_none: bool = False,
encoder: Union[Callable[[Any], Any], NoneType] = None,
models_as_dict: bool = True,
**dumps_kwargs: Any
) -> 'unicode'
Generate a JSON representation of the model, include
and exclude
arguments as per dict()
.
encoder
is an optional function to supply as default
to json.dumps(), other arguments as per json.dumps()
.