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
datapayload from a season response - shard – 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.Playerto retrieve data for this seasonReturns: a chicken_dinner.models.PlayerSeasonfor thisplayer_id
-
id¶ The season id.
-
shard¶ The shard for this season.
- pubg – an instance of the class
-
class
chicken_dinner.models.Seasons(pubg, shard=None)[source]¶ Seasons model.
An iterable containing instances of the class
chicken_dinner.models.Seasonfor 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.Seasoninstance for the current season
-
data¶ The seasons’ data payload from the response.
-
ids¶ Get a list of the season ids.
-
response= None¶ The API response for this object
-
shard¶ The shard for this player.
-
url¶ The url for the model response.
- pubg – an instance of the class
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
-
game_mode¶ The game mode for this leaderboard
-
ids¶ The player ids from this leaderboard in rank order.
-
names¶ The player names from this leaderboard in rank order.
-
shard¶ The shard for this leaderboard.
-
url¶ A URL for this leaderboard resource.
- pubg – an instance of the class
-
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
-
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
- pubg – an instance of the class
-
get_current_season()[source]¶ Get the player-season data for the current season.
Returns: a chicken_dinner.models.PlayerSeasoninstance for the current season
-
get_season(season_id)[source]¶ Get a season response for a specific season.
Parameters: season_id – a season_idorchicken_dinner.models.Seasonobject from which to get player-season data. Use the string “current” to get the current season.Returns: a chicken_dinner.models.PlayerSeasoninstance
-
id¶ The player account id.
-
match_ids¶ A list of the player’s most recent match ids (most recent first).
-
name¶ The player’s in-game name.
-
patch_version¶ The last patch version on which the player has played.
-
response= None¶ The API response for this object.
-
shard¶ The shard for this player.
-
stats¶ Stats for the player.
-
title_id¶ The title_id for the data.
-
url¶ The URL for this player resource.
- pubg – an instance of the class
-
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_idsorplayer_namescorresponding to thefilter_typeparameter - shard (str) – the shard for the seasons response
-
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
-
ids¶ A list of player ids corresponding to the players.
-
names¶ A list of player names corresponding to the players.
-
response= None¶ The API response for this object
-
shard¶ The shard for this player.
Return a list of matches in which all players participated.
Returns: list of match_ids
-
url¶ The URL for this players resource.
- pubg – an instance of the class
-
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
-
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 modes - perspective (str) – (optional) either
tpporfpp. If not specified returns stats for all perspectives
- group (str) – (optional) either
-
id¶ The ids of the player and season.
Returns: a dict with keys player_idandseason_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_idsfor all group modes - perspective (str) – (optional) either
tpporfpp. If not specified returnsmatch_idsfor all perspectives - flat (bool) – if
Truereturns match ids in a list
- group (str) – (optional) either
-
player_id¶ The player’s account id.
-
response= None¶ The API response for this object.
-
season_id¶ The season id.
-
shard¶ The shard for this player-season.
-
url¶ A URL for this player-season resource.
- pubg – an instance of the class
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.PUBGclass-
data¶ The status data payload.
-
id¶ Get the id of the status.
-
released_at¶ Get the timestamp this version was released.
-
response= None¶ The API response for this object
-
url¶ The status endpoint URL.
-
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
-
created_at¶ The timestamp on which the set of samples was created.
-
data¶ The data payload of the samples response.
-
id¶ An id for the samples.
-
match_ids¶ A list of match ids from the samples response.
-
response= None¶ The API response for this object
-
shard¶ The shard for this player.
-
start= None¶ The start timestamp for this set of samples
-
title_id¶ The title id associated with the samples.
-
url¶ A URL for this samples resource.
- pubg – an instance of the class