# 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}") ``` ## BeatSaverClient ```python from helpers.BeatSaverAPI import BeatSaverAPI beatsaver_api = BeatSaverAPI() map_data = beatsaver_api.get_maps(year=2024, month=9) ``` ## SimpleBeatLeaderAPI ```python from helpers.SimpleBeatLeaderAPI import SimpleBeatLeaderAPI player_id = "76561199407393962" beatleader_api = SimpleBeatLeaderAPI() data = beatleader_api.get_player_accgraph(player_id) data[0] filtered_data = [{'acc': item['acc'], 'stars': item['stars'], 'hash': item['hash']} for item in data] filtered_data[0] ``` ## SimpleBeatSaverAPI ```python from helpers.SimpleBeatSaverAPI import SimpleBeatSaverAPI beat_saver_api = SimpleBeatSaverAPI() curated_songs = beat_saver_api.get_curated_songs(use_cache=False) mapper_maps = beat_saver_api.get_mapper_maps(mapper_id=4285738, use_cache=False) ``` ## ScoreSaberAPI ```python from helpers.ScoreSaberAPI import ScoreSaberAPI from clients.scoresaber.models.get_api_player_player_id_scores_sort import GetApiPlayerPlayerIdScoresSort # Instantiate the API client scoresaber_api = ScoreSaberAPI() # Specify the player ID you want to fetch scores for player_id = "76561199407393962" # Fetch player scores scores_data = scoresaber_api.get_player_scores( player_id=player_id, use_cache=True, # Use cached data if available limit=100, # Number of scores per page sort=GetApiPlayerPlayerIdScoresSort.RECENT, # Sort by most recent scores max_pages=2 # Maximum number of pages to fetch ) ranked_scores = [score for score in scores_data.get('playerScores') if score['leaderboard']['stars'] != 0] print(f"Got {len(scores_data.get('playerScores'))} scores for player {player_id}") print(f"Got {len(ranked_scores)} ranked scores for player {player_id}") ```