API Models¶
The chicken_dinner.pubgapi.PUBG
class returns type instances that
are associated with the resources from the PUBG JSON API. These objects pass
the PUBG
object (and shard
) between themselves so that related objects
can be generated from one another with method calls.
Each of the API model objects also provides a response
attribute that
contains the deserialized JSON response for the associated API call.
Match Models¶
See Match Detail Models for detailed match-level models.
Season Models¶
Models related to season objects and metadata.
-
class
chicken_dinner.models.
Season
(pubg, data, shard=None)[source]¶ Single season model.
An object containing metadata about a PUBG season.
- Parameters
pubg – an instance of the class
chicken_dinner.pubgapi.PUBG
data – the
data
payload from a season responseshard – the shard for the season response
-
data
= None¶ The data payload for this season
-
get_player
(player_id)[source]¶ Get a player-season dataset for this season.
- Parameters
player_id – a player account id or instance of
chicken_dinner.models.Player
to retrieve data for this season- Returns
a
chicken_dinner.models.PlayerSeason
for thisplayer_id
-
property
id
¶ The season id.
-
property
shard
¶ The shard for this season.
-
class
chicken_dinner.models.
Seasons
(pubg, shard=None)[source]¶ Seasons model.
An iterable containing instances of the class
chicken_dinner.models.Season
for each season.- Parameters
pubg – an instance of the class
chicken_dinner.pubgapi.PUBG
shard – the shard for the seasons response
-
current
()[source]¶ Get the current season.
- Returns
a
chicken_dinner.models.Season
instance for the current season
-
property
data
¶ The seasons’ data payload from the response.
-
property
ids
¶ Get a list of the season ids.
-
response
= None¶ The API response for this object
-
property
shard
¶ The shard for this player.
-
property
url
¶ The url for the model response.
Player Models¶
Models related to player objects, stats, and metadata.
-
class
chicken_dinner.models.
Leaderboard
(pubg, game_mode, shard=None)[source]¶ Leaderboard model.
An object for a leaderboard and its top players.
- Parameters
pubg – an instance of the class
chicken_dinner.pubgapi.PUBG
game_mode (str) – the game mode for the leaderboard
shard (str) – the shard for the seasons response
-
property
game_mode
¶ The game mode for this leaderboard
-
property
ids
¶ The player ids from this leaderboard in rank order.
-
property
names
¶ The player names from this leaderboard in rank order.
-
property
shard
¶ The shard for this leaderboard.
-
to_table
(exclude_fields=None)[source]¶ Create a string representing the leaderboard and stats.
- fields are:
“rank”, “id”, “name”, “rank_points”, “wins”, “games”, “win_ratio”, “average_damage”, “kills”, “kill_death_ratio”, “average_rank”
- Parameters
exclude_fields (list(str)) – a list of fields to include
-
property
url
¶ A URL for this leaderboard resource.
-
class
chicken_dinner.models.
Player
(pubg, player_id, data=None, shard=None)[source]¶ Player model.
An object encapsulating metadata about a PUBG player.
- Parameters
pubg – an instance of the class
chicken_dinner.pubgapi.PUBG
player_id (str) – the player’s account id
data (dict) – (optional) the data payload from the player response
shard (str) – the shard for the seasons response
-
property
data
¶ The data payload of the player response.
-
classmethod
from_data
(pubg, data, shard=None)[source]¶ Constructor for a player object with a data payload.
- Parameters
pubg – an instance of the class
chicken_dinner.pubgapi.PUBG
data (dict) – the data payload from the player response
shard (str) – the shard for the seasons response
-
get_current_season
()[source]¶ Get the player-season data for the current season.
- Returns
a
chicken_dinner.models.PlayerSeason
instance for the current season
-
get_season
(season_id)[source]¶ Get a season response for a specific season.
- Parameters
season_id – a
season_id
orchicken_dinner.models.Season
object from which to get player-season data. Use the string “current” to get the current season.- Returns
a
chicken_dinner.models.PlayerSeason
instance
-
property
id
¶ The player account id.
-
property
match_ids
¶ A list of the player’s most recent match ids (most recent first).
-
property
name
¶ The player’s in-game name.
-
property
patch_version
¶ The last patch version on which the player has played.
-
response
= None¶ The API response for this object.
-
property
shard
¶ The shard for this player.
-
property
stats
¶ Stats for the player.
-
property
title_id
¶ The title_id for the data.
-
property
url
¶ The URL for this player resource.
-
class
chicken_dinner.models.
Players
(pubg, filter_type, filter_value, shard=None)[source]¶ Players model.
An iterable containing multiple instances of the class
chicken_dinner.models.Player
.- Parameters
pubg – an instance of the class
chicken_dinner.pubgapi.PUBG
filter_type (str) – either “player_ids” or “player_names”
filter_value (list) – a list of
player_ids
orplayer_names
corresponding to thefilter_type
parametershard (str) – the shard for the seasons response
-
property
data
¶ The data payload of the repsonse.
-
filter_type
= None¶ The filter type for this Players query
-
filter_value
= None¶ The filter value for this Players query
-
property
ids
¶ A list of player ids corresponding to the players.
-
property
names
¶ A list of player names corresponding to the players.
-
response
= None¶ The API response for this object
-
property
shard
¶ The shard for this player.
Return a list of matches in which all players participated.
- Returns
list of
match_ids
-
property
url
¶ The URL for this players resource.
-
class
chicken_dinner.models.
PlayerSeason
(pubg, player_id, season_id, shard=None)[source]¶ Player-season model.
An object containing data about a player’s season (or lifetime) data and stats.
- Parameters
pubg – an instance of the class
chicken_dinner.pubgapi.PUBG
player_id (str) – the player’s account id
season_id (str) – a season id for the player data
shard (str) – the shard for the seasons response
-
property
data
¶ The data payload from the response.
-
game_mode_stats
(group=None, perspective=None)[source]¶ Get game mode states for a group-perspective (game mode).
- Parameters
group (str) – (optional) either
solo
,duo
, orsquad
. If not specified returns stats for all group modesperspective (str) – (optional) either
tpp
orfpp
. If not specified returns stats for all perspectives
-
property
id
¶ The ids of the player and season.
- Returns
a dict with keys
player_id
andseason_id
-
match_ids
(group=None, perspective=None, flat=False)[source]¶ Get recent match_ids for a group-perspective (game mode).
- Parameters
group (str) – (optional) either
solo
,duo
, orsquad
. If not specified returnsmatch_ids
for all group modesperspective (str) – (optional) either
tpp
orfpp
. If not specified returnsmatch_ids
for all perspectivesflat (bool) – if
True
returns match ids in a list
-
property
player_id
¶ The player’s account id.
-
response
= None¶ The API response for this object.
-
property
season_id
¶ The season id.
-
property
shard
¶ The shard for this player-season.
-
property
url
¶ A URL for this player-season resource.
Other Models¶
-
class
chicken_dinner.models.
Status
(pubg)[source]¶ Status model.
Contains information about the status of the PUBG API.
- Parameters
pubg – an instance of the
chicken_dinner.pubgapi.PUBG
class
-
property
data
¶ The status data payload.
-
property
id
¶ Get the id of the status.
-
property
released_at
¶ Get the timestamp this version was released.
-
response
= None¶ The API response for this object
-
property
url
¶ The status endpoint URL.
-
property
version
¶ Get the API version.
-
class
chicken_dinner.models.
Samples
(pubg, start=None, shard=None)[source]¶ Samples model.
An object containing sample match data for a PUBG shard.
- Parameters
pubg – an instance of the class
chicken_dinner.pubgapi.PUBG
start – (optional) the timestamp from which samples are generated
shard – the shard for the samples response
-
property
created_at
¶ The timestamp on which the set of samples was created.
-
property
data
¶ The data payload of the samples response.
-
property
id
¶ An id for the samples.
-
property
match_ids
¶ A list of match ids from the samples response.
-
response
= None¶ The API response for this object
-
property
shard
¶ The shard for this player.
-
start
= None¶ The start timestamp for this set of samples
-
property
title_id
¶ The title id associated with the samples.
-
property
url
¶ A URL for this samples resource.