2024-10-05 05:01:56 +00:00
|
|
|
# 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}")
|
|
|
|
```
|
2024-10-12 00:40:45 +00:00
|
|
|
|
|
|
|
## BeatSaverClient
|
|
|
|
|
|
|
|
```python
|
|
|
|
from helpers.BeatSaverAPI import BeatSaverAPI
|
|
|
|
beatsaver_api = BeatSaverAPI()
|
|
|
|
map_data = beatsaver_api.get_maps(year=2024, month=9)
|
|
|
|
```
|