Player
High-level player object for convenient access to player data.
This class provides a convenient interface for accessing player data across multiple API endpoints. The riot account data is fetched immediately during creation, while other data is fetched lazily and cached within the object to avoid repeated API calls.
Source code in nexar/models/player.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 |
|
client
instance-attribute
The client instance to use for API calls.
game_name
instance-attribute
Player's game name (without #).
puuid
property
Get the player's PUUID.
region = None
class-attribute
instance-attribute
The player's region (defaults to client default).
riot_account
instance-attribute
The player's Riot account information.
tag_line
instance-attribute
Player's tag line (without #).
__repr__()
__str__()
by_riot_id(client, riot_id, *, region=None)
async
classmethod
Create a Player instance from a Riot ID in "username#tagline" format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
client
|
NexarClient
|
The client instance to use for API calls |
required |
riot_id
|
str
|
Riot ID in "username#tagline" format (e.g., "bexli#bex") |
required |
region
|
Region | None
|
The player's region (defaults to client default) |
None
|
Returns:
Type | Description |
---|---|
Player
|
Player instance with riot account data pre-fetched |
Raises:
Type | Description |
---|---|
ValueError
|
If riot_id is not in the correct format |
Source code in nexar/models/player.py
create(client, game_name, tag_line, *, region=None)
async
classmethod
Create a Player instance and fetch the riot account data immediately.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
client
|
NexarClient
|
The client instance to use for API calls |
required |
game_name
|
str
|
Player's game name (without #) |
required |
tag_line
|
str
|
Player's tag line (without #) |
required |
region
|
Region | None
|
The player's region (defaults to client default) |
None
|
Returns:
Type | Description |
---|---|
Player
|
Player instance with riot account data pre-fetched |
Source code in nexar/models/player.py
get_flex_rank()
async
Get the player's flex queue rank.
- API queue type: RANKED_FLEX_SR
- Map: Summoner's Rift
- Colloquial name: Flex Queue
Returns:
Type | Description |
---|---|
LeagueEntry | None
|
LeagueEntry for flex queue, or None if unranked |
Source code in nexar/models/player.py
get_last_match()
async
Get the player's most recent match.
Returns:
Type | Description |
---|---|
Match | None
|
Most recent Match object, or None if no matches found |
Source code in nexar/models/player.py
get_league_entries()
async
Get the player's league entries.
Returns:
Type | Description |
---|---|
list[LeagueEntry]
|
List of league entries for the player |
Source code in nexar/models/player.py
get_match_ids(*, start_time=None, end_time=None, queue=None, match_type=None, start=0, count=20)
async
Get match IDs for the player.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start_time
|
int | datetime | None
|
Epoch timestamp in seconds or datetime for match start filter |
None
|
end_time
|
int | datetime | None
|
Epoch timestamp in seconds or datetime for match end filter |
None
|
queue
|
Queue | int | None
|
Queue ID filter (int or QueueId enum) |
None
|
match_type
|
MatchType | str | None
|
Match type filter (str or MatchType enum) |
None
|
start
|
int
|
Start index (0-based) |
0
|
count
|
int
|
Number of match IDs to return (0-100) |
20
|
Returns:
Type | Description |
---|---|
list[str]
|
List of match IDs |
Source code in nexar/models/player.py
get_matches(*, start_time=None, end_time=None, queue=None, match_type=None, start=0, count=20)
async
Get match details for the player.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start_time
|
int | datetime | None
|
Epoch timestamp in seconds or datetime for match start filter |
None
|
end_time
|
int | datetime | None
|
Epoch timestamp in seconds or datetime for match end filter |
None
|
queue
|
Queue | int | None
|
Queue ID filter (int or QueueId enum) |
None
|
match_type
|
MatchType | str | None
|
Match type filter (str or MatchType enum) |
None
|
start
|
int
|
Start index (0-based) |
0
|
count
|
int
|
Number of match IDs to return (0-100) |
20
|
Returns:
Type | Description |
---|---|
MatchList
|
MatchList of Match objects with detailed match information |
Source code in nexar/models/player.py
get_recent_performance_by_role(count=50, queue=None)
async
Get performance statistics grouped by role.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
count
|
int
|
Number of recent matches to analyze (default 50) |
50
|
queue
|
Queue | int | None
|
Optional queue type filter |
None
|
Returns:
Type | Description |
---|---|
dict[str, dict[str, Any]]
|
Dictionary with role names as keys and performance stats as values |
Source code in nexar/models/player.py
get_solo_rank()
async
Get the player's solo queue rank.
- API queue type: RANKED_SOLO_5x5
- Map: Summoner's Rift
- Colloquial name: Solo Queue or Solo/Duo Queue
Returns:
Type | Description |
---|---|
LeagueEntry | None
|
LeagueEntry for solo queue, or None if unranked |
Source code in nexar/models/player.py
get_solo_rank_value()
async
Combined tier/rank value for the player's solo queue rank.
Returns None if the player is unranked in solo queue.
Useful for comparing or sorting players by solo queue rank.
Returns:
Type | Description |
---|---|
tuple[int, int] | None
|
Tuple of (rank_value, league_points), or None if unranked |
Source code in nexar/models/player.py
get_summoner()
async
Get the player's summoner information.
Returns:
Type | Description |
---|---|
Summoner
|
Summoner with summoner information |
Source code in nexar/models/player.py
get_top_champions(top_n=5, count=20, queue=None, match_type=None)
async
Get top played champions.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
top_n
|
int
|
Number of top champions to return (default 5) |
5
|
count
|
int
|
Number of recent matches to analyze (default 20) |
20
|
queue
|
Queue | int | None
|
Optional queue type filter |
None
|
match_type
|
MatchType | str | None
|
Optional match type filter |
None
|
Returns:
Type | Description |
---|---|
list[ChampionStats]
|
List of ChampionStats sorted by games played (descending) |
Source code in nexar/models/player.py
is_on_win_streak(min_games=3)
async
Check if the player is currently on a win streak.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
min_games
|
int
|
Minimum number of games to consider a streak (default 3) |
3
|
Returns:
Type | Description |
---|---|
bool
|
True if the player is on a win streak of at least min_games |