27 lines
850 B
Markdown
27 lines
850 B
Markdown
# API Client Wrapper Usage
|
|
|
|
## BeatLeaderClient
|
|
|
|
```python
|
|
from helpers.BeatLeaderAPI import BeatLeaderAPI
|
|
from clients.beatleader.models.scores_sort_by import ScoresSortBy
|
|
from clients.beatleader.models.order import Order
|
|
|
|
# Instantiate the API client
|
|
beatleader_api = BeatLeaderAPI()
|
|
|
|
# Specify the player ID you want to fetch scores for
|
|
player_id = "76561199407393962"
|
|
|
|
# Fetch player scores
|
|
scores_data = beatleader_api.get_player_scores(
|
|
player_id=player_id,
|
|
use_cache=True, # Use cached data if available
|
|
count=100, # Number of scores per page
|
|
sort_by=ScoresSortBy.DATE, # Sort scores by date
|
|
order=Order.DESC, # In descending order
|
|
max_pages=2 # Maximum number of pages to fetch
|
|
)
|
|
print(f"Got {len(scores_data.get('playerScores'))} scores for player {player_id}")
|
|
```
|