Massive rewrite using openapi-python-client.
This commit is contained in:
parent
a45d23ca84
commit
76e796eb16
@ -1,78 +0,0 @@
|
||||
# BeatLeaderAPI Python Wrapper
|
||||
|
||||
This Python class provides a convenient wrapper for interacting with the BeatLeader API, specifically for retrieving player scores and song data for the game Beat Saber.
|
||||
|
||||
## Features
|
||||
|
||||
- Fetch player scores and song data from the BeatLeader API
|
||||
- Local caching of API responses to reduce API calls and improve performance
|
||||
- Automatic pagination handling to retrieve all available data
|
||||
- Configurable cache expiration
|
||||
- Methods to retrieve both full and minimal song data
|
||||
|
||||
## Usage
|
||||
|
||||
### Basic Usage
|
||||
|
||||
```python
|
||||
from saberlist.beatleaderAPI import BeatLeaderAPI
|
||||
|
||||
# Initialize the API wrapper
|
||||
api = BeatLeaderAPI(cache_expiry_days=1)
|
||||
|
||||
# Fetch player scores
|
||||
player_id = '76561199407393962'
|
||||
scores = api.get_player_scores(player_id)
|
||||
|
||||
# Get full song data
|
||||
songs = api.get_player_songs(player_id)
|
||||
|
||||
# Get minimal song data
|
||||
minimal_songs = api.get_player_songs_minimal(player_id)
|
||||
```
|
||||
|
||||
### Caching
|
||||
|
||||
The class uses a local cache to store API responses. By default, the cache is located at:
|
||||
|
||||
- `~/.cache/saberlist/` on Unix-like systems (if `~/.cache/` exists)
|
||||
- `./.cache/` in the current working directory (as a fallback)
|
||||
|
||||
You can control cache behavior:
|
||||
|
||||
```python
|
||||
# Set cache expiry (in days)
|
||||
api = BeatLeaderAPI(cache_expiry_days=7)
|
||||
|
||||
# Force a fresh API call (ignore cache)
|
||||
fresh_scores = api.get_player_scores(player_id, use_cache=False)
|
||||
|
||||
# Clear cache for a specific player
|
||||
api.clear_cache(player_id)
|
||||
|
||||
# Clear all cache
|
||||
api.clear_cache()
|
||||
|
||||
# Get the current cache directory
|
||||
cache_dir = api.get_cache_dir()
|
||||
```
|
||||
|
||||
### Pagination
|
||||
|
||||
The `get_player_scores` method automatically handles pagination to retrieve all available scores. You can control this behavior:
|
||||
|
||||
```python
|
||||
# Set a custom page size (default is 100)
|
||||
scores = api.get_player_scores(player_id, page_size=50)
|
||||
|
||||
# Limit the number of pages fetched
|
||||
scores = api.get_player_scores(player_id, max_pages=5)
|
||||
```
|
||||
|
||||
## Methods
|
||||
|
||||
- `get_player_scores(player_id, use_cache=True, page_size=100, max_pages=None)`: Retrieves all scores for a player.
|
||||
- `get_player_songs(player_id, page=1, count=100, use_cache=True)`: Retrieves full song data for all unique songs a player has played.
|
||||
- `get_player_songs_minimal(player_id, page=1, count=100, use_cache=True)`: Retrieves minimal song data (id, name, author, mapper, hash, bpm, duration) for all unique songs a player has played.
|
||||
- `clear_cache(player_id=None)`: Clears the cache for a specific player or all cached data.
|
||||
- `get_cache_dir()`: Returns the path to the current cache directory.
|
@ -1,80 +0,0 @@
|
||||
# playlist helper
|
||||
|
||||
This is the old readme that explains the scoresaber functions.
|
||||
|
||||
## Usage
|
||||
|
||||
```sh
|
||||
pipx install pleb-saberlist
|
||||
player_scores_by_stars
|
||||
leaderboard_songs_by_stars
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
```sh
|
||||
leaderboard_songs_by_stars
|
||||
Enter the minimum starlevel to include on the playlist (Default: 6.0): 6.2
|
||||
Enter the maximum starlevel to include on the playlist (Default: 6.3):
|
||||
Enter the filename for the playlist (Default: SS Leaderboard 6.2★):
|
||||
2024-07-09 16:06:13 DEBUG: Using selector: EpollSelector
|
||||
2024-07-09 16:06:13 INFO: Fetching page 1/-1 of leaderboards
|
||||
2024-07-09 16:06:13 INFO: Got 14 songs from leaderboard page 1
|
||||
2024-07-09 16:06:13 INFO: Fetching page 2/3 of leaderboards
|
||||
2024-07-09 16:06:14 INFO: Got 14 songs from leaderboard page 2
|
||||
2024-07-09 16:06:14 INFO: Fetching page 3/3 of leaderboards
|
||||
2024-07-09 16:06:14 INFO: Got 3 songs from leaderboard page 3
|
||||
2024-07-09 16:06:14 INFO: Playlist written to SS Leaderboard 6.2★.bplist
|
||||
```
|
||||
|
||||
Player songs by stars:
|
||||
|
||||
```sh
|
||||
player_scores_by_stars
|
||||
2024-07-09 16:07:04 DEBUG: Using selector: EpollSelector
|
||||
Enter the playerid (Default: 76561199407393962):
|
||||
Enter the minimum starlevel to include on the playlist (Default: 5):
|
||||
Enter the maximum starlevel to include on the playlist (Default: 6.0): 5.5
|
||||
Enter the filename for the playlist (Default: Replay SS 5.0★):
|
||||
2024-07-09 16:07:14 INFO: Fetching page 1/-1 of player scores
|
||||
2024-07-09 16:07:15 INFO: Got 100 scores from page 1
|
||||
...
|
||||
2024-07-09 16:07:19 INFO: Fetching page 8/9 of player scores
|
||||
2024-07-09 16:07:20 INFO: Got 96 scores from page 8
|
||||
2024-07-09 16:07:20 INFO: Playlist written to Replay SS 5.0★.bplist
|
||||
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
Clone the repo and install dependencies into a local virtual environment:
|
||||
|
||||
```bash
|
||||
pip install --upgrade pip
|
||||
pip install --editable .
|
||||
```
|
||||
|
||||
## Resources
|
||||
|
||||
* [Beatleader API](https://beatleader.xyz/developer)
|
||||
* [ScoreSaber API](https://docs.scoresaber.com/)
|
||||
|
||||
## Tips
|
||||
|
||||
Count results
|
||||
|
||||
```shell
|
||||
jq '.songs | length' < playlist.bplist
|
||||
```
|
||||
|
||||
Avoid printing covers in console.
|
||||
|
||||
```shell
|
||||
jq 'del(.image)' < playlist.bplist
|
||||
```
|
||||
|
||||
Find the most common mappers the player has played:
|
||||
|
||||
```shell
|
||||
jq -r '.songs[].levelAuthorName' *.bplist | sort | uniq -c | sort -rn | head -n 10
|
||||
```
|
157
docs/PlaylistBuilder.md
Normal file
157
docs/PlaylistBuilder.md
Normal file
@ -0,0 +1,157 @@
|
||||
# PlaylistBuilder Class - Quick Reference
|
||||
|
||||
## Overview
|
||||
|
||||
The **PlaylistBuilder** class is a Python utility designed to create customized playlists efficiently. It manages cover images, tracks usage history to prevent duplication, and structures playlist data in a standardized JSON format. Ideal for applications requiring organized and visually appealing playlists, `PlaylistBuilder` simplifies the playlist creation process.
|
||||
|
||||
## Key Data Structures
|
||||
|
||||
### Difficulty
|
||||
Represents the difficulty level of a song.
|
||||
|
||||
- **Attributes:**
|
||||
- `name` (str): Difficulty name (e.g., "normal", "hard").
|
||||
- `characteristic` (str): Mode or characteristic (e.g., "Standard").
|
||||
|
||||
### Song
|
||||
Encapsulates song details within a playlist.
|
||||
|
||||
- **Attributes:**
|
||||
- `hash` (str): Unique identifier for the song.
|
||||
- `difficulties` (List[Difficulty]): Available difficulty levels.
|
||||
- `key` (Optional[str]): Optional key identifier.
|
||||
- `levelId` (Optional[str]): Optional custom level ID.
|
||||
- `songName` (Optional[str]): Optional name of the song.
|
||||
|
||||
### CustomData
|
||||
Holds additional metadata for the playlist.
|
||||
|
||||
- **Attributes:**
|
||||
- `syncURL` (Optional[str])
|
||||
- `owner` (Optional[str])
|
||||
- `id` (Optional[str])
|
||||
- `hash` (Optional[str])
|
||||
- `shared` (Optional[bool])
|
||||
|
||||
### Playlist
|
||||
Represents the complete playlist structure.
|
||||
|
||||
- **Attributes:**
|
||||
- `playlistTitle` (str): Title of the playlist.
|
||||
- `songs` (List[Song]): List of songs included.
|
||||
- `playlistAuthor` (Optional[str]): Author of the playlist.
|
||||
- `image` (Optional[str]): Base64-encoded cover image.
|
||||
- `coverImage` (Optional[str]): File path to the cover image.
|
||||
- `description` (Optional[str]): Description of the playlist.
|
||||
- `allowDuplicates` (Optional[bool]): Flag to allow duplicate songs.
|
||||
- `customData` (Optional[CustomData]): Additional metadata.
|
||||
|
||||
## PlaylistBuilder Class
|
||||
|
||||
### Initialization
|
||||
|
||||
```python
|
||||
def __init__(self, covers_dir="./covers", history_file="./playlist_history.json", output_dir=None):
|
||||
```
|
||||
|
||||
- **Parameters:**
|
||||
- `covers_dir` (str): Directory containing cover images.
|
||||
- `history_file` (str): Path to the JSON file tracking used covers.
|
||||
- `output_dir` (Optional[str]): Directory to save generated playlists. Defaults to current working directory.
|
||||
|
||||
- **Behavior:**
|
||||
- Ensures the covers directory exists.
|
||||
- Loads or initializes the history of used covers.
|
||||
|
||||
### Methods
|
||||
|
||||
#### `create_playlist`
|
||||
|
||||
Generates a playlist based on provided song data.
|
||||
|
||||
```python
|
||||
def create_playlist(self, playlist_data: List[Dict], playlist_title: str = "playlist", playlist_author: str = "SaberList Tool") -> str:
|
||||
```
|
||||
|
||||
- **Parameters:**
|
||||
- `playlist_data` (List[Dict]): List of song dictionaries.
|
||||
- `playlist_title` (str): Title of the playlist.
|
||||
- `playlist_author` (str): Author of the playlist.
|
||||
|
||||
- **Returns:**
|
||||
- `str`: File path to the created playlist.
|
||||
|
||||
- **Behavior:**
|
||||
- Converts song dictionaries to `Song` instances.
|
||||
- Selects a random unused cover image.
|
||||
- Encodes the cover image to Base64.
|
||||
- Constructs a `Playlist` instance.
|
||||
- Saves the playlist as a `.bplist` JSON file.
|
||||
- Updates the history of used covers.
|
||||
|
||||
## Usage Example
|
||||
|
||||
```python
|
||||
from src.saberlist.PlaylistBuilder import PlaylistBuilder
|
||||
|
||||
# Initialize PlaylistBuilder
|
||||
builder = PlaylistBuilder(
|
||||
covers_dir="./covers",
|
||||
history_file="./playlist_history.json",
|
||||
output_dir="./playlists"
|
||||
)
|
||||
|
||||
# Define song data
|
||||
sample_song = {
|
||||
"hash": "7c9e0a7c523395c7ef9d79006b9d42dc6ab8b44a",
|
||||
"key": "2a44e",
|
||||
"levelId": "custom_level_7c9e0a7c523395c7ef9d79006b9d42dc6ab8b44a",
|
||||
"songName": "Gleodream",
|
||||
"difficulties": [
|
||||
{
|
||||
"name": "normal",
|
||||
"characteristic": "Standard"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
# Create the playlist
|
||||
playlist_path = builder.create_playlist(
|
||||
playlist_data=[sample_song],
|
||||
playlist_title="Chill Vibes",
|
||||
playlist_author="Alice Smith"
|
||||
)
|
||||
|
||||
print(f"Playlist created at: {playlist_path}")
|
||||
```
|
||||
|
||||
## Handling Cover Images
|
||||
|
||||
- **Adding Covers:** Place `.jpg` images in the `covers_dir`. The `PlaylistBuilder` selects an unused cover for each playlist.
|
||||
- **Preventing Duplicates:** The `history_file` tracks used covers to avoid repetition until all covers are utilized.
|
||||
- **Resetting History:** Delete or modify `playlist_history.json` to reset cover usage history.
|
||||
|
||||
## File Structures
|
||||
|
||||
### Playlist File (`.bplist`)
|
||||
|
||||
- **Format:** JSON
|
||||
- **Contents:**
|
||||
- Playlist metadata (title, author, description).
|
||||
- List of songs with details.
|
||||
- Base64-encoded cover image.
|
||||
- Path to the cover image file.
|
||||
|
||||
### History File (`playlist_history.json`)
|
||||
|
||||
- **Format:** JSON
|
||||
- **Contents:**
|
||||
- `used_covers`: Array of filenames that have been used as covers.
|
||||
|
||||
## Additional Information
|
||||
|
||||
- **Logging:** The class logs important actions, such as creating directories and handling missing covers.
|
||||
- **Extensibility:** Easily extendable to support more image formats or additional metadata fields.
|
||||
- **Dependencies:** Utilizes Python's standard libraries (`os`, `json`, `random`, etc.) and `dataclasses` for structured data.
|
||||
|
||||
---
|
75
docs/api.md
Normal file
75
docs/api.md
Normal file
@ -0,0 +1,75 @@
|
||||
# API Libraries
|
||||
|
||||
Libraries were generated using [openapi-python-client](https://github.com/openapi-generators/openapi-python-client) for interacting with various REST APIs:
|
||||
|
||||
```sh
|
||||
nix-shell -p ruff --run "openapi-python-client generate --path archive/scoresaber.com.swagger.json"
|
||||
nix-shell -p ruff --run "openapi-python-client generate --path archive/beatleader.xyz.swagger.json"
|
||||
```
|
||||
|
||||
To convert beatsaver, we had to convert it from openapi 2.0 to 3.0:
|
||||
|
||||
```sh
|
||||
npm set prefix ~/.npm-global
|
||||
export PATH=$HOME/.npm-global/bin:$PATH
|
||||
npm install -g swagger2openapi
|
||||
swagger2openapi --patch archive/beatsaver.com.swagger.json > archive/beatsaver.com.swagger_openapi3.json
|
||||
```
|
||||
|
||||
Then we had to run some python code to fix up the mapping after the conversion:
|
||||
|
||||
```python
|
||||
import json
|
||||
|
||||
# Load the OpenAPI spec
|
||||
with open('archive/beatsaver.com.swagger_openapi3.json', 'r') as f:
|
||||
spec = json.load(f)
|
||||
|
||||
# Fix tags in the main spec
|
||||
if 'tags' in spec:
|
||||
spec['tags'] = [tag['name'] if isinstance(tag, dict) else tag for tag in spec['tags']]
|
||||
|
||||
# Fix tags in each path
|
||||
for path in spec['paths'].values():
|
||||
for method in path.values():
|
||||
if 'tags' in method:
|
||||
method['tags'] = [tag['name'] if isinstance(tag, dict) else tag for tag in method['tags']]
|
||||
|
||||
# Save the fixed spec
|
||||
with open('archive/beatsaver.com.swagger_openapi3_fixed.json', 'w') as f:
|
||||
json.dump(spec, f, indent=2)
|
||||
```
|
||||
|
||||
And we ran this one too:
|
||||
|
||||
```python
|
||||
import json
|
||||
|
||||
# Load the OpenAPI spec
|
||||
with open('archive/beatsaver.com.swagger_openapi3_fixed.json', 'r') as f:
|
||||
spec = json.load(f)
|
||||
|
||||
# Fix tags in the main spec
|
||||
if 'tags' in spec:
|
||||
spec['tags'] = [tag['name'] if isinstance(tag, dict) else tag for tag in spec['tags']]
|
||||
|
||||
# Fix tags and content types in each path
|
||||
for path in spec['paths'].values():
|
||||
for method in path.values():
|
||||
if 'tags' in method:
|
||||
method['tags'] = [tag['name'] if isinstance(tag, dict) else tag for tag in method['tags']]
|
||||
if 'responses' in method:
|
||||
for response in method['responses'].values():
|
||||
if 'content' in response:
|
||||
if '*/*' in response['content']:
|
||||
content = response['content']['*/*']
|
||||
response['content'] = {'application/json': content}
|
||||
|
||||
# Save the fixed spec
|
||||
with open('archive/beatsaver.com.swagger_openapi3_fixed2.json', 'w') as f:
|
||||
json.dump(spec, f, indent=2)
|
||||
```
|
||||
|
||||
```sh
|
||||
nix-shell -p ruff --run "openapi-python-client generate --path archive/beatsaver.com.swagger_openapi3_fixed2.json"
|
||||
```
|
226
docs/capture.md
Normal file
226
docs/capture.md
Normal file
@ -0,0 +1,226 @@
|
||||
# Notes
|
||||
|
||||
Sample bplist (playlist file) for [PlaylistManager](https://github.com/rithik-b/PlaylistManager):
|
||||
|
||||
```json
|
||||
{
|
||||
"playlistTitle": "My Enhanced Playlist",
|
||||
"playlistAuthor": "SaberList Tool",
|
||||
"image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg==",
|
||||
"coverImage": "https://example.com/playlist-cover.jpg",
|
||||
"description": "This is an enhanced version of my playlist with additional fields.",
|
||||
"allowDuplicates": false,
|
||||
"songs": [
|
||||
{
|
||||
"hash": "7c9e0a7c523395c7ef9d79006b9d42dc6ab8b44a",
|
||||
"key": "2a44e",
|
||||
"levelId": "custom_level_7c9e0a7c523395c7ef9d79006b9d42dc6ab8b44a",
|
||||
"songName": "Gleodream",
|
||||
"difficulties": [
|
||||
{
|
||||
"name": "normal",
|
||||
"characteristic": "Standard"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"hash": "18ef469f44b0fa93327f9d193d10bdfe7401e5a0",
|
||||
"key": "1b3f7",
|
||||
"levelId": "custom_level_18ef469f44b0fa93327f9d193d10bdfe7401e5a0",
|
||||
"songName": "Dual Fractal",
|
||||
"difficulties": [
|
||||
{
|
||||
"name": "expert",
|
||||
"characteristic": "Standard"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"hash": "a51425319d892986a4867388153bce45b3c28483",
|
||||
"key": "3c8d9",
|
||||
"levelId": "custom_level_a51425319d892986a4867388153bce45b3c28483",
|
||||
"songName": "Shake The Ground",
|
||||
"difficulties": [
|
||||
{
|
||||
"name": "expert",
|
||||
"characteristic": "Standard"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"customData": {
|
||||
"syncURL": "https://api.beatleader.xyz/playlist/guid/fc1000d77d0f4ed19611043367248ee0",
|
||||
"owner": "76561199407393962",
|
||||
"id": "80650",
|
||||
"hash": "279a9c66ed021b8ef75ff9db848b28ad6c48d3c770bd26f1a586e8d489c728b3",
|
||||
"shared": false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Sample Scoresaber score:
|
||||
|
||||
```python
|
||||
data = {
|
||||
'metadata': {'itemsPerPage': 100, 'page': 10, 'total': 961},
|
||||
'playerScores': [{
|
||||
'leaderboard': {
|
||||
'coverImage': 'https://cdn.scoresaber.com/covers/09F8BEE6908E3A9CD724B3DB3162A5C381ECB156.png',
|
||||
'createdDate': '2020-12-04T12:52:24.000Z',
|
||||
'dailyPlays': 7,
|
||||
'difficulties': None,
|
||||
'difficulty': {
|
||||
'difficulty': 9,
|
||||
'difficultyRaw': '_ExpertPlus_SoloStandard',
|
||||
'gameMode': 'SoloStandard',
|
||||
'leaderboardId': 311333
|
||||
},
|
||||
'id': 311333,
|
||||
'levelAuthorName': 'FatBeanzoop & ExUnReal',
|
||||
'loved': False,
|
||||
'lovedDate': None,
|
||||
'maxPP': -1,
|
||||
'maxScore': 1476715,
|
||||
'playerScore': None,
|
||||
'plays': 13701,
|
||||
'positiveModifiers': False,
|
||||
'qualified': False,
|
||||
'qualifiedDate': '2020-12-05T18:16:56.000Z',
|
||||
'ranked': True,
|
||||
'rankedDate': '2020-12-20T17:15:39.000Z',
|
||||
'songAuthorName': 'Pegboard Nerds',
|
||||
'songHash': '09F8BEE6908E3A9CD724B3DB3162A5C381ECB156',
|
||||
'songName': 'Purple People Eater',
|
||||
'songSubName': '',
|
||||
'stars': 7.05
|
||||
},
|
||||
'score': {
|
||||
'badCuts': 4,
|
||||
'baseScore': 1362341,
|
||||
'deviceControllerLeft': 'Touch',
|
||||
'deviceControllerRight': 'Touch',
|
||||
'deviceHmd': 'Vive',
|
||||
'fullCombo': False,
|
||||
'hasReplay': False,
|
||||
'hmd': 0,
|
||||
'id': 85113198,
|
||||
'leaderboardPlayerInfo': None,
|
||||
'maxCombo': 741,
|
||||
'missedNotes': 4,
|
||||
'modifiedScore': 1362341,
|
||||
'modifiers': '',
|
||||
'multiplier': 1,
|
||||
'pp': 261.6251,
|
||||
'rank': 2711,
|
||||
'timeSet': '2024-09-28T22:02:02.000Z',
|
||||
'weight': 0.04670344831503159
|
||||
}
|
||||
}]
|
||||
}
|
||||
```
|
||||
|
||||
Sample BeatLeader score:
|
||||
|
||||
```python
|
||||
scores = [{
|
||||
'accLeft': 110.32343,
|
||||
'accPP': 366.7179,
|
||||
'accRight': 110.67913,
|
||||
'accuracy': 0.95488137,
|
||||
'badCuts': 1,
|
||||
'baseScore': 1090317,
|
||||
'bombCuts': 1,
|
||||
'bonusPp': 63.974487,
|
||||
'controller': 64,
|
||||
'country': 'NL',
|
||||
'fcAccuracy': 0.95854264,
|
||||
'fcPp': 510.75574,
|
||||
'fullCombo': False,
|
||||
'hmd': 64,
|
||||
'id': 2800090,
|
||||
'lastTryTime': 0,
|
||||
'leaderboard': {'difficulty': {'accRating': 10.151069,
|
||||
'bombs': 666,
|
||||
'difficultyName': 'ExpertPlus',
|
||||
'duration': 227,
|
||||
'featureTags': 0,
|
||||
'id': 115,
|
||||
'maxScore': 1141835,
|
||||
'mode': 1,
|
||||
'modeName': 'Standard',
|
||||
'modifierValues': {'da': 0,
|
||||
'ez': -0.4,
|
||||
'fs': 0.22,
|
||||
'gn': 0.08,
|
||||
'hd': 0.05,
|
||||
'modifierId': 3203,
|
||||
'na': -0.3,
|
||||
'nb': -0.2,
|
||||
'nf': -1,
|
||||
'no': -0.2,
|
||||
'ohp': 0,
|
||||
'op': -0.5,
|
||||
'pm': 0,
|
||||
'sa': 0,
|
||||
'sc': 0,
|
||||
'sf': 0.5,
|
||||
'smc': 0.07,
|
||||
'ss': -0.3},
|
||||
'modifiersRating': {'bfsAccRating': 10.946411,
|
||||
'bfsPassRating': 6.827801,
|
||||
'bfsPredictedAcc': 0.97209585,
|
||||
'bfsStars': 9.858454,
|
||||
'bfsTechRating': 6.3452663,
|
||||
'bsfAccRating': 11.91756,
|
||||
'bsfPassRating': 9.088728,
|
||||
'bsfPredictedAcc': 0.96791214,
|
||||
'bsfStars': 11.616207,
|
||||
'bsfTechRating': 6.8890166,
|
||||
'fsAccRating': 11.0798855,
|
||||
'fsPassRating': 6.8595705,
|
||||
'fsPredictedAcc': 0.9715599,
|
||||
'fsStars': 9.968003,
|
||||
'fsTechRating': 6.22683,
|
||||
'id': 6456,
|
||||
'sfAccRating': 12.244068,
|
||||
'sfPassRating': 9.434687,
|
||||
'sfPredictedAcc': 0.9660631,
|
||||
'sfStars': 12.006947,
|
||||
'sfTechRating': 6.655377,
|
||||
'ssAccRating': 9.436057,
|
||||
'ssPassRating': 4.4481916,
|
||||
'ssPredictedAcc': 0.97730374,
|
||||
'ssStars': 7.6588736,
|
||||
'ssTechRating': 5.366563},
|
||||
'njs': 19,
|
||||
'nominatedTime': 0,
|
||||
'notes': 1249,
|
||||
'nps': 5.66,
|
||||
'passRating': 5.48632,
|
||||
'predictedAcc': 0.9749072,
|
||||
'qualifiedTime': 0,
|
||||
'rankedTime': 0,
|
||||
'requirements': 0,
|
||||
'speedTags': 0,
|
||||
'stars': 8.681121,
|
||||
'status': 3,
|
||||
'styleTags': 0,
|
||||
'techRating': 6.0219316,
|
||||
'type': 2,
|
||||
'value': 9,
|
||||
'walls': 666},
|
||||
'id': '138da91',
|
||||
'song': {'author': 'Desmeon',
|
||||
'bpm': 174,
|
||||
'collaboratorIds': None,
|
||||
'coverImage': 'https://eu.cdn.beatsaver.com/bdf85d5d575a992139eff968a8348b3e6f03eefe.jpg',
|
||||
'duration': 227,
|
||||
'fullCoverImage': 'https://cdn.assets.beatleader.xyz/songcover-138da-cover.png',
|
||||
'hash': 'bdf85d5d575a992139eff968a8348b3e6f03eefe',
|
||||
'id': '138da',
|
||||
'mapper': 'CyanSnow',
|
||||
'mapperId': 4235138,
|
||||
'name': 'Hellcat',
|
||||
'subName': ''}},
|
||||
}]
|
||||
```
|
392
docs/prompts/01-new.md
Normal file
392
docs/prompts/01-new.md
Normal file
@ -0,0 +1,392 @@
|
||||
# Python coding
|
||||
|
||||
We used openapi-python-client to generate client libraries for the scoresaber api. It's in clients/scoresaber in our python project:
|
||||
|
||||
```
|
||||
treegit
|
||||
.
|
||||
├── docs
|
||||
│ ├── api.md
|
||||
│ ├── capture.md
|
||||
│ └── PlaylistBuilder.md
|
||||
├── src
|
||||
│ ├── clients
|
||||
│ │ ├── beatleader
|
||||
│ │ │ ├── api
|
||||
│ │ │ │ ├── beast_saber
|
||||
│ │ │ │ │ ├── beast_saber_get_all.py
|
||||
│ │ │ │ │ ├── beast_saber_nominate.py
|
||||
│ │ │ │ │ └── __init__.py
|
||||
│ │ │ │ ├── clan
|
||||
│ │ │ │ │ ├── clan_get_all.py
|
||||
│ │ │ │ │ ├── clan_get_clan_by_id.py
|
||||
│ │ │ │ │ ├── clan_get_clan.py
|
||||
│ │ │ │ │ ├── clan_get_clan_with_maps_by_id.py
|
||||
│ │ │ │ │ ├── clan_get_clan_with_maps.py
|
||||
│ │ │ │ │ ├── clan_get_history.py
|
||||
│ │ │ │ │ ├── clan_global_map.py
|
||||
│ │ │ │ │ └── __init__.py
|
||||
│ │ │ │ ├── leaderboard
|
||||
│ │ │ │ │ ├── __init__.py
|
||||
│ │ │ │ │ ├── leaderboard_get_all.py
|
||||
│ │ │ │ │ ├── leaderboard_get_clan_rankings.py
|
||||
│ │ │ │ │ ├── leaderboard_get.py
|
||||
│ │ │ │ │ └── leaderboard_get_scoregraph.py
|
||||
│ │ │ │ ├── modifiers
|
||||
│ │ │ │ │ ├── __init__.py
|
||||
│ │ │ │ │ └── modifiers_get_modifiers.py
|
||||
│ │ │ │ ├── patreon
|
||||
│ │ │ │ │ ├── __init__.py
|
||||
│ │ │ │ │ └── patreon_refresh_my_patreon.py
|
||||
│ │ │ │ ├── player
|
||||
│ │ │ │ │ ├── __init__.py
|
||||
│ │ │ │ │ ├── player_get_beat_saver.py
|
||||
│ │ │ │ │ ├── player_get_discord.py
|
||||
│ │ │ │ │ ├── player_get_followers_info.py
|
||||
│ │ │ │ │ ├── player_get_followers.py
|
||||
│ │ │ │ │ ├── player_get_founded_clan.py
|
||||
│ │ │ │ │ ├── player_get_participating_events.py
|
||||
│ │ │ │ │ ├── player_get_patreon.py
|
||||
│ │ │ │ │ ├── player_get_players.py
|
||||
│ │ │ │ │ ├── player_get.py
|
||||
│ │ │ │ │ └── player_get_ranked_maps.py
|
||||
│ │ │ │ ├── player_scores
|
||||
│ │ │ │ │ ├── __init__.py
|
||||
│ │ │ │ │ ├── player_scores_acc_graph.py
|
||||
│ │ │ │ │ ├── player_scores_get_compact_history.py
|
||||
│ │ │ │ │ ├── player_scores_get_compact_scores.py
|
||||
│ │ │ │ │ ├── player_scores_get_history.py
|
||||
│ │ │ │ │ ├── player_scores_get_pinned_scores.py
|
||||
│ │ │ │ │ ├── player_scores_get_scores.py
|
||||
│ │ │ │ │ └── player_scores_get_score_value.py
|
||||
│ │ │ │ ├── song
|
||||
│ │ │ │ │ ├── __init__.py
|
||||
│ │ │ │ │ └── song_get_all.py
|
||||
│ │ │ │ └── __init__.py
|
||||
│ │ │ ├── models
|
||||
│ │ │ │ ├── __pycache__
|
||||
│ │ │ │ ├── achievement_description.py
|
||||
│ │ │ │ ├── achievement_level.py
|
||||
│ │ │ │ ├── achievement.py
|
||||
│ │ │ │ ├── badge.py
|
||||
│ │ │ │ ├── ban.py
|
||||
│ │ │ │ ├── beasties_nomination.py
|
||||
│ │ │ │ ├── besties_nomination_response.py
|
||||
│ │ │ │ ├── clan_bigger_response.py
|
||||
│ │ │ │ ├── clan_global_map_point.py
|
||||
│ │ │ │ ├── clan_global_map.py
|
||||
│ │ │ │ ├── clan_map_connection.py
|
||||
│ │ │ │ ├── clan_maps_sort_by.py
|
||||
│ │ │ │ ├── clan_point.py
|
||||
│ │ │ │ ├── clan.py
|
||||
│ │ │ │ ├── clan_ranking_response_clan_response_full_response_with_metadata_and_container.py
|
||||
│ │ │ │ ├── clan_ranking_response.py
|
||||
│ │ │ │ ├── clan_response_full.py
|
||||
│ │ │ │ ├── clan_response_full_response_with_metadata.py
|
||||
│ │ │ │ ├── clan_response.py
|
||||
│ │ │ │ ├── clan_sort_by.py
|
||||
│ │ │ │ ├── compact_leaderboard.py
|
||||
│ │ │ │ ├── compact_leaderboard_response.py
|
||||
│ │ │ │ ├── compact_score.py
|
||||
│ │ │ │ ├── compact_score_response.py
|
||||
│ │ │ │ ├── compact_score_response_response_with_metadata.py
|
||||
│ │ │ │ ├── compact_song_response.py
|
||||
│ │ │ │ ├── controller_enum.py
|
||||
│ │ │ │ ├── criteria_commentary.py
|
||||
│ │ │ │ ├── difficulty_description.py
|
||||
│ │ │ │ ├── difficulty_response.py
|
||||
│ │ │ │ ├── difficulty_status.py
|
||||
│ │ │ │ ├── event_player.py
|
||||
│ │ │ │ ├── event_ranking.py
|
||||
│ │ │ │ ├── external_status.py
|
||||
│ │ │ │ ├── featured_playlist.py
|
||||
│ │ │ │ ├── featured_playlist_response.py
|
||||
│ │ │ │ ├── follower_type.py
|
||||
│ │ │ │ ├── global_map_history.py
|
||||
│ │ │ │ ├── history_compact_response.py
|
||||
│ │ │ │ ├── hmd.py
|
||||
│ │ │ │ ├── info_to_highlight.py
|
||||
│ │ │ │ ├── __init__.py
|
||||
│ │ │ │ ├── leaderboard_change.py
|
||||
│ │ │ │ ├── leaderboard_clan_ranking_response.py
|
||||
│ │ │ │ ├── leaderboard_contexts.py
|
||||
│ │ │ │ ├── leaderboard_group_entry.py
|
||||
│ │ │ │ ├── leaderboard_info_response.py
|
||||
│ │ │ │ ├── leaderboard_info_response_response_with_metadata.py
|
||||
│ │ │ │ ├── leaderboard.py
|
||||
│ │ │ │ ├── leaderboard_response.py
|
||||
│ │ │ │ ├── leaderboard_sort_by.py
|
||||
│ │ │ │ ├── legacy_modifiers.py
|
||||
│ │ │ │ ├── link_response.py
|
||||
│ │ │ │ ├── map_diff_response.py
|
||||
│ │ │ │ ├── map_info_response.py
|
||||
│ │ │ │ ├── map_info_response_response_with_metadata.py
|
||||
│ │ │ │ ├── mapper.py
|
||||
│ │ │ │ ├── mapper_response.py
|
||||
│ │ │ │ ├── map_quality.py
|
||||
│ │ │ │ ├── map_sort_by.py
|
||||
│ │ │ │ ├── maps_type.py
|
||||
│ │ │ │ ├── metadata.py
|
||||
│ │ │ │ ├── modifiers_map.py
|
||||
│ │ │ │ ├── modifiers_rating.py
|
||||
│ │ │ │ ├── my_type.py
|
||||
│ │ │ │ ├── operation.py
|
||||
│ │ │ │ ├── order.py
|
||||
│ │ │ │ ├── participating_event_response.py
|
||||
│ │ │ │ ├── patreon_features.py
|
||||
│ │ │ │ ├── player_change.py
|
||||
│ │ │ │ ├── player_context_extension.py
|
||||
│ │ │ │ ├── player_follower.py
|
||||
│ │ │ │ ├── player_followers_info_response.py
|
||||
│ │ │ │ ├── player.py
|
||||
│ │ │ │ ├── player_response_clan_response_full_response_with_metadata_and_container.py
|
||||
│ │ │ │ ├── player_response_full.py
|
||||
│ │ │ │ ├── player_response.py
|
||||
│ │ │ │ ├── player_response_with_stats.py
|
||||
│ │ │ │ ├── player_response_with_stats_response_with_metadata.py
|
||||
│ │ │ │ ├── player_score_stats_history.py
|
||||
│ │ │ │ ├── player_score_stats.py
|
||||
│ │ │ │ ├── player_search.py
|
||||
│ │ │ │ ├── player_social.py
|
||||
│ │ │ │ ├── player_sort_by.py
|
||||
│ │ │ │ ├── pp_type.py
|
||||
│ │ │ │ ├── profile_settings.py
|
||||
│ │ │ │ ├── qualification_change.py
|
||||
│ │ │ │ ├── qualification_commentary.py
|
||||
│ │ │ │ ├── qualification_vote.py
|
||||
│ │ │ │ ├── ranked_mapper_response.py
|
||||
│ │ │ │ ├── ranked_map.py
|
||||
│ │ │ │ ├── rank_qualification.py
|
||||
│ │ │ │ ├── rank_update_change.py
|
||||
│ │ │ │ ├── rank_update.py
|
||||
│ │ │ │ ├── rank_voting.py
|
||||
│ │ │ │ ├── replay_offsets.py
|
||||
│ │ │ │ ├── requirements.py
|
||||
│ │ │ │ ├── score_filter_status.py
|
||||
│ │ │ │ ├── score_graph_entry.py
|
||||
│ │ │ │ ├── score_improvement.py
|
||||
│ │ │ │ ├── score_metadata.py
|
||||
│ │ │ │ ├── score_response.py
|
||||
│ │ │ │ ├── score_response_with_acc.py
|
||||
│ │ │ │ ├── score_response_with_my_score.py
|
||||
│ │ │ │ ├── score_response_with_my_score_response_with_metadata.py
|
||||
│ │ │ │ ├── scores_sort_by.py
|
||||
│ │ │ │ ├── song.py
|
||||
│ │ │ │ ├── song_response.py
|
||||
│ │ │ │ ├── song_status.py
|
||||
│ │ │ │ ├── type.py
|
||||
│ │ │ │ └── voter_feedback.py
|
||||
│ │ │ ├── __pycache__
|
||||
│ │ │ ├── client.py
|
||||
│ │ │ ├── errors.py
|
||||
│ │ │ ├── __init__.py
|
||||
│ │ │ ├── py.typed
|
||||
│ │ │ └── types.py
|
||||
│ │ ├── beatsaver
|
||||
│ │ │ ├── api
|
||||
│ │ │ │ ├── maps
|
||||
│ │ │ │ │ ├── get_maps_collaborations_id.py
|
||||
│ │ │ │ │ ├── get_maps_hash_hash.py
|
||||
│ │ │ │ │ ├── get_maps_id_id.py
|
||||
│ │ │ │ │ ├── get_maps_ids_ids.py
|
||||
│ │ │ │ │ ├── get_maps_latest.py
|
||||
│ │ │ │ │ ├── get_maps_plays_page.py
|
||||
│ │ │ │ │ ├── get_maps_uploader_id_page.py
|
||||
│ │ │ │ │ └── __init__.py
|
||||
│ │ │ │ ├── playlists
|
||||
│ │ │ │ │ ├── get_playlists_id_id_page.py
|
||||
│ │ │ │ │ ├── get_playlists_latest.py
|
||||
│ │ │ │ │ ├── get_playlists_search_page.py
|
||||
│ │ │ │ │ ├── get_playlists_user_user_id_page.py
|
||||
│ │ │ │ │ ├── __init__.py
|
||||
│ │ │ │ │ └── post_playlists_id_id_batch.py
|
||||
│ │ │ │ ├── search
|
||||
│ │ │ │ │ ├── get_search_text_page.py
|
||||
│ │ │ │ │ └── __init__.py
|
||||
│ │ │ │ ├── users
|
||||
│ │ │ │ │ ├── get_users_id_id.py
|
||||
│ │ │ │ │ ├── get_users_ids_ids.py
|
||||
│ │ │ │ │ ├── get_users_name_name.py
|
||||
│ │ │ │ │ ├── __init__.py
|
||||
│ │ │ │ │ └── post_users_verify.py
|
||||
│ │ │ │ ├── vote
|
||||
│ │ │ │ │ ├── get_vote.py
|
||||
│ │ │ │ │ ├── __init__.py
|
||||
│ │ │ │ │ └── post_vote.py
|
||||
│ │ │ │ └── __init__.py
|
||||
│ │ │ ├── models
|
||||
│ │ │ │ ├── __pycache__
|
||||
│ │ │ │ ├── action_response.py
|
||||
│ │ │ │ ├── auth_request.py
|
||||
│ │ │ │ ├── get_maps_latest_sort.py
|
||||
│ │ │ │ ├── get_playlists_latest_sort.py
|
||||
│ │ │ │ ├── get_playlists_search_page_sort_order.py
|
||||
│ │ │ │ ├── get_search_text_page_leaderboard.py
|
||||
│ │ │ │ ├── get_search_text_page_sort_order.py
|
||||
│ │ │ │ ├── __init__.py
|
||||
│ │ │ │ ├── map_detail_declared_ai.py
|
||||
│ │ │ │ ├── map_detail_metadata.py
|
||||
│ │ │ │ ├── map_detail.py
|
||||
│ │ │ │ ├── map_detail_tags_item.py
|
||||
│ │ │ │ ├── map_detail_with_order.py
|
||||
│ │ │ │ ├── map_difficulty_characteristic.py
|
||||
│ │ │ │ ├── map_difficulty_difficulty.py
|
||||
│ │ │ │ ├── map_difficulty.py
|
||||
│ │ │ │ ├── map_parity_summary.py
|
||||
│ │ │ │ ├── map_stats.py
|
||||
│ │ │ │ ├── map_stats_sentiment.py
|
||||
│ │ │ │ ├── map_testplay.py
|
||||
│ │ │ │ ├── map_version.py
|
||||
│ │ │ │ ├── map_version_state.py
|
||||
│ │ │ │ ├── playlist_batch_request.py
|
||||
│ │ │ │ ├── playlist_full.py
|
||||
│ │ │ │ ├── playlist_full_type.py
|
||||
│ │ │ │ ├── playlist_page.py
|
||||
│ │ │ │ ├── playlist_search_response.py
|
||||
│ │ │ │ ├── playlist_stats.py
|
||||
│ │ │ │ ├── search_response.py
|
||||
│ │ │ │ ├── user_detail_patreon.py
|
||||
│ │ │ │ ├── user_detail.py
|
||||
│ │ │ │ ├── user_detail_type.py
|
||||
│ │ │ │ ├── user_diff_stats.py
|
||||
│ │ │ │ ├── user_follow_data.py
|
||||
│ │ │ │ ├── user_stats.py
|
||||
│ │ │ │ ├── vote_request.py
|
||||
│ │ │ │ └── vote_summary.py
|
||||
│ │ │ ├── __pycache__
|
||||
│ │ │ ├── client.py
|
||||
│ │ │ ├── errors.py
|
||||
│ │ │ ├── __init__.py
|
||||
│ │ │ ├── py.typed
|
||||
│ │ │ └── types.py
|
||||
│ │ ├── __pycache__
|
||||
│ │ ├── scoresaber
|
||||
│ │ │ ├── api
|
||||
│ │ │ │ ├── leaderboards
|
||||
│ │ │ │ │ ├── get_api_leaderboard_by_hash_hash_info.py
|
||||
│ │ │ │ │ ├── get_api_leaderboard_by_hash_hash_scores.py
|
||||
│ │ │ │ │ ├── get_api_leaderboard_by_id_leaderboard_id_info.py
|
||||
│ │ │ │ │ ├── get_api_leaderboard_by_id_leaderboard_id_scores.py
|
||||
│ │ │ │ │ ├── get_api_leaderboard_get_difficulties_hash.py
|
||||
│ │ │ │ │ ├── get_api_leaderboards.py
|
||||
│ │ │ │ │ └── __init__.py
|
||||
│ │ │ │ ├── nomination_assessment_team
|
||||
│ │ │ │ │ ├── __init__.py
|
||||
│ │ │ │ │ ├── post_api_ranking_request_action_nat_deny.py
|
||||
│ │ │ │ │ ├── post_api_ranking_request_action_nat_qualify.py
|
||||
│ │ │ │ │ └── post_api_ranking_request_action_nat_replace.py
|
||||
│ │ │ │ ├── players
|
||||
│ │ │ │ │ ├── get_api_player_player_id_basic.py
|
||||
│ │ │ │ │ ├── get_api_player_player_id_full.py
|
||||
│ │ │ │ │ ├── get_api_player_player_id_scores.py
|
||||
│ │ │ │ │ ├── get_api_players_count.py
|
||||
│ │ │ │ │ ├── get_api_players.py
|
||||
│ │ │ │ │ └── __init__.py
|
||||
│ │ │ │ ├── public_ranking
|
||||
│ │ │ │ │ ├── get_api_ranking_request_by_id_leaderboard_id.py
|
||||
│ │ │ │ │ ├── get_api_ranking_request_request_id.py
|
||||
│ │ │ │ │ ├── get_api_ranking_requests_below_top.py
|
||||
│ │ │ │ │ ├── get_api_ranking_requests_top.py
|
||||
│ │ │ │ │ └── __init__.py
|
||||
│ │ │ │ ├── quality_assurance_team
|
||||
│ │ │ │ │ ├── __init__.py
|
||||
│ │ │ │ │ ├── post_api_ranking_request_action_qat_comment.py
|
||||
│ │ │ │ │ └── post_api_ranking_request_action_qat_vote.py
|
||||
│ │ │ │ ├── ranking_team
|
||||
│ │ │ │ │ ├── __init__.py
|
||||
│ │ │ │ │ ├── post_api_ranking_request_action_rt_comment.py
|
||||
│ │ │ │ │ ├── post_api_ranking_request_action_rt_create.py
|
||||
│ │ │ │ │ └── post_api_ranking_request_action_rt_vote.py
|
||||
│ │ │ │ ├── website_auth
|
||||
│ │ │ │ │ ├── get_api_auth_get_token.py
|
||||
│ │ │ │ │ ├── get_api_auth_logout.py
|
||||
│ │ │ │ │ ├── __init__.py
|
||||
│ │ │ │ │ └── post_api_auth_check_token.py
|
||||
│ │ │ │ ├── website_user
|
||||
│ │ │ │ │ ├── get_api_user_me.py
|
||||
│ │ │ │ │ ├── get_api_user_player_id_refresh.py
|
||||
│ │ │ │ │ ├── get_api_user_quest_key.py
|
||||
│ │ │ │ │ └── __init__.py
|
||||
│ │ │ │ └── __init__.py
|
||||
│ │ │ ├── models
|
||||
│ │ │ │ ├── __pycache__
|
||||
│ │ │ │ ├── badge.py
|
||||
│ │ │ │ ├── check_token_body.py
|
||||
│ │ │ │ ├── comment.py
|
||||
│ │ │ │ ├── difficulty.py
|
||||
│ │ │ │ ├── get_api_player_player_id_scores_sort.py
|
||||
│ │ │ │ ├── i_get_token_response.py
|
||||
│ │ │ │ ├── __init__.py
|
||||
│ │ │ │ ├── leaderboard_info_collection.py
|
||||
│ │ │ │ ├── leaderboard_info.py
|
||||
│ │ │ │ ├── leaderboard_player.py
|
||||
│ │ │ │ ├── metadata.py
|
||||
│ │ │ │ ├── nat_deny_body.py
|
||||
│ │ │ │ ├── nat_qualify_body.py
|
||||
│ │ │ │ ├── nat_replace_body.py
|
||||
│ │ │ │ ├── player_badges_type_1.py
|
||||
│ │ │ │ ├── player_collection.py
|
||||
│ │ │ │ ├── player.py
|
||||
│ │ │ │ ├── player_score_collection.py
|
||||
│ │ │ │ ├── player_score.py
|
||||
│ │ │ │ ├── qat_comment_body.py
|
||||
│ │ │ │ ├── qat_vote_body.py
|
||||
│ │ │ │ ├── ranking_difficulty.py
|
||||
│ │ │ │ ├── rank_request_information.py
|
||||
│ │ │ │ ├── rank_request_listing.py
|
||||
│ │ │ │ ├── rt_comment_body.py
|
||||
│ │ │ │ ├── rt_create_body.py
|
||||
│ │ │ │ ├── rt_vote_body.py
|
||||
│ │ │ │ ├── score_collection.py
|
||||
│ │ │ │ ├── score.py
|
||||
│ │ │ │ ├── score_saber_error.py
|
||||
│ │ │ │ ├── score_stats.py
|
||||
│ │ │ │ ├── user_data.py
|
||||
│ │ │ │ └── vote_group.py
|
||||
│ │ │ ├── __pycache__
|
||||
│ │ │ ├── client.py
|
||||
│ │ │ ├── errors.py
|
||||
│ │ │ ├── __init__.py
|
||||
│ │ │ ├── py.typed
|
||||
│ │ │ └── types.py
|
||||
│ │ └── __init__.py
|
||||
│ ├── pleb_saberlist.egg-info
|
||||
│ │ ├── dependency_links.txt
|
||||
│ │ ├── entry_points.txt
|
||||
│ │ ├── PKG-INFO
|
||||
│ │ ├── requires.txt
|
||||
│ │ ├── SOURCES.txt
|
||||
│ │ └── top_level.txt
|
||||
│ ├── saberlist
|
||||
│ │ ├── __pycache__
|
||||
│ │ ├── beatleader.py
|
||||
│ │ ├── __init__.py
|
||||
│ │ ├── PlaylistBuilder.py
|
||||
│ │ └── scoresaber.py
|
||||
│ └── saberlist.egg-info
|
||||
│ ├── dependency_links.txt
|
||||
│ ├── entry_points.txt
|
||||
│ ├── PKG-INFO
|
||||
│ ├── requires.txt
|
||||
│ ├── SOURCES.txt
|
||||
│ └── top_level.txt
|
||||
├── temp_covers
|
||||
├── tests
|
||||
│ ├── archive
|
||||
│ │ ├── __pycache__
|
||||
│ │ └── saberlist
|
||||
│ │ ├── __pycache__
|
||||
│ │ └── playlist_builder.py
|
||||
│ ├── assets
|
||||
│ │ └── sample_cover.jpg
|
||||
│ ├── __pycache__
|
||||
│ └── playlist_builder.py
|
||||
├── convert-comyfui-outupt.sh
|
||||
├── LICENSE
|
||||
├── pyproject.toml
|
||||
└── README.md
|
||||
|
||||
53 directories, 328 files
|
||||
```
|
||||
|
||||
We are trying to learn how to use the scoresaber client in `clients/scoresaber` that we generated using openapi-python-client.
|
41
docs/prompts/02-sample-usage.md
Normal file
41
docs/prompts/02-sample-usage.md
Normal file
File diff suppressed because one or more lines are too long
@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "pleb-saberlist"
|
||||
version = "0.1.0"
|
||||
version = "0.2.0"
|
||||
description = "Beat Saber playlist tool"
|
||||
readme = "README.md"
|
||||
authors = [{ name = "blee", email = "git@blee.tube" }]
|
||||
@ -14,6 +14,7 @@ dependencies = [
|
||||
'build>=1.2.1',
|
||||
'requests>=2.31.0',
|
||||
'pytest>=8.1.1',
|
||||
'python-dotenv>=1.0.1',
|
||||
'PyScoreSaber>=1.0.10',
|
||||
'beatsaver>=1.0.1'
|
||||
]
|
||||
@ -37,7 +38,8 @@ Homepage = "https://git.satstack.dev/blee/beatsaber-playlist-tool"
|
||||
#player_scores_by_stars = "saberlist.scoresaber:replay_ranked"
|
||||
#replay_all_by_acc = "saberlist.scoresaber:replay_all_by_acc"
|
||||
#leaderboard_songs_by_stars = "saberlist.scoresaber:leaderboard_songs"
|
||||
saberlist_replay_bl = "saberlist.beatleader:saberlist_replay_bl"
|
||||
#saberlist_replay_bl = "saberlist.beatleader:saberlist_replay_bl"
|
||||
settle_old_scores_ss = "saberlist.make:create_playlist"
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
pythonpath = ["src"]
|
35
src/clients/__init__.py
Normal file
35
src/clients/__init__.py
Normal file
@ -0,0 +1,35 @@
|
||||
"""
|
||||
from .beatleader.client import Client as BeatLeaderClient
|
||||
from .beatleader.models import (
|
||||
Player as BeatLeaderPlayer,
|
||||
Leaderboard as BeatLeaderLeaderboard,
|
||||
)
|
||||
|
||||
from .beatsaver.client import Client as BeatSaverClient
|
||||
from .beatsaver.models import (
|
||||
MapDetail as BeatSaverMapDetail,
|
||||
UserDetail as BeatSaverUserDetail,
|
||||
SearchResponse as BeatSaverSearchResponse,
|
||||
)
|
||||
"""
|
||||
from .scoresaber.client import Client as ScoreSaberClient
|
||||
from .scoresaber.models import (
|
||||
Player as ScoreSaberPlayer,
|
||||
Score as ScoreSaberScore,
|
||||
LeaderboardInfo as ScoreSaberLeaderboardInfo,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
# "BeatLeaderClient",
|
||||
# "BeatLeaderPlayer",
|
||||
# "BeatLeaderScore",
|
||||
# "BeatLeaderLeaderboard",
|
||||
# "BeatSaverClient",
|
||||
# "BeatSaverMapDetail",
|
||||
# "BeatSaverUserDetail",
|
||||
# "BeatSaverSearchResponse",
|
||||
"ScoreSaberClient",
|
||||
"ScoreSaberPlayer",
|
||||
"ScoreSaberScore",
|
||||
"ScoreSaberLeaderboardInfo",
|
||||
]
|
8
src/clients/beatleader/__init__.py
Normal file
8
src/clients/beatleader/__init__.py
Normal file
@ -0,0 +1,8 @@
|
||||
"""A client library for accessing BeatLeader API. Get various Beat Saber information."""
|
||||
|
||||
from .client import AuthenticatedClient, Client
|
||||
|
||||
__all__ = (
|
||||
"AuthenticatedClient",
|
||||
"Client",
|
||||
)
|
1
src/clients/beatleader/api/__init__.py
Normal file
1
src/clients/beatleader/api/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
"""Contains methods for accessing the API"""
|
0
src/clients/beatleader/api/beast_saber/__init__.py
Normal file
0
src/clients/beatleader/api/beast_saber/__init__.py
Normal file
177
src/clients/beatleader/api/beast_saber/beast_saber_get_all.py
Normal file
177
src/clients/beatleader/api/beast_saber/beast_saber_get_all.py
Normal file
@ -0,0 +1,177 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, List, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.beasties_nomination import BeastiesNomination
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
leaderboard_id: Union[Unset, str] = UNSET,
|
||||
) -> Dict[str, Any]:
|
||||
params: Dict[str, Any] = {}
|
||||
|
||||
params["leaderboardId"] = leaderboard_id
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": "/beasties/nominations",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, List["BeastiesNomination"]]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = []
|
||||
_response_200 = response.text
|
||||
for response_200_item_data in _response_200:
|
||||
response_200_item = BeastiesNomination.from_dict(response_200_item_data)
|
||||
|
||||
response_200.append(response_200_item)
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.BAD_REQUEST:
|
||||
response_400 = cast(Any, None)
|
||||
return response_400
|
||||
if response.status_code == HTTPStatus.UNAUTHORIZED:
|
||||
response_401 = cast(Any, None)
|
||||
return response_401
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, List["BeastiesNomination"]]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
leaderboard_id: Union[Unset, str] = UNSET,
|
||||
) -> Response[Union[Any, List["BeastiesNomination"]]]:
|
||||
"""Retrieve a list of nominations for particular leaderboard
|
||||
|
||||
Authenticated player Beasties nominations.
|
||||
|
||||
Args:
|
||||
leaderboard_id (Union[Unset, str]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, List['BeastiesNomination']]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
leaderboard_id=leaderboard_id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
leaderboard_id: Union[Unset, str] = UNSET,
|
||||
) -> Optional[Union[Any, List["BeastiesNomination"]]]:
|
||||
"""Retrieve a list of nominations for particular leaderboard
|
||||
|
||||
Authenticated player Beasties nominations.
|
||||
|
||||
Args:
|
||||
leaderboard_id (Union[Unset, str]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, List['BeastiesNomination']]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
leaderboard_id=leaderboard_id,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
leaderboard_id: Union[Unset, str] = UNSET,
|
||||
) -> Response[Union[Any, List["BeastiesNomination"]]]:
|
||||
"""Retrieve a list of nominations for particular leaderboard
|
||||
|
||||
Authenticated player Beasties nominations.
|
||||
|
||||
Args:
|
||||
leaderboard_id (Union[Unset, str]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, List['BeastiesNomination']]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
leaderboard_id=leaderboard_id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
leaderboard_id: Union[Unset, str] = UNSET,
|
||||
) -> Optional[Union[Any, List["BeastiesNomination"]]]:
|
||||
"""Retrieve a list of nominations for particular leaderboard
|
||||
|
||||
Authenticated player Beasties nominations.
|
||||
|
||||
Args:
|
||||
leaderboard_id (Union[Unset, str]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, List['BeastiesNomination']]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
leaderboard_id=leaderboard_id,
|
||||
)
|
||||
).parsed
|
187
src/clients/beatleader/api/beast_saber/beast_saber_nominate.py
Normal file
187
src/clients/beatleader/api/beast_saber/beast_saber_nominate.py
Normal file
@ -0,0 +1,187 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.besties_nomination_response import BestiesNominationResponse
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
leaderboard_id: Union[Unset, str] = UNSET,
|
||||
category: Union[Unset, str] = UNSET,
|
||||
) -> Dict[str, Any]:
|
||||
params: Dict[str, Any] = {}
|
||||
|
||||
params["leaderboardId"] = leaderboard_id
|
||||
|
||||
params["category"] = category
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "post",
|
||||
"url": "/beasties/nominate",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, BestiesNominationResponse]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = BestiesNominationResponse.from_dict(response.text)
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.BAD_REQUEST:
|
||||
response_400 = cast(Any, None)
|
||||
return response_400
|
||||
if response.status_code == HTTPStatus.UNAUTHORIZED:
|
||||
response_401 = cast(Any, None)
|
||||
return response_401
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, BestiesNominationResponse]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
leaderboard_id: Union[Unset, str] = UNSET,
|
||||
category: Union[Unset, str] = UNSET,
|
||||
) -> Response[Union[Any, BestiesNominationResponse]]:
|
||||
"""Nominate a map for Besties Awards
|
||||
|
||||
Nominates provided leaderboard map for mapping awards in selected category
|
||||
|
||||
Args:
|
||||
leaderboard_id (Union[Unset, str]):
|
||||
category (Union[Unset, str]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, BestiesNominationResponse]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
leaderboard_id=leaderboard_id,
|
||||
category=category,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
leaderboard_id: Union[Unset, str] = UNSET,
|
||||
category: Union[Unset, str] = UNSET,
|
||||
) -> Optional[Union[Any, BestiesNominationResponse]]:
|
||||
"""Nominate a map for Besties Awards
|
||||
|
||||
Nominates provided leaderboard map for mapping awards in selected category
|
||||
|
||||
Args:
|
||||
leaderboard_id (Union[Unset, str]):
|
||||
category (Union[Unset, str]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, BestiesNominationResponse]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
leaderboard_id=leaderboard_id,
|
||||
category=category,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
leaderboard_id: Union[Unset, str] = UNSET,
|
||||
category: Union[Unset, str] = UNSET,
|
||||
) -> Response[Union[Any, BestiesNominationResponse]]:
|
||||
"""Nominate a map for Besties Awards
|
||||
|
||||
Nominates provided leaderboard map for mapping awards in selected category
|
||||
|
||||
Args:
|
||||
leaderboard_id (Union[Unset, str]):
|
||||
category (Union[Unset, str]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, BestiesNominationResponse]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
leaderboard_id=leaderboard_id,
|
||||
category=category,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
leaderboard_id: Union[Unset, str] = UNSET,
|
||||
category: Union[Unset, str] = UNSET,
|
||||
) -> Optional[Union[Any, BestiesNominationResponse]]:
|
||||
"""Nominate a map for Besties Awards
|
||||
|
||||
Nominates provided leaderboard map for mapping awards in selected category
|
||||
|
||||
Args:
|
||||
leaderboard_id (Union[Unset, str]):
|
||||
category (Union[Unset, str]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, BestiesNominationResponse]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
leaderboard_id=leaderboard_id,
|
||||
category=category,
|
||||
)
|
||||
).parsed
|
0
src/clients/beatleader/api/clan/__init__.py
Normal file
0
src/clients/beatleader/api/clan/__init__.py
Normal file
265
src/clients/beatleader/api/clan/clan_get_all.py
Normal file
265
src/clients/beatleader/api/clan/clan_get_all.py
Normal file
@ -0,0 +1,265 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.clan_response_full_response_with_metadata import ClanResponseFullResponseWithMetadata
|
||||
from ...models.clan_sort_by import ClanSortBy
|
||||
from ...models.order import Order
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort: Union[Unset, ClanSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
sort_by: Union[Unset, ClanSortBy] = UNSET,
|
||||
) -> Dict[str, Any]:
|
||||
params: Dict[str, Any] = {}
|
||||
|
||||
params["page"] = page
|
||||
|
||||
params["count"] = count
|
||||
|
||||
json_sort: Union[Unset, str] = UNSET
|
||||
if not isinstance(sort, Unset):
|
||||
json_sort = sort.value
|
||||
|
||||
params["sort"] = json_sort
|
||||
|
||||
json_order: Union[Unset, str] = UNSET
|
||||
if not isinstance(order, Unset):
|
||||
json_order = order.value
|
||||
|
||||
params["order"] = json_order
|
||||
|
||||
params["search"] = search
|
||||
|
||||
json_sort_by: Union[Unset, str] = UNSET
|
||||
if not isinstance(sort_by, Unset):
|
||||
json_sort_by = sort_by.value
|
||||
|
||||
params["sortBy"] = json_sort_by
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": "/clans",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, ClanResponseFullResponseWithMetadata]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = ClanResponseFullResponseWithMetadata.from_dict(response.text)
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.BAD_REQUEST:
|
||||
response_400 = cast(Any, None)
|
||||
return response_400
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, ClanResponseFullResponseWithMetadata]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort: Union[Unset, ClanSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
sort_by: Union[Unset, ClanSortBy] = UNSET,
|
||||
) -> Response[Union[Any, ClanResponseFullResponseWithMetadata]]:
|
||||
"""Retrieve a list of clans
|
||||
|
||||
Fetches a paginated and optionally filtered list of clans (group of players). Filters include
|
||||
sorting by performance points, search, name, rank, and more.
|
||||
|
||||
Args:
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort (Union[Unset, ClanSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
search (Union[Unset, str]):
|
||||
sort_by (Union[Unset, ClanSortBy]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, ClanResponseFullResponseWithMetadata]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
page=page,
|
||||
count=count,
|
||||
sort=sort,
|
||||
order=order,
|
||||
search=search,
|
||||
sort_by=sort_by,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort: Union[Unset, ClanSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
sort_by: Union[Unset, ClanSortBy] = UNSET,
|
||||
) -> Optional[Union[Any, ClanResponseFullResponseWithMetadata]]:
|
||||
"""Retrieve a list of clans
|
||||
|
||||
Fetches a paginated and optionally filtered list of clans (group of players). Filters include
|
||||
sorting by performance points, search, name, rank, and more.
|
||||
|
||||
Args:
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort (Union[Unset, ClanSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
search (Union[Unset, str]):
|
||||
sort_by (Union[Unset, ClanSortBy]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, ClanResponseFullResponseWithMetadata]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
page=page,
|
||||
count=count,
|
||||
sort=sort,
|
||||
order=order,
|
||||
search=search,
|
||||
sort_by=sort_by,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort: Union[Unset, ClanSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
sort_by: Union[Unset, ClanSortBy] = UNSET,
|
||||
) -> Response[Union[Any, ClanResponseFullResponseWithMetadata]]:
|
||||
"""Retrieve a list of clans
|
||||
|
||||
Fetches a paginated and optionally filtered list of clans (group of players). Filters include
|
||||
sorting by performance points, search, name, rank, and more.
|
||||
|
||||
Args:
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort (Union[Unset, ClanSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
search (Union[Unset, str]):
|
||||
sort_by (Union[Unset, ClanSortBy]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, ClanResponseFullResponseWithMetadata]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
page=page,
|
||||
count=count,
|
||||
sort=sort,
|
||||
order=order,
|
||||
search=search,
|
||||
sort_by=sort_by,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort: Union[Unset, ClanSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
sort_by: Union[Unset, ClanSortBy] = UNSET,
|
||||
) -> Optional[Union[Any, ClanResponseFullResponseWithMetadata]]:
|
||||
"""Retrieve a list of clans
|
||||
|
||||
Fetches a paginated and optionally filtered list of clans (group of players). Filters include
|
||||
sorting by performance points, search, name, rank, and more.
|
||||
|
||||
Args:
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort (Union[Unset, ClanSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
search (Union[Unset, str]):
|
||||
sort_by (Union[Unset, ClanSortBy]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, ClanResponseFullResponseWithMetadata]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
page=page,
|
||||
count=count,
|
||||
sort=sort,
|
||||
order=order,
|
||||
search=search,
|
||||
sort_by=sort_by,
|
||||
)
|
||||
).parsed
|
254
src/clients/beatleader/api/clan/clan_get_clan.py
Normal file
254
src/clients/beatleader/api/clan/clan_get_clan.py
Normal file
@ -0,0 +1,254 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.order import Order
|
||||
from ...models.player_response_clan_response_full_response_with_metadata_and_container import (
|
||||
PlayerResponseClanResponseFullResponseWithMetadataAndContainer,
|
||||
)
|
||||
from ...models.player_sort_by import PlayerSortBy
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
tag: str,
|
||||
*,
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, PlayerSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
primary: Union[Unset, bool] = False,
|
||||
) -> Dict[str, Any]:
|
||||
params: Dict[str, Any] = {}
|
||||
|
||||
params["page"] = page
|
||||
|
||||
params["count"] = count
|
||||
|
||||
json_sort_by: Union[Unset, str] = UNSET
|
||||
if not isinstance(sort_by, Unset):
|
||||
json_sort_by = sort_by.value
|
||||
|
||||
params["sortBy"] = json_sort_by
|
||||
|
||||
json_order: Union[Unset, str] = UNSET
|
||||
if not isinstance(order, Unset):
|
||||
json_order = order.value
|
||||
|
||||
params["order"] = json_order
|
||||
|
||||
params["primary"] = primary
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/clan/{tag}",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, PlayerResponseClanResponseFullResponseWithMetadataAndContainer]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = PlayerResponseClanResponseFullResponseWithMetadataAndContainer.from_dict(response.text)
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, PlayerResponseClanResponseFullResponseWithMetadataAndContainer]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
tag: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, PlayerSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
primary: Union[Unset, bool] = False,
|
||||
) -> Response[Union[Any, PlayerResponseClanResponseFullResponseWithMetadataAndContainer]]:
|
||||
"""Retrieve details of a specific clan by tag
|
||||
|
||||
Fetches details of a specific clan identified by its tag.
|
||||
|
||||
Args:
|
||||
tag (str):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort_by (Union[Unset, PlayerSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
primary (Union[Unset, bool]): Default: False.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, PlayerResponseClanResponseFullResponseWithMetadataAndContainer]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
tag=tag,
|
||||
page=page,
|
||||
count=count,
|
||||
sort_by=sort_by,
|
||||
order=order,
|
||||
primary=primary,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
tag: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, PlayerSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
primary: Union[Unset, bool] = False,
|
||||
) -> Optional[Union[Any, PlayerResponseClanResponseFullResponseWithMetadataAndContainer]]:
|
||||
"""Retrieve details of a specific clan by tag
|
||||
|
||||
Fetches details of a specific clan identified by its tag.
|
||||
|
||||
Args:
|
||||
tag (str):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort_by (Union[Unset, PlayerSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
primary (Union[Unset, bool]): Default: False.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, PlayerResponseClanResponseFullResponseWithMetadataAndContainer]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
tag=tag,
|
||||
client=client,
|
||||
page=page,
|
||||
count=count,
|
||||
sort_by=sort_by,
|
||||
order=order,
|
||||
primary=primary,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
tag: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, PlayerSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
primary: Union[Unset, bool] = False,
|
||||
) -> Response[Union[Any, PlayerResponseClanResponseFullResponseWithMetadataAndContainer]]:
|
||||
"""Retrieve details of a specific clan by tag
|
||||
|
||||
Fetches details of a specific clan identified by its tag.
|
||||
|
||||
Args:
|
||||
tag (str):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort_by (Union[Unset, PlayerSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
primary (Union[Unset, bool]): Default: False.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, PlayerResponseClanResponseFullResponseWithMetadataAndContainer]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
tag=tag,
|
||||
page=page,
|
||||
count=count,
|
||||
sort_by=sort_by,
|
||||
order=order,
|
||||
primary=primary,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
tag: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, PlayerSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
primary: Union[Unset, bool] = False,
|
||||
) -> Optional[Union[Any, PlayerResponseClanResponseFullResponseWithMetadataAndContainer]]:
|
||||
"""Retrieve details of a specific clan by tag
|
||||
|
||||
Fetches details of a specific clan identified by its tag.
|
||||
|
||||
Args:
|
||||
tag (str):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort_by (Union[Unset, PlayerSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
primary (Union[Unset, bool]): Default: False.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, PlayerResponseClanResponseFullResponseWithMetadataAndContainer]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
tag=tag,
|
||||
client=client,
|
||||
page=page,
|
||||
count=count,
|
||||
sort_by=sort_by,
|
||||
order=order,
|
||||
primary=primary,
|
||||
)
|
||||
).parsed
|
254
src/clients/beatleader/api/clan/clan_get_clan_by_id.py
Normal file
254
src/clients/beatleader/api/clan/clan_get_clan_by_id.py
Normal file
@ -0,0 +1,254 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.order import Order
|
||||
from ...models.player_response_clan_response_full_response_with_metadata_and_container import (
|
||||
PlayerResponseClanResponseFullResponseWithMetadataAndContainer,
|
||||
)
|
||||
from ...models.player_sort_by import PlayerSortBy
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: int,
|
||||
*,
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, PlayerSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
primary: Union[Unset, bool] = False,
|
||||
) -> Dict[str, Any]:
|
||||
params: Dict[str, Any] = {}
|
||||
|
||||
params["page"] = page
|
||||
|
||||
params["count"] = count
|
||||
|
||||
json_sort_by: Union[Unset, str] = UNSET
|
||||
if not isinstance(sort_by, Unset):
|
||||
json_sort_by = sort_by.value
|
||||
|
||||
params["sortBy"] = json_sort_by
|
||||
|
||||
json_order: Union[Unset, str] = UNSET
|
||||
if not isinstance(order, Unset):
|
||||
json_order = order.value
|
||||
|
||||
params["order"] = json_order
|
||||
|
||||
params["primary"] = primary
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/clan/id/{id}",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, PlayerResponseClanResponseFullResponseWithMetadataAndContainer]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = PlayerResponseClanResponseFullResponseWithMetadataAndContainer.from_dict(response.text)
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, PlayerResponseClanResponseFullResponseWithMetadataAndContainer]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, PlayerSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
primary: Union[Unset, bool] = False,
|
||||
) -> Response[Union[Any, PlayerResponseClanResponseFullResponseWithMetadataAndContainer]]:
|
||||
"""Retrieve details of a specific clan by ID
|
||||
|
||||
Fetches details of a specific clan identified by its ID.
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort_by (Union[Unset, PlayerSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
primary (Union[Unset, bool]): Default: False.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, PlayerResponseClanResponseFullResponseWithMetadataAndContainer]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
page=page,
|
||||
count=count,
|
||||
sort_by=sort_by,
|
||||
order=order,
|
||||
primary=primary,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, PlayerSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
primary: Union[Unset, bool] = False,
|
||||
) -> Optional[Union[Any, PlayerResponseClanResponseFullResponseWithMetadataAndContainer]]:
|
||||
"""Retrieve details of a specific clan by ID
|
||||
|
||||
Fetches details of a specific clan identified by its ID.
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort_by (Union[Unset, PlayerSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
primary (Union[Unset, bool]): Default: False.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, PlayerResponseClanResponseFullResponseWithMetadataAndContainer]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
page=page,
|
||||
count=count,
|
||||
sort_by=sort_by,
|
||||
order=order,
|
||||
primary=primary,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, PlayerSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
primary: Union[Unset, bool] = False,
|
||||
) -> Response[Union[Any, PlayerResponseClanResponseFullResponseWithMetadataAndContainer]]:
|
||||
"""Retrieve details of a specific clan by ID
|
||||
|
||||
Fetches details of a specific clan identified by its ID.
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort_by (Union[Unset, PlayerSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
primary (Union[Unset, bool]): Default: False.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, PlayerResponseClanResponseFullResponseWithMetadataAndContainer]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
page=page,
|
||||
count=count,
|
||||
sort_by=sort_by,
|
||||
order=order,
|
||||
primary=primary,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, PlayerSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
primary: Union[Unset, bool] = False,
|
||||
) -> Optional[Union[Any, PlayerResponseClanResponseFullResponseWithMetadataAndContainer]]:
|
||||
"""Retrieve details of a specific clan by ID
|
||||
|
||||
Fetches details of a specific clan identified by its ID.
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort_by (Union[Unset, PlayerSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
primary (Union[Unset, bool]): Default: False.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, PlayerResponseClanResponseFullResponseWithMetadataAndContainer]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
page=page,
|
||||
count=count,
|
||||
sort_by=sort_by,
|
||||
order=order,
|
||||
primary=primary,
|
||||
)
|
||||
).parsed
|
263
src/clients/beatleader/api/clan/clan_get_clan_with_maps.py
Normal file
263
src/clients/beatleader/api/clan/clan_get_clan_with_maps.py
Normal file
@ -0,0 +1,263 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.clan_maps_sort_by import ClanMapsSortBy
|
||||
from ...models.clan_ranking_response_clan_response_full_response_with_metadata_and_container import (
|
||||
ClanRankingResponseClanResponseFullResponseWithMetadataAndContainer,
|
||||
)
|
||||
from ...models.leaderboard_contexts import LeaderboardContexts
|
||||
from ...models.order import Order
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
tag: str,
|
||||
*,
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, ClanMapsSortBy] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
) -> Dict[str, Any]:
|
||||
params: Dict[str, Any] = {}
|
||||
|
||||
params["page"] = page
|
||||
|
||||
params["count"] = count
|
||||
|
||||
json_sort_by: Union[Unset, str] = UNSET
|
||||
if not isinstance(sort_by, Unset):
|
||||
json_sort_by = sort_by.value
|
||||
|
||||
params["sortBy"] = json_sort_by
|
||||
|
||||
json_leaderboard_context: Union[Unset, str] = UNSET
|
||||
if not isinstance(leaderboard_context, Unset):
|
||||
json_leaderboard_context = leaderboard_context.value
|
||||
|
||||
params["leaderboardContext"] = json_leaderboard_context
|
||||
|
||||
json_order: Union[Unset, str] = UNSET
|
||||
if not isinstance(order, Unset):
|
||||
json_order = order.value
|
||||
|
||||
params["order"] = json_order
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/clan/{tag}/maps",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, ClanRankingResponseClanResponseFullResponseWithMetadataAndContainer]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = ClanRankingResponseClanResponseFullResponseWithMetadataAndContainer.from_dict(response.text)
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, ClanRankingResponseClanResponseFullResponseWithMetadataAndContainer]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
tag: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, ClanMapsSortBy] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
) -> Response[Union[Any, ClanRankingResponseClanResponseFullResponseWithMetadataAndContainer]]:
|
||||
"""Retrieve clan maps by tag
|
||||
|
||||
Fetches ranked maps(maps that can be captured on the global map) for where players of clan made
|
||||
scores identified by its tag, with optional sorting and filtering.
|
||||
|
||||
Args:
|
||||
tag (str):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort_by (Union[Unset, ClanMapsSortBy]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, ClanRankingResponseClanResponseFullResponseWithMetadataAndContainer]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
tag=tag,
|
||||
page=page,
|
||||
count=count,
|
||||
sort_by=sort_by,
|
||||
leaderboard_context=leaderboard_context,
|
||||
order=order,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
tag: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, ClanMapsSortBy] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
) -> Optional[Union[Any, ClanRankingResponseClanResponseFullResponseWithMetadataAndContainer]]:
|
||||
"""Retrieve clan maps by tag
|
||||
|
||||
Fetches ranked maps(maps that can be captured on the global map) for where players of clan made
|
||||
scores identified by its tag, with optional sorting and filtering.
|
||||
|
||||
Args:
|
||||
tag (str):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort_by (Union[Unset, ClanMapsSortBy]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, ClanRankingResponseClanResponseFullResponseWithMetadataAndContainer]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
tag=tag,
|
||||
client=client,
|
||||
page=page,
|
||||
count=count,
|
||||
sort_by=sort_by,
|
||||
leaderboard_context=leaderboard_context,
|
||||
order=order,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
tag: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, ClanMapsSortBy] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
) -> Response[Union[Any, ClanRankingResponseClanResponseFullResponseWithMetadataAndContainer]]:
|
||||
"""Retrieve clan maps by tag
|
||||
|
||||
Fetches ranked maps(maps that can be captured on the global map) for where players of clan made
|
||||
scores identified by its tag, with optional sorting and filtering.
|
||||
|
||||
Args:
|
||||
tag (str):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort_by (Union[Unset, ClanMapsSortBy]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, ClanRankingResponseClanResponseFullResponseWithMetadataAndContainer]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
tag=tag,
|
||||
page=page,
|
||||
count=count,
|
||||
sort_by=sort_by,
|
||||
leaderboard_context=leaderboard_context,
|
||||
order=order,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
tag: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, ClanMapsSortBy] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
) -> Optional[Union[Any, ClanRankingResponseClanResponseFullResponseWithMetadataAndContainer]]:
|
||||
"""Retrieve clan maps by tag
|
||||
|
||||
Fetches ranked maps(maps that can be captured on the global map) for where players of clan made
|
||||
scores identified by its tag, with optional sorting and filtering.
|
||||
|
||||
Args:
|
||||
tag (str):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort_by (Union[Unset, ClanMapsSortBy]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, ClanRankingResponseClanResponseFullResponseWithMetadataAndContainer]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
tag=tag,
|
||||
client=client,
|
||||
page=page,
|
||||
count=count,
|
||||
sort_by=sort_by,
|
||||
leaderboard_context=leaderboard_context,
|
||||
order=order,
|
||||
)
|
||||
).parsed
|
263
src/clients/beatleader/api/clan/clan_get_clan_with_maps_by_id.py
Normal file
263
src/clients/beatleader/api/clan/clan_get_clan_with_maps_by_id.py
Normal file
@ -0,0 +1,263 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.clan_maps_sort_by import ClanMapsSortBy
|
||||
from ...models.clan_ranking_response_clan_response_full_response_with_metadata_and_container import (
|
||||
ClanRankingResponseClanResponseFullResponseWithMetadataAndContainer,
|
||||
)
|
||||
from ...models.leaderboard_contexts import LeaderboardContexts
|
||||
from ...models.order import Order
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: int,
|
||||
*,
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, ClanMapsSortBy] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
) -> Dict[str, Any]:
|
||||
params: Dict[str, Any] = {}
|
||||
|
||||
params["page"] = page
|
||||
|
||||
params["count"] = count
|
||||
|
||||
json_sort_by: Union[Unset, str] = UNSET
|
||||
if not isinstance(sort_by, Unset):
|
||||
json_sort_by = sort_by.value
|
||||
|
||||
params["sortBy"] = json_sort_by
|
||||
|
||||
json_leaderboard_context: Union[Unset, str] = UNSET
|
||||
if not isinstance(leaderboard_context, Unset):
|
||||
json_leaderboard_context = leaderboard_context.value
|
||||
|
||||
params["leaderboardContext"] = json_leaderboard_context
|
||||
|
||||
json_order: Union[Unset, str] = UNSET
|
||||
if not isinstance(order, Unset):
|
||||
json_order = order.value
|
||||
|
||||
params["order"] = json_order
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/clan/id/{id}/maps",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, ClanRankingResponseClanResponseFullResponseWithMetadataAndContainer]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = ClanRankingResponseClanResponseFullResponseWithMetadataAndContainer.from_dict(response.text)
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, ClanRankingResponseClanResponseFullResponseWithMetadataAndContainer]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, ClanMapsSortBy] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
) -> Response[Union[Any, ClanRankingResponseClanResponseFullResponseWithMetadataAndContainer]]:
|
||||
"""Retrieve clan maps by ID
|
||||
|
||||
Fetches ranked maps(maps that can be captured on the global map) for where players of clan made
|
||||
scores identified by its ID, with optional sorting and filtering.
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort_by (Union[Unset, ClanMapsSortBy]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, ClanRankingResponseClanResponseFullResponseWithMetadataAndContainer]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
page=page,
|
||||
count=count,
|
||||
sort_by=sort_by,
|
||||
leaderboard_context=leaderboard_context,
|
||||
order=order,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, ClanMapsSortBy] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
) -> Optional[Union[Any, ClanRankingResponseClanResponseFullResponseWithMetadataAndContainer]]:
|
||||
"""Retrieve clan maps by ID
|
||||
|
||||
Fetches ranked maps(maps that can be captured on the global map) for where players of clan made
|
||||
scores identified by its ID, with optional sorting and filtering.
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort_by (Union[Unset, ClanMapsSortBy]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, ClanRankingResponseClanResponseFullResponseWithMetadataAndContainer]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
page=page,
|
||||
count=count,
|
||||
sort_by=sort_by,
|
||||
leaderboard_context=leaderboard_context,
|
||||
order=order,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, ClanMapsSortBy] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
) -> Response[Union[Any, ClanRankingResponseClanResponseFullResponseWithMetadataAndContainer]]:
|
||||
"""Retrieve clan maps by ID
|
||||
|
||||
Fetches ranked maps(maps that can be captured on the global map) for where players of clan made
|
||||
scores identified by its ID, with optional sorting and filtering.
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort_by (Union[Unset, ClanMapsSortBy]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, ClanRankingResponseClanResponseFullResponseWithMetadataAndContainer]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
page=page,
|
||||
count=count,
|
||||
sort_by=sort_by,
|
||||
leaderboard_context=leaderboard_context,
|
||||
order=order,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, ClanMapsSortBy] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
) -> Optional[Union[Any, ClanRankingResponseClanResponseFullResponseWithMetadataAndContainer]]:
|
||||
"""Retrieve clan maps by ID
|
||||
|
||||
Fetches ranked maps(maps that can be captured on the global map) for where players of clan made
|
||||
scores identified by its ID, with optional sorting and filtering.
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort_by (Union[Unset, ClanMapsSortBy]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, ClanRankingResponseClanResponseFullResponseWithMetadataAndContainer]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
page=page,
|
||||
count=count,
|
||||
sort_by=sort_by,
|
||||
leaderboard_context=leaderboard_context,
|
||||
order=order,
|
||||
)
|
||||
).parsed
|
190
src/clients/beatleader/api/clan/clan_get_history.py
Normal file
190
src/clients/beatleader/api/clan/clan_get_history.py
Normal file
@ -0,0 +1,190 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, List, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.global_map_history import GlobalMapHistory
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: int,
|
||||
*,
|
||||
count: Union[Unset, int] = 50,
|
||||
) -> Dict[str, Any]:
|
||||
params: Dict[str, Any] = {}
|
||||
|
||||
params["count"] = count
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/clan/{id}/history",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, List["GlobalMapHistory"]]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = []
|
||||
_response_200 = response.text
|
||||
for response_200_item_data in _response_200:
|
||||
response_200_item = GlobalMapHistory.from_dict(response_200_item_data)
|
||||
|
||||
response_200.append(response_200_item)
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.BAD_REQUEST:
|
||||
response_400 = cast(Any, None)
|
||||
return response_400
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, List["GlobalMapHistory"]]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
count: Union[Unset, int] = 50,
|
||||
) -> Response[Union[Any, List["GlobalMapHistory"]]]:
|
||||
"""Retrieve clan's statistic history
|
||||
|
||||
Fetches a list of player's performance metrics and various stats saved daily
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
count (Union[Unset, int]): Default: 50.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, List['GlobalMapHistory']]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
count=count,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
count: Union[Unset, int] = 50,
|
||||
) -> Optional[Union[Any, List["GlobalMapHistory"]]]:
|
||||
"""Retrieve clan's statistic history
|
||||
|
||||
Fetches a list of player's performance metrics and various stats saved daily
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
count (Union[Unset, int]): Default: 50.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, List['GlobalMapHistory']]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
count=count,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
count: Union[Unset, int] = 50,
|
||||
) -> Response[Union[Any, List["GlobalMapHistory"]]]:
|
||||
"""Retrieve clan's statistic history
|
||||
|
||||
Fetches a list of player's performance metrics and various stats saved daily
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
count (Union[Unset, int]): Default: 50.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, List['GlobalMapHistory']]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
count=count,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
count: Union[Unset, int] = 50,
|
||||
) -> Optional[Union[Any, List["GlobalMapHistory"]]]:
|
||||
"""Retrieve clan's statistic history
|
||||
|
||||
Fetches a list of player's performance metrics and various stats saved daily
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
count (Union[Unset, int]): Default: 50.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, List['GlobalMapHistory']]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
count=count,
|
||||
)
|
||||
).parsed
|
137
src/clients/beatleader/api/clan/clan_global_map.py
Normal file
137
src/clients/beatleader/api/clan/clan_global_map.py
Normal file
@ -0,0 +1,137 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.clan_global_map import ClanGlobalMap
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs() -> Dict[str, Any]:
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": "/clans/globalmap",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, ClanGlobalMap]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = ClanGlobalMap.from_dict(response.text)
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, ClanGlobalMap]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Any, ClanGlobalMap]]:
|
||||
"""Retrieve the global clan map
|
||||
|
||||
Fetches a global map showing clan captured maps and rankings.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, ClanGlobalMap]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs()
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Any, ClanGlobalMap]]:
|
||||
"""Retrieve the global clan map
|
||||
|
||||
Fetches a global map showing clan captured maps and rankings.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, ClanGlobalMap]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Any, ClanGlobalMap]]:
|
||||
"""Retrieve the global clan map
|
||||
|
||||
Fetches a global map showing clan captured maps and rankings.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, ClanGlobalMap]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs()
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Any, ClanGlobalMap]]:
|
||||
"""Retrieve the global clan map
|
||||
|
||||
Fetches a global map showing clan captured maps and rankings.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, ClanGlobalMap]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
0
src/clients/beatleader/api/leaderboard/__init__.py
Normal file
0
src/clients/beatleader/api/leaderboard/__init__.py
Normal file
386
src/clients/beatleader/api/leaderboard/leaderboard_get.py
Normal file
386
src/clients/beatleader/api/leaderboard/leaderboard_get.py
Normal file
@ -0,0 +1,386 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.leaderboard_contexts import LeaderboardContexts
|
||||
from ...models.leaderboard_response import LeaderboardResponse
|
||||
from ...models.leaderboard_sort_by import LeaderboardSortBy
|
||||
from ...models.order import Order
|
||||
from ...models.score_filter_status import ScoreFilterStatus
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, LeaderboardSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
score_status: Union[Unset, ScoreFilterStatus] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
countries: Union[Unset, str] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
modifiers: Union[Unset, str] = UNSET,
|
||||
friends: Union[Unset, bool] = False,
|
||||
voters: Union[Unset, bool] = False,
|
||||
clan_tag: Union[Unset, str] = UNSET,
|
||||
prediction: Union[Unset, bool] = False,
|
||||
) -> Dict[str, Any]:
|
||||
params: Dict[str, Any] = {}
|
||||
|
||||
params["page"] = page
|
||||
|
||||
params["count"] = count
|
||||
|
||||
json_sort_by: Union[Unset, str] = UNSET
|
||||
if not isinstance(sort_by, Unset):
|
||||
json_sort_by = sort_by.value
|
||||
|
||||
params["sortBy"] = json_sort_by
|
||||
|
||||
json_order: Union[Unset, str] = UNSET
|
||||
if not isinstance(order, Unset):
|
||||
json_order = order.value
|
||||
|
||||
params["order"] = json_order
|
||||
|
||||
json_score_status: Union[Unset, str] = UNSET
|
||||
if not isinstance(score_status, Unset):
|
||||
json_score_status = score_status.value
|
||||
|
||||
params["scoreStatus"] = json_score_status
|
||||
|
||||
json_leaderboard_context: Union[Unset, str] = UNSET
|
||||
if not isinstance(leaderboard_context, Unset):
|
||||
json_leaderboard_context = leaderboard_context.value
|
||||
|
||||
params["leaderboardContext"] = json_leaderboard_context
|
||||
|
||||
params["countries"] = countries
|
||||
|
||||
params["search"] = search
|
||||
|
||||
params["modifiers"] = modifiers
|
||||
|
||||
params["friends"] = friends
|
||||
|
||||
params["voters"] = voters
|
||||
|
||||
params["clanTag"] = clan_tag
|
||||
|
||||
params["prediction"] = prediction
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/leaderboard/{id}",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, LeaderboardResponse]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = LeaderboardResponse.from_dict(response.text)
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, LeaderboardResponse]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, LeaderboardSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
score_status: Union[Unset, ScoreFilterStatus] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
countries: Union[Unset, str] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
modifiers: Union[Unset, str] = UNSET,
|
||||
friends: Union[Unset, bool] = False,
|
||||
voters: Union[Unset, bool] = False,
|
||||
clan_tag: Union[Unset, str] = UNSET,
|
||||
prediction: Union[Unset, bool] = False,
|
||||
) -> Response[Union[Any, LeaderboardResponse]]:
|
||||
"""Retrieve leaderboard details
|
||||
|
||||
Fetches details of a leaderboard identified by its ID, with optional sorting and filtering for
|
||||
scores.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort_by (Union[Unset, LeaderboardSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
score_status (Union[Unset, ScoreFilterStatus]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
countries (Union[Unset, str]):
|
||||
search (Union[Unset, str]):
|
||||
modifiers (Union[Unset, str]):
|
||||
friends (Union[Unset, bool]): Default: False.
|
||||
voters (Union[Unset, bool]): Default: False.
|
||||
clan_tag (Union[Unset, str]):
|
||||
prediction (Union[Unset, bool]): Default: False.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, LeaderboardResponse]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
page=page,
|
||||
count=count,
|
||||
sort_by=sort_by,
|
||||
order=order,
|
||||
score_status=score_status,
|
||||
leaderboard_context=leaderboard_context,
|
||||
countries=countries,
|
||||
search=search,
|
||||
modifiers=modifiers,
|
||||
friends=friends,
|
||||
voters=voters,
|
||||
clan_tag=clan_tag,
|
||||
prediction=prediction,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, LeaderboardSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
score_status: Union[Unset, ScoreFilterStatus] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
countries: Union[Unset, str] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
modifiers: Union[Unset, str] = UNSET,
|
||||
friends: Union[Unset, bool] = False,
|
||||
voters: Union[Unset, bool] = False,
|
||||
clan_tag: Union[Unset, str] = UNSET,
|
||||
prediction: Union[Unset, bool] = False,
|
||||
) -> Optional[Union[Any, LeaderboardResponse]]:
|
||||
"""Retrieve leaderboard details
|
||||
|
||||
Fetches details of a leaderboard identified by its ID, with optional sorting and filtering for
|
||||
scores.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort_by (Union[Unset, LeaderboardSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
score_status (Union[Unset, ScoreFilterStatus]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
countries (Union[Unset, str]):
|
||||
search (Union[Unset, str]):
|
||||
modifiers (Union[Unset, str]):
|
||||
friends (Union[Unset, bool]): Default: False.
|
||||
voters (Union[Unset, bool]): Default: False.
|
||||
clan_tag (Union[Unset, str]):
|
||||
prediction (Union[Unset, bool]): Default: False.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, LeaderboardResponse]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
page=page,
|
||||
count=count,
|
||||
sort_by=sort_by,
|
||||
order=order,
|
||||
score_status=score_status,
|
||||
leaderboard_context=leaderboard_context,
|
||||
countries=countries,
|
||||
search=search,
|
||||
modifiers=modifiers,
|
||||
friends=friends,
|
||||
voters=voters,
|
||||
clan_tag=clan_tag,
|
||||
prediction=prediction,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, LeaderboardSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
score_status: Union[Unset, ScoreFilterStatus] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
countries: Union[Unset, str] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
modifiers: Union[Unset, str] = UNSET,
|
||||
friends: Union[Unset, bool] = False,
|
||||
voters: Union[Unset, bool] = False,
|
||||
clan_tag: Union[Unset, str] = UNSET,
|
||||
prediction: Union[Unset, bool] = False,
|
||||
) -> Response[Union[Any, LeaderboardResponse]]:
|
||||
"""Retrieve leaderboard details
|
||||
|
||||
Fetches details of a leaderboard identified by its ID, with optional sorting and filtering for
|
||||
scores.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort_by (Union[Unset, LeaderboardSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
score_status (Union[Unset, ScoreFilterStatus]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
countries (Union[Unset, str]):
|
||||
search (Union[Unset, str]):
|
||||
modifiers (Union[Unset, str]):
|
||||
friends (Union[Unset, bool]): Default: False.
|
||||
voters (Union[Unset, bool]): Default: False.
|
||||
clan_tag (Union[Unset, str]):
|
||||
prediction (Union[Unset, bool]): Default: False.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, LeaderboardResponse]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
page=page,
|
||||
count=count,
|
||||
sort_by=sort_by,
|
||||
order=order,
|
||||
score_status=score_status,
|
||||
leaderboard_context=leaderboard_context,
|
||||
countries=countries,
|
||||
search=search,
|
||||
modifiers=modifiers,
|
||||
friends=friends,
|
||||
voters=voters,
|
||||
clan_tag=clan_tag,
|
||||
prediction=prediction,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, LeaderboardSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
score_status: Union[Unset, ScoreFilterStatus] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
countries: Union[Unset, str] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
modifiers: Union[Unset, str] = UNSET,
|
||||
friends: Union[Unset, bool] = False,
|
||||
voters: Union[Unset, bool] = False,
|
||||
clan_tag: Union[Unset, str] = UNSET,
|
||||
prediction: Union[Unset, bool] = False,
|
||||
) -> Optional[Union[Any, LeaderboardResponse]]:
|
||||
"""Retrieve leaderboard details
|
||||
|
||||
Fetches details of a leaderboard identified by its ID, with optional sorting and filtering for
|
||||
scores.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort_by (Union[Unset, LeaderboardSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
score_status (Union[Unset, ScoreFilterStatus]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
countries (Union[Unset, str]):
|
||||
search (Union[Unset, str]):
|
||||
modifiers (Union[Unset, str]):
|
||||
friends (Union[Unset, bool]): Default: False.
|
||||
voters (Union[Unset, bool]): Default: False.
|
||||
clan_tag (Union[Unset, str]):
|
||||
prediction (Union[Unset, bool]): Default: False.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, LeaderboardResponse]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
page=page,
|
||||
count=count,
|
||||
sort_by=sort_by,
|
||||
order=order,
|
||||
score_status=score_status,
|
||||
leaderboard_context=leaderboard_context,
|
||||
countries=countries,
|
||||
search=search,
|
||||
modifiers=modifiers,
|
||||
friends=friends,
|
||||
voters=voters,
|
||||
clan_tag=clan_tag,
|
||||
prediction=prediction,
|
||||
)
|
||||
).parsed
|
603
src/clients/beatleader/api/leaderboard/leaderboard_get_all.py
Normal file
603
src/clients/beatleader/api/leaderboard/leaderboard_get_all.py
Normal file
@ -0,0 +1,603 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.leaderboard_contexts import LeaderboardContexts
|
||||
from ...models.leaderboard_info_response_response_with_metadata import LeaderboardInfoResponseResponseWithMetadata
|
||||
from ...models.map_sort_by import MapSortBy
|
||||
from ...models.my_type import MyType
|
||||
from ...models.operation import Operation
|
||||
from ...models.order import Order
|
||||
from ...models.requirements import Requirements
|
||||
from ...models.song_status import SongStatus
|
||||
from ...models.type import Type
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, MapSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
type: Union[Unset, Type] = UNSET,
|
||||
mode: Union[Unset, str] = UNSET,
|
||||
difficulty: Union[Unset, str] = UNSET,
|
||||
map_type: Union[Unset, int] = UNSET,
|
||||
all_types: Union[Unset, Operation] = UNSET,
|
||||
map_requirements: Union[Unset, Requirements] = UNSET,
|
||||
all_requirements: Union[Unset, Operation] = UNSET,
|
||||
song_status: Union[Unset, SongStatus] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
mytype: Union[Unset, MyType] = UNSET,
|
||||
stars_from: Union[Unset, float] = UNSET,
|
||||
stars_to: Union[Unset, float] = UNSET,
|
||||
accrating_from: Union[Unset, float] = UNSET,
|
||||
accrating_to: Union[Unset, float] = UNSET,
|
||||
passrating_from: Union[Unset, float] = UNSET,
|
||||
passrating_to: Union[Unset, float] = UNSET,
|
||||
techrating_from: Union[Unset, float] = UNSET,
|
||||
techrating_to: Union[Unset, float] = UNSET,
|
||||
date_from: Union[Unset, int] = UNSET,
|
||||
date_to: Union[Unset, int] = UNSET,
|
||||
mappers: Union[Unset, str] = UNSET,
|
||||
override_current_id: Union[Unset, str] = UNSET,
|
||||
) -> Dict[str, Any]:
|
||||
params: Dict[str, Any] = {}
|
||||
|
||||
params["page"] = page
|
||||
|
||||
params["count"] = count
|
||||
|
||||
json_sort_by: Union[Unset, str] = UNSET
|
||||
if not isinstance(sort_by, Unset):
|
||||
json_sort_by = sort_by.value
|
||||
|
||||
params["sortBy"] = json_sort_by
|
||||
|
||||
json_order: Union[Unset, str] = UNSET
|
||||
if not isinstance(order, Unset):
|
||||
json_order = order.value
|
||||
|
||||
params["order"] = json_order
|
||||
|
||||
params["search"] = search
|
||||
|
||||
json_type: Union[Unset, str] = UNSET
|
||||
if not isinstance(type, Unset):
|
||||
json_type = type.value
|
||||
|
||||
params["type"] = json_type
|
||||
|
||||
params["mode"] = mode
|
||||
|
||||
params["difficulty"] = difficulty
|
||||
|
||||
params["mapType"] = map_type
|
||||
|
||||
json_all_types: Union[Unset, str] = UNSET
|
||||
if not isinstance(all_types, Unset):
|
||||
json_all_types = all_types.value
|
||||
|
||||
params["allTypes"] = json_all_types
|
||||
|
||||
json_map_requirements: Union[Unset, str] = UNSET
|
||||
if not isinstance(map_requirements, Unset):
|
||||
json_map_requirements = map_requirements.value
|
||||
|
||||
params["mapRequirements"] = json_map_requirements
|
||||
|
||||
json_all_requirements: Union[Unset, str] = UNSET
|
||||
if not isinstance(all_requirements, Unset):
|
||||
json_all_requirements = all_requirements.value
|
||||
|
||||
params["allRequirements"] = json_all_requirements
|
||||
|
||||
json_song_status: Union[Unset, str] = UNSET
|
||||
if not isinstance(song_status, Unset):
|
||||
json_song_status = song_status.value
|
||||
|
||||
params["songStatus"] = json_song_status
|
||||
|
||||
json_leaderboard_context: Union[Unset, str] = UNSET
|
||||
if not isinstance(leaderboard_context, Unset):
|
||||
json_leaderboard_context = leaderboard_context.value
|
||||
|
||||
params["leaderboardContext"] = json_leaderboard_context
|
||||
|
||||
json_mytype: Union[Unset, str] = UNSET
|
||||
if not isinstance(mytype, Unset):
|
||||
json_mytype = mytype.value
|
||||
|
||||
params["mytype"] = json_mytype
|
||||
|
||||
params["stars_from"] = stars_from
|
||||
|
||||
params["stars_to"] = stars_to
|
||||
|
||||
params["accrating_from"] = accrating_from
|
||||
|
||||
params["accrating_to"] = accrating_to
|
||||
|
||||
params["passrating_from"] = passrating_from
|
||||
|
||||
params["passrating_to"] = passrating_to
|
||||
|
||||
params["techrating_from"] = techrating_from
|
||||
|
||||
params["techrating_to"] = techrating_to
|
||||
|
||||
params["date_from"] = date_from
|
||||
|
||||
params["date_to"] = date_to
|
||||
|
||||
params["mappers"] = mappers
|
||||
|
||||
params["overrideCurrentId"] = override_current_id
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": "/leaderboards",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, LeaderboardInfoResponseResponseWithMetadata]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = LeaderboardInfoResponseResponseWithMetadata.from_dict(response.text)
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, LeaderboardInfoResponseResponseWithMetadata]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, MapSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
type: Union[Unset, Type] = UNSET,
|
||||
mode: Union[Unset, str] = UNSET,
|
||||
difficulty: Union[Unset, str] = UNSET,
|
||||
map_type: Union[Unset, int] = UNSET,
|
||||
all_types: Union[Unset, Operation] = UNSET,
|
||||
map_requirements: Union[Unset, Requirements] = UNSET,
|
||||
all_requirements: Union[Unset, Operation] = UNSET,
|
||||
song_status: Union[Unset, SongStatus] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
mytype: Union[Unset, MyType] = UNSET,
|
||||
stars_from: Union[Unset, float] = UNSET,
|
||||
stars_to: Union[Unset, float] = UNSET,
|
||||
accrating_from: Union[Unset, float] = UNSET,
|
||||
accrating_to: Union[Unset, float] = UNSET,
|
||||
passrating_from: Union[Unset, float] = UNSET,
|
||||
passrating_to: Union[Unset, float] = UNSET,
|
||||
techrating_from: Union[Unset, float] = UNSET,
|
||||
techrating_to: Union[Unset, float] = UNSET,
|
||||
date_from: Union[Unset, int] = UNSET,
|
||||
date_to: Union[Unset, int] = UNSET,
|
||||
mappers: Union[Unset, str] = UNSET,
|
||||
override_current_id: Union[Unset, str] = UNSET,
|
||||
) -> Response[Union[Any, LeaderboardInfoResponseResponseWithMetadata]]:
|
||||
"""Retrieve a list of leaderboards (maps)
|
||||
|
||||
Fetches a paginated and optionally filtered list of leaderboards (Beat Saber maps).
|
||||
|
||||
Args:
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort_by (Union[Unset, MapSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
search (Union[Unset, str]):
|
||||
type (Union[Unset, Type]):
|
||||
mode (Union[Unset, str]):
|
||||
difficulty (Union[Unset, str]):
|
||||
map_type (Union[Unset, int]):
|
||||
all_types (Union[Unset, Operation]):
|
||||
map_requirements (Union[Unset, Requirements]):
|
||||
all_requirements (Union[Unset, Operation]):
|
||||
song_status (Union[Unset, SongStatus]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
mytype (Union[Unset, MyType]):
|
||||
stars_from (Union[Unset, float]):
|
||||
stars_to (Union[Unset, float]):
|
||||
accrating_from (Union[Unset, float]):
|
||||
accrating_to (Union[Unset, float]):
|
||||
passrating_from (Union[Unset, float]):
|
||||
passrating_to (Union[Unset, float]):
|
||||
techrating_from (Union[Unset, float]):
|
||||
techrating_to (Union[Unset, float]):
|
||||
date_from (Union[Unset, int]):
|
||||
date_to (Union[Unset, int]):
|
||||
mappers (Union[Unset, str]):
|
||||
override_current_id (Union[Unset, str]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, LeaderboardInfoResponseResponseWithMetadata]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
page=page,
|
||||
count=count,
|
||||
sort_by=sort_by,
|
||||
order=order,
|
||||
search=search,
|
||||
type=type,
|
||||
mode=mode,
|
||||
difficulty=difficulty,
|
||||
map_type=map_type,
|
||||
all_types=all_types,
|
||||
map_requirements=map_requirements,
|
||||
all_requirements=all_requirements,
|
||||
song_status=song_status,
|
||||
leaderboard_context=leaderboard_context,
|
||||
mytype=mytype,
|
||||
stars_from=stars_from,
|
||||
stars_to=stars_to,
|
||||
accrating_from=accrating_from,
|
||||
accrating_to=accrating_to,
|
||||
passrating_from=passrating_from,
|
||||
passrating_to=passrating_to,
|
||||
techrating_from=techrating_from,
|
||||
techrating_to=techrating_to,
|
||||
date_from=date_from,
|
||||
date_to=date_to,
|
||||
mappers=mappers,
|
||||
override_current_id=override_current_id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, MapSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
type: Union[Unset, Type] = UNSET,
|
||||
mode: Union[Unset, str] = UNSET,
|
||||
difficulty: Union[Unset, str] = UNSET,
|
||||
map_type: Union[Unset, int] = UNSET,
|
||||
all_types: Union[Unset, Operation] = UNSET,
|
||||
map_requirements: Union[Unset, Requirements] = UNSET,
|
||||
all_requirements: Union[Unset, Operation] = UNSET,
|
||||
song_status: Union[Unset, SongStatus] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
mytype: Union[Unset, MyType] = UNSET,
|
||||
stars_from: Union[Unset, float] = UNSET,
|
||||
stars_to: Union[Unset, float] = UNSET,
|
||||
accrating_from: Union[Unset, float] = UNSET,
|
||||
accrating_to: Union[Unset, float] = UNSET,
|
||||
passrating_from: Union[Unset, float] = UNSET,
|
||||
passrating_to: Union[Unset, float] = UNSET,
|
||||
techrating_from: Union[Unset, float] = UNSET,
|
||||
techrating_to: Union[Unset, float] = UNSET,
|
||||
date_from: Union[Unset, int] = UNSET,
|
||||
date_to: Union[Unset, int] = UNSET,
|
||||
mappers: Union[Unset, str] = UNSET,
|
||||
override_current_id: Union[Unset, str] = UNSET,
|
||||
) -> Optional[Union[Any, LeaderboardInfoResponseResponseWithMetadata]]:
|
||||
"""Retrieve a list of leaderboards (maps)
|
||||
|
||||
Fetches a paginated and optionally filtered list of leaderboards (Beat Saber maps).
|
||||
|
||||
Args:
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort_by (Union[Unset, MapSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
search (Union[Unset, str]):
|
||||
type (Union[Unset, Type]):
|
||||
mode (Union[Unset, str]):
|
||||
difficulty (Union[Unset, str]):
|
||||
map_type (Union[Unset, int]):
|
||||
all_types (Union[Unset, Operation]):
|
||||
map_requirements (Union[Unset, Requirements]):
|
||||
all_requirements (Union[Unset, Operation]):
|
||||
song_status (Union[Unset, SongStatus]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
mytype (Union[Unset, MyType]):
|
||||
stars_from (Union[Unset, float]):
|
||||
stars_to (Union[Unset, float]):
|
||||
accrating_from (Union[Unset, float]):
|
||||
accrating_to (Union[Unset, float]):
|
||||
passrating_from (Union[Unset, float]):
|
||||
passrating_to (Union[Unset, float]):
|
||||
techrating_from (Union[Unset, float]):
|
||||
techrating_to (Union[Unset, float]):
|
||||
date_from (Union[Unset, int]):
|
||||
date_to (Union[Unset, int]):
|
||||
mappers (Union[Unset, str]):
|
||||
override_current_id (Union[Unset, str]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, LeaderboardInfoResponseResponseWithMetadata]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
page=page,
|
||||
count=count,
|
||||
sort_by=sort_by,
|
||||
order=order,
|
||||
search=search,
|
||||
type=type,
|
||||
mode=mode,
|
||||
difficulty=difficulty,
|
||||
map_type=map_type,
|
||||
all_types=all_types,
|
||||
map_requirements=map_requirements,
|
||||
all_requirements=all_requirements,
|
||||
song_status=song_status,
|
||||
leaderboard_context=leaderboard_context,
|
||||
mytype=mytype,
|
||||
stars_from=stars_from,
|
||||
stars_to=stars_to,
|
||||
accrating_from=accrating_from,
|
||||
accrating_to=accrating_to,
|
||||
passrating_from=passrating_from,
|
||||
passrating_to=passrating_to,
|
||||
techrating_from=techrating_from,
|
||||
techrating_to=techrating_to,
|
||||
date_from=date_from,
|
||||
date_to=date_to,
|
||||
mappers=mappers,
|
||||
override_current_id=override_current_id,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, MapSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
type: Union[Unset, Type] = UNSET,
|
||||
mode: Union[Unset, str] = UNSET,
|
||||
difficulty: Union[Unset, str] = UNSET,
|
||||
map_type: Union[Unset, int] = UNSET,
|
||||
all_types: Union[Unset, Operation] = UNSET,
|
||||
map_requirements: Union[Unset, Requirements] = UNSET,
|
||||
all_requirements: Union[Unset, Operation] = UNSET,
|
||||
song_status: Union[Unset, SongStatus] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
mytype: Union[Unset, MyType] = UNSET,
|
||||
stars_from: Union[Unset, float] = UNSET,
|
||||
stars_to: Union[Unset, float] = UNSET,
|
||||
accrating_from: Union[Unset, float] = UNSET,
|
||||
accrating_to: Union[Unset, float] = UNSET,
|
||||
passrating_from: Union[Unset, float] = UNSET,
|
||||
passrating_to: Union[Unset, float] = UNSET,
|
||||
techrating_from: Union[Unset, float] = UNSET,
|
||||
techrating_to: Union[Unset, float] = UNSET,
|
||||
date_from: Union[Unset, int] = UNSET,
|
||||
date_to: Union[Unset, int] = UNSET,
|
||||
mappers: Union[Unset, str] = UNSET,
|
||||
override_current_id: Union[Unset, str] = UNSET,
|
||||
) -> Response[Union[Any, LeaderboardInfoResponseResponseWithMetadata]]:
|
||||
"""Retrieve a list of leaderboards (maps)
|
||||
|
||||
Fetches a paginated and optionally filtered list of leaderboards (Beat Saber maps).
|
||||
|
||||
Args:
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort_by (Union[Unset, MapSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
search (Union[Unset, str]):
|
||||
type (Union[Unset, Type]):
|
||||
mode (Union[Unset, str]):
|
||||
difficulty (Union[Unset, str]):
|
||||
map_type (Union[Unset, int]):
|
||||
all_types (Union[Unset, Operation]):
|
||||
map_requirements (Union[Unset, Requirements]):
|
||||
all_requirements (Union[Unset, Operation]):
|
||||
song_status (Union[Unset, SongStatus]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
mytype (Union[Unset, MyType]):
|
||||
stars_from (Union[Unset, float]):
|
||||
stars_to (Union[Unset, float]):
|
||||
accrating_from (Union[Unset, float]):
|
||||
accrating_to (Union[Unset, float]):
|
||||
passrating_from (Union[Unset, float]):
|
||||
passrating_to (Union[Unset, float]):
|
||||
techrating_from (Union[Unset, float]):
|
||||
techrating_to (Union[Unset, float]):
|
||||
date_from (Union[Unset, int]):
|
||||
date_to (Union[Unset, int]):
|
||||
mappers (Union[Unset, str]):
|
||||
override_current_id (Union[Unset, str]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, LeaderboardInfoResponseResponseWithMetadata]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
page=page,
|
||||
count=count,
|
||||
sort_by=sort_by,
|
||||
order=order,
|
||||
search=search,
|
||||
type=type,
|
||||
mode=mode,
|
||||
difficulty=difficulty,
|
||||
map_type=map_type,
|
||||
all_types=all_types,
|
||||
map_requirements=map_requirements,
|
||||
all_requirements=all_requirements,
|
||||
song_status=song_status,
|
||||
leaderboard_context=leaderboard_context,
|
||||
mytype=mytype,
|
||||
stars_from=stars_from,
|
||||
stars_to=stars_to,
|
||||
accrating_from=accrating_from,
|
||||
accrating_to=accrating_to,
|
||||
passrating_from=passrating_from,
|
||||
passrating_to=passrating_to,
|
||||
techrating_from=techrating_from,
|
||||
techrating_to=techrating_to,
|
||||
date_from=date_from,
|
||||
date_to=date_to,
|
||||
mappers=mappers,
|
||||
override_current_id=override_current_id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, MapSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
type: Union[Unset, Type] = UNSET,
|
||||
mode: Union[Unset, str] = UNSET,
|
||||
difficulty: Union[Unset, str] = UNSET,
|
||||
map_type: Union[Unset, int] = UNSET,
|
||||
all_types: Union[Unset, Operation] = UNSET,
|
||||
map_requirements: Union[Unset, Requirements] = UNSET,
|
||||
all_requirements: Union[Unset, Operation] = UNSET,
|
||||
song_status: Union[Unset, SongStatus] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
mytype: Union[Unset, MyType] = UNSET,
|
||||
stars_from: Union[Unset, float] = UNSET,
|
||||
stars_to: Union[Unset, float] = UNSET,
|
||||
accrating_from: Union[Unset, float] = UNSET,
|
||||
accrating_to: Union[Unset, float] = UNSET,
|
||||
passrating_from: Union[Unset, float] = UNSET,
|
||||
passrating_to: Union[Unset, float] = UNSET,
|
||||
techrating_from: Union[Unset, float] = UNSET,
|
||||
techrating_to: Union[Unset, float] = UNSET,
|
||||
date_from: Union[Unset, int] = UNSET,
|
||||
date_to: Union[Unset, int] = UNSET,
|
||||
mappers: Union[Unset, str] = UNSET,
|
||||
override_current_id: Union[Unset, str] = UNSET,
|
||||
) -> Optional[Union[Any, LeaderboardInfoResponseResponseWithMetadata]]:
|
||||
"""Retrieve a list of leaderboards (maps)
|
||||
|
||||
Fetches a paginated and optionally filtered list of leaderboards (Beat Saber maps).
|
||||
|
||||
Args:
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort_by (Union[Unset, MapSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
search (Union[Unset, str]):
|
||||
type (Union[Unset, Type]):
|
||||
mode (Union[Unset, str]):
|
||||
difficulty (Union[Unset, str]):
|
||||
map_type (Union[Unset, int]):
|
||||
all_types (Union[Unset, Operation]):
|
||||
map_requirements (Union[Unset, Requirements]):
|
||||
all_requirements (Union[Unset, Operation]):
|
||||
song_status (Union[Unset, SongStatus]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
mytype (Union[Unset, MyType]):
|
||||
stars_from (Union[Unset, float]):
|
||||
stars_to (Union[Unset, float]):
|
||||
accrating_from (Union[Unset, float]):
|
||||
accrating_to (Union[Unset, float]):
|
||||
passrating_from (Union[Unset, float]):
|
||||
passrating_to (Union[Unset, float]):
|
||||
techrating_from (Union[Unset, float]):
|
||||
techrating_to (Union[Unset, float]):
|
||||
date_from (Union[Unset, int]):
|
||||
date_to (Union[Unset, int]):
|
||||
mappers (Union[Unset, str]):
|
||||
override_current_id (Union[Unset, str]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, LeaderboardInfoResponseResponseWithMetadata]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
page=page,
|
||||
count=count,
|
||||
sort_by=sort_by,
|
||||
order=order,
|
||||
search=search,
|
||||
type=type,
|
||||
mode=mode,
|
||||
difficulty=difficulty,
|
||||
map_type=map_type,
|
||||
all_types=all_types,
|
||||
map_requirements=map_requirements,
|
||||
all_requirements=all_requirements,
|
||||
song_status=song_status,
|
||||
leaderboard_context=leaderboard_context,
|
||||
mytype=mytype,
|
||||
stars_from=stars_from,
|
||||
stars_to=stars_to,
|
||||
accrating_from=accrating_from,
|
||||
accrating_to=accrating_to,
|
||||
passrating_from=passrating_from,
|
||||
passrating_to=passrating_to,
|
||||
techrating_from=techrating_from,
|
||||
techrating_to=techrating_to,
|
||||
date_from=date_from,
|
||||
date_to=date_to,
|
||||
mappers=mappers,
|
||||
override_current_id=override_current_id,
|
||||
)
|
||||
).parsed
|
@ -0,0 +1,197 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.leaderboard_clan_ranking_response import LeaderboardClanRankingResponse
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
) -> Dict[str, Any]:
|
||||
params: Dict[str, Any] = {}
|
||||
|
||||
params["page"] = page
|
||||
|
||||
params["count"] = count
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/leaderboard/clanRankings/{id}",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, LeaderboardClanRankingResponse]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = LeaderboardClanRankingResponse.from_dict(response.text)
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, LeaderboardClanRankingResponse]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
) -> Response[Union[Any, LeaderboardClanRankingResponse]]:
|
||||
"""Retrieve clan rankings for a leaderboard
|
||||
|
||||
Fetches clan rankings for a leaderboard identified by its ID.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, LeaderboardClanRankingResponse]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
page=page,
|
||||
count=count,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
) -> Optional[Union[Any, LeaderboardClanRankingResponse]]:
|
||||
"""Retrieve clan rankings for a leaderboard
|
||||
|
||||
Fetches clan rankings for a leaderboard identified by its ID.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, LeaderboardClanRankingResponse]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
page=page,
|
||||
count=count,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
) -> Response[Union[Any, LeaderboardClanRankingResponse]]:
|
||||
"""Retrieve clan rankings for a leaderboard
|
||||
|
||||
Fetches clan rankings for a leaderboard identified by its ID.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, LeaderboardClanRankingResponse]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
page=page,
|
||||
count=count,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
) -> Optional[Union[Any, LeaderboardClanRankingResponse]]:
|
||||
"""Retrieve clan rankings for a leaderboard
|
||||
|
||||
Fetches clan rankings for a leaderboard identified by its ID.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, LeaderboardClanRankingResponse]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
page=page,
|
||||
count=count,
|
||||
)
|
||||
).parsed
|
@ -0,0 +1,170 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, List, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.score_graph_entry import ScoreGraphEntry
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
) -> Dict[str, Any]:
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/leaderboard/{id}/scoregraph",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, List["ScoreGraphEntry"]]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = []
|
||||
_response_200 = response.text
|
||||
for response_200_item_data in _response_200:
|
||||
response_200_item = ScoreGraphEntry.from_dict(response_200_item_data)
|
||||
|
||||
response_200.append(response_200_item)
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, List["ScoreGraphEntry"]]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Any, List["ScoreGraphEntry"]]]:
|
||||
"""Retrieve scores graph for a leaderboard
|
||||
|
||||
Fetches the scores graph for a leaderboard identified by its ID. Compact endpoint to use in the
|
||||
leaderboard data visualizations.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, List['ScoreGraphEntry']]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Any, List["ScoreGraphEntry"]]]:
|
||||
"""Retrieve scores graph for a leaderboard
|
||||
|
||||
Fetches the scores graph for a leaderboard identified by its ID. Compact endpoint to use in the
|
||||
leaderboard data visualizations.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, List['ScoreGraphEntry']]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Any, List["ScoreGraphEntry"]]]:
|
||||
"""Retrieve scores graph for a leaderboard
|
||||
|
||||
Fetches the scores graph for a leaderboard identified by its ID. Compact endpoint to use in the
|
||||
leaderboard data visualizations.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, List['ScoreGraphEntry']]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Any, List["ScoreGraphEntry"]]]:
|
||||
"""Retrieve scores graph for a leaderboard
|
||||
|
||||
Fetches the scores graph for a leaderboard identified by its ID. Compact endpoint to use in the
|
||||
leaderboard data visualizations.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, List['ScoreGraphEntry']]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
0
src/clients/beatleader/api/modifiers/__init__.py
Normal file
0
src/clients/beatleader/api/modifiers/__init__.py
Normal file
138
src/clients/beatleader/api/modifiers/modifiers_get_modifiers.py
Normal file
138
src/clients/beatleader/api/modifiers/modifiers_get_modifiers.py
Normal file
@ -0,0 +1,138 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.legacy_modifiers import LegacyModifiers
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs() -> Dict[str, Any]:
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": "/modifiers",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[LegacyModifiers]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = LegacyModifiers.from_dict(response.text)
|
||||
|
||||
return response_200
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[LegacyModifiers]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[LegacyModifiers]:
|
||||
"""Retrieve Legacy Modifiers
|
||||
|
||||
Provides a list of Beat Saber modifiers and their associated score multiplier values. This is legacy
|
||||
support, for the recent values please use `modifierValues` and `modifierRatings` on leaderboards.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[LegacyModifiers]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs()
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[LegacyModifiers]:
|
||||
"""Retrieve Legacy Modifiers
|
||||
|
||||
Provides a list of Beat Saber modifiers and their associated score multiplier values. This is legacy
|
||||
support, for the recent values please use `modifierValues` and `modifierRatings` on leaderboards.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
LegacyModifiers
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[LegacyModifiers]:
|
||||
"""Retrieve Legacy Modifiers
|
||||
|
||||
Provides a list of Beat Saber modifiers and their associated score multiplier values. This is legacy
|
||||
support, for the recent values please use `modifierValues` and `modifierRatings` on leaderboards.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[LegacyModifiers]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs()
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[LegacyModifiers]:
|
||||
"""Retrieve Legacy Modifiers
|
||||
|
||||
Provides a list of Beat Saber modifiers and their associated score multiplier values. This is legacy
|
||||
support, for the recent values please use `modifierValues` and `modifierRatings` on leaderboards.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
LegacyModifiers
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
0
src/clients/beatleader/api/patreon/__init__.py
Normal file
0
src/clients/beatleader/api/patreon/__init__.py
Normal file
@ -0,0 +1,89 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs() -> Dict[str, Any]:
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": "/refreshmypatreon",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
return None
|
||||
if response.status_code == HTTPStatus.BAD_REQUEST:
|
||||
return None
|
||||
if response.status_code == HTTPStatus.UNAUTHORIZED:
|
||||
return None
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Any]:
|
||||
"""Refresh Patreon Link
|
||||
|
||||
Refreshes the Patreon link for the current user, updating their Patreon tier and roles based on the
|
||||
latest information.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Any]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs()
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Any]:
|
||||
"""Refresh Patreon Link
|
||||
|
||||
Refreshes the Patreon link for the current user, updating their Patreon tier and roles based on the
|
||||
latest information.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Any]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs()
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
0
src/clients/beatleader/api/player/__init__.py
Normal file
0
src/clients/beatleader/api/player/__init__.py
Normal file
217
src/clients/beatleader/api/player/player_get.py
Normal file
217
src/clients/beatleader/api/player/player_get.py
Normal file
@ -0,0 +1,217 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.leaderboard_contexts import LeaderboardContexts
|
||||
from ...models.player_response_full import PlayerResponseFull
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
stats: Union[Unset, bool] = True,
|
||||
keep_original_id: Union[Unset, bool] = False,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
) -> Dict[str, Any]:
|
||||
params: Dict[str, Any] = {}
|
||||
|
||||
params["stats"] = stats
|
||||
|
||||
params["keepOriginalId"] = keep_original_id
|
||||
|
||||
json_leaderboard_context: Union[Unset, str] = UNSET
|
||||
if not isinstance(leaderboard_context, Unset):
|
||||
json_leaderboard_context = leaderboard_context.value
|
||||
|
||||
params["leaderboardContext"] = json_leaderboard_context
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/player/{id}",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, PlayerResponseFull]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = PlayerResponseFull.from_dict(response.text)
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, PlayerResponseFull]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
stats: Union[Unset, bool] = True,
|
||||
keep_original_id: Union[Unset, bool] = False,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
) -> Response[Union[Any, PlayerResponseFull]]:
|
||||
"""Get player profile
|
||||
|
||||
Retrieves a Beat Saber profile data for a specific player ID.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
stats (Union[Unset, bool]): Default: True.
|
||||
keep_original_id (Union[Unset, bool]): Default: False.
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, PlayerResponseFull]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
stats=stats,
|
||||
keep_original_id=keep_original_id,
|
||||
leaderboard_context=leaderboard_context,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
stats: Union[Unset, bool] = True,
|
||||
keep_original_id: Union[Unset, bool] = False,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
) -> Optional[Union[Any, PlayerResponseFull]]:
|
||||
"""Get player profile
|
||||
|
||||
Retrieves a Beat Saber profile data for a specific player ID.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
stats (Union[Unset, bool]): Default: True.
|
||||
keep_original_id (Union[Unset, bool]): Default: False.
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, PlayerResponseFull]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
stats=stats,
|
||||
keep_original_id=keep_original_id,
|
||||
leaderboard_context=leaderboard_context,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
stats: Union[Unset, bool] = True,
|
||||
keep_original_id: Union[Unset, bool] = False,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
) -> Response[Union[Any, PlayerResponseFull]]:
|
||||
"""Get player profile
|
||||
|
||||
Retrieves a Beat Saber profile data for a specific player ID.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
stats (Union[Unset, bool]): Default: True.
|
||||
keep_original_id (Union[Unset, bool]): Default: False.
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, PlayerResponseFull]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
stats=stats,
|
||||
keep_original_id=keep_original_id,
|
||||
leaderboard_context=leaderboard_context,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
stats: Union[Unset, bool] = True,
|
||||
keep_original_id: Union[Unset, bool] = False,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
) -> Optional[Union[Any, PlayerResponseFull]]:
|
||||
"""Get player profile
|
||||
|
||||
Retrieves a Beat Saber profile data for a specific player ID.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
stats (Union[Unset, bool]): Default: True.
|
||||
keep_original_id (Union[Unset, bool]): Default: False.
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, PlayerResponseFull]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
stats=stats,
|
||||
keep_original_id=keep_original_id,
|
||||
leaderboard_context=leaderboard_context,
|
||||
)
|
||||
).parsed
|
161
src/clients/beatleader/api/player/player_get_beat_saver.py
Normal file
161
src/clients/beatleader/api/player/player_get_beat_saver.py
Normal file
@ -0,0 +1,161 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.player_response_full import PlayerResponseFull
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
) -> Dict[str, Any]:
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/player/beatsaver/{id}",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, PlayerResponseFull]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = PlayerResponseFull.from_dict(response.text)
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, PlayerResponseFull]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Any, PlayerResponseFull]]:
|
||||
"""Get player with BeatSaver
|
||||
|
||||
Retrieves a BeatLeader profile data with linked BeatSaver profile.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, PlayerResponseFull]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Any, PlayerResponseFull]]:
|
||||
"""Get player with BeatSaver
|
||||
|
||||
Retrieves a BeatLeader profile data with linked BeatSaver profile.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, PlayerResponseFull]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Any, PlayerResponseFull]]:
|
||||
"""Get player with BeatSaver
|
||||
|
||||
Retrieves a BeatLeader profile data with linked BeatSaver profile.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, PlayerResponseFull]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Any, PlayerResponseFull]]:
|
||||
"""Get player with BeatSaver
|
||||
|
||||
Retrieves a BeatLeader profile data with linked BeatSaver profile.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, PlayerResponseFull]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
161
src/clients/beatleader/api/player/player_get_discord.py
Normal file
161
src/clients/beatleader/api/player/player_get_discord.py
Normal file
@ -0,0 +1,161 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.player_response_full import PlayerResponseFull
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
) -> Dict[str, Any]:
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/player/discord/{id}",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, PlayerResponseFull]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = PlayerResponseFull.from_dict(response.text)
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, PlayerResponseFull]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Any, PlayerResponseFull]]:
|
||||
"""Get player with Discord
|
||||
|
||||
Retrieves a BeatLeader profile data with linked Discord profile.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, PlayerResponseFull]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Any, PlayerResponseFull]]:
|
||||
"""Get player with Discord
|
||||
|
||||
Retrieves a BeatLeader profile data with linked Discord profile.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, PlayerResponseFull]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Any, PlayerResponseFull]]:
|
||||
"""Get player with Discord
|
||||
|
||||
Retrieves a BeatLeader profile data with linked Discord profile.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, PlayerResponseFull]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Any, PlayerResponseFull]]:
|
||||
"""Get player with Discord
|
||||
|
||||
Retrieves a BeatLeader profile data with linked Discord profile.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, PlayerResponseFull]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
222
src/clients/beatleader/api/player/player_get_followers.py
Normal file
222
src/clients/beatleader/api/player/player_get_followers.py
Normal file
@ -0,0 +1,222 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, List, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.follower_type import FollowerType
|
||||
from ...models.player_follower import PlayerFollower
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
type: Union[Unset, FollowerType] = UNSET,
|
||||
) -> Dict[str, Any]:
|
||||
params: Dict[str, Any] = {}
|
||||
|
||||
params["page"] = page
|
||||
|
||||
params["count"] = count
|
||||
|
||||
json_type: Union[Unset, str] = UNSET
|
||||
if not isinstance(type, Unset):
|
||||
json_type = type.value
|
||||
|
||||
params["type"] = json_type
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/player/{id}/followers",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, List["PlayerFollower"]]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = []
|
||||
_response_200 = response.text
|
||||
for response_200_item_data in _response_200:
|
||||
response_200_item = PlayerFollower.from_dict(response_200_item_data)
|
||||
|
||||
response_200.append(response_200_item)
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, List["PlayerFollower"]]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
type: Union[Unset, FollowerType] = UNSET,
|
||||
) -> Response[Union[Any, List["PlayerFollower"]]]:
|
||||
"""Get player's full follower list
|
||||
|
||||
Retrieves a full list of player' followers and players this player follow.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
type (Union[Unset, FollowerType]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, List['PlayerFollower']]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
page=page,
|
||||
count=count,
|
||||
type=type,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
type: Union[Unset, FollowerType] = UNSET,
|
||||
) -> Optional[Union[Any, List["PlayerFollower"]]]:
|
||||
"""Get player's full follower list
|
||||
|
||||
Retrieves a full list of player' followers and players this player follow.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
type (Union[Unset, FollowerType]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, List['PlayerFollower']]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
page=page,
|
||||
count=count,
|
||||
type=type,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
type: Union[Unset, FollowerType] = UNSET,
|
||||
) -> Response[Union[Any, List["PlayerFollower"]]]:
|
||||
"""Get player's full follower list
|
||||
|
||||
Retrieves a full list of player' followers and players this player follow.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
type (Union[Unset, FollowerType]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, List['PlayerFollower']]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
page=page,
|
||||
count=count,
|
||||
type=type,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
type: Union[Unset, FollowerType] = UNSET,
|
||||
) -> Optional[Union[Any, List["PlayerFollower"]]]:
|
||||
"""Get player's full follower list
|
||||
|
||||
Retrieves a full list of player' followers and players this player follow.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
type (Union[Unset, FollowerType]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, List['PlayerFollower']]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
page=page,
|
||||
count=count,
|
||||
type=type,
|
||||
)
|
||||
).parsed
|
165
src/clients/beatleader/api/player/player_get_followers_info.py
Normal file
165
src/clients/beatleader/api/player/player_get_followers_info.py
Normal file
@ -0,0 +1,165 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.player_followers_info_response import PlayerFollowersInfoResponse
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
) -> Dict[str, Any]:
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/player/{id}/followersInfo",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, PlayerFollowersInfoResponse]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = PlayerFollowersInfoResponse.from_dict(response.text)
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, PlayerFollowersInfoResponse]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Any, PlayerFollowersInfoResponse]]:
|
||||
"""Get player' followers and players they follow
|
||||
|
||||
Retrieves an info about player' followers such as count and 3 closest followers. Also 3 most
|
||||
followed players this player follows
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, PlayerFollowersInfoResponse]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Any, PlayerFollowersInfoResponse]]:
|
||||
"""Get player' followers and players they follow
|
||||
|
||||
Retrieves an info about player' followers such as count and 3 closest followers. Also 3 most
|
||||
followed players this player follows
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, PlayerFollowersInfoResponse]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Any, PlayerFollowersInfoResponse]]:
|
||||
"""Get player' followers and players they follow
|
||||
|
||||
Retrieves an info about player' followers such as count and 3 closest followers. Also 3 most
|
||||
followed players this player follows
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, PlayerFollowersInfoResponse]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Any, PlayerFollowersInfoResponse]]:
|
||||
"""Get player' followers and players they follow
|
||||
|
||||
Retrieves an info about player' followers such as count and 3 closest followers. Also 3 most
|
||||
followed players this player follows
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, PlayerFollowersInfoResponse]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
161
src/clients/beatleader/api/player/player_get_founded_clan.py
Normal file
161
src/clients/beatleader/api/player/player_get_founded_clan.py
Normal file
@ -0,0 +1,161 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.clan_bigger_response import ClanBiggerResponse
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
) -> Dict[str, Any]:
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/player/{id}/foundedClan",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, ClanBiggerResponse]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = ClanBiggerResponse.from_dict(response.text)
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, ClanBiggerResponse]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Any, ClanBiggerResponse]]:
|
||||
"""Get info about the clan this player founded
|
||||
|
||||
Retrieves an information about the clan this player created and manage.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, ClanBiggerResponse]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Any, ClanBiggerResponse]]:
|
||||
"""Get info about the clan this player founded
|
||||
|
||||
Retrieves an information about the clan this player created and manage.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, ClanBiggerResponse]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Any, ClanBiggerResponse]]:
|
||||
"""Get info about the clan this player founded
|
||||
|
||||
Retrieves an information about the clan this player created and manage.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, ClanBiggerResponse]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Any, ClanBiggerResponse]]:
|
||||
"""Get info about the clan this player founded
|
||||
|
||||
Retrieves an information about the clan this player created and manage.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, ClanBiggerResponse]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
@ -0,0 +1,161 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.participating_event_response import ParticipatingEventResponse
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
) -> Dict[str, Any]:
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/player/{id}/eventsparticipating",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, ParticipatingEventResponse]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = ParticipatingEventResponse.from_dict(response.text)
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, ParticipatingEventResponse]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Any, ParticipatingEventResponse]]:
|
||||
"""Get events where player participated
|
||||
|
||||
Retrieves a chronological list of events player with such ID took part of.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, ParticipatingEventResponse]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Any, ParticipatingEventResponse]]:
|
||||
"""Get events where player participated
|
||||
|
||||
Retrieves a chronological list of events player with such ID took part of.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, ParticipatingEventResponse]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Any, ParticipatingEventResponse]]:
|
||||
"""Get events where player participated
|
||||
|
||||
Retrieves a chronological list of events player with such ID took part of.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, ParticipatingEventResponse]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Any, ParticipatingEventResponse]]:
|
||||
"""Get events where player participated
|
||||
|
||||
Retrieves a chronological list of events player with such ID took part of.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, ParticipatingEventResponse]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
161
src/clients/beatleader/api/player/player_get_patreon.py
Normal file
161
src/clients/beatleader/api/player/player_get_patreon.py
Normal file
@ -0,0 +1,161 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.player_response_full import PlayerResponseFull
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
) -> Dict[str, Any]:
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/player/patreon/{id}",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, PlayerResponseFull]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = PlayerResponseFull.from_dict(response.text)
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, PlayerResponseFull]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Any, PlayerResponseFull]]:
|
||||
"""Get player with Patreon
|
||||
|
||||
Retrieves a BeatLeader profile data with linked Patreon profile.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, PlayerResponseFull]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Any, PlayerResponseFull]]:
|
||||
"""Get player with Patreon
|
||||
|
||||
Retrieves a BeatLeader profile data with linked Patreon profile.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, PlayerResponseFull]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Any, PlayerResponseFull]]:
|
||||
"""Get player with Patreon
|
||||
|
||||
Retrieves a BeatLeader profile data with linked Patreon profile.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, PlayerResponseFull]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Any, PlayerResponseFull]]:
|
||||
"""Get player with Patreon
|
||||
|
||||
Retrieves a BeatLeader profile data with linked Patreon profile.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, PlayerResponseFull]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
441
src/clients/beatleader/api/player/player_get_players.py
Normal file
441
src/clients/beatleader/api/player/player_get_players.py
Normal file
@ -0,0 +1,441 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.leaderboard_contexts import LeaderboardContexts
|
||||
from ...models.maps_type import MapsType
|
||||
from ...models.order import Order
|
||||
from ...models.player_response_with_stats_response_with_metadata import PlayerResponseWithStatsResponseWithMetadata
|
||||
from ...models.player_sort_by import PlayerSortBy
|
||||
from ...models.pp_type import PpType
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
sort_by: Union[Unset, PlayerSortBy] = UNSET,
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 50,
|
||||
search: Union[Unset, str] = "",
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
countries: Union[Unset, str] = "",
|
||||
maps_type: Union[Unset, MapsType] = UNSET,
|
||||
pp_type: Union[Unset, PpType] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
friends: Union[Unset, bool] = False,
|
||||
pp_range: Union[Unset, str] = UNSET,
|
||||
score_range: Union[Unset, str] = UNSET,
|
||||
platform: Union[Unset, str] = UNSET,
|
||||
role: Union[Unset, str] = UNSET,
|
||||
hmd: Union[Unset, str] = UNSET,
|
||||
activity_period: Union[Unset, int] = UNSET,
|
||||
banned: Union[Unset, bool] = UNSET,
|
||||
) -> Dict[str, Any]:
|
||||
params: Dict[str, Any] = {}
|
||||
|
||||
json_sort_by: Union[Unset, str] = UNSET
|
||||
if not isinstance(sort_by, Unset):
|
||||
json_sort_by = sort_by.value
|
||||
|
||||
params["sortBy"] = json_sort_by
|
||||
|
||||
params["page"] = page
|
||||
|
||||
params["count"] = count
|
||||
|
||||
params["search"] = search
|
||||
|
||||
json_order: Union[Unset, str] = UNSET
|
||||
if not isinstance(order, Unset):
|
||||
json_order = order.value
|
||||
|
||||
params["order"] = json_order
|
||||
|
||||
params["countries"] = countries
|
||||
|
||||
json_maps_type: Union[Unset, str] = UNSET
|
||||
if not isinstance(maps_type, Unset):
|
||||
json_maps_type = maps_type.value
|
||||
|
||||
params["mapsType"] = json_maps_type
|
||||
|
||||
json_pp_type: Union[Unset, str] = UNSET
|
||||
if not isinstance(pp_type, Unset):
|
||||
json_pp_type = pp_type.value
|
||||
|
||||
params["ppType"] = json_pp_type
|
||||
|
||||
json_leaderboard_context: Union[Unset, str] = UNSET
|
||||
if not isinstance(leaderboard_context, Unset):
|
||||
json_leaderboard_context = leaderboard_context.value
|
||||
|
||||
params["leaderboardContext"] = json_leaderboard_context
|
||||
|
||||
params["friends"] = friends
|
||||
|
||||
params["pp_range"] = pp_range
|
||||
|
||||
params["score_range"] = score_range
|
||||
|
||||
params["platform"] = platform
|
||||
|
||||
params["role"] = role
|
||||
|
||||
params["hmd"] = hmd
|
||||
|
||||
params["activityPeriod"] = activity_period
|
||||
|
||||
params["banned"] = banned
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": "/players",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, PlayerResponseWithStatsResponseWithMetadata]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = PlayerResponseWithStatsResponseWithMetadata.from_dict(response.text)
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.BAD_REQUEST:
|
||||
response_400 = cast(Any, None)
|
||||
return response_400
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, PlayerResponseWithStatsResponseWithMetadata]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
sort_by: Union[Unset, PlayerSortBy] = UNSET,
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 50,
|
||||
search: Union[Unset, str] = "",
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
countries: Union[Unset, str] = "",
|
||||
maps_type: Union[Unset, MapsType] = UNSET,
|
||||
pp_type: Union[Unset, PpType] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
friends: Union[Unset, bool] = False,
|
||||
pp_range: Union[Unset, str] = UNSET,
|
||||
score_range: Union[Unset, str] = UNSET,
|
||||
platform: Union[Unset, str] = UNSET,
|
||||
role: Union[Unset, str] = UNSET,
|
||||
hmd: Union[Unset, str] = UNSET,
|
||||
activity_period: Union[Unset, int] = UNSET,
|
||||
banned: Union[Unset, bool] = UNSET,
|
||||
) -> Response[Union[Any, PlayerResponseWithStatsResponseWithMetadata]]:
|
||||
"""Retrieve a list of players (ranking)
|
||||
|
||||
Fetches a paginated and optionally filtered list of players. Filters include sorting by performance
|
||||
points, search, country, maps type, platform, and more.
|
||||
|
||||
Args:
|
||||
sort_by (Union[Unset, PlayerSortBy]):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 50.
|
||||
search (Union[Unset, str]): Default: ''.
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
countries (Union[Unset, str]): Default: ''.
|
||||
maps_type (Union[Unset, MapsType]):
|
||||
pp_type (Union[Unset, PpType]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
friends (Union[Unset, bool]): Default: False.
|
||||
pp_range (Union[Unset, str]):
|
||||
score_range (Union[Unset, str]):
|
||||
platform (Union[Unset, str]):
|
||||
role (Union[Unset, str]):
|
||||
hmd (Union[Unset, str]):
|
||||
activity_period (Union[Unset, int]):
|
||||
banned (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, PlayerResponseWithStatsResponseWithMetadata]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
sort_by=sort_by,
|
||||
page=page,
|
||||
count=count,
|
||||
search=search,
|
||||
order=order,
|
||||
countries=countries,
|
||||
maps_type=maps_type,
|
||||
pp_type=pp_type,
|
||||
leaderboard_context=leaderboard_context,
|
||||
friends=friends,
|
||||
pp_range=pp_range,
|
||||
score_range=score_range,
|
||||
platform=platform,
|
||||
role=role,
|
||||
hmd=hmd,
|
||||
activity_period=activity_period,
|
||||
banned=banned,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
sort_by: Union[Unset, PlayerSortBy] = UNSET,
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 50,
|
||||
search: Union[Unset, str] = "",
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
countries: Union[Unset, str] = "",
|
||||
maps_type: Union[Unset, MapsType] = UNSET,
|
||||
pp_type: Union[Unset, PpType] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
friends: Union[Unset, bool] = False,
|
||||
pp_range: Union[Unset, str] = UNSET,
|
||||
score_range: Union[Unset, str] = UNSET,
|
||||
platform: Union[Unset, str] = UNSET,
|
||||
role: Union[Unset, str] = UNSET,
|
||||
hmd: Union[Unset, str] = UNSET,
|
||||
activity_period: Union[Unset, int] = UNSET,
|
||||
banned: Union[Unset, bool] = UNSET,
|
||||
) -> Optional[Union[Any, PlayerResponseWithStatsResponseWithMetadata]]:
|
||||
"""Retrieve a list of players (ranking)
|
||||
|
||||
Fetches a paginated and optionally filtered list of players. Filters include sorting by performance
|
||||
points, search, country, maps type, platform, and more.
|
||||
|
||||
Args:
|
||||
sort_by (Union[Unset, PlayerSortBy]):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 50.
|
||||
search (Union[Unset, str]): Default: ''.
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
countries (Union[Unset, str]): Default: ''.
|
||||
maps_type (Union[Unset, MapsType]):
|
||||
pp_type (Union[Unset, PpType]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
friends (Union[Unset, bool]): Default: False.
|
||||
pp_range (Union[Unset, str]):
|
||||
score_range (Union[Unset, str]):
|
||||
platform (Union[Unset, str]):
|
||||
role (Union[Unset, str]):
|
||||
hmd (Union[Unset, str]):
|
||||
activity_period (Union[Unset, int]):
|
||||
banned (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, PlayerResponseWithStatsResponseWithMetadata]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
sort_by=sort_by,
|
||||
page=page,
|
||||
count=count,
|
||||
search=search,
|
||||
order=order,
|
||||
countries=countries,
|
||||
maps_type=maps_type,
|
||||
pp_type=pp_type,
|
||||
leaderboard_context=leaderboard_context,
|
||||
friends=friends,
|
||||
pp_range=pp_range,
|
||||
score_range=score_range,
|
||||
platform=platform,
|
||||
role=role,
|
||||
hmd=hmd,
|
||||
activity_period=activity_period,
|
||||
banned=banned,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
sort_by: Union[Unset, PlayerSortBy] = UNSET,
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 50,
|
||||
search: Union[Unset, str] = "",
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
countries: Union[Unset, str] = "",
|
||||
maps_type: Union[Unset, MapsType] = UNSET,
|
||||
pp_type: Union[Unset, PpType] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
friends: Union[Unset, bool] = False,
|
||||
pp_range: Union[Unset, str] = UNSET,
|
||||
score_range: Union[Unset, str] = UNSET,
|
||||
platform: Union[Unset, str] = UNSET,
|
||||
role: Union[Unset, str] = UNSET,
|
||||
hmd: Union[Unset, str] = UNSET,
|
||||
activity_period: Union[Unset, int] = UNSET,
|
||||
banned: Union[Unset, bool] = UNSET,
|
||||
) -> Response[Union[Any, PlayerResponseWithStatsResponseWithMetadata]]:
|
||||
"""Retrieve a list of players (ranking)
|
||||
|
||||
Fetches a paginated and optionally filtered list of players. Filters include sorting by performance
|
||||
points, search, country, maps type, platform, and more.
|
||||
|
||||
Args:
|
||||
sort_by (Union[Unset, PlayerSortBy]):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 50.
|
||||
search (Union[Unset, str]): Default: ''.
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
countries (Union[Unset, str]): Default: ''.
|
||||
maps_type (Union[Unset, MapsType]):
|
||||
pp_type (Union[Unset, PpType]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
friends (Union[Unset, bool]): Default: False.
|
||||
pp_range (Union[Unset, str]):
|
||||
score_range (Union[Unset, str]):
|
||||
platform (Union[Unset, str]):
|
||||
role (Union[Unset, str]):
|
||||
hmd (Union[Unset, str]):
|
||||
activity_period (Union[Unset, int]):
|
||||
banned (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, PlayerResponseWithStatsResponseWithMetadata]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
sort_by=sort_by,
|
||||
page=page,
|
||||
count=count,
|
||||
search=search,
|
||||
order=order,
|
||||
countries=countries,
|
||||
maps_type=maps_type,
|
||||
pp_type=pp_type,
|
||||
leaderboard_context=leaderboard_context,
|
||||
friends=friends,
|
||||
pp_range=pp_range,
|
||||
score_range=score_range,
|
||||
platform=platform,
|
||||
role=role,
|
||||
hmd=hmd,
|
||||
activity_period=activity_period,
|
||||
banned=banned,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
sort_by: Union[Unset, PlayerSortBy] = UNSET,
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 50,
|
||||
search: Union[Unset, str] = "",
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
countries: Union[Unset, str] = "",
|
||||
maps_type: Union[Unset, MapsType] = UNSET,
|
||||
pp_type: Union[Unset, PpType] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
friends: Union[Unset, bool] = False,
|
||||
pp_range: Union[Unset, str] = UNSET,
|
||||
score_range: Union[Unset, str] = UNSET,
|
||||
platform: Union[Unset, str] = UNSET,
|
||||
role: Union[Unset, str] = UNSET,
|
||||
hmd: Union[Unset, str] = UNSET,
|
||||
activity_period: Union[Unset, int] = UNSET,
|
||||
banned: Union[Unset, bool] = UNSET,
|
||||
) -> Optional[Union[Any, PlayerResponseWithStatsResponseWithMetadata]]:
|
||||
"""Retrieve a list of players (ranking)
|
||||
|
||||
Fetches a paginated and optionally filtered list of players. Filters include sorting by performance
|
||||
points, search, country, maps type, platform, and more.
|
||||
|
||||
Args:
|
||||
sort_by (Union[Unset, PlayerSortBy]):
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 50.
|
||||
search (Union[Unset, str]): Default: ''.
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
countries (Union[Unset, str]): Default: ''.
|
||||
maps_type (Union[Unset, MapsType]):
|
||||
pp_type (Union[Unset, PpType]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
friends (Union[Unset, bool]): Default: False.
|
||||
pp_range (Union[Unset, str]):
|
||||
score_range (Union[Unset, str]):
|
||||
platform (Union[Unset, str]):
|
||||
role (Union[Unset, str]):
|
||||
hmd (Union[Unset, str]):
|
||||
activity_period (Union[Unset, int]):
|
||||
banned (Union[Unset, bool]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, PlayerResponseWithStatsResponseWithMetadata]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
sort_by=sort_by,
|
||||
page=page,
|
||||
count=count,
|
||||
search=search,
|
||||
order=order,
|
||||
countries=countries,
|
||||
maps_type=maps_type,
|
||||
pp_type=pp_type,
|
||||
leaderboard_context=leaderboard_context,
|
||||
friends=friends,
|
||||
pp_range=pp_range,
|
||||
score_range=score_range,
|
||||
platform=platform,
|
||||
role=role,
|
||||
hmd=hmd,
|
||||
activity_period=activity_period,
|
||||
banned=banned,
|
||||
)
|
||||
).parsed
|
182
src/clients/beatleader/api/player/player_get_ranked_maps.py
Normal file
182
src/clients/beatleader/api/player/player_get_ranked_maps.py
Normal file
@ -0,0 +1,182 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.ranked_mapper_response import RankedMapperResponse
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: int,
|
||||
*,
|
||||
sort_by: Union[Unset, str] = UNSET,
|
||||
) -> Dict[str, Any]:
|
||||
params: Dict[str, Any] = {}
|
||||
|
||||
params["sortBy"] = sort_by
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/player/{id}/rankedMaps",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, RankedMapperResponse]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = RankedMapperResponse.from_dict(response.text)
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, RankedMapperResponse]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
sort_by: Union[Unset, str] = UNSET,
|
||||
) -> Response[Union[Any, RankedMapperResponse]]:
|
||||
"""Get ranked maps this player mapped
|
||||
|
||||
Retrieves a list of maps this player created that later became ranked and give PP now.
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
sort_by (Union[Unset, str]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, RankedMapperResponse]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
sort_by=sort_by,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
sort_by: Union[Unset, str] = UNSET,
|
||||
) -> Optional[Union[Any, RankedMapperResponse]]:
|
||||
"""Get ranked maps this player mapped
|
||||
|
||||
Retrieves a list of maps this player created that later became ranked and give PP now.
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
sort_by (Union[Unset, str]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, RankedMapperResponse]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
sort_by=sort_by,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
sort_by: Union[Unset, str] = UNSET,
|
||||
) -> Response[Union[Any, RankedMapperResponse]]:
|
||||
"""Get ranked maps this player mapped
|
||||
|
||||
Retrieves a list of maps this player created that later became ranked and give PP now.
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
sort_by (Union[Unset, str]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, RankedMapperResponse]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
sort_by=sort_by,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: int,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
sort_by: Union[Unset, str] = UNSET,
|
||||
) -> Optional[Union[Any, RankedMapperResponse]]:
|
||||
"""Get ranked maps this player mapped
|
||||
|
||||
Retrieves a list of maps this player created that later became ranked and give PP now.
|
||||
|
||||
Args:
|
||||
id (int):
|
||||
sort_by (Union[Unset, str]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, RankedMapperResponse]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
sort_by=sort_by,
|
||||
)
|
||||
).parsed
|
@ -0,0 +1,139 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.leaderboard_contexts import LeaderboardContexts
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
type: Union[Unset, str] = "acc",
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
no_unranked_stars: Union[Unset, bool] = False,
|
||||
) -> Dict[str, Any]:
|
||||
params: Dict[str, Any] = {}
|
||||
|
||||
params["type"] = type
|
||||
|
||||
json_leaderboard_context: Union[Unset, str] = UNSET
|
||||
if not isinstance(leaderboard_context, Unset):
|
||||
json_leaderboard_context = leaderboard_context.value
|
||||
|
||||
params["leaderboardContext"] = json_leaderboard_context
|
||||
|
||||
params["no_unranked_stars"] = no_unranked_stars
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/player/{id}/accgraph",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
return None
|
||||
if response.status_code == HTTPStatus.BAD_REQUEST:
|
||||
return None
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
return None
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
type: Union[Unset, str] = "acc",
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
no_unranked_stars: Union[Unset, bool] = False,
|
||||
) -> Response[Any]:
|
||||
"""Retrieve player's accuracy graph
|
||||
|
||||
Usefull to visualise player's performance relative to map's complexity
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
type (Union[Unset, str]): Default: 'acc'.
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
no_unranked_stars (Union[Unset, bool]): Default: False.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Any]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
type=type,
|
||||
leaderboard_context=leaderboard_context,
|
||||
no_unranked_stars=no_unranked_stars,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
type: Union[Unset, str] = "acc",
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
no_unranked_stars: Union[Unset, bool] = False,
|
||||
) -> Response[Any]:
|
||||
"""Retrieve player's accuracy graph
|
||||
|
||||
Usefull to visualise player's performance relative to map's complexity
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
type (Union[Unset, str]): Default: 'acc'.
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
no_unranked_stars (Union[Unset, bool]): Default: False.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Any]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
type=type,
|
||||
leaderboard_context=leaderboard_context,
|
||||
no_unranked_stars=no_unranked_stars,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
@ -0,0 +1,210 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, List, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.history_compact_response import HistoryCompactResponse
|
||||
from ...models.leaderboard_contexts import LeaderboardContexts
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
count: Union[Unset, int] = 50,
|
||||
) -> Dict[str, Any]:
|
||||
params: Dict[str, Any] = {}
|
||||
|
||||
json_leaderboard_context: Union[Unset, str] = UNSET
|
||||
if not isinstance(leaderboard_context, Unset):
|
||||
json_leaderboard_context = leaderboard_context.value
|
||||
|
||||
params["leaderboardContext"] = json_leaderboard_context
|
||||
|
||||
params["count"] = count
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/player/{id}/history/compact",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, List["HistoryCompactResponse"]]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = []
|
||||
_response_200 = response.text
|
||||
for response_200_item_data in _response_200:
|
||||
response_200_item = HistoryCompactResponse.from_dict(response_200_item_data)
|
||||
|
||||
response_200.append(response_200_item)
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.BAD_REQUEST:
|
||||
response_400 = cast(Any, None)
|
||||
return response_400
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, List["HistoryCompactResponse"]]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
count: Union[Unset, int] = 50,
|
||||
) -> Response[Union[Any, List["HistoryCompactResponse"]]]:
|
||||
"""Retrieve player's statistic history in a compact form
|
||||
|
||||
Fetches a list of player's performance metrics subset. Use the main history endpoint for a full.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
count (Union[Unset, int]): Default: 50.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, List['HistoryCompactResponse']]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
leaderboard_context=leaderboard_context,
|
||||
count=count,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
count: Union[Unset, int] = 50,
|
||||
) -> Optional[Union[Any, List["HistoryCompactResponse"]]]:
|
||||
"""Retrieve player's statistic history in a compact form
|
||||
|
||||
Fetches a list of player's performance metrics subset. Use the main history endpoint for a full.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
count (Union[Unset, int]): Default: 50.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, List['HistoryCompactResponse']]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
leaderboard_context=leaderboard_context,
|
||||
count=count,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
count: Union[Unset, int] = 50,
|
||||
) -> Response[Union[Any, List["HistoryCompactResponse"]]]:
|
||||
"""Retrieve player's statistic history in a compact form
|
||||
|
||||
Fetches a list of player's performance metrics subset. Use the main history endpoint for a full.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
count (Union[Unset, int]): Default: 50.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, List['HistoryCompactResponse']]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
leaderboard_context=leaderboard_context,
|
||||
count=count,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
count: Union[Unset, int] = 50,
|
||||
) -> Optional[Union[Any, List["HistoryCompactResponse"]]]:
|
||||
"""Retrieve player's statistic history in a compact form
|
||||
|
||||
Fetches a list of player's performance metrics subset. Use the main history endpoint for a full.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
count (Union[Unset, int]): Default: 50.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, List['HistoryCompactResponse']]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
leaderboard_context=leaderboard_context,
|
||||
count=count,
|
||||
)
|
||||
).parsed
|
@ -0,0 +1,459 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.compact_score_response_response_with_metadata import CompactScoreResponseResponseWithMetadata
|
||||
from ...models.difficulty_status import DifficultyStatus
|
||||
from ...models.leaderboard_contexts import LeaderboardContexts
|
||||
from ...models.order import Order
|
||||
from ...models.requirements import Requirements
|
||||
from ...models.score_filter_status import ScoreFilterStatus
|
||||
from ...models.scores_sort_by import ScoresSortBy
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
sort_by: Union[Unset, ScoresSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 8,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
diff: Union[Unset, str] = UNSET,
|
||||
mode: Union[Unset, str] = UNSET,
|
||||
requirements: Union[Unset, Requirements] = UNSET,
|
||||
score_status: Union[Unset, ScoreFilterStatus] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
type: Union[Unset, DifficultyStatus] = UNSET,
|
||||
modifiers: Union[Unset, str] = UNSET,
|
||||
stars_from: Union[Unset, float] = UNSET,
|
||||
stars_to: Union[Unset, float] = UNSET,
|
||||
time_from: Union[Unset, int] = UNSET,
|
||||
time_to: Union[Unset, int] = UNSET,
|
||||
event_id: Union[Unset, int] = UNSET,
|
||||
) -> Dict[str, Any]:
|
||||
params: Dict[str, Any] = {}
|
||||
|
||||
json_sort_by: Union[Unset, str] = UNSET
|
||||
if not isinstance(sort_by, Unset):
|
||||
json_sort_by = sort_by.value
|
||||
|
||||
params["sortBy"] = json_sort_by
|
||||
|
||||
json_order: Union[Unset, str] = UNSET
|
||||
if not isinstance(order, Unset):
|
||||
json_order = order.value
|
||||
|
||||
params["order"] = json_order
|
||||
|
||||
params["page"] = page
|
||||
|
||||
params["count"] = count
|
||||
|
||||
params["search"] = search
|
||||
|
||||
params["diff"] = diff
|
||||
|
||||
params["mode"] = mode
|
||||
|
||||
json_requirements: Union[Unset, str] = UNSET
|
||||
if not isinstance(requirements, Unset):
|
||||
json_requirements = requirements.value
|
||||
|
||||
params["requirements"] = json_requirements
|
||||
|
||||
json_score_status: Union[Unset, str] = UNSET
|
||||
if not isinstance(score_status, Unset):
|
||||
json_score_status = score_status.value
|
||||
|
||||
params["scoreStatus"] = json_score_status
|
||||
|
||||
json_leaderboard_context: Union[Unset, str] = UNSET
|
||||
if not isinstance(leaderboard_context, Unset):
|
||||
json_leaderboard_context = leaderboard_context.value
|
||||
|
||||
params["leaderboardContext"] = json_leaderboard_context
|
||||
|
||||
json_type: Union[Unset, str] = UNSET
|
||||
if not isinstance(type, Unset):
|
||||
json_type = type.value
|
||||
|
||||
params["type"] = json_type
|
||||
|
||||
params["modifiers"] = modifiers
|
||||
|
||||
params["stars_from"] = stars_from
|
||||
|
||||
params["stars_to"] = stars_to
|
||||
|
||||
params["time_from"] = time_from
|
||||
|
||||
params["time_to"] = time_to
|
||||
|
||||
params["eventId"] = event_id
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/player/{id}/scores/compact",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, CompactScoreResponseResponseWithMetadata]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = CompactScoreResponseResponseWithMetadata.from_dict(response.text)
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.BAD_REQUEST:
|
||||
response_400 = cast(Any, None)
|
||||
return response_400
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, CompactScoreResponseResponseWithMetadata]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
sort_by: Union[Unset, ScoresSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 8,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
diff: Union[Unset, str] = UNSET,
|
||||
mode: Union[Unset, str] = UNSET,
|
||||
requirements: Union[Unset, Requirements] = UNSET,
|
||||
score_status: Union[Unset, ScoreFilterStatus] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
type: Union[Unset, DifficultyStatus] = UNSET,
|
||||
modifiers: Union[Unset, str] = UNSET,
|
||||
stars_from: Union[Unset, float] = UNSET,
|
||||
stars_to: Union[Unset, float] = UNSET,
|
||||
time_from: Union[Unset, int] = UNSET,
|
||||
time_to: Union[Unset, int] = UNSET,
|
||||
event_id: Union[Unset, int] = UNSET,
|
||||
) -> Response[Union[Any, CompactScoreResponseResponseWithMetadata]]:
|
||||
"""Retrieve player's scores in a compact form
|
||||
|
||||
Fetches a paginated list of scores for a specified player ID. Returns less info to save bandwith or
|
||||
processing time
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
sort_by (Union[Unset, ScoresSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 8.
|
||||
search (Union[Unset, str]):
|
||||
diff (Union[Unset, str]):
|
||||
mode (Union[Unset, str]):
|
||||
requirements (Union[Unset, Requirements]):
|
||||
score_status (Union[Unset, ScoreFilterStatus]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
type (Union[Unset, DifficultyStatus]): Represents the difficulty status of a map.
|
||||
modifiers (Union[Unset, str]):
|
||||
stars_from (Union[Unset, float]):
|
||||
stars_to (Union[Unset, float]):
|
||||
time_from (Union[Unset, int]):
|
||||
time_to (Union[Unset, int]):
|
||||
event_id (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, CompactScoreResponseResponseWithMetadata]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
sort_by=sort_by,
|
||||
order=order,
|
||||
page=page,
|
||||
count=count,
|
||||
search=search,
|
||||
diff=diff,
|
||||
mode=mode,
|
||||
requirements=requirements,
|
||||
score_status=score_status,
|
||||
leaderboard_context=leaderboard_context,
|
||||
type=type,
|
||||
modifiers=modifiers,
|
||||
stars_from=stars_from,
|
||||
stars_to=stars_to,
|
||||
time_from=time_from,
|
||||
time_to=time_to,
|
||||
event_id=event_id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
sort_by: Union[Unset, ScoresSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 8,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
diff: Union[Unset, str] = UNSET,
|
||||
mode: Union[Unset, str] = UNSET,
|
||||
requirements: Union[Unset, Requirements] = UNSET,
|
||||
score_status: Union[Unset, ScoreFilterStatus] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
type: Union[Unset, DifficultyStatus] = UNSET,
|
||||
modifiers: Union[Unset, str] = UNSET,
|
||||
stars_from: Union[Unset, float] = UNSET,
|
||||
stars_to: Union[Unset, float] = UNSET,
|
||||
time_from: Union[Unset, int] = UNSET,
|
||||
time_to: Union[Unset, int] = UNSET,
|
||||
event_id: Union[Unset, int] = UNSET,
|
||||
) -> Optional[Union[Any, CompactScoreResponseResponseWithMetadata]]:
|
||||
"""Retrieve player's scores in a compact form
|
||||
|
||||
Fetches a paginated list of scores for a specified player ID. Returns less info to save bandwith or
|
||||
processing time
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
sort_by (Union[Unset, ScoresSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 8.
|
||||
search (Union[Unset, str]):
|
||||
diff (Union[Unset, str]):
|
||||
mode (Union[Unset, str]):
|
||||
requirements (Union[Unset, Requirements]):
|
||||
score_status (Union[Unset, ScoreFilterStatus]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
type (Union[Unset, DifficultyStatus]): Represents the difficulty status of a map.
|
||||
modifiers (Union[Unset, str]):
|
||||
stars_from (Union[Unset, float]):
|
||||
stars_to (Union[Unset, float]):
|
||||
time_from (Union[Unset, int]):
|
||||
time_to (Union[Unset, int]):
|
||||
event_id (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, CompactScoreResponseResponseWithMetadata]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
sort_by=sort_by,
|
||||
order=order,
|
||||
page=page,
|
||||
count=count,
|
||||
search=search,
|
||||
diff=diff,
|
||||
mode=mode,
|
||||
requirements=requirements,
|
||||
score_status=score_status,
|
||||
leaderboard_context=leaderboard_context,
|
||||
type=type,
|
||||
modifiers=modifiers,
|
||||
stars_from=stars_from,
|
||||
stars_to=stars_to,
|
||||
time_from=time_from,
|
||||
time_to=time_to,
|
||||
event_id=event_id,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
sort_by: Union[Unset, ScoresSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 8,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
diff: Union[Unset, str] = UNSET,
|
||||
mode: Union[Unset, str] = UNSET,
|
||||
requirements: Union[Unset, Requirements] = UNSET,
|
||||
score_status: Union[Unset, ScoreFilterStatus] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
type: Union[Unset, DifficultyStatus] = UNSET,
|
||||
modifiers: Union[Unset, str] = UNSET,
|
||||
stars_from: Union[Unset, float] = UNSET,
|
||||
stars_to: Union[Unset, float] = UNSET,
|
||||
time_from: Union[Unset, int] = UNSET,
|
||||
time_to: Union[Unset, int] = UNSET,
|
||||
event_id: Union[Unset, int] = UNSET,
|
||||
) -> Response[Union[Any, CompactScoreResponseResponseWithMetadata]]:
|
||||
"""Retrieve player's scores in a compact form
|
||||
|
||||
Fetches a paginated list of scores for a specified player ID. Returns less info to save bandwith or
|
||||
processing time
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
sort_by (Union[Unset, ScoresSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 8.
|
||||
search (Union[Unset, str]):
|
||||
diff (Union[Unset, str]):
|
||||
mode (Union[Unset, str]):
|
||||
requirements (Union[Unset, Requirements]):
|
||||
score_status (Union[Unset, ScoreFilterStatus]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
type (Union[Unset, DifficultyStatus]): Represents the difficulty status of a map.
|
||||
modifiers (Union[Unset, str]):
|
||||
stars_from (Union[Unset, float]):
|
||||
stars_to (Union[Unset, float]):
|
||||
time_from (Union[Unset, int]):
|
||||
time_to (Union[Unset, int]):
|
||||
event_id (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, CompactScoreResponseResponseWithMetadata]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
sort_by=sort_by,
|
||||
order=order,
|
||||
page=page,
|
||||
count=count,
|
||||
search=search,
|
||||
diff=diff,
|
||||
mode=mode,
|
||||
requirements=requirements,
|
||||
score_status=score_status,
|
||||
leaderboard_context=leaderboard_context,
|
||||
type=type,
|
||||
modifiers=modifiers,
|
||||
stars_from=stars_from,
|
||||
stars_to=stars_to,
|
||||
time_from=time_from,
|
||||
time_to=time_to,
|
||||
event_id=event_id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
sort_by: Union[Unset, ScoresSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 8,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
diff: Union[Unset, str] = UNSET,
|
||||
mode: Union[Unset, str] = UNSET,
|
||||
requirements: Union[Unset, Requirements] = UNSET,
|
||||
score_status: Union[Unset, ScoreFilterStatus] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
type: Union[Unset, DifficultyStatus] = UNSET,
|
||||
modifiers: Union[Unset, str] = UNSET,
|
||||
stars_from: Union[Unset, float] = UNSET,
|
||||
stars_to: Union[Unset, float] = UNSET,
|
||||
time_from: Union[Unset, int] = UNSET,
|
||||
time_to: Union[Unset, int] = UNSET,
|
||||
event_id: Union[Unset, int] = UNSET,
|
||||
) -> Optional[Union[Any, CompactScoreResponseResponseWithMetadata]]:
|
||||
"""Retrieve player's scores in a compact form
|
||||
|
||||
Fetches a paginated list of scores for a specified player ID. Returns less info to save bandwith or
|
||||
processing time
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
sort_by (Union[Unset, ScoresSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 8.
|
||||
search (Union[Unset, str]):
|
||||
diff (Union[Unset, str]):
|
||||
mode (Union[Unset, str]):
|
||||
requirements (Union[Unset, Requirements]):
|
||||
score_status (Union[Unset, ScoreFilterStatus]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
type (Union[Unset, DifficultyStatus]): Represents the difficulty status of a map.
|
||||
modifiers (Union[Unset, str]):
|
||||
stars_from (Union[Unset, float]):
|
||||
stars_to (Union[Unset, float]):
|
||||
time_from (Union[Unset, int]):
|
||||
time_to (Union[Unset, int]):
|
||||
event_id (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, CompactScoreResponseResponseWithMetadata]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
sort_by=sort_by,
|
||||
order=order,
|
||||
page=page,
|
||||
count=count,
|
||||
search=search,
|
||||
diff=diff,
|
||||
mode=mode,
|
||||
requirements=requirements,
|
||||
score_status=score_status,
|
||||
leaderboard_context=leaderboard_context,
|
||||
type=type,
|
||||
modifiers=modifiers,
|
||||
stars_from=stars_from,
|
||||
stars_to=stars_to,
|
||||
time_from=time_from,
|
||||
time_to=time_to,
|
||||
event_id=event_id,
|
||||
)
|
||||
).parsed
|
@ -0,0 +1,210 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, List, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.leaderboard_contexts import LeaderboardContexts
|
||||
from ...models.player_score_stats_history import PlayerScoreStatsHistory
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
count: Union[Unset, int] = 50,
|
||||
) -> Dict[str, Any]:
|
||||
params: Dict[str, Any] = {}
|
||||
|
||||
json_leaderboard_context: Union[Unset, str] = UNSET
|
||||
if not isinstance(leaderboard_context, Unset):
|
||||
json_leaderboard_context = leaderboard_context.value
|
||||
|
||||
params["leaderboardContext"] = json_leaderboard_context
|
||||
|
||||
params["count"] = count
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/player/{id}/history",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, List["PlayerScoreStatsHistory"]]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = []
|
||||
_response_200 = response.text
|
||||
for response_200_item_data in _response_200:
|
||||
response_200_item = PlayerScoreStatsHistory.from_dict(response_200_item_data)
|
||||
|
||||
response_200.append(response_200_item)
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.BAD_REQUEST:
|
||||
response_400 = cast(Any, None)
|
||||
return response_400
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, List["PlayerScoreStatsHistory"]]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
count: Union[Unset, int] = 50,
|
||||
) -> Response[Union[Any, List["PlayerScoreStatsHistory"]]]:
|
||||
"""Retrieve player's statistic history
|
||||
|
||||
Fetches a list of player's performance metrics and various stats saved daily
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
count (Union[Unset, int]): Default: 50.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, List['PlayerScoreStatsHistory']]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
leaderboard_context=leaderboard_context,
|
||||
count=count,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
count: Union[Unset, int] = 50,
|
||||
) -> Optional[Union[Any, List["PlayerScoreStatsHistory"]]]:
|
||||
"""Retrieve player's statistic history
|
||||
|
||||
Fetches a list of player's performance metrics and various stats saved daily
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
count (Union[Unset, int]): Default: 50.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, List['PlayerScoreStatsHistory']]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
leaderboard_context=leaderboard_context,
|
||||
count=count,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
count: Union[Unset, int] = 50,
|
||||
) -> Response[Union[Any, List["PlayerScoreStatsHistory"]]]:
|
||||
"""Retrieve player's statistic history
|
||||
|
||||
Fetches a list of player's performance metrics and various stats saved daily
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
count (Union[Unset, int]): Default: 50.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, List['PlayerScoreStatsHistory']]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
leaderboard_context=leaderboard_context,
|
||||
count=count,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
count: Union[Unset, int] = 50,
|
||||
) -> Optional[Union[Any, List["PlayerScoreStatsHistory"]]]:
|
||||
"""Retrieve player's statistic history
|
||||
|
||||
Fetches a list of player's performance metrics and various stats saved daily
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
count (Union[Unset, int]): Default: 50.
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, List['PlayerScoreStatsHistory']]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
leaderboard_context=leaderboard_context,
|
||||
count=count,
|
||||
)
|
||||
).parsed
|
@ -0,0 +1,195 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, List, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.leaderboard_contexts import LeaderboardContexts
|
||||
from ...models.score_response_with_my_score import ScoreResponseWithMyScore
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
) -> Dict[str, Any]:
|
||||
params: Dict[str, Any] = {}
|
||||
|
||||
json_leaderboard_context: Union[Unset, str] = UNSET
|
||||
if not isinstance(leaderboard_context, Unset):
|
||||
json_leaderboard_context = leaderboard_context.value
|
||||
|
||||
params["leaderboardContext"] = json_leaderboard_context
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/player/{id}/pinnedScores",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, List["ScoreResponseWithMyScore"]]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = []
|
||||
_response_200 = response.text
|
||||
for response_200_item_data in _response_200:
|
||||
response_200_item = ScoreResponseWithMyScore.from_dict(response_200_item_data)
|
||||
|
||||
response_200.append(response_200_item)
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.BAD_REQUEST:
|
||||
response_400 = cast(Any, None)
|
||||
return response_400
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, List["ScoreResponseWithMyScore"]]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
) -> Response[Union[Any, List["ScoreResponseWithMyScore"]]]:
|
||||
"""Retrieve player's pinned scores
|
||||
|
||||
Fetches a paginated list of scores pinned by player for their ID.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, List['ScoreResponseWithMyScore']]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
leaderboard_context=leaderboard_context,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
) -> Optional[Union[Any, List["ScoreResponseWithMyScore"]]]:
|
||||
"""Retrieve player's pinned scores
|
||||
|
||||
Fetches a paginated list of scores pinned by player for their ID.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, List['ScoreResponseWithMyScore']]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
leaderboard_context=leaderboard_context,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
) -> Response[Union[Any, List["ScoreResponseWithMyScore"]]]:
|
||||
"""Retrieve player's pinned scores
|
||||
|
||||
Fetches a paginated list of scores pinned by player for their ID.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, List['ScoreResponseWithMyScore']]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
leaderboard_context=leaderboard_context,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
) -> Optional[Union[Any, List["ScoreResponseWithMyScore"]]]:
|
||||
"""Retrieve player's pinned scores
|
||||
|
||||
Fetches a paginated list of scores pinned by player for their ID.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, List['ScoreResponseWithMyScore']]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
leaderboard_context=leaderboard_context,
|
||||
)
|
||||
).parsed
|
@ -0,0 +1,201 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...types import Response
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
hash_: str,
|
||||
difficulty: str,
|
||||
mode: str,
|
||||
) -> Dict[str, Any]:
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/player/{id}/scorevalue/{hash_}/{difficulty}/{mode}",
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, int]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = cast(int, response.text)
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.BAD_REQUEST:
|
||||
response_400 = cast(Any, None)
|
||||
return response_400
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, int]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
hash_: str,
|
||||
difficulty: str,
|
||||
mode: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Any, int]]:
|
||||
"""Retrieve player's score for a specific map
|
||||
|
||||
Fetches a score made by a Player with ID for a map specified by Hash and difficulty
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
hash_ (str):
|
||||
difficulty (str):
|
||||
mode (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, int]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
hash_=hash_,
|
||||
difficulty=difficulty,
|
||||
mode=mode,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
hash_: str,
|
||||
difficulty: str,
|
||||
mode: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Any, int]]:
|
||||
"""Retrieve player's score for a specific map
|
||||
|
||||
Fetches a score made by a Player with ID for a map specified by Hash and difficulty
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
hash_ (str):
|
||||
difficulty (str):
|
||||
mode (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, int]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
hash_=hash_,
|
||||
difficulty=difficulty,
|
||||
mode=mode,
|
||||
client=client,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
hash_: str,
|
||||
difficulty: str,
|
||||
mode: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Response[Union[Any, int]]:
|
||||
"""Retrieve player's score for a specific map
|
||||
|
||||
Fetches a score made by a Player with ID for a map specified by Hash and difficulty
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
hash_ (str):
|
||||
difficulty (str):
|
||||
mode (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, int]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
hash_=hash_,
|
||||
difficulty=difficulty,
|
||||
mode=mode,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
hash_: str,
|
||||
difficulty: str,
|
||||
mode: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
) -> Optional[Union[Any, int]]:
|
||||
"""Retrieve player's score for a specific map
|
||||
|
||||
Fetches a score made by a Player with ID for a map specified by Hash and difficulty
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
hash_ (str):
|
||||
difficulty (str):
|
||||
mode (str):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, int]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
hash_=hash_,
|
||||
difficulty=difficulty,
|
||||
mode=mode,
|
||||
client=client,
|
||||
)
|
||||
).parsed
|
@ -0,0 +1,459 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.difficulty_status import DifficultyStatus
|
||||
from ...models.leaderboard_contexts import LeaderboardContexts
|
||||
from ...models.order import Order
|
||||
from ...models.requirements import Requirements
|
||||
from ...models.score_filter_status import ScoreFilterStatus
|
||||
from ...models.score_response_with_my_score_response_with_metadata import ScoreResponseWithMyScoreResponseWithMetadata
|
||||
from ...models.scores_sort_by import ScoresSortBy
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
id: str,
|
||||
*,
|
||||
sort_by: Union[Unset, ScoresSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 8,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
diff: Union[Unset, str] = UNSET,
|
||||
mode: Union[Unset, str] = UNSET,
|
||||
requirements: Union[Unset, Requirements] = UNSET,
|
||||
score_status: Union[Unset, ScoreFilterStatus] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
type: Union[Unset, DifficultyStatus] = UNSET,
|
||||
modifiers: Union[Unset, str] = UNSET,
|
||||
stars_from: Union[Unset, float] = UNSET,
|
||||
stars_to: Union[Unset, float] = UNSET,
|
||||
time_from: Union[Unset, int] = UNSET,
|
||||
time_to: Union[Unset, int] = UNSET,
|
||||
event_id: Union[Unset, int] = UNSET,
|
||||
) -> Dict[str, Any]:
|
||||
params: Dict[str, Any] = {}
|
||||
|
||||
json_sort_by: Union[Unset, str] = UNSET
|
||||
if not isinstance(sort_by, Unset):
|
||||
json_sort_by = sort_by.value
|
||||
|
||||
params["sortBy"] = json_sort_by
|
||||
|
||||
json_order: Union[Unset, str] = UNSET
|
||||
if not isinstance(order, Unset):
|
||||
json_order = order.value
|
||||
|
||||
params["order"] = json_order
|
||||
|
||||
params["page"] = page
|
||||
|
||||
params["count"] = count
|
||||
|
||||
params["search"] = search
|
||||
|
||||
params["diff"] = diff
|
||||
|
||||
params["mode"] = mode
|
||||
|
||||
json_requirements: Union[Unset, str] = UNSET
|
||||
if not isinstance(requirements, Unset):
|
||||
json_requirements = requirements.value
|
||||
|
||||
params["requirements"] = json_requirements
|
||||
|
||||
json_score_status: Union[Unset, str] = UNSET
|
||||
if not isinstance(score_status, Unset):
|
||||
json_score_status = score_status.value
|
||||
|
||||
params["scoreStatus"] = json_score_status
|
||||
|
||||
json_leaderboard_context: Union[Unset, str] = UNSET
|
||||
if not isinstance(leaderboard_context, Unset):
|
||||
json_leaderboard_context = leaderboard_context.value
|
||||
|
||||
params["leaderboardContext"] = json_leaderboard_context
|
||||
|
||||
json_type: Union[Unset, str] = UNSET
|
||||
if not isinstance(type, Unset):
|
||||
json_type = type.value
|
||||
|
||||
params["type"] = json_type
|
||||
|
||||
params["modifiers"] = modifiers
|
||||
|
||||
params["stars_from"] = stars_from
|
||||
|
||||
params["stars_to"] = stars_to
|
||||
|
||||
params["time_from"] = time_from
|
||||
|
||||
params["time_to"] = time_to
|
||||
|
||||
params["eventId"] = event_id
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": f"/player/{id}/scores",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, ScoreResponseWithMyScoreResponseWithMetadata]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = ScoreResponseWithMyScoreResponseWithMetadata.from_dict(response.text)
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.BAD_REQUEST:
|
||||
response_400 = cast(Any, None)
|
||||
return response_400
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, ScoreResponseWithMyScoreResponseWithMetadata]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
sort_by: Union[Unset, ScoresSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 8,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
diff: Union[Unset, str] = UNSET,
|
||||
mode: Union[Unset, str] = UNSET,
|
||||
requirements: Union[Unset, Requirements] = UNSET,
|
||||
score_status: Union[Unset, ScoreFilterStatus] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
type: Union[Unset, DifficultyStatus] = UNSET,
|
||||
modifiers: Union[Unset, str] = UNSET,
|
||||
stars_from: Union[Unset, float] = UNSET,
|
||||
stars_to: Union[Unset, float] = UNSET,
|
||||
time_from: Union[Unset, int] = UNSET,
|
||||
time_to: Union[Unset, int] = UNSET,
|
||||
event_id: Union[Unset, int] = UNSET,
|
||||
) -> Response[Union[Any, ScoreResponseWithMyScoreResponseWithMetadata]]:
|
||||
"""Retrieve player's scores
|
||||
|
||||
Fetches a paginated list of scores for a specified player ID. Allows filtering by various criteria
|
||||
like date, difficulty, mode, and more.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
sort_by (Union[Unset, ScoresSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 8.
|
||||
search (Union[Unset, str]):
|
||||
diff (Union[Unset, str]):
|
||||
mode (Union[Unset, str]):
|
||||
requirements (Union[Unset, Requirements]):
|
||||
score_status (Union[Unset, ScoreFilterStatus]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
type (Union[Unset, DifficultyStatus]): Represents the difficulty status of a map.
|
||||
modifiers (Union[Unset, str]):
|
||||
stars_from (Union[Unset, float]):
|
||||
stars_to (Union[Unset, float]):
|
||||
time_from (Union[Unset, int]):
|
||||
time_to (Union[Unset, int]):
|
||||
event_id (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, ScoreResponseWithMyScoreResponseWithMetadata]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
sort_by=sort_by,
|
||||
order=order,
|
||||
page=page,
|
||||
count=count,
|
||||
search=search,
|
||||
diff=diff,
|
||||
mode=mode,
|
||||
requirements=requirements,
|
||||
score_status=score_status,
|
||||
leaderboard_context=leaderboard_context,
|
||||
type=type,
|
||||
modifiers=modifiers,
|
||||
stars_from=stars_from,
|
||||
stars_to=stars_to,
|
||||
time_from=time_from,
|
||||
time_to=time_to,
|
||||
event_id=event_id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
sort_by: Union[Unset, ScoresSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 8,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
diff: Union[Unset, str] = UNSET,
|
||||
mode: Union[Unset, str] = UNSET,
|
||||
requirements: Union[Unset, Requirements] = UNSET,
|
||||
score_status: Union[Unset, ScoreFilterStatus] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
type: Union[Unset, DifficultyStatus] = UNSET,
|
||||
modifiers: Union[Unset, str] = UNSET,
|
||||
stars_from: Union[Unset, float] = UNSET,
|
||||
stars_to: Union[Unset, float] = UNSET,
|
||||
time_from: Union[Unset, int] = UNSET,
|
||||
time_to: Union[Unset, int] = UNSET,
|
||||
event_id: Union[Unset, int] = UNSET,
|
||||
) -> Optional[Union[Any, ScoreResponseWithMyScoreResponseWithMetadata]]:
|
||||
"""Retrieve player's scores
|
||||
|
||||
Fetches a paginated list of scores for a specified player ID. Allows filtering by various criteria
|
||||
like date, difficulty, mode, and more.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
sort_by (Union[Unset, ScoresSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 8.
|
||||
search (Union[Unset, str]):
|
||||
diff (Union[Unset, str]):
|
||||
mode (Union[Unset, str]):
|
||||
requirements (Union[Unset, Requirements]):
|
||||
score_status (Union[Unset, ScoreFilterStatus]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
type (Union[Unset, DifficultyStatus]): Represents the difficulty status of a map.
|
||||
modifiers (Union[Unset, str]):
|
||||
stars_from (Union[Unset, float]):
|
||||
stars_to (Union[Unset, float]):
|
||||
time_from (Union[Unset, int]):
|
||||
time_to (Union[Unset, int]):
|
||||
event_id (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, ScoreResponseWithMyScoreResponseWithMetadata]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
sort_by=sort_by,
|
||||
order=order,
|
||||
page=page,
|
||||
count=count,
|
||||
search=search,
|
||||
diff=diff,
|
||||
mode=mode,
|
||||
requirements=requirements,
|
||||
score_status=score_status,
|
||||
leaderboard_context=leaderboard_context,
|
||||
type=type,
|
||||
modifiers=modifiers,
|
||||
stars_from=stars_from,
|
||||
stars_to=stars_to,
|
||||
time_from=time_from,
|
||||
time_to=time_to,
|
||||
event_id=event_id,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
sort_by: Union[Unset, ScoresSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 8,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
diff: Union[Unset, str] = UNSET,
|
||||
mode: Union[Unset, str] = UNSET,
|
||||
requirements: Union[Unset, Requirements] = UNSET,
|
||||
score_status: Union[Unset, ScoreFilterStatus] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
type: Union[Unset, DifficultyStatus] = UNSET,
|
||||
modifiers: Union[Unset, str] = UNSET,
|
||||
stars_from: Union[Unset, float] = UNSET,
|
||||
stars_to: Union[Unset, float] = UNSET,
|
||||
time_from: Union[Unset, int] = UNSET,
|
||||
time_to: Union[Unset, int] = UNSET,
|
||||
event_id: Union[Unset, int] = UNSET,
|
||||
) -> Response[Union[Any, ScoreResponseWithMyScoreResponseWithMetadata]]:
|
||||
"""Retrieve player's scores
|
||||
|
||||
Fetches a paginated list of scores for a specified player ID. Allows filtering by various criteria
|
||||
like date, difficulty, mode, and more.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
sort_by (Union[Unset, ScoresSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 8.
|
||||
search (Union[Unset, str]):
|
||||
diff (Union[Unset, str]):
|
||||
mode (Union[Unset, str]):
|
||||
requirements (Union[Unset, Requirements]):
|
||||
score_status (Union[Unset, ScoreFilterStatus]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
type (Union[Unset, DifficultyStatus]): Represents the difficulty status of a map.
|
||||
modifiers (Union[Unset, str]):
|
||||
stars_from (Union[Unset, float]):
|
||||
stars_to (Union[Unset, float]):
|
||||
time_from (Union[Unset, int]):
|
||||
time_to (Union[Unset, int]):
|
||||
event_id (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, ScoreResponseWithMyScoreResponseWithMetadata]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
id=id,
|
||||
sort_by=sort_by,
|
||||
order=order,
|
||||
page=page,
|
||||
count=count,
|
||||
search=search,
|
||||
diff=diff,
|
||||
mode=mode,
|
||||
requirements=requirements,
|
||||
score_status=score_status,
|
||||
leaderboard_context=leaderboard_context,
|
||||
type=type,
|
||||
modifiers=modifiers,
|
||||
stars_from=stars_from,
|
||||
stars_to=stars_to,
|
||||
time_from=time_from,
|
||||
time_to=time_to,
|
||||
event_id=event_id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
id: str,
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
sort_by: Union[Unset, ScoresSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 8,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
diff: Union[Unset, str] = UNSET,
|
||||
mode: Union[Unset, str] = UNSET,
|
||||
requirements: Union[Unset, Requirements] = UNSET,
|
||||
score_status: Union[Unset, ScoreFilterStatus] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
type: Union[Unset, DifficultyStatus] = UNSET,
|
||||
modifiers: Union[Unset, str] = UNSET,
|
||||
stars_from: Union[Unset, float] = UNSET,
|
||||
stars_to: Union[Unset, float] = UNSET,
|
||||
time_from: Union[Unset, int] = UNSET,
|
||||
time_to: Union[Unset, int] = UNSET,
|
||||
event_id: Union[Unset, int] = UNSET,
|
||||
) -> Optional[Union[Any, ScoreResponseWithMyScoreResponseWithMetadata]]:
|
||||
"""Retrieve player's scores
|
||||
|
||||
Fetches a paginated list of scores for a specified player ID. Allows filtering by various criteria
|
||||
like date, difficulty, mode, and more.
|
||||
|
||||
Args:
|
||||
id (str):
|
||||
sort_by (Union[Unset, ScoresSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 8.
|
||||
search (Union[Unset, str]):
|
||||
diff (Union[Unset, str]):
|
||||
mode (Union[Unset, str]):
|
||||
requirements (Union[Unset, Requirements]):
|
||||
score_status (Union[Unset, ScoreFilterStatus]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
type (Union[Unset, DifficultyStatus]): Represents the difficulty status of a map.
|
||||
modifiers (Union[Unset, str]):
|
||||
stars_from (Union[Unset, float]):
|
||||
stars_to (Union[Unset, float]):
|
||||
time_from (Union[Unset, int]):
|
||||
time_to (Union[Unset, int]):
|
||||
event_id (Union[Unset, int]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, ScoreResponseWithMyScoreResponseWithMetadata]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
id=id,
|
||||
client=client,
|
||||
sort_by=sort_by,
|
||||
order=order,
|
||||
page=page,
|
||||
count=count,
|
||||
search=search,
|
||||
diff=diff,
|
||||
mode=mode,
|
||||
requirements=requirements,
|
||||
score_status=score_status,
|
||||
leaderboard_context=leaderboard_context,
|
||||
type=type,
|
||||
modifiers=modifiers,
|
||||
stars_from=stars_from,
|
||||
stars_to=stars_to,
|
||||
time_from=time_from,
|
||||
time_to=time_to,
|
||||
event_id=event_id,
|
||||
)
|
||||
).parsed
|
0
src/clients/beatleader/api/song/__init__.py
Normal file
0
src/clients/beatleader/api/song/__init__.py
Normal file
603
src/clients/beatleader/api/song/song_get_all.py
Normal file
603
src/clients/beatleader/api/song/song_get_all.py
Normal file
@ -0,0 +1,603 @@
|
||||
from http import HTTPStatus
|
||||
from typing import Any, Dict, Optional, Union, cast
|
||||
|
||||
import httpx
|
||||
|
||||
from ... import errors
|
||||
from ...client import AuthenticatedClient, Client
|
||||
from ...models.leaderboard_contexts import LeaderboardContexts
|
||||
from ...models.map_info_response_response_with_metadata import MapInfoResponseResponseWithMetadata
|
||||
from ...models.map_sort_by import MapSortBy
|
||||
from ...models.my_type import MyType
|
||||
from ...models.operation import Operation
|
||||
from ...models.order import Order
|
||||
from ...models.requirements import Requirements
|
||||
from ...models.song_status import SongStatus
|
||||
from ...models.type import Type
|
||||
from ...types import UNSET, Response, Unset
|
||||
|
||||
|
||||
def _get_kwargs(
|
||||
*,
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, MapSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
type: Union[Unset, Type] = UNSET,
|
||||
mode: Union[Unset, str] = UNSET,
|
||||
difficulty: Union[Unset, str] = UNSET,
|
||||
map_type: Union[Unset, int] = UNSET,
|
||||
all_types: Union[Unset, Operation] = UNSET,
|
||||
map_requirements: Union[Unset, Requirements] = UNSET,
|
||||
all_requirements: Union[Unset, Operation] = UNSET,
|
||||
song_status: Union[Unset, SongStatus] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
mytype: Union[Unset, MyType] = UNSET,
|
||||
stars_from: Union[Unset, float] = UNSET,
|
||||
stars_to: Union[Unset, float] = UNSET,
|
||||
accrating_from: Union[Unset, float] = UNSET,
|
||||
accrating_to: Union[Unset, float] = UNSET,
|
||||
passrating_from: Union[Unset, float] = UNSET,
|
||||
passrating_to: Union[Unset, float] = UNSET,
|
||||
techrating_from: Union[Unset, float] = UNSET,
|
||||
techrating_to: Union[Unset, float] = UNSET,
|
||||
date_from: Union[Unset, int] = UNSET,
|
||||
date_to: Union[Unset, int] = UNSET,
|
||||
mappers: Union[Unset, str] = UNSET,
|
||||
override_current_id: Union[Unset, str] = UNSET,
|
||||
) -> Dict[str, Any]:
|
||||
params: Dict[str, Any] = {}
|
||||
|
||||
params["page"] = page
|
||||
|
||||
params["count"] = count
|
||||
|
||||
json_sort_by: Union[Unset, str] = UNSET
|
||||
if not isinstance(sort_by, Unset):
|
||||
json_sort_by = sort_by.value
|
||||
|
||||
params["sortBy"] = json_sort_by
|
||||
|
||||
json_order: Union[Unset, str] = UNSET
|
||||
if not isinstance(order, Unset):
|
||||
json_order = order.value
|
||||
|
||||
params["order"] = json_order
|
||||
|
||||
params["search"] = search
|
||||
|
||||
json_type: Union[Unset, str] = UNSET
|
||||
if not isinstance(type, Unset):
|
||||
json_type = type.value
|
||||
|
||||
params["type"] = json_type
|
||||
|
||||
params["mode"] = mode
|
||||
|
||||
params["difficulty"] = difficulty
|
||||
|
||||
params["mapType"] = map_type
|
||||
|
||||
json_all_types: Union[Unset, str] = UNSET
|
||||
if not isinstance(all_types, Unset):
|
||||
json_all_types = all_types.value
|
||||
|
||||
params["allTypes"] = json_all_types
|
||||
|
||||
json_map_requirements: Union[Unset, str] = UNSET
|
||||
if not isinstance(map_requirements, Unset):
|
||||
json_map_requirements = map_requirements.value
|
||||
|
||||
params["mapRequirements"] = json_map_requirements
|
||||
|
||||
json_all_requirements: Union[Unset, str] = UNSET
|
||||
if not isinstance(all_requirements, Unset):
|
||||
json_all_requirements = all_requirements.value
|
||||
|
||||
params["allRequirements"] = json_all_requirements
|
||||
|
||||
json_song_status: Union[Unset, str] = UNSET
|
||||
if not isinstance(song_status, Unset):
|
||||
json_song_status = song_status.value
|
||||
|
||||
params["songStatus"] = json_song_status
|
||||
|
||||
json_leaderboard_context: Union[Unset, str] = UNSET
|
||||
if not isinstance(leaderboard_context, Unset):
|
||||
json_leaderboard_context = leaderboard_context.value
|
||||
|
||||
params["leaderboardContext"] = json_leaderboard_context
|
||||
|
||||
json_mytype: Union[Unset, str] = UNSET
|
||||
if not isinstance(mytype, Unset):
|
||||
json_mytype = mytype.value
|
||||
|
||||
params["mytype"] = json_mytype
|
||||
|
||||
params["stars_from"] = stars_from
|
||||
|
||||
params["stars_to"] = stars_to
|
||||
|
||||
params["accrating_from"] = accrating_from
|
||||
|
||||
params["accrating_to"] = accrating_to
|
||||
|
||||
params["passrating_from"] = passrating_from
|
||||
|
||||
params["passrating_to"] = passrating_to
|
||||
|
||||
params["techrating_from"] = techrating_from
|
||||
|
||||
params["techrating_to"] = techrating_to
|
||||
|
||||
params["date_from"] = date_from
|
||||
|
||||
params["date_to"] = date_to
|
||||
|
||||
params["mappers"] = mappers
|
||||
|
||||
params["overrideCurrentId"] = override_current_id
|
||||
|
||||
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
||||
|
||||
_kwargs: Dict[str, Any] = {
|
||||
"method": "get",
|
||||
"url": "/maps",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
return _kwargs
|
||||
|
||||
|
||||
def _parse_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Optional[Union[Any, MapInfoResponseResponseWithMetadata]]:
|
||||
if response.status_code == HTTPStatus.OK:
|
||||
response_200 = MapInfoResponseResponseWithMetadata.from_dict(response.text)
|
||||
|
||||
return response_200
|
||||
if response.status_code == HTTPStatus.NOT_FOUND:
|
||||
response_404 = cast(Any, None)
|
||||
return response_404
|
||||
if client.raise_on_unexpected_status:
|
||||
raise errors.UnexpectedStatus(response.status_code, response.content)
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
def _build_response(
|
||||
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
||||
) -> Response[Union[Any, MapInfoResponseResponseWithMetadata]]:
|
||||
return Response(
|
||||
status_code=HTTPStatus(response.status_code),
|
||||
content=response.content,
|
||||
headers=response.headers,
|
||||
parsed=_parse_response(client=client, response=response),
|
||||
)
|
||||
|
||||
|
||||
def sync_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, MapSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
type: Union[Unset, Type] = UNSET,
|
||||
mode: Union[Unset, str] = UNSET,
|
||||
difficulty: Union[Unset, str] = UNSET,
|
||||
map_type: Union[Unset, int] = UNSET,
|
||||
all_types: Union[Unset, Operation] = UNSET,
|
||||
map_requirements: Union[Unset, Requirements] = UNSET,
|
||||
all_requirements: Union[Unset, Operation] = UNSET,
|
||||
song_status: Union[Unset, SongStatus] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
mytype: Union[Unset, MyType] = UNSET,
|
||||
stars_from: Union[Unset, float] = UNSET,
|
||||
stars_to: Union[Unset, float] = UNSET,
|
||||
accrating_from: Union[Unset, float] = UNSET,
|
||||
accrating_to: Union[Unset, float] = UNSET,
|
||||
passrating_from: Union[Unset, float] = UNSET,
|
||||
passrating_to: Union[Unset, float] = UNSET,
|
||||
techrating_from: Union[Unset, float] = UNSET,
|
||||
techrating_to: Union[Unset, float] = UNSET,
|
||||
date_from: Union[Unset, int] = UNSET,
|
||||
date_to: Union[Unset, int] = UNSET,
|
||||
mappers: Union[Unset, str] = UNSET,
|
||||
override_current_id: Union[Unset, str] = UNSET,
|
||||
) -> Response[Union[Any, MapInfoResponseResponseWithMetadata]]:
|
||||
"""Retrieve a list of leaderboards (maps)
|
||||
|
||||
Fetches a paginated and optionally filtered list of leaderboards (Beat Saber maps).
|
||||
|
||||
Args:
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort_by (Union[Unset, MapSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
search (Union[Unset, str]):
|
||||
type (Union[Unset, Type]):
|
||||
mode (Union[Unset, str]):
|
||||
difficulty (Union[Unset, str]):
|
||||
map_type (Union[Unset, int]):
|
||||
all_types (Union[Unset, Operation]):
|
||||
map_requirements (Union[Unset, Requirements]):
|
||||
all_requirements (Union[Unset, Operation]):
|
||||
song_status (Union[Unset, SongStatus]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
mytype (Union[Unset, MyType]):
|
||||
stars_from (Union[Unset, float]):
|
||||
stars_to (Union[Unset, float]):
|
||||
accrating_from (Union[Unset, float]):
|
||||
accrating_to (Union[Unset, float]):
|
||||
passrating_from (Union[Unset, float]):
|
||||
passrating_to (Union[Unset, float]):
|
||||
techrating_from (Union[Unset, float]):
|
||||
techrating_to (Union[Unset, float]):
|
||||
date_from (Union[Unset, int]):
|
||||
date_to (Union[Unset, int]):
|
||||
mappers (Union[Unset, str]):
|
||||
override_current_id (Union[Unset, str]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, MapInfoResponseResponseWithMetadata]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
page=page,
|
||||
count=count,
|
||||
sort_by=sort_by,
|
||||
order=order,
|
||||
search=search,
|
||||
type=type,
|
||||
mode=mode,
|
||||
difficulty=difficulty,
|
||||
map_type=map_type,
|
||||
all_types=all_types,
|
||||
map_requirements=map_requirements,
|
||||
all_requirements=all_requirements,
|
||||
song_status=song_status,
|
||||
leaderboard_context=leaderboard_context,
|
||||
mytype=mytype,
|
||||
stars_from=stars_from,
|
||||
stars_to=stars_to,
|
||||
accrating_from=accrating_from,
|
||||
accrating_to=accrating_to,
|
||||
passrating_from=passrating_from,
|
||||
passrating_to=passrating_to,
|
||||
techrating_from=techrating_from,
|
||||
techrating_to=techrating_to,
|
||||
date_from=date_from,
|
||||
date_to=date_to,
|
||||
mappers=mappers,
|
||||
override_current_id=override_current_id,
|
||||
)
|
||||
|
||||
response = client.get_httpx_client().request(
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
def sync(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, MapSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
type: Union[Unset, Type] = UNSET,
|
||||
mode: Union[Unset, str] = UNSET,
|
||||
difficulty: Union[Unset, str] = UNSET,
|
||||
map_type: Union[Unset, int] = UNSET,
|
||||
all_types: Union[Unset, Operation] = UNSET,
|
||||
map_requirements: Union[Unset, Requirements] = UNSET,
|
||||
all_requirements: Union[Unset, Operation] = UNSET,
|
||||
song_status: Union[Unset, SongStatus] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
mytype: Union[Unset, MyType] = UNSET,
|
||||
stars_from: Union[Unset, float] = UNSET,
|
||||
stars_to: Union[Unset, float] = UNSET,
|
||||
accrating_from: Union[Unset, float] = UNSET,
|
||||
accrating_to: Union[Unset, float] = UNSET,
|
||||
passrating_from: Union[Unset, float] = UNSET,
|
||||
passrating_to: Union[Unset, float] = UNSET,
|
||||
techrating_from: Union[Unset, float] = UNSET,
|
||||
techrating_to: Union[Unset, float] = UNSET,
|
||||
date_from: Union[Unset, int] = UNSET,
|
||||
date_to: Union[Unset, int] = UNSET,
|
||||
mappers: Union[Unset, str] = UNSET,
|
||||
override_current_id: Union[Unset, str] = UNSET,
|
||||
) -> Optional[Union[Any, MapInfoResponseResponseWithMetadata]]:
|
||||
"""Retrieve a list of leaderboards (maps)
|
||||
|
||||
Fetches a paginated and optionally filtered list of leaderboards (Beat Saber maps).
|
||||
|
||||
Args:
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort_by (Union[Unset, MapSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
search (Union[Unset, str]):
|
||||
type (Union[Unset, Type]):
|
||||
mode (Union[Unset, str]):
|
||||
difficulty (Union[Unset, str]):
|
||||
map_type (Union[Unset, int]):
|
||||
all_types (Union[Unset, Operation]):
|
||||
map_requirements (Union[Unset, Requirements]):
|
||||
all_requirements (Union[Unset, Operation]):
|
||||
song_status (Union[Unset, SongStatus]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
mytype (Union[Unset, MyType]):
|
||||
stars_from (Union[Unset, float]):
|
||||
stars_to (Union[Unset, float]):
|
||||
accrating_from (Union[Unset, float]):
|
||||
accrating_to (Union[Unset, float]):
|
||||
passrating_from (Union[Unset, float]):
|
||||
passrating_to (Union[Unset, float]):
|
||||
techrating_from (Union[Unset, float]):
|
||||
techrating_to (Union[Unset, float]):
|
||||
date_from (Union[Unset, int]):
|
||||
date_to (Union[Unset, int]):
|
||||
mappers (Union[Unset, str]):
|
||||
override_current_id (Union[Unset, str]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, MapInfoResponseResponseWithMetadata]
|
||||
"""
|
||||
|
||||
return sync_detailed(
|
||||
client=client,
|
||||
page=page,
|
||||
count=count,
|
||||
sort_by=sort_by,
|
||||
order=order,
|
||||
search=search,
|
||||
type=type,
|
||||
mode=mode,
|
||||
difficulty=difficulty,
|
||||
map_type=map_type,
|
||||
all_types=all_types,
|
||||
map_requirements=map_requirements,
|
||||
all_requirements=all_requirements,
|
||||
song_status=song_status,
|
||||
leaderboard_context=leaderboard_context,
|
||||
mytype=mytype,
|
||||
stars_from=stars_from,
|
||||
stars_to=stars_to,
|
||||
accrating_from=accrating_from,
|
||||
accrating_to=accrating_to,
|
||||
passrating_from=passrating_from,
|
||||
passrating_to=passrating_to,
|
||||
techrating_from=techrating_from,
|
||||
techrating_to=techrating_to,
|
||||
date_from=date_from,
|
||||
date_to=date_to,
|
||||
mappers=mappers,
|
||||
override_current_id=override_current_id,
|
||||
).parsed
|
||||
|
||||
|
||||
async def asyncio_detailed(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, MapSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
type: Union[Unset, Type] = UNSET,
|
||||
mode: Union[Unset, str] = UNSET,
|
||||
difficulty: Union[Unset, str] = UNSET,
|
||||
map_type: Union[Unset, int] = UNSET,
|
||||
all_types: Union[Unset, Operation] = UNSET,
|
||||
map_requirements: Union[Unset, Requirements] = UNSET,
|
||||
all_requirements: Union[Unset, Operation] = UNSET,
|
||||
song_status: Union[Unset, SongStatus] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
mytype: Union[Unset, MyType] = UNSET,
|
||||
stars_from: Union[Unset, float] = UNSET,
|
||||
stars_to: Union[Unset, float] = UNSET,
|
||||
accrating_from: Union[Unset, float] = UNSET,
|
||||
accrating_to: Union[Unset, float] = UNSET,
|
||||
passrating_from: Union[Unset, float] = UNSET,
|
||||
passrating_to: Union[Unset, float] = UNSET,
|
||||
techrating_from: Union[Unset, float] = UNSET,
|
||||
techrating_to: Union[Unset, float] = UNSET,
|
||||
date_from: Union[Unset, int] = UNSET,
|
||||
date_to: Union[Unset, int] = UNSET,
|
||||
mappers: Union[Unset, str] = UNSET,
|
||||
override_current_id: Union[Unset, str] = UNSET,
|
||||
) -> Response[Union[Any, MapInfoResponseResponseWithMetadata]]:
|
||||
"""Retrieve a list of leaderboards (maps)
|
||||
|
||||
Fetches a paginated and optionally filtered list of leaderboards (Beat Saber maps).
|
||||
|
||||
Args:
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort_by (Union[Unset, MapSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
search (Union[Unset, str]):
|
||||
type (Union[Unset, Type]):
|
||||
mode (Union[Unset, str]):
|
||||
difficulty (Union[Unset, str]):
|
||||
map_type (Union[Unset, int]):
|
||||
all_types (Union[Unset, Operation]):
|
||||
map_requirements (Union[Unset, Requirements]):
|
||||
all_requirements (Union[Unset, Operation]):
|
||||
song_status (Union[Unset, SongStatus]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
mytype (Union[Unset, MyType]):
|
||||
stars_from (Union[Unset, float]):
|
||||
stars_to (Union[Unset, float]):
|
||||
accrating_from (Union[Unset, float]):
|
||||
accrating_to (Union[Unset, float]):
|
||||
passrating_from (Union[Unset, float]):
|
||||
passrating_to (Union[Unset, float]):
|
||||
techrating_from (Union[Unset, float]):
|
||||
techrating_to (Union[Unset, float]):
|
||||
date_from (Union[Unset, int]):
|
||||
date_to (Union[Unset, int]):
|
||||
mappers (Union[Unset, str]):
|
||||
override_current_id (Union[Unset, str]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Response[Union[Any, MapInfoResponseResponseWithMetadata]]
|
||||
"""
|
||||
|
||||
kwargs = _get_kwargs(
|
||||
page=page,
|
||||
count=count,
|
||||
sort_by=sort_by,
|
||||
order=order,
|
||||
search=search,
|
||||
type=type,
|
||||
mode=mode,
|
||||
difficulty=difficulty,
|
||||
map_type=map_type,
|
||||
all_types=all_types,
|
||||
map_requirements=map_requirements,
|
||||
all_requirements=all_requirements,
|
||||
song_status=song_status,
|
||||
leaderboard_context=leaderboard_context,
|
||||
mytype=mytype,
|
||||
stars_from=stars_from,
|
||||
stars_to=stars_to,
|
||||
accrating_from=accrating_from,
|
||||
accrating_to=accrating_to,
|
||||
passrating_from=passrating_from,
|
||||
passrating_to=passrating_to,
|
||||
techrating_from=techrating_from,
|
||||
techrating_to=techrating_to,
|
||||
date_from=date_from,
|
||||
date_to=date_to,
|
||||
mappers=mappers,
|
||||
override_current_id=override_current_id,
|
||||
)
|
||||
|
||||
response = await client.get_async_httpx_client().request(**kwargs)
|
||||
|
||||
return _build_response(client=client, response=response)
|
||||
|
||||
|
||||
async def asyncio(
|
||||
*,
|
||||
client: Union[AuthenticatedClient, Client],
|
||||
page: Union[Unset, int] = 1,
|
||||
count: Union[Unset, int] = 10,
|
||||
sort_by: Union[Unset, MapSortBy] = UNSET,
|
||||
order: Union[Unset, Order] = UNSET,
|
||||
search: Union[Unset, str] = UNSET,
|
||||
type: Union[Unset, Type] = UNSET,
|
||||
mode: Union[Unset, str] = UNSET,
|
||||
difficulty: Union[Unset, str] = UNSET,
|
||||
map_type: Union[Unset, int] = UNSET,
|
||||
all_types: Union[Unset, Operation] = UNSET,
|
||||
map_requirements: Union[Unset, Requirements] = UNSET,
|
||||
all_requirements: Union[Unset, Operation] = UNSET,
|
||||
song_status: Union[Unset, SongStatus] = UNSET,
|
||||
leaderboard_context: Union[Unset, LeaderboardContexts] = UNSET,
|
||||
mytype: Union[Unset, MyType] = UNSET,
|
||||
stars_from: Union[Unset, float] = UNSET,
|
||||
stars_to: Union[Unset, float] = UNSET,
|
||||
accrating_from: Union[Unset, float] = UNSET,
|
||||
accrating_to: Union[Unset, float] = UNSET,
|
||||
passrating_from: Union[Unset, float] = UNSET,
|
||||
passrating_to: Union[Unset, float] = UNSET,
|
||||
techrating_from: Union[Unset, float] = UNSET,
|
||||
techrating_to: Union[Unset, float] = UNSET,
|
||||
date_from: Union[Unset, int] = UNSET,
|
||||
date_to: Union[Unset, int] = UNSET,
|
||||
mappers: Union[Unset, str] = UNSET,
|
||||
override_current_id: Union[Unset, str] = UNSET,
|
||||
) -> Optional[Union[Any, MapInfoResponseResponseWithMetadata]]:
|
||||
"""Retrieve a list of leaderboards (maps)
|
||||
|
||||
Fetches a paginated and optionally filtered list of leaderboards (Beat Saber maps).
|
||||
|
||||
Args:
|
||||
page (Union[Unset, int]): Default: 1.
|
||||
count (Union[Unset, int]): Default: 10.
|
||||
sort_by (Union[Unset, MapSortBy]):
|
||||
order (Union[Unset, Order]): Represents the order in which values will be sorted.
|
||||
search (Union[Unset, str]):
|
||||
type (Union[Unset, Type]):
|
||||
mode (Union[Unset, str]):
|
||||
difficulty (Union[Unset, str]):
|
||||
map_type (Union[Unset, int]):
|
||||
all_types (Union[Unset, Operation]):
|
||||
map_requirements (Union[Unset, Requirements]):
|
||||
all_requirements (Union[Unset, Operation]):
|
||||
song_status (Union[Unset, SongStatus]):
|
||||
leaderboard_context (Union[Unset, LeaderboardContexts]):
|
||||
mytype (Union[Unset, MyType]):
|
||||
stars_from (Union[Unset, float]):
|
||||
stars_to (Union[Unset, float]):
|
||||
accrating_from (Union[Unset, float]):
|
||||
accrating_to (Union[Unset, float]):
|
||||
passrating_from (Union[Unset, float]):
|
||||
passrating_to (Union[Unset, float]):
|
||||
techrating_from (Union[Unset, float]):
|
||||
techrating_to (Union[Unset, float]):
|
||||
date_from (Union[Unset, int]):
|
||||
date_to (Union[Unset, int]):
|
||||
mappers (Union[Unset, str]):
|
||||
override_current_id (Union[Unset, str]):
|
||||
|
||||
Raises:
|
||||
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
||||
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
||||
|
||||
Returns:
|
||||
Union[Any, MapInfoResponseResponseWithMetadata]
|
||||
"""
|
||||
|
||||
return (
|
||||
await asyncio_detailed(
|
||||
client=client,
|
||||
page=page,
|
||||
count=count,
|
||||
sort_by=sort_by,
|
||||
order=order,
|
||||
search=search,
|
||||
type=type,
|
||||
mode=mode,
|
||||
difficulty=difficulty,
|
||||
map_type=map_type,
|
||||
all_types=all_types,
|
||||
map_requirements=map_requirements,
|
||||
all_requirements=all_requirements,
|
||||
song_status=song_status,
|
||||
leaderboard_context=leaderboard_context,
|
||||
mytype=mytype,
|
||||
stars_from=stars_from,
|
||||
stars_to=stars_to,
|
||||
accrating_from=accrating_from,
|
||||
accrating_to=accrating_to,
|
||||
passrating_from=passrating_from,
|
||||
passrating_to=passrating_to,
|
||||
techrating_from=techrating_from,
|
||||
techrating_to=techrating_to,
|
||||
date_from=date_from,
|
||||
date_to=date_to,
|
||||
mappers=mappers,
|
||||
override_current_id=override_current_id,
|
||||
)
|
||||
).parsed
|
268
src/clients/beatleader/client.py
Normal file
268
src/clients/beatleader/client.py
Normal file
@ -0,0 +1,268 @@
|
||||
import ssl
|
||||
from typing import Any, Dict, Optional, Union
|
||||
|
||||
import httpx
|
||||
from attrs import define, evolve, field
|
||||
|
||||
|
||||
@define
|
||||
class Client:
|
||||
"""A class for keeping track of data related to the API
|
||||
|
||||
The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
|
||||
|
||||
``base_url``: The base URL for the API, all requests are made to a relative path to this URL
|
||||
|
||||
``cookies``: A dictionary of cookies to be sent with every request
|
||||
|
||||
``headers``: A dictionary of headers to be sent with every request
|
||||
|
||||
``timeout``: The maximum amount of a time a request can take. API functions will raise
|
||||
httpx.TimeoutException if this is exceeded.
|
||||
|
||||
``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
|
||||
but can be set to False for testing purposes.
|
||||
|
||||
``follow_redirects``: Whether or not to follow redirects. Default value is False.
|
||||
|
||||
``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
|
||||
|
||||
|
||||
Attributes:
|
||||
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
|
||||
status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
|
||||
argument to the constructor.
|
||||
"""
|
||||
|
||||
raise_on_unexpected_status: bool = field(default=False, kw_only=True)
|
||||
_base_url: str = field(alias="base_url")
|
||||
_cookies: Dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
|
||||
_headers: Dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
|
||||
_timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout")
|
||||
_verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl")
|
||||
_follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
|
||||
_httpx_args: Dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
|
||||
_client: Optional[httpx.Client] = field(default=None, init=False)
|
||||
_async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
|
||||
|
||||
def with_headers(self, headers: Dict[str, str]) -> "Client":
|
||||
"""Get a new client matching this one with additional headers"""
|
||||
if self._client is not None:
|
||||
self._client.headers.update(headers)
|
||||
if self._async_client is not None:
|
||||
self._async_client.headers.update(headers)
|
||||
return evolve(self, headers={**self._headers, **headers})
|
||||
|
||||
def with_cookies(self, cookies: Dict[str, str]) -> "Client":
|
||||
"""Get a new client matching this one with additional cookies"""
|
||||
if self._client is not None:
|
||||
self._client.cookies.update(cookies)
|
||||
if self._async_client is not None:
|
||||
self._async_client.cookies.update(cookies)
|
||||
return evolve(self, cookies={**self._cookies, **cookies})
|
||||
|
||||
def with_timeout(self, timeout: httpx.Timeout) -> "Client":
|
||||
"""Get a new client matching this one with a new timeout (in seconds)"""
|
||||
if self._client is not None:
|
||||
self._client.timeout = timeout
|
||||
if self._async_client is not None:
|
||||
self._async_client.timeout = timeout
|
||||
return evolve(self, timeout=timeout)
|
||||
|
||||
def set_httpx_client(self, client: httpx.Client) -> "Client":
|
||||
"""Manually the underlying httpx.Client
|
||||
|
||||
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
||||
"""
|
||||
self._client = client
|
||||
return self
|
||||
|
||||
def get_httpx_client(self) -> httpx.Client:
|
||||
"""Get the underlying httpx.Client, constructing a new one if not previously set"""
|
||||
if self._client is None:
|
||||
self._client = httpx.Client(
|
||||
base_url=self._base_url,
|
||||
cookies=self._cookies,
|
||||
headers=self._headers,
|
||||
timeout=self._timeout,
|
||||
verify=self._verify_ssl,
|
||||
follow_redirects=self._follow_redirects,
|
||||
**self._httpx_args,
|
||||
)
|
||||
return self._client
|
||||
|
||||
def __enter__(self) -> "Client":
|
||||
"""Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
|
||||
self.get_httpx_client().__enter__()
|
||||
return self
|
||||
|
||||
def __exit__(self, *args: Any, **kwargs: Any) -> None:
|
||||
"""Exit a context manager for internal httpx.Client (see httpx docs)"""
|
||||
self.get_httpx_client().__exit__(*args, **kwargs)
|
||||
|
||||
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client":
|
||||
"""Manually the underlying httpx.AsyncClient
|
||||
|
||||
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
||||
"""
|
||||
self._async_client = async_client
|
||||
return self
|
||||
|
||||
def get_async_httpx_client(self) -> httpx.AsyncClient:
|
||||
"""Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
|
||||
if self._async_client is None:
|
||||
self._async_client = httpx.AsyncClient(
|
||||
base_url=self._base_url,
|
||||
cookies=self._cookies,
|
||||
headers=self._headers,
|
||||
timeout=self._timeout,
|
||||
verify=self._verify_ssl,
|
||||
follow_redirects=self._follow_redirects,
|
||||
**self._httpx_args,
|
||||
)
|
||||
return self._async_client
|
||||
|
||||
async def __aenter__(self) -> "Client":
|
||||
"""Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
|
||||
await self.get_async_httpx_client().__aenter__()
|
||||
return self
|
||||
|
||||
async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
|
||||
"""Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
|
||||
await self.get_async_httpx_client().__aexit__(*args, **kwargs)
|
||||
|
||||
|
||||
@define
|
||||
class AuthenticatedClient:
|
||||
"""A Client which has been authenticated for use on secured endpoints
|
||||
|
||||
The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
|
||||
|
||||
``base_url``: The base URL for the API, all requests are made to a relative path to this URL
|
||||
|
||||
``cookies``: A dictionary of cookies to be sent with every request
|
||||
|
||||
``headers``: A dictionary of headers to be sent with every request
|
||||
|
||||
``timeout``: The maximum amount of a time a request can take. API functions will raise
|
||||
httpx.TimeoutException if this is exceeded.
|
||||
|
||||
``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
|
||||
but can be set to False for testing purposes.
|
||||
|
||||
``follow_redirects``: Whether or not to follow redirects. Default value is False.
|
||||
|
||||
``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
|
||||
|
||||
|
||||
Attributes:
|
||||
raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
|
||||
status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
|
||||
argument to the constructor.
|
||||
token: The token to use for authentication
|
||||
prefix: The prefix to use for the Authorization header
|
||||
auth_header_name: The name of the Authorization header
|
||||
"""
|
||||
|
||||
raise_on_unexpected_status: bool = field(default=False, kw_only=True)
|
||||
_base_url: str = field(alias="base_url")
|
||||
_cookies: Dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
|
||||
_headers: Dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
|
||||
_timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout")
|
||||
_verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl")
|
||||
_follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
|
||||
_httpx_args: Dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
|
||||
_client: Optional[httpx.Client] = field(default=None, init=False)
|
||||
_async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
|
||||
|
||||
token: str
|
||||
prefix: str = "Bearer"
|
||||
auth_header_name: str = "Authorization"
|
||||
|
||||
def with_headers(self, headers: Dict[str, str]) -> "AuthenticatedClient":
|
||||
"""Get a new client matching this one with additional headers"""
|
||||
if self._client is not None:
|
||||
self._client.headers.update(headers)
|
||||
if self._async_client is not None:
|
||||
self._async_client.headers.update(headers)
|
||||
return evolve(self, headers={**self._headers, **headers})
|
||||
|
||||
def with_cookies(self, cookies: Dict[str, str]) -> "AuthenticatedClient":
|
||||
"""Get a new client matching this one with additional cookies"""
|
||||
if self._client is not None:
|
||||
self._client.cookies.update(cookies)
|
||||
if self._async_client is not None:
|
||||
self._async_client.cookies.update(cookies)
|
||||
return evolve(self, cookies={**self._cookies, **cookies})
|
||||
|
||||
def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient":
|
||||
"""Get a new client matching this one with a new timeout (in seconds)"""
|
||||
if self._client is not None:
|
||||
self._client.timeout = timeout
|
||||
if self._async_client is not None:
|
||||
self._async_client.timeout = timeout
|
||||
return evolve(self, timeout=timeout)
|
||||
|
||||
def set_httpx_client(self, client: httpx.Client) -> "AuthenticatedClient":
|
||||
"""Manually the underlying httpx.Client
|
||||
|
||||
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
||||
"""
|
||||
self._client = client
|
||||
return self
|
||||
|
||||
def get_httpx_client(self) -> httpx.Client:
|
||||
"""Get the underlying httpx.Client, constructing a new one if not previously set"""
|
||||
if self._client is None:
|
||||
self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token
|
||||
self._client = httpx.Client(
|
||||
base_url=self._base_url,
|
||||
cookies=self._cookies,
|
||||
headers=self._headers,
|
||||
timeout=self._timeout,
|
||||
verify=self._verify_ssl,
|
||||
follow_redirects=self._follow_redirects,
|
||||
**self._httpx_args,
|
||||
)
|
||||
return self._client
|
||||
|
||||
def __enter__(self) -> "AuthenticatedClient":
|
||||
"""Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
|
||||
self.get_httpx_client().__enter__()
|
||||
return self
|
||||
|
||||
def __exit__(self, *args: Any, **kwargs: Any) -> None:
|
||||
"""Exit a context manager for internal httpx.Client (see httpx docs)"""
|
||||
self.get_httpx_client().__exit__(*args, **kwargs)
|
||||
|
||||
def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient":
|
||||
"""Manually the underlying httpx.AsyncClient
|
||||
|
||||
**NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
|
||||
"""
|
||||
self._async_client = async_client
|
||||
return self
|
||||
|
||||
def get_async_httpx_client(self) -> httpx.AsyncClient:
|
||||
"""Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
|
||||
if self._async_client is None:
|
||||
self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token
|
||||
self._async_client = httpx.AsyncClient(
|
||||
base_url=self._base_url,
|
||||
cookies=self._cookies,
|
||||
headers=self._headers,
|
||||
timeout=self._timeout,
|
||||
verify=self._verify_ssl,
|
||||
follow_redirects=self._follow_redirects,
|
||||
**self._httpx_args,
|
||||
)
|
||||
return self._async_client
|
||||
|
||||
async def __aenter__(self) -> "AuthenticatedClient":
|
||||
"""Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
|
||||
await self.get_async_httpx_client().__aenter__()
|
||||
return self
|
||||
|
||||
async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
|
||||
"""Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
|
||||
await self.get_async_httpx_client().__aexit__(*args, **kwargs)
|
16
src/clients/beatleader/errors.py
Normal file
16
src/clients/beatleader/errors.py
Normal file
@ -0,0 +1,16 @@
|
||||
"""Contains shared errors types that can be raised from API functions"""
|
||||
|
||||
|
||||
class UnexpectedStatus(Exception):
|
||||
"""Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True"""
|
||||
|
||||
def __init__(self, status_code: int, content: bytes):
|
||||
self.status_code = status_code
|
||||
self.content = content
|
||||
|
||||
super().__init__(
|
||||
f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}"
|
||||
)
|
||||
|
||||
|
||||
__all__ = ["UnexpectedStatus"]
|
229
src/clients/beatleader/models/__init__.py
Normal file
229
src/clients/beatleader/models/__init__.py
Normal file
@ -0,0 +1,229 @@
|
||||
"""Contains all the data models used in inputs/outputs"""
|
||||
|
||||
from .achievement import Achievement
|
||||
from .achievement_description import AchievementDescription
|
||||
from .achievement_level import AchievementLevel
|
||||
from .badge import Badge
|
||||
from .ban import Ban
|
||||
from .beasties_nomination import BeastiesNomination
|
||||
from .besties_nomination_response import BestiesNominationResponse
|
||||
from .clan import Clan
|
||||
from .clan_bigger_response import ClanBiggerResponse
|
||||
from .clan_global_map import ClanGlobalMap
|
||||
from .clan_global_map_point import ClanGlobalMapPoint
|
||||
from .clan_map_connection import ClanMapConnection
|
||||
from .clan_maps_sort_by import ClanMapsSortBy
|
||||
from .clan_point import ClanPoint
|
||||
from .clan_ranking_response import ClanRankingResponse
|
||||
from .clan_ranking_response_clan_response_full_response_with_metadata_and_container import (
|
||||
ClanRankingResponseClanResponseFullResponseWithMetadataAndContainer,
|
||||
)
|
||||
from .clan_response import ClanResponse
|
||||
from .clan_response_full import ClanResponseFull
|
||||
from .clan_response_full_response_with_metadata import ClanResponseFullResponseWithMetadata
|
||||
from .clan_sort_by import ClanSortBy
|
||||
from .compact_leaderboard import CompactLeaderboard
|
||||
from .compact_leaderboard_response import CompactLeaderboardResponse
|
||||
from .compact_score import CompactScore
|
||||
from .compact_score_response import CompactScoreResponse
|
||||
from .compact_score_response_response_with_metadata import CompactScoreResponseResponseWithMetadata
|
||||
from .compact_song_response import CompactSongResponse
|
||||
from .controller_enum import ControllerEnum
|
||||
from .criteria_commentary import CriteriaCommentary
|
||||
from .difficulty_description import DifficultyDescription
|
||||
from .difficulty_response import DifficultyResponse
|
||||
from .difficulty_status import DifficultyStatus
|
||||
from .event_player import EventPlayer
|
||||
from .event_ranking import EventRanking
|
||||
from .external_status import ExternalStatus
|
||||
from .featured_playlist import FeaturedPlaylist
|
||||
from .featured_playlist_response import FeaturedPlaylistResponse
|
||||
from .follower_type import FollowerType
|
||||
from .global_map_history import GlobalMapHistory
|
||||
from .history_compact_response import HistoryCompactResponse
|
||||
from .hmd import HMD
|
||||
from .info_to_highlight import InfoToHighlight
|
||||
from .leaderboard import Leaderboard
|
||||
from .leaderboard_change import LeaderboardChange
|
||||
from .leaderboard_clan_ranking_response import LeaderboardClanRankingResponse
|
||||
from .leaderboard_contexts import LeaderboardContexts
|
||||
from .leaderboard_group_entry import LeaderboardGroupEntry
|
||||
from .leaderboard_info_response import LeaderboardInfoResponse
|
||||
from .leaderboard_info_response_response_with_metadata import LeaderboardInfoResponseResponseWithMetadata
|
||||
from .leaderboard_response import LeaderboardResponse
|
||||
from .leaderboard_sort_by import LeaderboardSortBy
|
||||
from .legacy_modifiers import LegacyModifiers
|
||||
from .link_response import LinkResponse
|
||||
from .map_diff_response import MapDiffResponse
|
||||
from .map_info_response import MapInfoResponse
|
||||
from .map_info_response_response_with_metadata import MapInfoResponseResponseWithMetadata
|
||||
from .map_quality import MapQuality
|
||||
from .map_sort_by import MapSortBy
|
||||
from .mapper import Mapper
|
||||
from .mapper_response import MapperResponse
|
||||
from .maps_type import MapsType
|
||||
from .metadata import Metadata
|
||||
from .modifiers_map import ModifiersMap
|
||||
from .modifiers_rating import ModifiersRating
|
||||
from .my_type import MyType
|
||||
from .operation import Operation
|
||||
from .order import Order
|
||||
from .participating_event_response import ParticipatingEventResponse
|
||||
from .patreon_features import PatreonFeatures
|
||||
from .player import Player
|
||||
from .player_change import PlayerChange
|
||||
from .player_context_extension import PlayerContextExtension
|
||||
from .player_follower import PlayerFollower
|
||||
from .player_followers_info_response import PlayerFollowersInfoResponse
|
||||
from .player_response import PlayerResponse
|
||||
from .player_response_clan_response_full_response_with_metadata_and_container import (
|
||||
PlayerResponseClanResponseFullResponseWithMetadataAndContainer,
|
||||
)
|
||||
from .player_response_full import PlayerResponseFull
|
||||
from .player_response_with_stats import PlayerResponseWithStats
|
||||
from .player_response_with_stats_response_with_metadata import PlayerResponseWithStatsResponseWithMetadata
|
||||
from .player_score_stats import PlayerScoreStats
|
||||
from .player_score_stats_history import PlayerScoreStatsHistory
|
||||
from .player_search import PlayerSearch
|
||||
from .player_social import PlayerSocial
|
||||
from .player_sort_by import PlayerSortBy
|
||||
from .pp_type import PpType
|
||||
from .profile_settings import ProfileSettings
|
||||
from .qualification_change import QualificationChange
|
||||
from .qualification_commentary import QualificationCommentary
|
||||
from .qualification_vote import QualificationVote
|
||||
from .rank_qualification import RankQualification
|
||||
from .rank_update import RankUpdate
|
||||
from .rank_update_change import RankUpdateChange
|
||||
from .rank_voting import RankVoting
|
||||
from .ranked_map import RankedMap
|
||||
from .ranked_mapper_response import RankedMapperResponse
|
||||
from .replay_offsets import ReplayOffsets
|
||||
from .requirements import Requirements
|
||||
from .score_filter_status import ScoreFilterStatus
|
||||
from .score_graph_entry import ScoreGraphEntry
|
||||
from .score_improvement import ScoreImprovement
|
||||
from .score_metadata import ScoreMetadata
|
||||
from .score_response import ScoreResponse
|
||||
from .score_response_with_acc import ScoreResponseWithAcc
|
||||
from .score_response_with_my_score import ScoreResponseWithMyScore
|
||||
from .score_response_with_my_score_response_with_metadata import ScoreResponseWithMyScoreResponseWithMetadata
|
||||
from .scores_sort_by import ScoresSortBy
|
||||
from .song import Song
|
||||
from .song_response import SongResponse
|
||||
from .song_status import SongStatus
|
||||
from .type import Type
|
||||
from .voter_feedback import VoterFeedback
|
||||
|
||||
__all__ = (
|
||||
"Achievement",
|
||||
"AchievementDescription",
|
||||
"AchievementLevel",
|
||||
"Badge",
|
||||
"Ban",
|
||||
"BeastiesNomination",
|
||||
"BestiesNominationResponse",
|
||||
"Clan",
|
||||
"ClanBiggerResponse",
|
||||
"ClanGlobalMap",
|
||||
"ClanGlobalMapPoint",
|
||||
"ClanMapConnection",
|
||||
"ClanMapsSortBy",
|
||||
"ClanPoint",
|
||||
"ClanRankingResponse",
|
||||
"ClanRankingResponseClanResponseFullResponseWithMetadataAndContainer",
|
||||
"ClanResponse",
|
||||
"ClanResponseFull",
|
||||
"ClanResponseFullResponseWithMetadata",
|
||||
"ClanSortBy",
|
||||
"CompactLeaderboard",
|
||||
"CompactLeaderboardResponse",
|
||||
"CompactScore",
|
||||
"CompactScoreResponse",
|
||||
"CompactScoreResponseResponseWithMetadata",
|
||||
"CompactSongResponse",
|
||||
"ControllerEnum",
|
||||
"CriteriaCommentary",
|
||||
"DifficultyDescription",
|
||||
"DifficultyResponse",
|
||||
"DifficultyStatus",
|
||||
"EventPlayer",
|
||||
"EventRanking",
|
||||
"ExternalStatus",
|
||||
"FeaturedPlaylist",
|
||||
"FeaturedPlaylistResponse",
|
||||
"FollowerType",
|
||||
"GlobalMapHistory",
|
||||
"HistoryCompactResponse",
|
||||
"HMD",
|
||||
"InfoToHighlight",
|
||||
"Leaderboard",
|
||||
"LeaderboardChange",
|
||||
"LeaderboardClanRankingResponse",
|
||||
"LeaderboardContexts",
|
||||
"LeaderboardGroupEntry",
|
||||
"LeaderboardInfoResponse",
|
||||
"LeaderboardInfoResponseResponseWithMetadata",
|
||||
"LeaderboardResponse",
|
||||
"LeaderboardSortBy",
|
||||
"LegacyModifiers",
|
||||
"LinkResponse",
|
||||
"MapDiffResponse",
|
||||
"MapInfoResponse",
|
||||
"MapInfoResponseResponseWithMetadata",
|
||||
"Mapper",
|
||||
"MapperResponse",
|
||||
"MapQuality",
|
||||
"MapSortBy",
|
||||
"MapsType",
|
||||
"Metadata",
|
||||
"ModifiersMap",
|
||||
"ModifiersRating",
|
||||
"MyType",
|
||||
"Operation",
|
||||
"Order",
|
||||
"ParticipatingEventResponse",
|
||||
"PatreonFeatures",
|
||||
"Player",
|
||||
"PlayerChange",
|
||||
"PlayerContextExtension",
|
||||
"PlayerFollower",
|
||||
"PlayerFollowersInfoResponse",
|
||||
"PlayerResponse",
|
||||
"PlayerResponseClanResponseFullResponseWithMetadataAndContainer",
|
||||
"PlayerResponseFull",
|
||||
"PlayerResponseWithStats",
|
||||
"PlayerResponseWithStatsResponseWithMetadata",
|
||||
"PlayerScoreStats",
|
||||
"PlayerScoreStatsHistory",
|
||||
"PlayerSearch",
|
||||
"PlayerSocial",
|
||||
"PlayerSortBy",
|
||||
"PpType",
|
||||
"ProfileSettings",
|
||||
"QualificationChange",
|
||||
"QualificationCommentary",
|
||||
"QualificationVote",
|
||||
"RankedMap",
|
||||
"RankedMapperResponse",
|
||||
"RankQualification",
|
||||
"RankUpdate",
|
||||
"RankUpdateChange",
|
||||
"RankVoting",
|
||||
"ReplayOffsets",
|
||||
"Requirements",
|
||||
"ScoreFilterStatus",
|
||||
"ScoreGraphEntry",
|
||||
"ScoreImprovement",
|
||||
"ScoreMetadata",
|
||||
"ScoreResponse",
|
||||
"ScoreResponseWithAcc",
|
||||
"ScoreResponseWithMyScore",
|
||||
"ScoreResponseWithMyScoreResponseWithMetadata",
|
||||
"ScoresSortBy",
|
||||
"Song",
|
||||
"SongResponse",
|
||||
"SongStatus",
|
||||
"Type",
|
||||
"VoterFeedback",
|
||||
)
|
125
src/clients/beatleader/models/achievement.py
Normal file
125
src/clients/beatleader/models/achievement.py
Normal file
@ -0,0 +1,125 @@
|
||||
from typing import TYPE_CHECKING, Any, Dict, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.achievement_description import AchievementDescription
|
||||
from ..models.achievement_level import AchievementLevel
|
||||
|
||||
|
||||
T = TypeVar("T", bound="Achievement")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class Achievement:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[Unset, int]):
|
||||
player_id (Union[None, Unset, str]):
|
||||
achievement_description_id (Union[Unset, int]):
|
||||
achievement_description (Union[Unset, AchievementDescription]):
|
||||
level (Union[Unset, AchievementLevel]):
|
||||
timeset (Union[Unset, int]):
|
||||
count (Union[Unset, int]):
|
||||
"""
|
||||
|
||||
id: Union[Unset, int] = UNSET
|
||||
player_id: Union[None, Unset, str] = UNSET
|
||||
achievement_description_id: Union[Unset, int] = UNSET
|
||||
achievement_description: Union[Unset, "AchievementDescription"] = UNSET
|
||||
level: Union[Unset, "AchievementLevel"] = UNSET
|
||||
timeset: Union[Unset, int] = UNSET
|
||||
count: Union[Unset, int] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id = self.id
|
||||
|
||||
player_id: Union[None, Unset, str]
|
||||
if isinstance(self.player_id, Unset):
|
||||
player_id = UNSET
|
||||
else:
|
||||
player_id = self.player_id
|
||||
|
||||
achievement_description_id = self.achievement_description_id
|
||||
|
||||
achievement_description: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.achievement_description, Unset):
|
||||
achievement_description = self.achievement_description.to_dict()
|
||||
|
||||
level: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.level, Unset):
|
||||
level = self.level.to_dict()
|
||||
|
||||
timeset = self.timeset
|
||||
|
||||
count = self.count
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if player_id is not UNSET:
|
||||
field_dict["playerId"] = player_id
|
||||
if achievement_description_id is not UNSET:
|
||||
field_dict["achievementDescriptionId"] = achievement_description_id
|
||||
if achievement_description is not UNSET:
|
||||
field_dict["achievementDescription"] = achievement_description
|
||||
if level is not UNSET:
|
||||
field_dict["level"] = level
|
||||
if timeset is not UNSET:
|
||||
field_dict["timeset"] = timeset
|
||||
if count is not UNSET:
|
||||
field_dict["count"] = count
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
from ..models.achievement_description import AchievementDescription
|
||||
from ..models.achievement_level import AchievementLevel
|
||||
|
||||
d = src_dict.copy()
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
def _parse_player_id(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
player_id = _parse_player_id(d.pop("playerId", UNSET))
|
||||
|
||||
achievement_description_id = d.pop("achievementDescriptionId", UNSET)
|
||||
|
||||
_achievement_description = d.pop("achievementDescription", UNSET)
|
||||
achievement_description: Union[Unset, AchievementDescription]
|
||||
if isinstance(_achievement_description, Unset):
|
||||
achievement_description = UNSET
|
||||
else:
|
||||
achievement_description = AchievementDescription.from_dict(_achievement_description)
|
||||
|
||||
_level = d.pop("level", UNSET)
|
||||
level: Union[Unset, AchievementLevel]
|
||||
if isinstance(_level, Unset):
|
||||
level = UNSET
|
||||
else:
|
||||
level = AchievementLevel.from_dict(_level)
|
||||
|
||||
timeset = d.pop("timeset", UNSET)
|
||||
|
||||
count = d.pop("count", UNSET)
|
||||
|
||||
achievement = cls(
|
||||
id=id,
|
||||
player_id=player_id,
|
||||
achievement_description_id=achievement_description_id,
|
||||
achievement_description=achievement_description,
|
||||
level=level,
|
||||
timeset=timeset,
|
||||
count=count,
|
||||
)
|
||||
|
||||
return achievement
|
143
src/clients/beatleader/models/achievement_description.py
Normal file
143
src/clients/beatleader/models/achievement_description.py
Normal file
@ -0,0 +1,143 @@
|
||||
from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.achievement_level import AchievementLevel
|
||||
|
||||
|
||||
T = TypeVar("T", bound="AchievementDescription")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AchievementDescription:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[Unset, int]):
|
||||
name (Union[None, Unset, str]):
|
||||
description (Union[None, Unset, str]):
|
||||
link (Union[None, Unset, str]):
|
||||
levels (Union[List['AchievementLevel'], None, Unset]):
|
||||
"""
|
||||
|
||||
id: Union[Unset, int] = UNSET
|
||||
name: Union[None, Unset, str] = UNSET
|
||||
description: Union[None, Unset, str] = UNSET
|
||||
link: Union[None, Unset, str] = UNSET
|
||||
levels: Union[List["AchievementLevel"], None, Unset] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id = self.id
|
||||
|
||||
name: Union[None, Unset, str]
|
||||
if isinstance(self.name, Unset):
|
||||
name = UNSET
|
||||
else:
|
||||
name = self.name
|
||||
|
||||
description: Union[None, Unset, str]
|
||||
if isinstance(self.description, Unset):
|
||||
description = UNSET
|
||||
else:
|
||||
description = self.description
|
||||
|
||||
link: Union[None, Unset, str]
|
||||
if isinstance(self.link, Unset):
|
||||
link = UNSET
|
||||
else:
|
||||
link = self.link
|
||||
|
||||
levels: Union[List[Dict[str, Any]], None, Unset]
|
||||
if isinstance(self.levels, Unset):
|
||||
levels = UNSET
|
||||
elif isinstance(self.levels, list):
|
||||
levels = []
|
||||
for levels_type_0_item_data in self.levels:
|
||||
levels_type_0_item = levels_type_0_item_data.to_dict()
|
||||
levels.append(levels_type_0_item)
|
||||
|
||||
else:
|
||||
levels = self.levels
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if name is not UNSET:
|
||||
field_dict["name"] = name
|
||||
if description is not UNSET:
|
||||
field_dict["description"] = description
|
||||
if link is not UNSET:
|
||||
field_dict["link"] = link
|
||||
if levels is not UNSET:
|
||||
field_dict["levels"] = levels
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
from ..models.achievement_level import AchievementLevel
|
||||
|
||||
d = src_dict.copy()
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
def _parse_name(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
name = _parse_name(d.pop("name", UNSET))
|
||||
|
||||
def _parse_description(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
description = _parse_description(d.pop("description", UNSET))
|
||||
|
||||
def _parse_link(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
link = _parse_link(d.pop("link", UNSET))
|
||||
|
||||
def _parse_levels(data: object) -> Union[List["AchievementLevel"], None, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, list):
|
||||
raise TypeError()
|
||||
levels_type_0 = []
|
||||
_levels_type_0 = data
|
||||
for levels_type_0_item_data in _levels_type_0:
|
||||
levels_type_0_item = AchievementLevel.from_dict(levels_type_0_item_data)
|
||||
|
||||
levels_type_0.append(levels_type_0_item)
|
||||
|
||||
return levels_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[List["AchievementLevel"], None, Unset], data)
|
||||
|
||||
levels = _parse_levels(d.pop("levels", UNSET))
|
||||
|
||||
achievement_description = cls(
|
||||
id=id,
|
||||
name=name,
|
||||
description=description,
|
||||
link=link,
|
||||
levels=levels,
|
||||
)
|
||||
|
||||
return achievement_description
|
196
src/clients/beatleader/models/achievement_level.py
Normal file
196
src/clients/beatleader/models/achievement_level.py
Normal file
@ -0,0 +1,196 @@
|
||||
from typing import Any, Dict, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="AchievementLevel")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class AchievementLevel:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[Unset, int]):
|
||||
image (Union[None, Unset, str]):
|
||||
small_image (Union[None, Unset, str]):
|
||||
name (Union[None, Unset, str]):
|
||||
description (Union[None, Unset, str]):
|
||||
detailed_description (Union[None, Unset, str]):
|
||||
color (Union[None, Unset, str]):
|
||||
value (Union[None, Unset, float]):
|
||||
level (Union[Unset, int]):
|
||||
achievement_description_id (Union[Unset, int]):
|
||||
"""
|
||||
|
||||
id: Union[Unset, int] = UNSET
|
||||
image: Union[None, Unset, str] = UNSET
|
||||
small_image: Union[None, Unset, str] = UNSET
|
||||
name: Union[None, Unset, str] = UNSET
|
||||
description: Union[None, Unset, str] = UNSET
|
||||
detailed_description: Union[None, Unset, str] = UNSET
|
||||
color: Union[None, Unset, str] = UNSET
|
||||
value: Union[None, Unset, float] = UNSET
|
||||
level: Union[Unset, int] = UNSET
|
||||
achievement_description_id: Union[Unset, int] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id = self.id
|
||||
|
||||
image: Union[None, Unset, str]
|
||||
if isinstance(self.image, Unset):
|
||||
image = UNSET
|
||||
else:
|
||||
image = self.image
|
||||
|
||||
small_image: Union[None, Unset, str]
|
||||
if isinstance(self.small_image, Unset):
|
||||
small_image = UNSET
|
||||
else:
|
||||
small_image = self.small_image
|
||||
|
||||
name: Union[None, Unset, str]
|
||||
if isinstance(self.name, Unset):
|
||||
name = UNSET
|
||||
else:
|
||||
name = self.name
|
||||
|
||||
description: Union[None, Unset, str]
|
||||
if isinstance(self.description, Unset):
|
||||
description = UNSET
|
||||
else:
|
||||
description = self.description
|
||||
|
||||
detailed_description: Union[None, Unset, str]
|
||||
if isinstance(self.detailed_description, Unset):
|
||||
detailed_description = UNSET
|
||||
else:
|
||||
detailed_description = self.detailed_description
|
||||
|
||||
color: Union[None, Unset, str]
|
||||
if isinstance(self.color, Unset):
|
||||
color = UNSET
|
||||
else:
|
||||
color = self.color
|
||||
|
||||
value: Union[None, Unset, float]
|
||||
if isinstance(self.value, Unset):
|
||||
value = UNSET
|
||||
else:
|
||||
value = self.value
|
||||
|
||||
level = self.level
|
||||
|
||||
achievement_description_id = self.achievement_description_id
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if image is not UNSET:
|
||||
field_dict["image"] = image
|
||||
if small_image is not UNSET:
|
||||
field_dict["smallImage"] = small_image
|
||||
if name is not UNSET:
|
||||
field_dict["name"] = name
|
||||
if description is not UNSET:
|
||||
field_dict["description"] = description
|
||||
if detailed_description is not UNSET:
|
||||
field_dict["detailedDescription"] = detailed_description
|
||||
if color is not UNSET:
|
||||
field_dict["color"] = color
|
||||
if value is not UNSET:
|
||||
field_dict["value"] = value
|
||||
if level is not UNSET:
|
||||
field_dict["level"] = level
|
||||
if achievement_description_id is not UNSET:
|
||||
field_dict["achievementDescriptionId"] = achievement_description_id
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
def _parse_image(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
image = _parse_image(d.pop("image", UNSET))
|
||||
|
||||
def _parse_small_image(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
small_image = _parse_small_image(d.pop("smallImage", UNSET))
|
||||
|
||||
def _parse_name(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
name = _parse_name(d.pop("name", UNSET))
|
||||
|
||||
def _parse_description(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
description = _parse_description(d.pop("description", UNSET))
|
||||
|
||||
def _parse_detailed_description(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
detailed_description = _parse_detailed_description(d.pop("detailedDescription", UNSET))
|
||||
|
||||
def _parse_color(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
color = _parse_color(d.pop("color", UNSET))
|
||||
|
||||
def _parse_value(data: object) -> Union[None, Unset, float]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, float], data)
|
||||
|
||||
value = _parse_value(d.pop("value", UNSET))
|
||||
|
||||
level = d.pop("level", UNSET)
|
||||
|
||||
achievement_description_id = d.pop("achievementDescriptionId", UNSET)
|
||||
|
||||
achievement_level = cls(
|
||||
id=id,
|
||||
image=image,
|
||||
small_image=small_image,
|
||||
name=name,
|
||||
description=description,
|
||||
detailed_description=detailed_description,
|
||||
color=color,
|
||||
value=value,
|
||||
level=level,
|
||||
achievement_description_id=achievement_description_id,
|
||||
)
|
||||
|
||||
return achievement_level
|
116
src/clients/beatleader/models/badge.py
Normal file
116
src/clients/beatleader/models/badge.py
Normal file
@ -0,0 +1,116 @@
|
||||
from typing import Any, Dict, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="Badge")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class Badge:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[Unset, int]):
|
||||
description (Union[None, Unset, str]):
|
||||
image (Union[None, Unset, str]):
|
||||
link (Union[None, Unset, str]):
|
||||
timeset (Union[Unset, int]):
|
||||
hidden (Union[Unset, bool]):
|
||||
"""
|
||||
|
||||
id: Union[Unset, int] = UNSET
|
||||
description: Union[None, Unset, str] = UNSET
|
||||
image: Union[None, Unset, str] = UNSET
|
||||
link: Union[None, Unset, str] = UNSET
|
||||
timeset: Union[Unset, int] = UNSET
|
||||
hidden: Union[Unset, bool] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id = self.id
|
||||
|
||||
description: Union[None, Unset, str]
|
||||
if isinstance(self.description, Unset):
|
||||
description = UNSET
|
||||
else:
|
||||
description = self.description
|
||||
|
||||
image: Union[None, Unset, str]
|
||||
if isinstance(self.image, Unset):
|
||||
image = UNSET
|
||||
else:
|
||||
image = self.image
|
||||
|
||||
link: Union[None, Unset, str]
|
||||
if isinstance(self.link, Unset):
|
||||
link = UNSET
|
||||
else:
|
||||
link = self.link
|
||||
|
||||
timeset = self.timeset
|
||||
|
||||
hidden = self.hidden
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if description is not UNSET:
|
||||
field_dict["description"] = description
|
||||
if image is not UNSET:
|
||||
field_dict["image"] = image
|
||||
if link is not UNSET:
|
||||
field_dict["link"] = link
|
||||
if timeset is not UNSET:
|
||||
field_dict["timeset"] = timeset
|
||||
if hidden is not UNSET:
|
||||
field_dict["hidden"] = hidden
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
def _parse_description(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
description = _parse_description(d.pop("description", UNSET))
|
||||
|
||||
def _parse_image(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
image = _parse_image(d.pop("image", UNSET))
|
||||
|
||||
def _parse_link(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
link = _parse_link(d.pop("link", UNSET))
|
||||
|
||||
timeset = d.pop("timeset", UNSET)
|
||||
|
||||
hidden = d.pop("hidden", UNSET)
|
||||
|
||||
badge = cls(
|
||||
id=id,
|
||||
description=description,
|
||||
image=image,
|
||||
link=link,
|
||||
timeset=timeset,
|
||||
hidden=hidden,
|
||||
)
|
||||
|
||||
return badge
|
116
src/clients/beatleader/models/ban.py
Normal file
116
src/clients/beatleader/models/ban.py
Normal file
@ -0,0 +1,116 @@
|
||||
from typing import Any, Dict, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="Ban")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class Ban:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[Unset, int]):
|
||||
player_id (Union[None, Unset, str]):
|
||||
banned_by (Union[None, Unset, str]):
|
||||
ban_reason (Union[None, Unset, str]):
|
||||
timeset (Union[Unset, int]):
|
||||
duration (Union[Unset, int]):
|
||||
"""
|
||||
|
||||
id: Union[Unset, int] = UNSET
|
||||
player_id: Union[None, Unset, str] = UNSET
|
||||
banned_by: Union[None, Unset, str] = UNSET
|
||||
ban_reason: Union[None, Unset, str] = UNSET
|
||||
timeset: Union[Unset, int] = UNSET
|
||||
duration: Union[Unset, int] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id = self.id
|
||||
|
||||
player_id: Union[None, Unset, str]
|
||||
if isinstance(self.player_id, Unset):
|
||||
player_id = UNSET
|
||||
else:
|
||||
player_id = self.player_id
|
||||
|
||||
banned_by: Union[None, Unset, str]
|
||||
if isinstance(self.banned_by, Unset):
|
||||
banned_by = UNSET
|
||||
else:
|
||||
banned_by = self.banned_by
|
||||
|
||||
ban_reason: Union[None, Unset, str]
|
||||
if isinstance(self.ban_reason, Unset):
|
||||
ban_reason = UNSET
|
||||
else:
|
||||
ban_reason = self.ban_reason
|
||||
|
||||
timeset = self.timeset
|
||||
|
||||
duration = self.duration
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if player_id is not UNSET:
|
||||
field_dict["playerId"] = player_id
|
||||
if banned_by is not UNSET:
|
||||
field_dict["bannedBy"] = banned_by
|
||||
if ban_reason is not UNSET:
|
||||
field_dict["banReason"] = ban_reason
|
||||
if timeset is not UNSET:
|
||||
field_dict["timeset"] = timeset
|
||||
if duration is not UNSET:
|
||||
field_dict["duration"] = duration
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
def _parse_player_id(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
player_id = _parse_player_id(d.pop("playerId", UNSET))
|
||||
|
||||
def _parse_banned_by(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
banned_by = _parse_banned_by(d.pop("bannedBy", UNSET))
|
||||
|
||||
def _parse_ban_reason(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
ban_reason = _parse_ban_reason(d.pop("banReason", UNSET))
|
||||
|
||||
timeset = d.pop("timeset", UNSET)
|
||||
|
||||
duration = d.pop("duration", UNSET)
|
||||
|
||||
ban = cls(
|
||||
id=id,
|
||||
player_id=player_id,
|
||||
banned_by=banned_by,
|
||||
ban_reason=ban_reason,
|
||||
timeset=timeset,
|
||||
duration=duration,
|
||||
)
|
||||
|
||||
return ban
|
107
src/clients/beatleader/models/beasties_nomination.py
Normal file
107
src/clients/beatleader/models/beasties_nomination.py
Normal file
@ -0,0 +1,107 @@
|
||||
from typing import Any, Dict, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="BeastiesNomination")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class BeastiesNomination:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[Unset, int]):
|
||||
player_id (Union[None, Unset, str]):
|
||||
leaderboard_id (Union[None, Unset, str]):
|
||||
category (Union[None, Unset, str]):
|
||||
timepost (Union[Unset, int]):
|
||||
"""
|
||||
|
||||
id: Union[Unset, int] = UNSET
|
||||
player_id: Union[None, Unset, str] = UNSET
|
||||
leaderboard_id: Union[None, Unset, str] = UNSET
|
||||
category: Union[None, Unset, str] = UNSET
|
||||
timepost: Union[Unset, int] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id = self.id
|
||||
|
||||
player_id: Union[None, Unset, str]
|
||||
if isinstance(self.player_id, Unset):
|
||||
player_id = UNSET
|
||||
else:
|
||||
player_id = self.player_id
|
||||
|
||||
leaderboard_id: Union[None, Unset, str]
|
||||
if isinstance(self.leaderboard_id, Unset):
|
||||
leaderboard_id = UNSET
|
||||
else:
|
||||
leaderboard_id = self.leaderboard_id
|
||||
|
||||
category: Union[None, Unset, str]
|
||||
if isinstance(self.category, Unset):
|
||||
category = UNSET
|
||||
else:
|
||||
category = self.category
|
||||
|
||||
timepost = self.timepost
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if player_id is not UNSET:
|
||||
field_dict["playerId"] = player_id
|
||||
if leaderboard_id is not UNSET:
|
||||
field_dict["leaderboardId"] = leaderboard_id
|
||||
if category is not UNSET:
|
||||
field_dict["category"] = category
|
||||
if timepost is not UNSET:
|
||||
field_dict["timepost"] = timepost
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
def _parse_player_id(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
player_id = _parse_player_id(d.pop("playerId", UNSET))
|
||||
|
||||
def _parse_leaderboard_id(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
leaderboard_id = _parse_leaderboard_id(d.pop("leaderboardId", UNSET))
|
||||
|
||||
def _parse_category(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
category = _parse_category(d.pop("category", UNSET))
|
||||
|
||||
timepost = d.pop("timepost", UNSET)
|
||||
|
||||
beasties_nomination = cls(
|
||||
id=id,
|
||||
player_id=player_id,
|
||||
leaderboard_id=leaderboard_id,
|
||||
category=category,
|
||||
timepost=timepost,
|
||||
)
|
||||
|
||||
return beasties_nomination
|
50
src/clients/beatleader/models/besties_nomination_response.py
Normal file
50
src/clients/beatleader/models/besties_nomination_response.py
Normal file
@ -0,0 +1,50 @@
|
||||
from typing import Any, Dict, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="BestiesNominationResponse")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class BestiesNominationResponse:
|
||||
"""
|
||||
Attributes:
|
||||
message (Union[None, Unset, str]):
|
||||
"""
|
||||
|
||||
message: Union[None, Unset, str] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
message: Union[None, Unset, str]
|
||||
if isinstance(self.message, Unset):
|
||||
message = UNSET
|
||||
else:
|
||||
message = self.message
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if message is not UNSET:
|
||||
field_dict["message"] = message
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
|
||||
def _parse_message(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
message = _parse_message(d.pop("message", UNSET))
|
||||
|
||||
besties_nomination_response = cls(
|
||||
message=message,
|
||||
)
|
||||
|
||||
return besties_nomination_response
|
354
src/clients/beatleader/models/clan.py
Normal file
354
src/clients/beatleader/models/clan.py
Normal file
@ -0,0 +1,354 @@
|
||||
from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.featured_playlist import FeaturedPlaylist
|
||||
from ..models.leaderboard import Leaderboard
|
||||
|
||||
|
||||
T = TypeVar("T", bound="Clan")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class Clan:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[Unset, int]):
|
||||
name (Union[None, Unset, str]):
|
||||
color (Union[None, Unset, str]):
|
||||
icon (Union[None, Unset, str]):
|
||||
tag (Union[None, Unset, str]):
|
||||
leader_id (Union[None, Unset, str]):
|
||||
description (Union[None, Unset, str]):
|
||||
bio (Union[None, Unset, str]):
|
||||
rich_bio_timeset (Union[Unset, int]):
|
||||
players_count (Union[Unset, int]):
|
||||
pp (Union[Unset, float]):
|
||||
rank (Union[Unset, int]):
|
||||
average_rank (Union[Unset, float]):
|
||||
average_accuracy (Union[Unset, float]):
|
||||
featured_playlists (Union[List['FeaturedPlaylist'], None, Unset]):
|
||||
ranked_pool_percent_captured (Union[Unset, float]):
|
||||
capture_leaderboards_count (Union[Unset, int]):
|
||||
captured_leaderboards (Union[List['Leaderboard'], None, Unset]):
|
||||
global_map_x (Union[Unset, float]):
|
||||
global_map_y (Union[Unset, float]):
|
||||
"""
|
||||
|
||||
id: Union[Unset, int] = UNSET
|
||||
name: Union[None, Unset, str] = UNSET
|
||||
color: Union[None, Unset, str] = UNSET
|
||||
icon: Union[None, Unset, str] = UNSET
|
||||
tag: Union[None, Unset, str] = UNSET
|
||||
leader_id: Union[None, Unset, str] = UNSET
|
||||
description: Union[None, Unset, str] = UNSET
|
||||
bio: Union[None, Unset, str] = UNSET
|
||||
rich_bio_timeset: Union[Unset, int] = UNSET
|
||||
players_count: Union[Unset, int] = UNSET
|
||||
pp: Union[Unset, float] = UNSET
|
||||
rank: Union[Unset, int] = UNSET
|
||||
average_rank: Union[Unset, float] = UNSET
|
||||
average_accuracy: Union[Unset, float] = UNSET
|
||||
featured_playlists: Union[List["FeaturedPlaylist"], None, Unset] = UNSET
|
||||
ranked_pool_percent_captured: Union[Unset, float] = UNSET
|
||||
capture_leaderboards_count: Union[Unset, int] = UNSET
|
||||
captured_leaderboards: Union[List["Leaderboard"], None, Unset] = UNSET
|
||||
global_map_x: Union[Unset, float] = UNSET
|
||||
global_map_y: Union[Unset, float] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id = self.id
|
||||
|
||||
name: Union[None, Unset, str]
|
||||
if isinstance(self.name, Unset):
|
||||
name = UNSET
|
||||
else:
|
||||
name = self.name
|
||||
|
||||
color: Union[None, Unset, str]
|
||||
if isinstance(self.color, Unset):
|
||||
color = UNSET
|
||||
else:
|
||||
color = self.color
|
||||
|
||||
icon: Union[None, Unset, str]
|
||||
if isinstance(self.icon, Unset):
|
||||
icon = UNSET
|
||||
else:
|
||||
icon = self.icon
|
||||
|
||||
tag: Union[None, Unset, str]
|
||||
if isinstance(self.tag, Unset):
|
||||
tag = UNSET
|
||||
else:
|
||||
tag = self.tag
|
||||
|
||||
leader_id: Union[None, Unset, str]
|
||||
if isinstance(self.leader_id, Unset):
|
||||
leader_id = UNSET
|
||||
else:
|
||||
leader_id = self.leader_id
|
||||
|
||||
description: Union[None, Unset, str]
|
||||
if isinstance(self.description, Unset):
|
||||
description = UNSET
|
||||
else:
|
||||
description = self.description
|
||||
|
||||
bio: Union[None, Unset, str]
|
||||
if isinstance(self.bio, Unset):
|
||||
bio = UNSET
|
||||
else:
|
||||
bio = self.bio
|
||||
|
||||
rich_bio_timeset = self.rich_bio_timeset
|
||||
|
||||
players_count = self.players_count
|
||||
|
||||
pp = self.pp
|
||||
|
||||
rank = self.rank
|
||||
|
||||
average_rank = self.average_rank
|
||||
|
||||
average_accuracy = self.average_accuracy
|
||||
|
||||
featured_playlists: Union[List[Dict[str, Any]], None, Unset]
|
||||
if isinstance(self.featured_playlists, Unset):
|
||||
featured_playlists = UNSET
|
||||
elif isinstance(self.featured_playlists, list):
|
||||
featured_playlists = []
|
||||
for featured_playlists_type_0_item_data in self.featured_playlists:
|
||||
featured_playlists_type_0_item = featured_playlists_type_0_item_data.to_dict()
|
||||
featured_playlists.append(featured_playlists_type_0_item)
|
||||
|
||||
else:
|
||||
featured_playlists = self.featured_playlists
|
||||
|
||||
ranked_pool_percent_captured = self.ranked_pool_percent_captured
|
||||
|
||||
capture_leaderboards_count = self.capture_leaderboards_count
|
||||
|
||||
captured_leaderboards: Union[List[Dict[str, Any]], None, Unset]
|
||||
if isinstance(self.captured_leaderboards, Unset):
|
||||
captured_leaderboards = UNSET
|
||||
elif isinstance(self.captured_leaderboards, list):
|
||||
captured_leaderboards = []
|
||||
for captured_leaderboards_type_0_item_data in self.captured_leaderboards:
|
||||
captured_leaderboards_type_0_item = captured_leaderboards_type_0_item_data.to_dict()
|
||||
captured_leaderboards.append(captured_leaderboards_type_0_item)
|
||||
|
||||
else:
|
||||
captured_leaderboards = self.captured_leaderboards
|
||||
|
||||
global_map_x = self.global_map_x
|
||||
|
||||
global_map_y = self.global_map_y
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if name is not UNSET:
|
||||
field_dict["name"] = name
|
||||
if color is not UNSET:
|
||||
field_dict["color"] = color
|
||||
if icon is not UNSET:
|
||||
field_dict["icon"] = icon
|
||||
if tag is not UNSET:
|
||||
field_dict["tag"] = tag
|
||||
if leader_id is not UNSET:
|
||||
field_dict["leaderID"] = leader_id
|
||||
if description is not UNSET:
|
||||
field_dict["description"] = description
|
||||
if bio is not UNSET:
|
||||
field_dict["bio"] = bio
|
||||
if rich_bio_timeset is not UNSET:
|
||||
field_dict["richBioTimeset"] = rich_bio_timeset
|
||||
if players_count is not UNSET:
|
||||
field_dict["playersCount"] = players_count
|
||||
if pp is not UNSET:
|
||||
field_dict["pp"] = pp
|
||||
if rank is not UNSET:
|
||||
field_dict["rank"] = rank
|
||||
if average_rank is not UNSET:
|
||||
field_dict["averageRank"] = average_rank
|
||||
if average_accuracy is not UNSET:
|
||||
field_dict["averageAccuracy"] = average_accuracy
|
||||
if featured_playlists is not UNSET:
|
||||
field_dict["featuredPlaylists"] = featured_playlists
|
||||
if ranked_pool_percent_captured is not UNSET:
|
||||
field_dict["rankedPoolPercentCaptured"] = ranked_pool_percent_captured
|
||||
if capture_leaderboards_count is not UNSET:
|
||||
field_dict["captureLeaderboardsCount"] = capture_leaderboards_count
|
||||
if captured_leaderboards is not UNSET:
|
||||
field_dict["capturedLeaderboards"] = captured_leaderboards
|
||||
if global_map_x is not UNSET:
|
||||
field_dict["globalMapX"] = global_map_x
|
||||
if global_map_y is not UNSET:
|
||||
field_dict["globalMapY"] = global_map_y
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
from ..models.featured_playlist import FeaturedPlaylist
|
||||
from ..models.leaderboard import Leaderboard
|
||||
|
||||
d = src_dict.copy()
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
def _parse_name(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
name = _parse_name(d.pop("name", UNSET))
|
||||
|
||||
def _parse_color(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
color = _parse_color(d.pop("color", UNSET))
|
||||
|
||||
def _parse_icon(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
icon = _parse_icon(d.pop("icon", UNSET))
|
||||
|
||||
def _parse_tag(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
tag = _parse_tag(d.pop("tag", UNSET))
|
||||
|
||||
def _parse_leader_id(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
leader_id = _parse_leader_id(d.pop("leaderID", UNSET))
|
||||
|
||||
def _parse_description(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
description = _parse_description(d.pop("description", UNSET))
|
||||
|
||||
def _parse_bio(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
bio = _parse_bio(d.pop("bio", UNSET))
|
||||
|
||||
rich_bio_timeset = d.pop("richBioTimeset", UNSET)
|
||||
|
||||
players_count = d.pop("playersCount", UNSET)
|
||||
|
||||
pp = d.pop("pp", UNSET)
|
||||
|
||||
rank = d.pop("rank", UNSET)
|
||||
|
||||
average_rank = d.pop("averageRank", UNSET)
|
||||
|
||||
average_accuracy = d.pop("averageAccuracy", UNSET)
|
||||
|
||||
def _parse_featured_playlists(data: object) -> Union[List["FeaturedPlaylist"], None, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, list):
|
||||
raise TypeError()
|
||||
featured_playlists_type_0 = []
|
||||
_featured_playlists_type_0 = data
|
||||
for featured_playlists_type_0_item_data in _featured_playlists_type_0:
|
||||
featured_playlists_type_0_item = FeaturedPlaylist.from_dict(featured_playlists_type_0_item_data)
|
||||
|
||||
featured_playlists_type_0.append(featured_playlists_type_0_item)
|
||||
|
||||
return featured_playlists_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[List["FeaturedPlaylist"], None, Unset], data)
|
||||
|
||||
featured_playlists = _parse_featured_playlists(d.pop("featuredPlaylists", UNSET))
|
||||
|
||||
ranked_pool_percent_captured = d.pop("rankedPoolPercentCaptured", UNSET)
|
||||
|
||||
capture_leaderboards_count = d.pop("captureLeaderboardsCount", UNSET)
|
||||
|
||||
def _parse_captured_leaderboards(data: object) -> Union[List["Leaderboard"], None, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, list):
|
||||
raise TypeError()
|
||||
captured_leaderboards_type_0 = []
|
||||
_captured_leaderboards_type_0 = data
|
||||
for captured_leaderboards_type_0_item_data in _captured_leaderboards_type_0:
|
||||
captured_leaderboards_type_0_item = Leaderboard.from_dict(captured_leaderboards_type_0_item_data)
|
||||
|
||||
captured_leaderboards_type_0.append(captured_leaderboards_type_0_item)
|
||||
|
||||
return captured_leaderboards_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[List["Leaderboard"], None, Unset], data)
|
||||
|
||||
captured_leaderboards = _parse_captured_leaderboards(d.pop("capturedLeaderboards", UNSET))
|
||||
|
||||
global_map_x = d.pop("globalMapX", UNSET)
|
||||
|
||||
global_map_y = d.pop("globalMapY", UNSET)
|
||||
|
||||
clan = cls(
|
||||
id=id,
|
||||
name=name,
|
||||
color=color,
|
||||
icon=icon,
|
||||
tag=tag,
|
||||
leader_id=leader_id,
|
||||
description=description,
|
||||
bio=bio,
|
||||
rich_bio_timeset=rich_bio_timeset,
|
||||
players_count=players_count,
|
||||
pp=pp,
|
||||
rank=rank,
|
||||
average_rank=average_rank,
|
||||
average_accuracy=average_accuracy,
|
||||
featured_playlists=featured_playlists,
|
||||
ranked_pool_percent_captured=ranked_pool_percent_captured,
|
||||
capture_leaderboards_count=capture_leaderboards_count,
|
||||
captured_leaderboards=captured_leaderboards,
|
||||
global_map_x=global_map_x,
|
||||
global_map_y=global_map_y,
|
||||
)
|
||||
|
||||
return clan
|
145
src/clients/beatleader/models/clan_bigger_response.py
Normal file
145
src/clients/beatleader/models/clan_bigger_response.py
Normal file
@ -0,0 +1,145 @@
|
||||
from typing import Any, Dict, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="ClanBiggerResponse")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ClanBiggerResponse:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[Unset, int]):
|
||||
tag (Union[None, Unset, str]):
|
||||
color (Union[None, Unset, str]):
|
||||
name (Union[None, Unset, str]):
|
||||
icon (Union[None, Unset, str]):
|
||||
ranked_pool_percent_captured (Union[Unset, float]):
|
||||
players_count (Union[Unset, int]):
|
||||
joined (Union[Unset, bool]):
|
||||
"""
|
||||
|
||||
id: Union[Unset, int] = UNSET
|
||||
tag: Union[None, Unset, str] = UNSET
|
||||
color: Union[None, Unset, str] = UNSET
|
||||
name: Union[None, Unset, str] = UNSET
|
||||
icon: Union[None, Unset, str] = UNSET
|
||||
ranked_pool_percent_captured: Union[Unset, float] = UNSET
|
||||
players_count: Union[Unset, int] = UNSET
|
||||
joined: Union[Unset, bool] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id = self.id
|
||||
|
||||
tag: Union[None, Unset, str]
|
||||
if isinstance(self.tag, Unset):
|
||||
tag = UNSET
|
||||
else:
|
||||
tag = self.tag
|
||||
|
||||
color: Union[None, Unset, str]
|
||||
if isinstance(self.color, Unset):
|
||||
color = UNSET
|
||||
else:
|
||||
color = self.color
|
||||
|
||||
name: Union[None, Unset, str]
|
||||
if isinstance(self.name, Unset):
|
||||
name = UNSET
|
||||
else:
|
||||
name = self.name
|
||||
|
||||
icon: Union[None, Unset, str]
|
||||
if isinstance(self.icon, Unset):
|
||||
icon = UNSET
|
||||
else:
|
||||
icon = self.icon
|
||||
|
||||
ranked_pool_percent_captured = self.ranked_pool_percent_captured
|
||||
|
||||
players_count = self.players_count
|
||||
|
||||
joined = self.joined
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if tag is not UNSET:
|
||||
field_dict["tag"] = tag
|
||||
if color is not UNSET:
|
||||
field_dict["color"] = color
|
||||
if name is not UNSET:
|
||||
field_dict["name"] = name
|
||||
if icon is not UNSET:
|
||||
field_dict["icon"] = icon
|
||||
if ranked_pool_percent_captured is not UNSET:
|
||||
field_dict["rankedPoolPercentCaptured"] = ranked_pool_percent_captured
|
||||
if players_count is not UNSET:
|
||||
field_dict["playersCount"] = players_count
|
||||
if joined is not UNSET:
|
||||
field_dict["joined"] = joined
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
def _parse_tag(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
tag = _parse_tag(d.pop("tag", UNSET))
|
||||
|
||||
def _parse_color(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
color = _parse_color(d.pop("color", UNSET))
|
||||
|
||||
def _parse_name(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
name = _parse_name(d.pop("name", UNSET))
|
||||
|
||||
def _parse_icon(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
icon = _parse_icon(d.pop("icon", UNSET))
|
||||
|
||||
ranked_pool_percent_captured = d.pop("rankedPoolPercentCaptured", UNSET)
|
||||
|
||||
players_count = d.pop("playersCount", UNSET)
|
||||
|
||||
joined = d.pop("joined", UNSET)
|
||||
|
||||
clan_bigger_response = cls(
|
||||
id=id,
|
||||
tag=tag,
|
||||
color=color,
|
||||
name=name,
|
||||
icon=icon,
|
||||
ranked_pool_percent_captured=ranked_pool_percent_captured,
|
||||
players_count=players_count,
|
||||
joined=joined,
|
||||
)
|
||||
|
||||
return clan_bigger_response
|
116
src/clients/beatleader/models/clan_global_map.py
Normal file
116
src/clients/beatleader/models/clan_global_map.py
Normal file
@ -0,0 +1,116 @@
|
||||
from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.clan_global_map_point import ClanGlobalMapPoint
|
||||
from ..models.clan_point import ClanPoint
|
||||
|
||||
|
||||
T = TypeVar("T", bound="ClanGlobalMap")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ClanGlobalMap:
|
||||
"""
|
||||
Attributes:
|
||||
points (Union[List['ClanGlobalMapPoint'], None, Unset]):
|
||||
clans (Union[List['ClanPoint'], None, Unset]):
|
||||
"""
|
||||
|
||||
points: Union[List["ClanGlobalMapPoint"], None, Unset] = UNSET
|
||||
clans: Union[List["ClanPoint"], None, Unset] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
points: Union[List[Dict[str, Any]], None, Unset]
|
||||
if isinstance(self.points, Unset):
|
||||
points = UNSET
|
||||
elif isinstance(self.points, list):
|
||||
points = []
|
||||
for points_type_0_item_data in self.points:
|
||||
points_type_0_item = points_type_0_item_data.to_dict()
|
||||
points.append(points_type_0_item)
|
||||
|
||||
else:
|
||||
points = self.points
|
||||
|
||||
clans: Union[List[Dict[str, Any]], None, Unset]
|
||||
if isinstance(self.clans, Unset):
|
||||
clans = UNSET
|
||||
elif isinstance(self.clans, list):
|
||||
clans = []
|
||||
for clans_type_0_item_data in self.clans:
|
||||
clans_type_0_item = clans_type_0_item_data.to_dict()
|
||||
clans.append(clans_type_0_item)
|
||||
|
||||
else:
|
||||
clans = self.clans
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if points is not UNSET:
|
||||
field_dict["points"] = points
|
||||
if clans is not UNSET:
|
||||
field_dict["clans"] = clans
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
from ..models.clan_global_map_point import ClanGlobalMapPoint
|
||||
from ..models.clan_point import ClanPoint
|
||||
|
||||
d = src_dict.copy()
|
||||
|
||||
def _parse_points(data: object) -> Union[List["ClanGlobalMapPoint"], None, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, list):
|
||||
raise TypeError()
|
||||
points_type_0 = []
|
||||
_points_type_0 = data
|
||||
for points_type_0_item_data in _points_type_0:
|
||||
points_type_0_item = ClanGlobalMapPoint.from_dict(points_type_0_item_data)
|
||||
|
||||
points_type_0.append(points_type_0_item)
|
||||
|
||||
return points_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[List["ClanGlobalMapPoint"], None, Unset], data)
|
||||
|
||||
points = _parse_points(d.pop("points", UNSET))
|
||||
|
||||
def _parse_clans(data: object) -> Union[List["ClanPoint"], None, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, list):
|
||||
raise TypeError()
|
||||
clans_type_0 = []
|
||||
_clans_type_0 = data
|
||||
for clans_type_0_item_data in _clans_type_0:
|
||||
clans_type_0_item = ClanPoint.from_dict(clans_type_0_item_data)
|
||||
|
||||
clans_type_0.append(clans_type_0_item)
|
||||
|
||||
return clans_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[List["ClanPoint"], None, Unset], data)
|
||||
|
||||
clans = _parse_clans(d.pop("clans", UNSET))
|
||||
|
||||
clan_global_map = cls(
|
||||
points=points,
|
||||
clans=clans,
|
||||
)
|
||||
|
||||
return clan_global_map
|
144
src/clients/beatleader/models/clan_global_map_point.py
Normal file
144
src/clients/beatleader/models/clan_global_map_point.py
Normal file
@ -0,0 +1,144 @@
|
||||
from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.clan_map_connection import ClanMapConnection
|
||||
|
||||
|
||||
T = TypeVar("T", bound="ClanGlobalMapPoint")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ClanGlobalMapPoint:
|
||||
"""
|
||||
Attributes:
|
||||
leaderboard_id (Union[None, Unset, str]):
|
||||
cover_image (Union[None, Unset, str]):
|
||||
stars (Union[None, Unset, float]):
|
||||
tie (Union[Unset, bool]):
|
||||
clans (Union[List['ClanMapConnection'], None, Unset]):
|
||||
"""
|
||||
|
||||
leaderboard_id: Union[None, Unset, str] = UNSET
|
||||
cover_image: Union[None, Unset, str] = UNSET
|
||||
stars: Union[None, Unset, float] = UNSET
|
||||
tie: Union[Unset, bool] = UNSET
|
||||
clans: Union[List["ClanMapConnection"], None, Unset] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
leaderboard_id: Union[None, Unset, str]
|
||||
if isinstance(self.leaderboard_id, Unset):
|
||||
leaderboard_id = UNSET
|
||||
else:
|
||||
leaderboard_id = self.leaderboard_id
|
||||
|
||||
cover_image: Union[None, Unset, str]
|
||||
if isinstance(self.cover_image, Unset):
|
||||
cover_image = UNSET
|
||||
else:
|
||||
cover_image = self.cover_image
|
||||
|
||||
stars: Union[None, Unset, float]
|
||||
if isinstance(self.stars, Unset):
|
||||
stars = UNSET
|
||||
else:
|
||||
stars = self.stars
|
||||
|
||||
tie = self.tie
|
||||
|
||||
clans: Union[List[Dict[str, Any]], None, Unset]
|
||||
if isinstance(self.clans, Unset):
|
||||
clans = UNSET
|
||||
elif isinstance(self.clans, list):
|
||||
clans = []
|
||||
for clans_type_0_item_data in self.clans:
|
||||
clans_type_0_item = clans_type_0_item_data.to_dict()
|
||||
clans.append(clans_type_0_item)
|
||||
|
||||
else:
|
||||
clans = self.clans
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if leaderboard_id is not UNSET:
|
||||
field_dict["leaderboardId"] = leaderboard_id
|
||||
if cover_image is not UNSET:
|
||||
field_dict["coverImage"] = cover_image
|
||||
if stars is not UNSET:
|
||||
field_dict["stars"] = stars
|
||||
if tie is not UNSET:
|
||||
field_dict["tie"] = tie
|
||||
if clans is not UNSET:
|
||||
field_dict["clans"] = clans
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
from ..models.clan_map_connection import ClanMapConnection
|
||||
|
||||
d = src_dict.copy()
|
||||
|
||||
def _parse_leaderboard_id(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
leaderboard_id = _parse_leaderboard_id(d.pop("leaderboardId", UNSET))
|
||||
|
||||
def _parse_cover_image(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
cover_image = _parse_cover_image(d.pop("coverImage", UNSET))
|
||||
|
||||
def _parse_stars(data: object) -> Union[None, Unset, float]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, float], data)
|
||||
|
||||
stars = _parse_stars(d.pop("stars", UNSET))
|
||||
|
||||
tie = d.pop("tie", UNSET)
|
||||
|
||||
def _parse_clans(data: object) -> Union[List["ClanMapConnection"], None, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, list):
|
||||
raise TypeError()
|
||||
clans_type_0 = []
|
||||
_clans_type_0 = data
|
||||
for clans_type_0_item_data in _clans_type_0:
|
||||
clans_type_0_item = ClanMapConnection.from_dict(clans_type_0_item_data)
|
||||
|
||||
clans_type_0.append(clans_type_0_item)
|
||||
|
||||
return clans_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[List["ClanMapConnection"], None, Unset], data)
|
||||
|
||||
clans = _parse_clans(d.pop("clans", UNSET))
|
||||
|
||||
clan_global_map_point = cls(
|
||||
leaderboard_id=leaderboard_id,
|
||||
cover_image=cover_image,
|
||||
stars=stars,
|
||||
tie=tie,
|
||||
clans=clans,
|
||||
)
|
||||
|
||||
return clan_global_map_point
|
59
src/clients/beatleader/models/clan_map_connection.py
Normal file
59
src/clients/beatleader/models/clan_map_connection.py
Normal file
@ -0,0 +1,59 @@
|
||||
from typing import Any, Dict, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="ClanMapConnection")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ClanMapConnection:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[None, Unset, int]):
|
||||
pp (Union[Unset, float]):
|
||||
"""
|
||||
|
||||
id: Union[None, Unset, int] = UNSET
|
||||
pp: Union[Unset, float] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id: Union[None, Unset, int]
|
||||
if isinstance(self.id, Unset):
|
||||
id = UNSET
|
||||
else:
|
||||
id = self.id
|
||||
|
||||
pp = self.pp
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if pp is not UNSET:
|
||||
field_dict["pp"] = pp
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
|
||||
def _parse_id(data: object) -> Union[None, Unset, int]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, int], data)
|
||||
|
||||
id = _parse_id(d.pop("id", UNSET))
|
||||
|
||||
pp = d.pop("pp", UNSET)
|
||||
|
||||
clan_map_connection = cls(
|
||||
id=id,
|
||||
pp=pp,
|
||||
)
|
||||
|
||||
return clan_map_connection
|
13
src/clients/beatleader/models/clan_maps_sort_by.py
Normal file
13
src/clients/beatleader/models/clan_maps_sort_by.py
Normal file
@ -0,0 +1,13 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class ClanMapsSortBy(str, Enum):
|
||||
ACC = "acc"
|
||||
DATE = "date"
|
||||
PP = "pp"
|
||||
RANK = "rank"
|
||||
TOCONQUER = "toconquer"
|
||||
TOHOLD = "tohold"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
96
src/clients/beatleader/models/clan_point.py
Normal file
96
src/clients/beatleader/models/clan_point.py
Normal file
@ -0,0 +1,96 @@
|
||||
from typing import Any, Dict, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="ClanPoint")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ClanPoint:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[Unset, int]):
|
||||
tag (Union[None, Unset, str]):
|
||||
color (Union[None, Unset, str]):
|
||||
x (Union[Unset, float]):
|
||||
y (Union[Unset, float]):
|
||||
"""
|
||||
|
||||
id: Union[Unset, int] = UNSET
|
||||
tag: Union[None, Unset, str] = UNSET
|
||||
color: Union[None, Unset, str] = UNSET
|
||||
x: Union[Unset, float] = UNSET
|
||||
y: Union[Unset, float] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id = self.id
|
||||
|
||||
tag: Union[None, Unset, str]
|
||||
if isinstance(self.tag, Unset):
|
||||
tag = UNSET
|
||||
else:
|
||||
tag = self.tag
|
||||
|
||||
color: Union[None, Unset, str]
|
||||
if isinstance(self.color, Unset):
|
||||
color = UNSET
|
||||
else:
|
||||
color = self.color
|
||||
|
||||
x = self.x
|
||||
|
||||
y = self.y
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if tag is not UNSET:
|
||||
field_dict["tag"] = tag
|
||||
if color is not UNSET:
|
||||
field_dict["color"] = color
|
||||
if x is not UNSET:
|
||||
field_dict["x"] = x
|
||||
if y is not UNSET:
|
||||
field_dict["y"] = y
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
def _parse_tag(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
tag = _parse_tag(d.pop("tag", UNSET))
|
||||
|
||||
def _parse_color(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
color = _parse_color(d.pop("color", UNSET))
|
||||
|
||||
x = d.pop("x", UNSET)
|
||||
|
||||
y = d.pop("y", UNSET)
|
||||
|
||||
clan_point = cls(
|
||||
id=id,
|
||||
tag=tag,
|
||||
color=color,
|
||||
x=x,
|
||||
y=y,
|
||||
)
|
||||
|
||||
return clan_point
|
220
src/clients/beatleader/models/clan_ranking_response.py
Normal file
220
src/clients/beatleader/models/clan_ranking_response.py
Normal file
@ -0,0 +1,220 @@
|
||||
from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.clan_response_full import ClanResponseFull
|
||||
from ..models.leaderboard_response import LeaderboardResponse
|
||||
from ..models.score_response import ScoreResponse
|
||||
from ..models.score_response_with_acc import ScoreResponseWithAcc
|
||||
|
||||
|
||||
T = TypeVar("T", bound="ClanRankingResponse")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ClanRankingResponse:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[Unset, int]):
|
||||
clan (Union[Unset, ClanResponseFull]):
|
||||
last_update_time (Union[Unset, int]):
|
||||
average_rank (Union[Unset, float]):
|
||||
rank (Union[Unset, int]):
|
||||
pp (Union[Unset, float]):
|
||||
average_accuracy (Union[Unset, float]):
|
||||
total_score (Union[Unset, float]):
|
||||
leaderboard_id (Union[None, Unset, str]):
|
||||
leaderboard (Union[Unset, LeaderboardResponse]):
|
||||
associated_scores (Union[List['ScoreResponse'], None, Unset]):
|
||||
associated_scores_count (Union[Unset, int]):
|
||||
my_score (Union[Unset, ScoreResponseWithAcc]):
|
||||
"""
|
||||
|
||||
id: Union[Unset, int] = UNSET
|
||||
clan: Union[Unset, "ClanResponseFull"] = UNSET
|
||||
last_update_time: Union[Unset, int] = UNSET
|
||||
average_rank: Union[Unset, float] = UNSET
|
||||
rank: Union[Unset, int] = UNSET
|
||||
pp: Union[Unset, float] = UNSET
|
||||
average_accuracy: Union[Unset, float] = UNSET
|
||||
total_score: Union[Unset, float] = UNSET
|
||||
leaderboard_id: Union[None, Unset, str] = UNSET
|
||||
leaderboard: Union[Unset, "LeaderboardResponse"] = UNSET
|
||||
associated_scores: Union[List["ScoreResponse"], None, Unset] = UNSET
|
||||
associated_scores_count: Union[Unset, int] = UNSET
|
||||
my_score: Union[Unset, "ScoreResponseWithAcc"] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id = self.id
|
||||
|
||||
clan: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.clan, Unset):
|
||||
clan = self.clan.to_dict()
|
||||
|
||||
last_update_time = self.last_update_time
|
||||
|
||||
average_rank = self.average_rank
|
||||
|
||||
rank = self.rank
|
||||
|
||||
pp = self.pp
|
||||
|
||||
average_accuracy = self.average_accuracy
|
||||
|
||||
total_score = self.total_score
|
||||
|
||||
leaderboard_id: Union[None, Unset, str]
|
||||
if isinstance(self.leaderboard_id, Unset):
|
||||
leaderboard_id = UNSET
|
||||
else:
|
||||
leaderboard_id = self.leaderboard_id
|
||||
|
||||
leaderboard: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.leaderboard, Unset):
|
||||
leaderboard = self.leaderboard.to_dict()
|
||||
|
||||
associated_scores: Union[List[Dict[str, Any]], None, Unset]
|
||||
if isinstance(self.associated_scores, Unset):
|
||||
associated_scores = UNSET
|
||||
elif isinstance(self.associated_scores, list):
|
||||
associated_scores = []
|
||||
for associated_scores_type_0_item_data in self.associated_scores:
|
||||
associated_scores_type_0_item = associated_scores_type_0_item_data.to_dict()
|
||||
associated_scores.append(associated_scores_type_0_item)
|
||||
|
||||
else:
|
||||
associated_scores = self.associated_scores
|
||||
|
||||
associated_scores_count = self.associated_scores_count
|
||||
|
||||
my_score: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.my_score, Unset):
|
||||
my_score = self.my_score.to_dict()
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if clan is not UNSET:
|
||||
field_dict["clan"] = clan
|
||||
if last_update_time is not UNSET:
|
||||
field_dict["lastUpdateTime"] = last_update_time
|
||||
if average_rank is not UNSET:
|
||||
field_dict["averageRank"] = average_rank
|
||||
if rank is not UNSET:
|
||||
field_dict["rank"] = rank
|
||||
if pp is not UNSET:
|
||||
field_dict["pp"] = pp
|
||||
if average_accuracy is not UNSET:
|
||||
field_dict["averageAccuracy"] = average_accuracy
|
||||
if total_score is not UNSET:
|
||||
field_dict["totalScore"] = total_score
|
||||
if leaderboard_id is not UNSET:
|
||||
field_dict["leaderboardId"] = leaderboard_id
|
||||
if leaderboard is not UNSET:
|
||||
field_dict["leaderboard"] = leaderboard
|
||||
if associated_scores is not UNSET:
|
||||
field_dict["associatedScores"] = associated_scores
|
||||
if associated_scores_count is not UNSET:
|
||||
field_dict["associatedScoresCount"] = associated_scores_count
|
||||
if my_score is not UNSET:
|
||||
field_dict["myScore"] = my_score
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
from ..models.clan_response_full import ClanResponseFull
|
||||
from ..models.leaderboard_response import LeaderboardResponse
|
||||
from ..models.score_response import ScoreResponse
|
||||
from ..models.score_response_with_acc import ScoreResponseWithAcc
|
||||
|
||||
d = src_dict.copy()
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
_clan = d.pop("clan", UNSET)
|
||||
clan: Union[Unset, ClanResponseFull]
|
||||
if isinstance(_clan, Unset):
|
||||
clan = UNSET
|
||||
else:
|
||||
clan = ClanResponseFull.from_dict(_clan)
|
||||
|
||||
last_update_time = d.pop("lastUpdateTime", UNSET)
|
||||
|
||||
average_rank = d.pop("averageRank", UNSET)
|
||||
|
||||
rank = d.pop("rank", UNSET)
|
||||
|
||||
pp = d.pop("pp", UNSET)
|
||||
|
||||
average_accuracy = d.pop("averageAccuracy", UNSET)
|
||||
|
||||
total_score = d.pop("totalScore", UNSET)
|
||||
|
||||
def _parse_leaderboard_id(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
leaderboard_id = _parse_leaderboard_id(d.pop("leaderboardId", UNSET))
|
||||
|
||||
_leaderboard = d.pop("leaderboard", UNSET)
|
||||
leaderboard: Union[Unset, LeaderboardResponse]
|
||||
if isinstance(_leaderboard, Unset):
|
||||
leaderboard = UNSET
|
||||
else:
|
||||
leaderboard = LeaderboardResponse.from_dict(_leaderboard)
|
||||
|
||||
def _parse_associated_scores(data: object) -> Union[List["ScoreResponse"], None, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, list):
|
||||
raise TypeError()
|
||||
associated_scores_type_0 = []
|
||||
_associated_scores_type_0 = data
|
||||
for associated_scores_type_0_item_data in _associated_scores_type_0:
|
||||
associated_scores_type_0_item = ScoreResponse.from_dict(associated_scores_type_0_item_data)
|
||||
|
||||
associated_scores_type_0.append(associated_scores_type_0_item)
|
||||
|
||||
return associated_scores_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[List["ScoreResponse"], None, Unset], data)
|
||||
|
||||
associated_scores = _parse_associated_scores(d.pop("associatedScores", UNSET))
|
||||
|
||||
associated_scores_count = d.pop("associatedScoresCount", UNSET)
|
||||
|
||||
_my_score = d.pop("myScore", UNSET)
|
||||
my_score: Union[Unset, ScoreResponseWithAcc]
|
||||
if isinstance(_my_score, Unset):
|
||||
my_score = UNSET
|
||||
else:
|
||||
my_score = ScoreResponseWithAcc.from_dict(_my_score)
|
||||
|
||||
clan_ranking_response = cls(
|
||||
id=id,
|
||||
clan=clan,
|
||||
last_update_time=last_update_time,
|
||||
average_rank=average_rank,
|
||||
rank=rank,
|
||||
pp=pp,
|
||||
average_accuracy=average_accuracy,
|
||||
total_score=total_score,
|
||||
leaderboard_id=leaderboard_id,
|
||||
leaderboard=leaderboard,
|
||||
associated_scores=associated_scores,
|
||||
associated_scores_count=associated_scores_count,
|
||||
my_score=my_score,
|
||||
)
|
||||
|
||||
return clan_ranking_response
|
@ -0,0 +1,110 @@
|
||||
from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.clan_ranking_response import ClanRankingResponse
|
||||
from ..models.clan_response_full import ClanResponseFull
|
||||
from ..models.metadata import Metadata
|
||||
|
||||
|
||||
T = TypeVar("T", bound="ClanRankingResponseClanResponseFullResponseWithMetadataAndContainer")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ClanRankingResponseClanResponseFullResponseWithMetadataAndContainer:
|
||||
"""
|
||||
Attributes:
|
||||
metadata (Union[Unset, Metadata]):
|
||||
data (Union[List['ClanRankingResponse'], None, Unset]):
|
||||
container (Union[Unset, ClanResponseFull]):
|
||||
"""
|
||||
|
||||
metadata: Union[Unset, "Metadata"] = UNSET
|
||||
data: Union[List["ClanRankingResponse"], None, Unset] = UNSET
|
||||
container: Union[Unset, "ClanResponseFull"] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
metadata: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.metadata, Unset):
|
||||
metadata = self.metadata.to_dict()
|
||||
|
||||
data: Union[List[Dict[str, Any]], None, Unset]
|
||||
if isinstance(self.data, Unset):
|
||||
data = UNSET
|
||||
elif isinstance(self.data, list):
|
||||
data = []
|
||||
for data_type_0_item_data in self.data:
|
||||
data_type_0_item = data_type_0_item_data.to_dict()
|
||||
data.append(data_type_0_item)
|
||||
|
||||
else:
|
||||
data = self.data
|
||||
|
||||
container: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.container, Unset):
|
||||
container = self.container.to_dict()
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if metadata is not UNSET:
|
||||
field_dict["metadata"] = metadata
|
||||
if data is not UNSET:
|
||||
field_dict["data"] = data
|
||||
if container is not UNSET:
|
||||
field_dict["container"] = container
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
from ..models.clan_ranking_response import ClanRankingResponse
|
||||
from ..models.clan_response_full import ClanResponseFull
|
||||
from ..models.metadata import Metadata
|
||||
|
||||
d = src_dict.copy()
|
||||
_metadata = d.pop("metadata", UNSET)
|
||||
metadata: Union[Unset, Metadata]
|
||||
if isinstance(_metadata, Unset):
|
||||
metadata = UNSET
|
||||
else:
|
||||
metadata = Metadata.from_dict(_metadata)
|
||||
|
||||
def _parse_data(data: object) -> Union[List["ClanRankingResponse"], None, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, list):
|
||||
raise TypeError()
|
||||
data_type_0 = []
|
||||
_data_type_0 = data
|
||||
for data_type_0_item_data in _data_type_0:
|
||||
data_type_0_item = ClanRankingResponse.from_dict(data_type_0_item_data)
|
||||
|
||||
data_type_0.append(data_type_0_item)
|
||||
|
||||
return data_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[List["ClanRankingResponse"], None, Unset], data)
|
||||
|
||||
data = _parse_data(d.pop("data", UNSET))
|
||||
|
||||
_container = d.pop("container", UNSET)
|
||||
container: Union[Unset, ClanResponseFull]
|
||||
if isinstance(_container, Unset):
|
||||
container = UNSET
|
||||
else:
|
||||
container = ClanResponseFull.from_dict(_container)
|
||||
|
||||
clan_ranking_response_clan_response_full_response_with_metadata_and_container = cls(
|
||||
metadata=metadata,
|
||||
data=data,
|
||||
container=container,
|
||||
)
|
||||
|
||||
return clan_ranking_response_clan_response_full_response_with_metadata_and_container
|
98
src/clients/beatleader/models/clan_response.py
Normal file
98
src/clients/beatleader/models/clan_response.py
Normal file
@ -0,0 +1,98 @@
|
||||
from typing import Any, Dict, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="ClanResponse")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ClanResponse:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[Unset, int]):
|
||||
tag (Union[None, Unset, str]):
|
||||
color (Union[None, Unset, str]):
|
||||
name (Union[None, Unset, str]):
|
||||
"""
|
||||
|
||||
id: Union[Unset, int] = UNSET
|
||||
tag: Union[None, Unset, str] = UNSET
|
||||
color: Union[None, Unset, str] = UNSET
|
||||
name: Union[None, Unset, str] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id = self.id
|
||||
|
||||
tag: Union[None, Unset, str]
|
||||
if isinstance(self.tag, Unset):
|
||||
tag = UNSET
|
||||
else:
|
||||
tag = self.tag
|
||||
|
||||
color: Union[None, Unset, str]
|
||||
if isinstance(self.color, Unset):
|
||||
color = UNSET
|
||||
else:
|
||||
color = self.color
|
||||
|
||||
name: Union[None, Unset, str]
|
||||
if isinstance(self.name, Unset):
|
||||
name = UNSET
|
||||
else:
|
||||
name = self.name
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if tag is not UNSET:
|
||||
field_dict["tag"] = tag
|
||||
if color is not UNSET:
|
||||
field_dict["color"] = color
|
||||
if name is not UNSET:
|
||||
field_dict["name"] = name
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
def _parse_tag(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
tag = _parse_tag(d.pop("tag", UNSET))
|
||||
|
||||
def _parse_color(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
color = _parse_color(d.pop("color", UNSET))
|
||||
|
||||
def _parse_name(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
name = _parse_name(d.pop("name", UNSET))
|
||||
|
||||
clan_response = cls(
|
||||
id=id,
|
||||
tag=tag,
|
||||
color=color,
|
||||
name=name,
|
||||
)
|
||||
|
||||
return clan_response
|
357
src/clients/beatleader/models/clan_response_full.py
Normal file
357
src/clients/beatleader/models/clan_response_full.py
Normal file
@ -0,0 +1,357 @@
|
||||
from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.featured_playlist_response import FeaturedPlaylistResponse
|
||||
|
||||
|
||||
T = TypeVar("T", bound="ClanResponseFull")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ClanResponseFull:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[Unset, int]):
|
||||
name (Union[None, Unset, str]):
|
||||
color (Union[None, Unset, str]):
|
||||
icon (Union[None, Unset, str]):
|
||||
tag (Union[None, Unset, str]):
|
||||
leader_id (Union[None, Unset, str]):
|
||||
description (Union[None, Unset, str]):
|
||||
bio (Union[None, Unset, str]):
|
||||
rich_bio_timeset (Union[Unset, int]):
|
||||
discord_invite (Union[None, Unset, str]):
|
||||
players_count (Union[Unset, int]):
|
||||
pp (Union[Unset, float]):
|
||||
rank (Union[Unset, int]):
|
||||
average_rank (Union[Unset, float]):
|
||||
average_accuracy (Union[Unset, float]):
|
||||
ranked_pool_percent_captured (Union[Unset, float]):
|
||||
capture_leaderboards_count (Union[Unset, int]):
|
||||
player_changes_callback (Union[None, Unset, str]):
|
||||
clan_ranking_discord_hook (Union[None, Unset, str]):
|
||||
featured_playlists (Union[List['FeaturedPlaylistResponse'], None, Unset]):
|
||||
"""
|
||||
|
||||
id: Union[Unset, int] = UNSET
|
||||
name: Union[None, Unset, str] = UNSET
|
||||
color: Union[None, Unset, str] = UNSET
|
||||
icon: Union[None, Unset, str] = UNSET
|
||||
tag: Union[None, Unset, str] = UNSET
|
||||
leader_id: Union[None, Unset, str] = UNSET
|
||||
description: Union[None, Unset, str] = UNSET
|
||||
bio: Union[None, Unset, str] = UNSET
|
||||
rich_bio_timeset: Union[Unset, int] = UNSET
|
||||
discord_invite: Union[None, Unset, str] = UNSET
|
||||
players_count: Union[Unset, int] = UNSET
|
||||
pp: Union[Unset, float] = UNSET
|
||||
rank: Union[Unset, int] = UNSET
|
||||
average_rank: Union[Unset, float] = UNSET
|
||||
average_accuracy: Union[Unset, float] = UNSET
|
||||
ranked_pool_percent_captured: Union[Unset, float] = UNSET
|
||||
capture_leaderboards_count: Union[Unset, int] = UNSET
|
||||
player_changes_callback: Union[None, Unset, str] = UNSET
|
||||
clan_ranking_discord_hook: Union[None, Unset, str] = UNSET
|
||||
featured_playlists: Union[List["FeaturedPlaylistResponse"], None, Unset] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id = self.id
|
||||
|
||||
name: Union[None, Unset, str]
|
||||
if isinstance(self.name, Unset):
|
||||
name = UNSET
|
||||
else:
|
||||
name = self.name
|
||||
|
||||
color: Union[None, Unset, str]
|
||||
if isinstance(self.color, Unset):
|
||||
color = UNSET
|
||||
else:
|
||||
color = self.color
|
||||
|
||||
icon: Union[None, Unset, str]
|
||||
if isinstance(self.icon, Unset):
|
||||
icon = UNSET
|
||||
else:
|
||||
icon = self.icon
|
||||
|
||||
tag: Union[None, Unset, str]
|
||||
if isinstance(self.tag, Unset):
|
||||
tag = UNSET
|
||||
else:
|
||||
tag = self.tag
|
||||
|
||||
leader_id: Union[None, Unset, str]
|
||||
if isinstance(self.leader_id, Unset):
|
||||
leader_id = UNSET
|
||||
else:
|
||||
leader_id = self.leader_id
|
||||
|
||||
description: Union[None, Unset, str]
|
||||
if isinstance(self.description, Unset):
|
||||
description = UNSET
|
||||
else:
|
||||
description = self.description
|
||||
|
||||
bio: Union[None, Unset, str]
|
||||
if isinstance(self.bio, Unset):
|
||||
bio = UNSET
|
||||
else:
|
||||
bio = self.bio
|
||||
|
||||
rich_bio_timeset = self.rich_bio_timeset
|
||||
|
||||
discord_invite: Union[None, Unset, str]
|
||||
if isinstance(self.discord_invite, Unset):
|
||||
discord_invite = UNSET
|
||||
else:
|
||||
discord_invite = self.discord_invite
|
||||
|
||||
players_count = self.players_count
|
||||
|
||||
pp = self.pp
|
||||
|
||||
rank = self.rank
|
||||
|
||||
average_rank = self.average_rank
|
||||
|
||||
average_accuracy = self.average_accuracy
|
||||
|
||||
ranked_pool_percent_captured = self.ranked_pool_percent_captured
|
||||
|
||||
capture_leaderboards_count = self.capture_leaderboards_count
|
||||
|
||||
player_changes_callback: Union[None, Unset, str]
|
||||
if isinstance(self.player_changes_callback, Unset):
|
||||
player_changes_callback = UNSET
|
||||
else:
|
||||
player_changes_callback = self.player_changes_callback
|
||||
|
||||
clan_ranking_discord_hook: Union[None, Unset, str]
|
||||
if isinstance(self.clan_ranking_discord_hook, Unset):
|
||||
clan_ranking_discord_hook = UNSET
|
||||
else:
|
||||
clan_ranking_discord_hook = self.clan_ranking_discord_hook
|
||||
|
||||
featured_playlists: Union[List[Dict[str, Any]], None, Unset]
|
||||
if isinstance(self.featured_playlists, Unset):
|
||||
featured_playlists = UNSET
|
||||
elif isinstance(self.featured_playlists, list):
|
||||
featured_playlists = []
|
||||
for featured_playlists_type_0_item_data in self.featured_playlists:
|
||||
featured_playlists_type_0_item = featured_playlists_type_0_item_data.to_dict()
|
||||
featured_playlists.append(featured_playlists_type_0_item)
|
||||
|
||||
else:
|
||||
featured_playlists = self.featured_playlists
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if name is not UNSET:
|
||||
field_dict["name"] = name
|
||||
if color is not UNSET:
|
||||
field_dict["color"] = color
|
||||
if icon is not UNSET:
|
||||
field_dict["icon"] = icon
|
||||
if tag is not UNSET:
|
||||
field_dict["tag"] = tag
|
||||
if leader_id is not UNSET:
|
||||
field_dict["leaderID"] = leader_id
|
||||
if description is not UNSET:
|
||||
field_dict["description"] = description
|
||||
if bio is not UNSET:
|
||||
field_dict["bio"] = bio
|
||||
if rich_bio_timeset is not UNSET:
|
||||
field_dict["richBioTimeset"] = rich_bio_timeset
|
||||
if discord_invite is not UNSET:
|
||||
field_dict["discordInvite"] = discord_invite
|
||||
if players_count is not UNSET:
|
||||
field_dict["playersCount"] = players_count
|
||||
if pp is not UNSET:
|
||||
field_dict["pp"] = pp
|
||||
if rank is not UNSET:
|
||||
field_dict["rank"] = rank
|
||||
if average_rank is not UNSET:
|
||||
field_dict["averageRank"] = average_rank
|
||||
if average_accuracy is not UNSET:
|
||||
field_dict["averageAccuracy"] = average_accuracy
|
||||
if ranked_pool_percent_captured is not UNSET:
|
||||
field_dict["rankedPoolPercentCaptured"] = ranked_pool_percent_captured
|
||||
if capture_leaderboards_count is not UNSET:
|
||||
field_dict["captureLeaderboardsCount"] = capture_leaderboards_count
|
||||
if player_changes_callback is not UNSET:
|
||||
field_dict["playerChangesCallback"] = player_changes_callback
|
||||
if clan_ranking_discord_hook is not UNSET:
|
||||
field_dict["clanRankingDiscordHook"] = clan_ranking_discord_hook
|
||||
if featured_playlists is not UNSET:
|
||||
field_dict["featuredPlaylists"] = featured_playlists
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
from ..models.featured_playlist_response import FeaturedPlaylistResponse
|
||||
|
||||
d = src_dict.copy()
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
def _parse_name(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
name = _parse_name(d.pop("name", UNSET))
|
||||
|
||||
def _parse_color(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
color = _parse_color(d.pop("color", UNSET))
|
||||
|
||||
def _parse_icon(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
icon = _parse_icon(d.pop("icon", UNSET))
|
||||
|
||||
def _parse_tag(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
tag = _parse_tag(d.pop("tag", UNSET))
|
||||
|
||||
def _parse_leader_id(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
leader_id = _parse_leader_id(d.pop("leaderID", UNSET))
|
||||
|
||||
def _parse_description(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
description = _parse_description(d.pop("description", UNSET))
|
||||
|
||||
def _parse_bio(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
bio = _parse_bio(d.pop("bio", UNSET))
|
||||
|
||||
rich_bio_timeset = d.pop("richBioTimeset", UNSET)
|
||||
|
||||
def _parse_discord_invite(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
discord_invite = _parse_discord_invite(d.pop("discordInvite", UNSET))
|
||||
|
||||
players_count = d.pop("playersCount", UNSET)
|
||||
|
||||
pp = d.pop("pp", UNSET)
|
||||
|
||||
rank = d.pop("rank", UNSET)
|
||||
|
||||
average_rank = d.pop("averageRank", UNSET)
|
||||
|
||||
average_accuracy = d.pop("averageAccuracy", UNSET)
|
||||
|
||||
ranked_pool_percent_captured = d.pop("rankedPoolPercentCaptured", UNSET)
|
||||
|
||||
capture_leaderboards_count = d.pop("captureLeaderboardsCount", UNSET)
|
||||
|
||||
def _parse_player_changes_callback(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
player_changes_callback = _parse_player_changes_callback(d.pop("playerChangesCallback", UNSET))
|
||||
|
||||
def _parse_clan_ranking_discord_hook(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
clan_ranking_discord_hook = _parse_clan_ranking_discord_hook(d.pop("clanRankingDiscordHook", UNSET))
|
||||
|
||||
def _parse_featured_playlists(data: object) -> Union[List["FeaturedPlaylistResponse"], None, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, list):
|
||||
raise TypeError()
|
||||
featured_playlists_type_0 = []
|
||||
_featured_playlists_type_0 = data
|
||||
for featured_playlists_type_0_item_data in _featured_playlists_type_0:
|
||||
featured_playlists_type_0_item = FeaturedPlaylistResponse.from_dict(
|
||||
featured_playlists_type_0_item_data
|
||||
)
|
||||
|
||||
featured_playlists_type_0.append(featured_playlists_type_0_item)
|
||||
|
||||
return featured_playlists_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[List["FeaturedPlaylistResponse"], None, Unset], data)
|
||||
|
||||
featured_playlists = _parse_featured_playlists(d.pop("featuredPlaylists", UNSET))
|
||||
|
||||
clan_response_full = cls(
|
||||
id=id,
|
||||
name=name,
|
||||
color=color,
|
||||
icon=icon,
|
||||
tag=tag,
|
||||
leader_id=leader_id,
|
||||
description=description,
|
||||
bio=bio,
|
||||
rich_bio_timeset=rich_bio_timeset,
|
||||
discord_invite=discord_invite,
|
||||
players_count=players_count,
|
||||
pp=pp,
|
||||
rank=rank,
|
||||
average_rank=average_rank,
|
||||
average_accuracy=average_accuracy,
|
||||
ranked_pool_percent_captured=ranked_pool_percent_captured,
|
||||
capture_leaderboards_count=capture_leaderboards_count,
|
||||
player_changes_callback=player_changes_callback,
|
||||
clan_ranking_discord_hook=clan_ranking_discord_hook,
|
||||
featured_playlists=featured_playlists,
|
||||
)
|
||||
|
||||
return clan_response_full
|
@ -0,0 +1,92 @@
|
||||
from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.clan_response_full import ClanResponseFull
|
||||
from ..models.metadata import Metadata
|
||||
|
||||
|
||||
T = TypeVar("T", bound="ClanResponseFullResponseWithMetadata")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ClanResponseFullResponseWithMetadata:
|
||||
"""
|
||||
Attributes:
|
||||
metadata (Union[Unset, Metadata]):
|
||||
data (Union[List['ClanResponseFull'], None, Unset]):
|
||||
"""
|
||||
|
||||
metadata: Union[Unset, "Metadata"] = UNSET
|
||||
data: Union[List["ClanResponseFull"], None, Unset] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
metadata: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.metadata, Unset):
|
||||
metadata = self.metadata.to_dict()
|
||||
|
||||
data: Union[List[Dict[str, Any]], None, Unset]
|
||||
if isinstance(self.data, Unset):
|
||||
data = UNSET
|
||||
elif isinstance(self.data, list):
|
||||
data = []
|
||||
for data_type_0_item_data in self.data:
|
||||
data_type_0_item = data_type_0_item_data.to_dict()
|
||||
data.append(data_type_0_item)
|
||||
|
||||
else:
|
||||
data = self.data
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if metadata is not UNSET:
|
||||
field_dict["metadata"] = metadata
|
||||
if data is not UNSET:
|
||||
field_dict["data"] = data
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
from ..models.clan_response_full import ClanResponseFull
|
||||
from ..models.metadata import Metadata
|
||||
|
||||
d = src_dict.copy()
|
||||
_metadata = d.pop("metadata", UNSET)
|
||||
metadata: Union[Unset, Metadata]
|
||||
if isinstance(_metadata, Unset):
|
||||
metadata = UNSET
|
||||
else:
|
||||
metadata = Metadata.from_dict(_metadata)
|
||||
|
||||
def _parse_data(data: object) -> Union[List["ClanResponseFull"], None, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, list):
|
||||
raise TypeError()
|
||||
data_type_0 = []
|
||||
_data_type_0 = data
|
||||
for data_type_0_item_data in _data_type_0:
|
||||
data_type_0_item = ClanResponseFull.from_dict(data_type_0_item_data)
|
||||
|
||||
data_type_0.append(data_type_0_item)
|
||||
|
||||
return data_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[List["ClanResponseFull"], None, Unset], data)
|
||||
|
||||
data = _parse_data(d.pop("data", UNSET))
|
||||
|
||||
clan_response_full_response_with_metadata = cls(
|
||||
metadata=metadata,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return clan_response_full_response_with_metadata
|
13
src/clients/beatleader/models/clan_sort_by.py
Normal file
13
src/clients/beatleader/models/clan_sort_by.py
Normal file
@ -0,0 +1,13 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class ClanSortBy(str, Enum):
|
||||
ACC = "acc"
|
||||
CAPTURES = "captures"
|
||||
COUNT = "count"
|
||||
NAME = "name"
|
||||
PP = "pp"
|
||||
RANK = "rank"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
99
src/clients/beatleader/models/compact_leaderboard.py
Normal file
99
src/clients/beatleader/models/compact_leaderboard.py
Normal file
@ -0,0 +1,99 @@
|
||||
from typing import Any, Dict, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="CompactLeaderboard")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class CompactLeaderboard:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[None, Unset, str]):
|
||||
song_hash (Union[None, Unset, str]):
|
||||
mode_name (Union[None, Unset, str]):
|
||||
difficulty (Union[Unset, int]):
|
||||
"""
|
||||
|
||||
id: Union[None, Unset, str] = UNSET
|
||||
song_hash: Union[None, Unset, str] = UNSET
|
||||
mode_name: Union[None, Unset, str] = UNSET
|
||||
difficulty: Union[Unset, int] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id: Union[None, Unset, str]
|
||||
if isinstance(self.id, Unset):
|
||||
id = UNSET
|
||||
else:
|
||||
id = self.id
|
||||
|
||||
song_hash: Union[None, Unset, str]
|
||||
if isinstance(self.song_hash, Unset):
|
||||
song_hash = UNSET
|
||||
else:
|
||||
song_hash = self.song_hash
|
||||
|
||||
mode_name: Union[None, Unset, str]
|
||||
if isinstance(self.mode_name, Unset):
|
||||
mode_name = UNSET
|
||||
else:
|
||||
mode_name = self.mode_name
|
||||
|
||||
difficulty = self.difficulty
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if song_hash is not UNSET:
|
||||
field_dict["songHash"] = song_hash
|
||||
if mode_name is not UNSET:
|
||||
field_dict["modeName"] = mode_name
|
||||
if difficulty is not UNSET:
|
||||
field_dict["difficulty"] = difficulty
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
|
||||
def _parse_id(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
id = _parse_id(d.pop("id", UNSET))
|
||||
|
||||
def _parse_song_hash(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
song_hash = _parse_song_hash(d.pop("songHash", UNSET))
|
||||
|
||||
def _parse_mode_name(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
mode_name = _parse_mode_name(d.pop("modeName", UNSET))
|
||||
|
||||
difficulty = d.pop("difficulty", UNSET)
|
||||
|
||||
compact_leaderboard = cls(
|
||||
id=id,
|
||||
song_hash=song_hash,
|
||||
mode_name=mode_name,
|
||||
difficulty=difficulty,
|
||||
)
|
||||
|
||||
return compact_leaderboard
|
@ -0,0 +1,90 @@
|
||||
from typing import TYPE_CHECKING, Any, Dict, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.compact_song_response import CompactSongResponse
|
||||
from ..models.difficulty_response import DifficultyResponse
|
||||
|
||||
|
||||
T = TypeVar("T", bound="CompactLeaderboardResponse")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class CompactLeaderboardResponse:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[None, Unset, str]):
|
||||
song (Union[Unset, CompactSongResponse]):
|
||||
difficulty (Union[Unset, DifficultyResponse]):
|
||||
"""
|
||||
|
||||
id: Union[None, Unset, str] = UNSET
|
||||
song: Union[Unset, "CompactSongResponse"] = UNSET
|
||||
difficulty: Union[Unset, "DifficultyResponse"] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id: Union[None, Unset, str]
|
||||
if isinstance(self.id, Unset):
|
||||
id = UNSET
|
||||
else:
|
||||
id = self.id
|
||||
|
||||
song: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.song, Unset):
|
||||
song = self.song.to_dict()
|
||||
|
||||
difficulty: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.difficulty, Unset):
|
||||
difficulty = self.difficulty.to_dict()
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if song is not UNSET:
|
||||
field_dict["song"] = song
|
||||
if difficulty is not UNSET:
|
||||
field_dict["difficulty"] = difficulty
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
from ..models.compact_song_response import CompactSongResponse
|
||||
from ..models.difficulty_response import DifficultyResponse
|
||||
|
||||
d = src_dict.copy()
|
||||
|
||||
def _parse_id(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
id = _parse_id(d.pop("id", UNSET))
|
||||
|
||||
_song = d.pop("song", UNSET)
|
||||
song: Union[Unset, CompactSongResponse]
|
||||
if isinstance(_song, Unset):
|
||||
song = UNSET
|
||||
else:
|
||||
song = CompactSongResponse.from_dict(_song)
|
||||
|
||||
_difficulty = d.pop("difficulty", UNSET)
|
||||
difficulty: Union[Unset, DifficultyResponse]
|
||||
if isinstance(_difficulty, Unset):
|
||||
difficulty = UNSET
|
||||
else:
|
||||
difficulty = DifficultyResponse.from_dict(_difficulty)
|
||||
|
||||
compact_leaderboard_response = cls(
|
||||
id=id,
|
||||
song=song,
|
||||
difficulty=difficulty,
|
||||
)
|
||||
|
||||
return compact_leaderboard_response
|
196
src/clients/beatleader/models/compact_score.py
Normal file
196
src/clients/beatleader/models/compact_score.py
Normal file
@ -0,0 +1,196 @@
|
||||
from typing import Any, Dict, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..models.controller_enum import ControllerEnum
|
||||
from ..models.hmd import HMD
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="CompactScore")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class CompactScore:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[None, Unset, int]):
|
||||
base_score (Union[Unset, int]):
|
||||
modified_score (Union[Unset, int]):
|
||||
modifiers (Union[None, Unset, str]):
|
||||
full_combo (Union[Unset, bool]):
|
||||
max_combo (Union[Unset, int]):
|
||||
missed_notes (Union[Unset, int]):
|
||||
bad_cuts (Union[Unset, int]):
|
||||
hmd (Union[Unset, HMD]):
|
||||
controller (Union[Unset, ControllerEnum]):
|
||||
accuracy (Union[Unset, float]):
|
||||
pp (Union[None, Unset, float]):
|
||||
epoch_time (Union[Unset, int]):
|
||||
"""
|
||||
|
||||
id: Union[None, Unset, int] = UNSET
|
||||
base_score: Union[Unset, int] = UNSET
|
||||
modified_score: Union[Unset, int] = UNSET
|
||||
modifiers: Union[None, Unset, str] = UNSET
|
||||
full_combo: Union[Unset, bool] = UNSET
|
||||
max_combo: Union[Unset, int] = UNSET
|
||||
missed_notes: Union[Unset, int] = UNSET
|
||||
bad_cuts: Union[Unset, int] = UNSET
|
||||
hmd: Union[Unset, HMD] = UNSET
|
||||
controller: Union[Unset, ControllerEnum] = UNSET
|
||||
accuracy: Union[Unset, float] = UNSET
|
||||
pp: Union[None, Unset, float] = UNSET
|
||||
epoch_time: Union[Unset, int] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id: Union[None, Unset, int]
|
||||
if isinstance(self.id, Unset):
|
||||
id = UNSET
|
||||
else:
|
||||
id = self.id
|
||||
|
||||
base_score = self.base_score
|
||||
|
||||
modified_score = self.modified_score
|
||||
|
||||
modifiers: Union[None, Unset, str]
|
||||
if isinstance(self.modifiers, Unset):
|
||||
modifiers = UNSET
|
||||
else:
|
||||
modifiers = self.modifiers
|
||||
|
||||
full_combo = self.full_combo
|
||||
|
||||
max_combo = self.max_combo
|
||||
|
||||
missed_notes = self.missed_notes
|
||||
|
||||
bad_cuts = self.bad_cuts
|
||||
|
||||
hmd: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.hmd, Unset):
|
||||
hmd = self.hmd.value
|
||||
|
||||
controller: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.controller, Unset):
|
||||
controller = self.controller.value
|
||||
|
||||
accuracy = self.accuracy
|
||||
|
||||
pp: Union[None, Unset, float]
|
||||
if isinstance(self.pp, Unset):
|
||||
pp = UNSET
|
||||
else:
|
||||
pp = self.pp
|
||||
|
||||
epoch_time = self.epoch_time
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if base_score is not UNSET:
|
||||
field_dict["baseScore"] = base_score
|
||||
if modified_score is not UNSET:
|
||||
field_dict["modifiedScore"] = modified_score
|
||||
if modifiers is not UNSET:
|
||||
field_dict["modifiers"] = modifiers
|
||||
if full_combo is not UNSET:
|
||||
field_dict["fullCombo"] = full_combo
|
||||
if max_combo is not UNSET:
|
||||
field_dict["maxCombo"] = max_combo
|
||||
if missed_notes is not UNSET:
|
||||
field_dict["missedNotes"] = missed_notes
|
||||
if bad_cuts is not UNSET:
|
||||
field_dict["badCuts"] = bad_cuts
|
||||
if hmd is not UNSET:
|
||||
field_dict["hmd"] = hmd
|
||||
if controller is not UNSET:
|
||||
field_dict["controller"] = controller
|
||||
if accuracy is not UNSET:
|
||||
field_dict["accuracy"] = accuracy
|
||||
if pp is not UNSET:
|
||||
field_dict["pp"] = pp
|
||||
if epoch_time is not UNSET:
|
||||
field_dict["epochTime"] = epoch_time
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
|
||||
def _parse_id(data: object) -> Union[None, Unset, int]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, int], data)
|
||||
|
||||
id = _parse_id(d.pop("id", UNSET))
|
||||
|
||||
base_score = d.pop("baseScore", UNSET)
|
||||
|
||||
modified_score = d.pop("modifiedScore", UNSET)
|
||||
|
||||
def _parse_modifiers(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
modifiers = _parse_modifiers(d.pop("modifiers", UNSET))
|
||||
|
||||
full_combo = d.pop("fullCombo", UNSET)
|
||||
|
||||
max_combo = d.pop("maxCombo", UNSET)
|
||||
|
||||
missed_notes = d.pop("missedNotes", UNSET)
|
||||
|
||||
bad_cuts = d.pop("badCuts", UNSET)
|
||||
|
||||
_hmd = d.pop("hmd", UNSET)
|
||||
hmd: Union[Unset, HMD]
|
||||
if isinstance(_hmd, Unset):
|
||||
hmd = UNSET
|
||||
else:
|
||||
hmd = HMD(_hmd)
|
||||
|
||||
_controller = d.pop("controller", UNSET)
|
||||
controller: Union[Unset, ControllerEnum]
|
||||
if isinstance(_controller, Unset):
|
||||
controller = UNSET
|
||||
else:
|
||||
controller = ControllerEnum(_controller)
|
||||
|
||||
accuracy = d.pop("accuracy", UNSET)
|
||||
|
||||
def _parse_pp(data: object) -> Union[None, Unset, float]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, float], data)
|
||||
|
||||
pp = _parse_pp(d.pop("pp", UNSET))
|
||||
|
||||
epoch_time = d.pop("epochTime", UNSET)
|
||||
|
||||
compact_score = cls(
|
||||
id=id,
|
||||
base_score=base_score,
|
||||
modified_score=modified_score,
|
||||
modifiers=modifiers,
|
||||
full_combo=full_combo,
|
||||
max_combo=max_combo,
|
||||
missed_notes=missed_notes,
|
||||
bad_cuts=bad_cuts,
|
||||
hmd=hmd,
|
||||
controller=controller,
|
||||
accuracy=accuracy,
|
||||
pp=pp,
|
||||
epoch_time=epoch_time,
|
||||
)
|
||||
|
||||
return compact_score
|
69
src/clients/beatleader/models/compact_score_response.py
Normal file
69
src/clients/beatleader/models/compact_score_response.py
Normal file
@ -0,0 +1,69 @@
|
||||
from typing import TYPE_CHECKING, Any, Dict, Type, TypeVar, Union
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.compact_leaderboard import CompactLeaderboard
|
||||
from ..models.compact_score import CompactScore
|
||||
|
||||
|
||||
T = TypeVar("T", bound="CompactScoreResponse")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class CompactScoreResponse:
|
||||
"""
|
||||
Attributes:
|
||||
score (Union[Unset, CompactScore]):
|
||||
leaderboard (Union[Unset, CompactLeaderboard]):
|
||||
"""
|
||||
|
||||
score: Union[Unset, "CompactScore"] = UNSET
|
||||
leaderboard: Union[Unset, "CompactLeaderboard"] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
score: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.score, Unset):
|
||||
score = self.score.to_dict()
|
||||
|
||||
leaderboard: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.leaderboard, Unset):
|
||||
leaderboard = self.leaderboard.to_dict()
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if score is not UNSET:
|
||||
field_dict["score"] = score
|
||||
if leaderboard is not UNSET:
|
||||
field_dict["leaderboard"] = leaderboard
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
from ..models.compact_leaderboard import CompactLeaderboard
|
||||
from ..models.compact_score import CompactScore
|
||||
|
||||
d = src_dict.copy()
|
||||
_score = d.pop("score", UNSET)
|
||||
score: Union[Unset, CompactScore]
|
||||
if isinstance(_score, Unset):
|
||||
score = UNSET
|
||||
else:
|
||||
score = CompactScore.from_dict(_score)
|
||||
|
||||
_leaderboard = d.pop("leaderboard", UNSET)
|
||||
leaderboard: Union[Unset, CompactLeaderboard]
|
||||
if isinstance(_leaderboard, Unset):
|
||||
leaderboard = UNSET
|
||||
else:
|
||||
leaderboard = CompactLeaderboard.from_dict(_leaderboard)
|
||||
|
||||
compact_score_response = cls(
|
||||
score=score,
|
||||
leaderboard=leaderboard,
|
||||
)
|
||||
|
||||
return compact_score_response
|
@ -0,0 +1,92 @@
|
||||
from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.compact_score_response import CompactScoreResponse
|
||||
from ..models.metadata import Metadata
|
||||
|
||||
|
||||
T = TypeVar("T", bound="CompactScoreResponseResponseWithMetadata")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class CompactScoreResponseResponseWithMetadata:
|
||||
"""
|
||||
Attributes:
|
||||
metadata (Union[Unset, Metadata]):
|
||||
data (Union[List['CompactScoreResponse'], None, Unset]):
|
||||
"""
|
||||
|
||||
metadata: Union[Unset, "Metadata"] = UNSET
|
||||
data: Union[List["CompactScoreResponse"], None, Unset] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
metadata: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.metadata, Unset):
|
||||
metadata = self.metadata.to_dict()
|
||||
|
||||
data: Union[List[Dict[str, Any]], None, Unset]
|
||||
if isinstance(self.data, Unset):
|
||||
data = UNSET
|
||||
elif isinstance(self.data, list):
|
||||
data = []
|
||||
for data_type_0_item_data in self.data:
|
||||
data_type_0_item = data_type_0_item_data.to_dict()
|
||||
data.append(data_type_0_item)
|
||||
|
||||
else:
|
||||
data = self.data
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if metadata is not UNSET:
|
||||
field_dict["metadata"] = metadata
|
||||
if data is not UNSET:
|
||||
field_dict["data"] = data
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
from ..models.compact_score_response import CompactScoreResponse
|
||||
from ..models.metadata import Metadata
|
||||
|
||||
d = src_dict.copy()
|
||||
_metadata = d.pop("metadata", UNSET)
|
||||
metadata: Union[Unset, Metadata]
|
||||
if isinstance(_metadata, Unset):
|
||||
metadata = UNSET
|
||||
else:
|
||||
metadata = Metadata.from_dict(_metadata)
|
||||
|
||||
def _parse_data(data: object) -> Union[List["CompactScoreResponse"], None, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, list):
|
||||
raise TypeError()
|
||||
data_type_0 = []
|
||||
_data_type_0 = data
|
||||
for data_type_0_item_data in _data_type_0:
|
||||
data_type_0_item = CompactScoreResponse.from_dict(data_type_0_item_data)
|
||||
|
||||
data_type_0.append(data_type_0_item)
|
||||
|
||||
return data_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[List["CompactScoreResponse"], None, Unset], data)
|
||||
|
||||
data = _parse_data(d.pop("data", UNSET))
|
||||
|
||||
compact_score_response_response_with_metadata = cls(
|
||||
metadata=metadata,
|
||||
data=data,
|
||||
)
|
||||
|
||||
return compact_score_response_response_with_metadata
|
237
src/clients/beatleader/models/compact_song_response.py
Normal file
237
src/clients/beatleader/models/compact_song_response.py
Normal file
@ -0,0 +1,237 @@
|
||||
from typing import Any, Dict, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="CompactSongResponse")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class CompactSongResponse:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[None, Unset, str]):
|
||||
hash_ (Union[None, Unset, str]):
|
||||
name (Union[None, Unset, str]):
|
||||
sub_name (Union[None, Unset, str]):
|
||||
author (Union[None, Unset, str]):
|
||||
mapper (Union[None, Unset, str]):
|
||||
mapper_id (Union[Unset, int]):
|
||||
collaborator_ids (Union[None, Unset, str]):
|
||||
cover_image (Union[None, Unset, str]):
|
||||
bpm (Union[Unset, float]):
|
||||
duration (Union[Unset, float]):
|
||||
full_cover_image (Union[None, Unset, str]):
|
||||
"""
|
||||
|
||||
id: Union[None, Unset, str] = UNSET
|
||||
hash_: Union[None, Unset, str] = UNSET
|
||||
name: Union[None, Unset, str] = UNSET
|
||||
sub_name: Union[None, Unset, str] = UNSET
|
||||
author: Union[None, Unset, str] = UNSET
|
||||
mapper: Union[None, Unset, str] = UNSET
|
||||
mapper_id: Union[Unset, int] = UNSET
|
||||
collaborator_ids: Union[None, Unset, str] = UNSET
|
||||
cover_image: Union[None, Unset, str] = UNSET
|
||||
bpm: Union[Unset, float] = UNSET
|
||||
duration: Union[Unset, float] = UNSET
|
||||
full_cover_image: Union[None, Unset, str] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id: Union[None, Unset, str]
|
||||
if isinstance(self.id, Unset):
|
||||
id = UNSET
|
||||
else:
|
||||
id = self.id
|
||||
|
||||
hash_: Union[None, Unset, str]
|
||||
if isinstance(self.hash_, Unset):
|
||||
hash_ = UNSET
|
||||
else:
|
||||
hash_ = self.hash_
|
||||
|
||||
name: Union[None, Unset, str]
|
||||
if isinstance(self.name, Unset):
|
||||
name = UNSET
|
||||
else:
|
||||
name = self.name
|
||||
|
||||
sub_name: Union[None, Unset, str]
|
||||
if isinstance(self.sub_name, Unset):
|
||||
sub_name = UNSET
|
||||
else:
|
||||
sub_name = self.sub_name
|
||||
|
||||
author: Union[None, Unset, str]
|
||||
if isinstance(self.author, Unset):
|
||||
author = UNSET
|
||||
else:
|
||||
author = self.author
|
||||
|
||||
mapper: Union[None, Unset, str]
|
||||
if isinstance(self.mapper, Unset):
|
||||
mapper = UNSET
|
||||
else:
|
||||
mapper = self.mapper
|
||||
|
||||
mapper_id = self.mapper_id
|
||||
|
||||
collaborator_ids: Union[None, Unset, str]
|
||||
if isinstance(self.collaborator_ids, Unset):
|
||||
collaborator_ids = UNSET
|
||||
else:
|
||||
collaborator_ids = self.collaborator_ids
|
||||
|
||||
cover_image: Union[None, Unset, str]
|
||||
if isinstance(self.cover_image, Unset):
|
||||
cover_image = UNSET
|
||||
else:
|
||||
cover_image = self.cover_image
|
||||
|
||||
bpm = self.bpm
|
||||
|
||||
duration = self.duration
|
||||
|
||||
full_cover_image: Union[None, Unset, str]
|
||||
if isinstance(self.full_cover_image, Unset):
|
||||
full_cover_image = UNSET
|
||||
else:
|
||||
full_cover_image = self.full_cover_image
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if hash_ is not UNSET:
|
||||
field_dict["hash"] = hash_
|
||||
if name is not UNSET:
|
||||
field_dict["name"] = name
|
||||
if sub_name is not UNSET:
|
||||
field_dict["subName"] = sub_name
|
||||
if author is not UNSET:
|
||||
field_dict["author"] = author
|
||||
if mapper is not UNSET:
|
||||
field_dict["mapper"] = mapper
|
||||
if mapper_id is not UNSET:
|
||||
field_dict["mapperId"] = mapper_id
|
||||
if collaborator_ids is not UNSET:
|
||||
field_dict["collaboratorIds"] = collaborator_ids
|
||||
if cover_image is not UNSET:
|
||||
field_dict["coverImage"] = cover_image
|
||||
if bpm is not UNSET:
|
||||
field_dict["bpm"] = bpm
|
||||
if duration is not UNSET:
|
||||
field_dict["duration"] = duration
|
||||
if full_cover_image is not UNSET:
|
||||
field_dict["fullCoverImage"] = full_cover_image
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
|
||||
def _parse_id(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
id = _parse_id(d.pop("id", UNSET))
|
||||
|
||||
def _parse_hash_(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
hash_ = _parse_hash_(d.pop("hash", UNSET))
|
||||
|
||||
def _parse_name(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
name = _parse_name(d.pop("name", UNSET))
|
||||
|
||||
def _parse_sub_name(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
sub_name = _parse_sub_name(d.pop("subName", UNSET))
|
||||
|
||||
def _parse_author(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
author = _parse_author(d.pop("author", UNSET))
|
||||
|
||||
def _parse_mapper(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
mapper = _parse_mapper(d.pop("mapper", UNSET))
|
||||
|
||||
mapper_id = d.pop("mapperId", UNSET)
|
||||
|
||||
def _parse_collaborator_ids(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
collaborator_ids = _parse_collaborator_ids(d.pop("collaboratorIds", UNSET))
|
||||
|
||||
def _parse_cover_image(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
cover_image = _parse_cover_image(d.pop("coverImage", UNSET))
|
||||
|
||||
bpm = d.pop("bpm", UNSET)
|
||||
|
||||
duration = d.pop("duration", UNSET)
|
||||
|
||||
def _parse_full_cover_image(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
full_cover_image = _parse_full_cover_image(d.pop("fullCoverImage", UNSET))
|
||||
|
||||
compact_song_response = cls(
|
||||
id=id,
|
||||
hash_=hash_,
|
||||
name=name,
|
||||
sub_name=sub_name,
|
||||
author=author,
|
||||
mapper=mapper,
|
||||
mapper_id=mapper_id,
|
||||
collaborator_ids=collaborator_ids,
|
||||
cover_image=cover_image,
|
||||
bpm=bpm,
|
||||
duration=duration,
|
||||
full_cover_image=full_cover_image,
|
||||
)
|
||||
|
||||
return compact_song_response
|
42
src/clients/beatleader/models/controller_enum.py
Normal file
42
src/clients/beatleader/models/controller_enum.py
Normal file
@ -0,0 +1,42 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class ControllerEnum(str, Enum):
|
||||
CONTACTGLOVE = "contactglove"
|
||||
CRY = "cry"
|
||||
DISCO = "disco"
|
||||
E4 = "e4"
|
||||
ETEE = "etee"
|
||||
GAMEPAD = "gamepad"
|
||||
HANDS = "hands"
|
||||
HPMOTION = "hpMotion"
|
||||
HUAWEI = "huawei"
|
||||
JOYCON = "joycon"
|
||||
KNUCKLES = "knuckles"
|
||||
MIRAMAR = "miramar"
|
||||
NOLO = "nolo"
|
||||
OCULUSTOUCH = "oculustouch"
|
||||
OCULUSTOUCH2 = "oculustouch2"
|
||||
ODYSSEY = "odyssey"
|
||||
PICONEO2 = "picoNeo2"
|
||||
PICONEO3 = "picoNeo3"
|
||||
PICOPHOENIX = "picophoenix"
|
||||
PIMAX = "pimax"
|
||||
POLARIS = "polaris"
|
||||
QUEST2 = "quest2"
|
||||
QUEST3 = "quest3"
|
||||
QUESTPRO = "questPro"
|
||||
STEAMDECK = "steamdeck"
|
||||
TUNDRA = "tundra"
|
||||
UNKNOWN = "unknown"
|
||||
VIVE = "vive"
|
||||
VIVECOSMOS = "viveCosmos"
|
||||
VIVEPRO = "vivePro"
|
||||
VIVEPRO2 = "vivePro2"
|
||||
VIVETRACKER = "viveTracker"
|
||||
VIVETRACKER2 = "viveTracker2"
|
||||
VIVETRACKER3 = "viveTracker3"
|
||||
WMR = "wmr"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
156
src/clients/beatleader/models/criteria_commentary.py
Normal file
156
src/clients/beatleader/models/criteria_commentary.py
Normal file
@ -0,0 +1,156 @@
|
||||
from typing import Any, Dict, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="CriteriaCommentary")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class CriteriaCommentary:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[Unset, int]):
|
||||
player_id (Union[None, Unset, str]):
|
||||
timeset (Union[Unset, int]):
|
||||
value (Union[None, Unset, str]):
|
||||
edit_timeset (Union[None, Unset, int]):
|
||||
edited (Union[Unset, bool]):
|
||||
rank_qualification_id (Union[None, Unset, int]):
|
||||
discord_message_id (Union[None, Unset, str]):
|
||||
"""
|
||||
|
||||
id: Union[Unset, int] = UNSET
|
||||
player_id: Union[None, Unset, str] = UNSET
|
||||
timeset: Union[Unset, int] = UNSET
|
||||
value: Union[None, Unset, str] = UNSET
|
||||
edit_timeset: Union[None, Unset, int] = UNSET
|
||||
edited: Union[Unset, bool] = UNSET
|
||||
rank_qualification_id: Union[None, Unset, int] = UNSET
|
||||
discord_message_id: Union[None, Unset, str] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id = self.id
|
||||
|
||||
player_id: Union[None, Unset, str]
|
||||
if isinstance(self.player_id, Unset):
|
||||
player_id = UNSET
|
||||
else:
|
||||
player_id = self.player_id
|
||||
|
||||
timeset = self.timeset
|
||||
|
||||
value: Union[None, Unset, str]
|
||||
if isinstance(self.value, Unset):
|
||||
value = UNSET
|
||||
else:
|
||||
value = self.value
|
||||
|
||||
edit_timeset: Union[None, Unset, int]
|
||||
if isinstance(self.edit_timeset, Unset):
|
||||
edit_timeset = UNSET
|
||||
else:
|
||||
edit_timeset = self.edit_timeset
|
||||
|
||||
edited = self.edited
|
||||
|
||||
rank_qualification_id: Union[None, Unset, int]
|
||||
if isinstance(self.rank_qualification_id, Unset):
|
||||
rank_qualification_id = UNSET
|
||||
else:
|
||||
rank_qualification_id = self.rank_qualification_id
|
||||
|
||||
discord_message_id: Union[None, Unset, str]
|
||||
if isinstance(self.discord_message_id, Unset):
|
||||
discord_message_id = UNSET
|
||||
else:
|
||||
discord_message_id = self.discord_message_id
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if player_id is not UNSET:
|
||||
field_dict["playerId"] = player_id
|
||||
if timeset is not UNSET:
|
||||
field_dict["timeset"] = timeset
|
||||
if value is not UNSET:
|
||||
field_dict["value"] = value
|
||||
if edit_timeset is not UNSET:
|
||||
field_dict["editTimeset"] = edit_timeset
|
||||
if edited is not UNSET:
|
||||
field_dict["edited"] = edited
|
||||
if rank_qualification_id is not UNSET:
|
||||
field_dict["rankQualificationId"] = rank_qualification_id
|
||||
if discord_message_id is not UNSET:
|
||||
field_dict["discordMessageId"] = discord_message_id
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
def _parse_player_id(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
player_id = _parse_player_id(d.pop("playerId", UNSET))
|
||||
|
||||
timeset = d.pop("timeset", UNSET)
|
||||
|
||||
def _parse_value(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
value = _parse_value(d.pop("value", UNSET))
|
||||
|
||||
def _parse_edit_timeset(data: object) -> Union[None, Unset, int]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, int], data)
|
||||
|
||||
edit_timeset = _parse_edit_timeset(d.pop("editTimeset", UNSET))
|
||||
|
||||
edited = d.pop("edited", UNSET)
|
||||
|
||||
def _parse_rank_qualification_id(data: object) -> Union[None, Unset, int]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, int], data)
|
||||
|
||||
rank_qualification_id = _parse_rank_qualification_id(d.pop("rankQualificationId", UNSET))
|
||||
|
||||
def _parse_discord_message_id(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
discord_message_id = _parse_discord_message_id(d.pop("discordMessageId", UNSET))
|
||||
|
||||
criteria_commentary = cls(
|
||||
id=id,
|
||||
player_id=player_id,
|
||||
timeset=timeset,
|
||||
value=value,
|
||||
edit_timeset=edit_timeset,
|
||||
edited=edited,
|
||||
rank_qualification_id=rank_qualification_id,
|
||||
discord_message_id=discord_message_id,
|
||||
)
|
||||
|
||||
return criteria_commentary
|
414
src/clients/beatleader/models/difficulty_description.py
Normal file
414
src/clients/beatleader/models/difficulty_description.py
Normal file
@ -0,0 +1,414 @@
|
||||
from typing import TYPE_CHECKING, Any, Dict, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..models.difficulty_status import DifficultyStatus
|
||||
from ..models.requirements import Requirements
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.modifiers_map import ModifiersMap
|
||||
from ..models.modifiers_rating import ModifiersRating
|
||||
|
||||
|
||||
T = TypeVar("T", bound="DifficultyDescription")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class DifficultyDescription:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[Unset, int]):
|
||||
value (Union[Unset, int]):
|
||||
mode (Union[Unset, int]):
|
||||
difficulty_name (Union[None, Unset, str]):
|
||||
mode_name (Union[None, Unset, str]):
|
||||
status (Union[Unset, DifficultyStatus]): Represents the difficulty status of a map.
|
||||
modifier_values (Union[Unset, ModifiersMap]):
|
||||
modifiers_rating (Union[Unset, ModifiersRating]):
|
||||
nominated_time (Union[Unset, int]):
|
||||
qualified_time (Union[Unset, int]):
|
||||
ranked_time (Union[Unset, int]):
|
||||
speed_tags (Union[Unset, int]):
|
||||
style_tags (Union[Unset, int]):
|
||||
feature_tags (Union[Unset, int]):
|
||||
stars (Union[None, Unset, float]):
|
||||
predicted_acc (Union[None, Unset, float]):
|
||||
pass_rating (Union[None, Unset, float]):
|
||||
acc_rating (Union[None, Unset, float]):
|
||||
tech_rating (Union[None, Unset, float]):
|
||||
type (Union[Unset, int]):
|
||||
njs (Union[Unset, float]):
|
||||
nps (Union[Unset, float]):
|
||||
notes (Union[Unset, int]):
|
||||
chains (Union[Unset, int]):
|
||||
sliders (Union[Unset, int]):
|
||||
bombs (Union[Unset, int]):
|
||||
walls (Union[Unset, int]):
|
||||
max_score (Union[Unset, int]):
|
||||
duration (Union[Unset, float]):
|
||||
requirements (Union[Unset, Requirements]):
|
||||
"""
|
||||
|
||||
id: Union[Unset, int] = UNSET
|
||||
value: Union[Unset, int] = UNSET
|
||||
mode: Union[Unset, int] = UNSET
|
||||
difficulty_name: Union[None, Unset, str] = UNSET
|
||||
mode_name: Union[None, Unset, str] = UNSET
|
||||
status: Union[Unset, DifficultyStatus] = UNSET
|
||||
modifier_values: Union[Unset, "ModifiersMap"] = UNSET
|
||||
modifiers_rating: Union[Unset, "ModifiersRating"] = UNSET
|
||||
nominated_time: Union[Unset, int] = UNSET
|
||||
qualified_time: Union[Unset, int] = UNSET
|
||||
ranked_time: Union[Unset, int] = UNSET
|
||||
speed_tags: Union[Unset, int] = UNSET
|
||||
style_tags: Union[Unset, int] = UNSET
|
||||
feature_tags: Union[Unset, int] = UNSET
|
||||
stars: Union[None, Unset, float] = UNSET
|
||||
predicted_acc: Union[None, Unset, float] = UNSET
|
||||
pass_rating: Union[None, Unset, float] = UNSET
|
||||
acc_rating: Union[None, Unset, float] = UNSET
|
||||
tech_rating: Union[None, Unset, float] = UNSET
|
||||
type: Union[Unset, int] = UNSET
|
||||
njs: Union[Unset, float] = UNSET
|
||||
nps: Union[Unset, float] = UNSET
|
||||
notes: Union[Unset, int] = UNSET
|
||||
chains: Union[Unset, int] = UNSET
|
||||
sliders: Union[Unset, int] = UNSET
|
||||
bombs: Union[Unset, int] = UNSET
|
||||
walls: Union[Unset, int] = UNSET
|
||||
max_score: Union[Unset, int] = UNSET
|
||||
duration: Union[Unset, float] = UNSET
|
||||
requirements: Union[Unset, Requirements] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id = self.id
|
||||
|
||||
value = self.value
|
||||
|
||||
mode = self.mode
|
||||
|
||||
difficulty_name: Union[None, Unset, str]
|
||||
if isinstance(self.difficulty_name, Unset):
|
||||
difficulty_name = UNSET
|
||||
else:
|
||||
difficulty_name = self.difficulty_name
|
||||
|
||||
mode_name: Union[None, Unset, str]
|
||||
if isinstance(self.mode_name, Unset):
|
||||
mode_name = UNSET
|
||||
else:
|
||||
mode_name = self.mode_name
|
||||
|
||||
status: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.status, Unset):
|
||||
status = self.status.value
|
||||
|
||||
modifier_values: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.modifier_values, Unset):
|
||||
modifier_values = self.modifier_values.to_dict()
|
||||
|
||||
modifiers_rating: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.modifiers_rating, Unset):
|
||||
modifiers_rating = self.modifiers_rating.to_dict()
|
||||
|
||||
nominated_time = self.nominated_time
|
||||
|
||||
qualified_time = self.qualified_time
|
||||
|
||||
ranked_time = self.ranked_time
|
||||
|
||||
speed_tags = self.speed_tags
|
||||
|
||||
style_tags = self.style_tags
|
||||
|
||||
feature_tags = self.feature_tags
|
||||
|
||||
stars: Union[None, Unset, float]
|
||||
if isinstance(self.stars, Unset):
|
||||
stars = UNSET
|
||||
else:
|
||||
stars = self.stars
|
||||
|
||||
predicted_acc: Union[None, Unset, float]
|
||||
if isinstance(self.predicted_acc, Unset):
|
||||
predicted_acc = UNSET
|
||||
else:
|
||||
predicted_acc = self.predicted_acc
|
||||
|
||||
pass_rating: Union[None, Unset, float]
|
||||
if isinstance(self.pass_rating, Unset):
|
||||
pass_rating = UNSET
|
||||
else:
|
||||
pass_rating = self.pass_rating
|
||||
|
||||
acc_rating: Union[None, Unset, float]
|
||||
if isinstance(self.acc_rating, Unset):
|
||||
acc_rating = UNSET
|
||||
else:
|
||||
acc_rating = self.acc_rating
|
||||
|
||||
tech_rating: Union[None, Unset, float]
|
||||
if isinstance(self.tech_rating, Unset):
|
||||
tech_rating = UNSET
|
||||
else:
|
||||
tech_rating = self.tech_rating
|
||||
|
||||
type = self.type
|
||||
|
||||
njs = self.njs
|
||||
|
||||
nps = self.nps
|
||||
|
||||
notes = self.notes
|
||||
|
||||
chains = self.chains
|
||||
|
||||
sliders = self.sliders
|
||||
|
||||
bombs = self.bombs
|
||||
|
||||
walls = self.walls
|
||||
|
||||
max_score = self.max_score
|
||||
|
||||
duration = self.duration
|
||||
|
||||
requirements: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.requirements, Unset):
|
||||
requirements = self.requirements.value
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if value is not UNSET:
|
||||
field_dict["value"] = value
|
||||
if mode is not UNSET:
|
||||
field_dict["mode"] = mode
|
||||
if difficulty_name is not UNSET:
|
||||
field_dict["difficultyName"] = difficulty_name
|
||||
if mode_name is not UNSET:
|
||||
field_dict["modeName"] = mode_name
|
||||
if status is not UNSET:
|
||||
field_dict["status"] = status
|
||||
if modifier_values is not UNSET:
|
||||
field_dict["modifierValues"] = modifier_values
|
||||
if modifiers_rating is not UNSET:
|
||||
field_dict["modifiersRating"] = modifiers_rating
|
||||
if nominated_time is not UNSET:
|
||||
field_dict["nominatedTime"] = nominated_time
|
||||
if qualified_time is not UNSET:
|
||||
field_dict["qualifiedTime"] = qualified_time
|
||||
if ranked_time is not UNSET:
|
||||
field_dict["rankedTime"] = ranked_time
|
||||
if speed_tags is not UNSET:
|
||||
field_dict["speedTags"] = speed_tags
|
||||
if style_tags is not UNSET:
|
||||
field_dict["styleTags"] = style_tags
|
||||
if feature_tags is not UNSET:
|
||||
field_dict["featureTags"] = feature_tags
|
||||
if stars is not UNSET:
|
||||
field_dict["stars"] = stars
|
||||
if predicted_acc is not UNSET:
|
||||
field_dict["predictedAcc"] = predicted_acc
|
||||
if pass_rating is not UNSET:
|
||||
field_dict["passRating"] = pass_rating
|
||||
if acc_rating is not UNSET:
|
||||
field_dict["accRating"] = acc_rating
|
||||
if tech_rating is not UNSET:
|
||||
field_dict["techRating"] = tech_rating
|
||||
if type is not UNSET:
|
||||
field_dict["type"] = type
|
||||
if njs is not UNSET:
|
||||
field_dict["njs"] = njs
|
||||
if nps is not UNSET:
|
||||
field_dict["nps"] = nps
|
||||
if notes is not UNSET:
|
||||
field_dict["notes"] = notes
|
||||
if chains is not UNSET:
|
||||
field_dict["chains"] = chains
|
||||
if sliders is not UNSET:
|
||||
field_dict["sliders"] = sliders
|
||||
if bombs is not UNSET:
|
||||
field_dict["bombs"] = bombs
|
||||
if walls is not UNSET:
|
||||
field_dict["walls"] = walls
|
||||
if max_score is not UNSET:
|
||||
field_dict["maxScore"] = max_score
|
||||
if duration is not UNSET:
|
||||
field_dict["duration"] = duration
|
||||
if requirements is not UNSET:
|
||||
field_dict["requirements"] = requirements
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
from ..models.modifiers_map import ModifiersMap
|
||||
from ..models.modifiers_rating import ModifiersRating
|
||||
|
||||
d = src_dict.copy()
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
value = d.pop("value", UNSET)
|
||||
|
||||
mode = d.pop("mode", UNSET)
|
||||
|
||||
def _parse_difficulty_name(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
difficulty_name = _parse_difficulty_name(d.pop("difficultyName", UNSET))
|
||||
|
||||
def _parse_mode_name(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
mode_name = _parse_mode_name(d.pop("modeName", UNSET))
|
||||
|
||||
_status = d.pop("status", UNSET)
|
||||
status: Union[Unset, DifficultyStatus]
|
||||
if isinstance(_status, Unset):
|
||||
status = UNSET
|
||||
else:
|
||||
status = DifficultyStatus(_status)
|
||||
|
||||
_modifier_values = d.pop("modifierValues", UNSET)
|
||||
modifier_values: Union[Unset, ModifiersMap]
|
||||
if isinstance(_modifier_values, Unset):
|
||||
modifier_values = UNSET
|
||||
else:
|
||||
modifier_values = ModifiersMap.from_dict(_modifier_values)
|
||||
|
||||
_modifiers_rating = d.pop("modifiersRating", UNSET)
|
||||
modifiers_rating: Union[Unset, ModifiersRating]
|
||||
if isinstance(_modifiers_rating, Unset):
|
||||
modifiers_rating = UNSET
|
||||
else:
|
||||
modifiers_rating = ModifiersRating.from_dict(_modifiers_rating)
|
||||
|
||||
nominated_time = d.pop("nominatedTime", UNSET)
|
||||
|
||||
qualified_time = d.pop("qualifiedTime", UNSET)
|
||||
|
||||
ranked_time = d.pop("rankedTime", UNSET)
|
||||
|
||||
speed_tags = d.pop("speedTags", UNSET)
|
||||
|
||||
style_tags = d.pop("styleTags", UNSET)
|
||||
|
||||
feature_tags = d.pop("featureTags", UNSET)
|
||||
|
||||
def _parse_stars(data: object) -> Union[None, Unset, float]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, float], data)
|
||||
|
||||
stars = _parse_stars(d.pop("stars", UNSET))
|
||||
|
||||
def _parse_predicted_acc(data: object) -> Union[None, Unset, float]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, float], data)
|
||||
|
||||
predicted_acc = _parse_predicted_acc(d.pop("predictedAcc", UNSET))
|
||||
|
||||
def _parse_pass_rating(data: object) -> Union[None, Unset, float]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, float], data)
|
||||
|
||||
pass_rating = _parse_pass_rating(d.pop("passRating", UNSET))
|
||||
|
||||
def _parse_acc_rating(data: object) -> Union[None, Unset, float]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, float], data)
|
||||
|
||||
acc_rating = _parse_acc_rating(d.pop("accRating", UNSET))
|
||||
|
||||
def _parse_tech_rating(data: object) -> Union[None, Unset, float]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, float], data)
|
||||
|
||||
tech_rating = _parse_tech_rating(d.pop("techRating", UNSET))
|
||||
|
||||
type = d.pop("type", UNSET)
|
||||
|
||||
njs = d.pop("njs", UNSET)
|
||||
|
||||
nps = d.pop("nps", UNSET)
|
||||
|
||||
notes = d.pop("notes", UNSET)
|
||||
|
||||
chains = d.pop("chains", UNSET)
|
||||
|
||||
sliders = d.pop("sliders", UNSET)
|
||||
|
||||
bombs = d.pop("bombs", UNSET)
|
||||
|
||||
walls = d.pop("walls", UNSET)
|
||||
|
||||
max_score = d.pop("maxScore", UNSET)
|
||||
|
||||
duration = d.pop("duration", UNSET)
|
||||
|
||||
_requirements = d.pop("requirements", UNSET)
|
||||
requirements: Union[Unset, Requirements]
|
||||
if isinstance(_requirements, Unset):
|
||||
requirements = UNSET
|
||||
else:
|
||||
requirements = Requirements(_requirements)
|
||||
|
||||
difficulty_description = cls(
|
||||
id=id,
|
||||
value=value,
|
||||
mode=mode,
|
||||
difficulty_name=difficulty_name,
|
||||
mode_name=mode_name,
|
||||
status=status,
|
||||
modifier_values=modifier_values,
|
||||
modifiers_rating=modifiers_rating,
|
||||
nominated_time=nominated_time,
|
||||
qualified_time=qualified_time,
|
||||
ranked_time=ranked_time,
|
||||
speed_tags=speed_tags,
|
||||
style_tags=style_tags,
|
||||
feature_tags=feature_tags,
|
||||
stars=stars,
|
||||
predicted_acc=predicted_acc,
|
||||
pass_rating=pass_rating,
|
||||
acc_rating=acc_rating,
|
||||
tech_rating=tech_rating,
|
||||
type=type,
|
||||
njs=njs,
|
||||
nps=nps,
|
||||
notes=notes,
|
||||
chains=chains,
|
||||
sliders=sliders,
|
||||
bombs=bombs,
|
||||
walls=walls,
|
||||
max_score=max_score,
|
||||
duration=duration,
|
||||
requirements=requirements,
|
||||
)
|
||||
|
||||
return difficulty_description
|
396
src/clients/beatleader/models/difficulty_response.py
Normal file
396
src/clients/beatleader/models/difficulty_response.py
Normal file
@ -0,0 +1,396 @@
|
||||
from typing import TYPE_CHECKING, Any, Dict, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..models.difficulty_status import DifficultyStatus
|
||||
from ..models.requirements import Requirements
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.modifiers_map import ModifiersMap
|
||||
from ..models.modifiers_rating import ModifiersRating
|
||||
|
||||
|
||||
T = TypeVar("T", bound="DifficultyResponse")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class DifficultyResponse:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[Unset, int]):
|
||||
value (Union[Unset, int]):
|
||||
mode (Union[Unset, int]):
|
||||
difficulty_name (Union[None, Unset, str]):
|
||||
mode_name (Union[None, Unset, str]):
|
||||
status (Union[Unset, DifficultyStatus]): Represents the difficulty status of a map.
|
||||
modifier_values (Union[Unset, ModifiersMap]):
|
||||
modifiers_rating (Union[Unset, ModifiersRating]):
|
||||
nominated_time (Union[Unset, int]):
|
||||
qualified_time (Union[Unset, int]):
|
||||
ranked_time (Union[Unset, int]):
|
||||
speed_tags (Union[Unset, int]):
|
||||
style_tags (Union[Unset, int]):
|
||||
feature_tags (Union[Unset, int]):
|
||||
stars (Union[None, Unset, float]):
|
||||
predicted_acc (Union[None, Unset, float]):
|
||||
pass_rating (Union[None, Unset, float]):
|
||||
acc_rating (Union[None, Unset, float]):
|
||||
tech_rating (Union[None, Unset, float]):
|
||||
type (Union[Unset, int]):
|
||||
njs (Union[Unset, float]):
|
||||
nps (Union[Unset, float]):
|
||||
notes (Union[Unset, int]):
|
||||
bombs (Union[Unset, int]):
|
||||
walls (Union[Unset, int]):
|
||||
max_score (Union[Unset, int]):
|
||||
duration (Union[Unset, float]):
|
||||
requirements (Union[Unset, Requirements]):
|
||||
"""
|
||||
|
||||
id: Union[Unset, int] = UNSET
|
||||
value: Union[Unset, int] = UNSET
|
||||
mode: Union[Unset, int] = UNSET
|
||||
difficulty_name: Union[None, Unset, str] = UNSET
|
||||
mode_name: Union[None, Unset, str] = UNSET
|
||||
status: Union[Unset, DifficultyStatus] = UNSET
|
||||
modifier_values: Union[Unset, "ModifiersMap"] = UNSET
|
||||
modifiers_rating: Union[Unset, "ModifiersRating"] = UNSET
|
||||
nominated_time: Union[Unset, int] = UNSET
|
||||
qualified_time: Union[Unset, int] = UNSET
|
||||
ranked_time: Union[Unset, int] = UNSET
|
||||
speed_tags: Union[Unset, int] = UNSET
|
||||
style_tags: Union[Unset, int] = UNSET
|
||||
feature_tags: Union[Unset, int] = UNSET
|
||||
stars: Union[None, Unset, float] = UNSET
|
||||
predicted_acc: Union[None, Unset, float] = UNSET
|
||||
pass_rating: Union[None, Unset, float] = UNSET
|
||||
acc_rating: Union[None, Unset, float] = UNSET
|
||||
tech_rating: Union[None, Unset, float] = UNSET
|
||||
type: Union[Unset, int] = UNSET
|
||||
njs: Union[Unset, float] = UNSET
|
||||
nps: Union[Unset, float] = UNSET
|
||||
notes: Union[Unset, int] = UNSET
|
||||
bombs: Union[Unset, int] = UNSET
|
||||
walls: Union[Unset, int] = UNSET
|
||||
max_score: Union[Unset, int] = UNSET
|
||||
duration: Union[Unset, float] = UNSET
|
||||
requirements: Union[Unset, Requirements] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id = self.id
|
||||
|
||||
value = self.value
|
||||
|
||||
mode = self.mode
|
||||
|
||||
difficulty_name: Union[None, Unset, str]
|
||||
if isinstance(self.difficulty_name, Unset):
|
||||
difficulty_name = UNSET
|
||||
else:
|
||||
difficulty_name = self.difficulty_name
|
||||
|
||||
mode_name: Union[None, Unset, str]
|
||||
if isinstance(self.mode_name, Unset):
|
||||
mode_name = UNSET
|
||||
else:
|
||||
mode_name = self.mode_name
|
||||
|
||||
status: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.status, Unset):
|
||||
status = self.status.value
|
||||
|
||||
modifier_values: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.modifier_values, Unset):
|
||||
modifier_values = self.modifier_values.to_dict()
|
||||
|
||||
modifiers_rating: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.modifiers_rating, Unset):
|
||||
modifiers_rating = self.modifiers_rating.to_dict()
|
||||
|
||||
nominated_time = self.nominated_time
|
||||
|
||||
qualified_time = self.qualified_time
|
||||
|
||||
ranked_time = self.ranked_time
|
||||
|
||||
speed_tags = self.speed_tags
|
||||
|
||||
style_tags = self.style_tags
|
||||
|
||||
feature_tags = self.feature_tags
|
||||
|
||||
stars: Union[None, Unset, float]
|
||||
if isinstance(self.stars, Unset):
|
||||
stars = UNSET
|
||||
else:
|
||||
stars = self.stars
|
||||
|
||||
predicted_acc: Union[None, Unset, float]
|
||||
if isinstance(self.predicted_acc, Unset):
|
||||
predicted_acc = UNSET
|
||||
else:
|
||||
predicted_acc = self.predicted_acc
|
||||
|
||||
pass_rating: Union[None, Unset, float]
|
||||
if isinstance(self.pass_rating, Unset):
|
||||
pass_rating = UNSET
|
||||
else:
|
||||
pass_rating = self.pass_rating
|
||||
|
||||
acc_rating: Union[None, Unset, float]
|
||||
if isinstance(self.acc_rating, Unset):
|
||||
acc_rating = UNSET
|
||||
else:
|
||||
acc_rating = self.acc_rating
|
||||
|
||||
tech_rating: Union[None, Unset, float]
|
||||
if isinstance(self.tech_rating, Unset):
|
||||
tech_rating = UNSET
|
||||
else:
|
||||
tech_rating = self.tech_rating
|
||||
|
||||
type = self.type
|
||||
|
||||
njs = self.njs
|
||||
|
||||
nps = self.nps
|
||||
|
||||
notes = self.notes
|
||||
|
||||
bombs = self.bombs
|
||||
|
||||
walls = self.walls
|
||||
|
||||
max_score = self.max_score
|
||||
|
||||
duration = self.duration
|
||||
|
||||
requirements: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.requirements, Unset):
|
||||
requirements = self.requirements.value
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if value is not UNSET:
|
||||
field_dict["value"] = value
|
||||
if mode is not UNSET:
|
||||
field_dict["mode"] = mode
|
||||
if difficulty_name is not UNSET:
|
||||
field_dict["difficultyName"] = difficulty_name
|
||||
if mode_name is not UNSET:
|
||||
field_dict["modeName"] = mode_name
|
||||
if status is not UNSET:
|
||||
field_dict["status"] = status
|
||||
if modifier_values is not UNSET:
|
||||
field_dict["modifierValues"] = modifier_values
|
||||
if modifiers_rating is not UNSET:
|
||||
field_dict["modifiersRating"] = modifiers_rating
|
||||
if nominated_time is not UNSET:
|
||||
field_dict["nominatedTime"] = nominated_time
|
||||
if qualified_time is not UNSET:
|
||||
field_dict["qualifiedTime"] = qualified_time
|
||||
if ranked_time is not UNSET:
|
||||
field_dict["rankedTime"] = ranked_time
|
||||
if speed_tags is not UNSET:
|
||||
field_dict["speedTags"] = speed_tags
|
||||
if style_tags is not UNSET:
|
||||
field_dict["styleTags"] = style_tags
|
||||
if feature_tags is not UNSET:
|
||||
field_dict["featureTags"] = feature_tags
|
||||
if stars is not UNSET:
|
||||
field_dict["stars"] = stars
|
||||
if predicted_acc is not UNSET:
|
||||
field_dict["predictedAcc"] = predicted_acc
|
||||
if pass_rating is not UNSET:
|
||||
field_dict["passRating"] = pass_rating
|
||||
if acc_rating is not UNSET:
|
||||
field_dict["accRating"] = acc_rating
|
||||
if tech_rating is not UNSET:
|
||||
field_dict["techRating"] = tech_rating
|
||||
if type is not UNSET:
|
||||
field_dict["type"] = type
|
||||
if njs is not UNSET:
|
||||
field_dict["njs"] = njs
|
||||
if nps is not UNSET:
|
||||
field_dict["nps"] = nps
|
||||
if notes is not UNSET:
|
||||
field_dict["notes"] = notes
|
||||
if bombs is not UNSET:
|
||||
field_dict["bombs"] = bombs
|
||||
if walls is not UNSET:
|
||||
field_dict["walls"] = walls
|
||||
if max_score is not UNSET:
|
||||
field_dict["maxScore"] = max_score
|
||||
if duration is not UNSET:
|
||||
field_dict["duration"] = duration
|
||||
if requirements is not UNSET:
|
||||
field_dict["requirements"] = requirements
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
from ..models.modifiers_map import ModifiersMap
|
||||
from ..models.modifiers_rating import ModifiersRating
|
||||
|
||||
d = src_dict.copy()
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
value = d.pop("value", UNSET)
|
||||
|
||||
mode = d.pop("mode", UNSET)
|
||||
|
||||
def _parse_difficulty_name(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
difficulty_name = _parse_difficulty_name(d.pop("difficultyName", UNSET))
|
||||
|
||||
def _parse_mode_name(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
mode_name = _parse_mode_name(d.pop("modeName", UNSET))
|
||||
|
||||
_status = d.pop("status", UNSET)
|
||||
status: Union[Unset, DifficultyStatus]
|
||||
if isinstance(_status, Unset):
|
||||
status = UNSET
|
||||
else:
|
||||
status = DifficultyStatus(_status)
|
||||
|
||||
_modifier_values = d.pop("modifierValues", UNSET)
|
||||
modifier_values: Union[Unset, ModifiersMap]
|
||||
if isinstance(_modifier_values, Unset):
|
||||
modifier_values = UNSET
|
||||
else:
|
||||
modifier_values = ModifiersMap.from_dict(_modifier_values)
|
||||
|
||||
_modifiers_rating = d.pop("modifiersRating", UNSET)
|
||||
modifiers_rating: Union[Unset, ModifiersRating]
|
||||
if isinstance(_modifiers_rating, Unset):
|
||||
modifiers_rating = UNSET
|
||||
else:
|
||||
modifiers_rating = ModifiersRating.from_dict(_modifiers_rating)
|
||||
|
||||
nominated_time = d.pop("nominatedTime", UNSET)
|
||||
|
||||
qualified_time = d.pop("qualifiedTime", UNSET)
|
||||
|
||||
ranked_time = d.pop("rankedTime", UNSET)
|
||||
|
||||
speed_tags = d.pop("speedTags", UNSET)
|
||||
|
||||
style_tags = d.pop("styleTags", UNSET)
|
||||
|
||||
feature_tags = d.pop("featureTags", UNSET)
|
||||
|
||||
def _parse_stars(data: object) -> Union[None, Unset, float]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, float], data)
|
||||
|
||||
stars = _parse_stars(d.pop("stars", UNSET))
|
||||
|
||||
def _parse_predicted_acc(data: object) -> Union[None, Unset, float]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, float], data)
|
||||
|
||||
predicted_acc = _parse_predicted_acc(d.pop("predictedAcc", UNSET))
|
||||
|
||||
def _parse_pass_rating(data: object) -> Union[None, Unset, float]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, float], data)
|
||||
|
||||
pass_rating = _parse_pass_rating(d.pop("passRating", UNSET))
|
||||
|
||||
def _parse_acc_rating(data: object) -> Union[None, Unset, float]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, float], data)
|
||||
|
||||
acc_rating = _parse_acc_rating(d.pop("accRating", UNSET))
|
||||
|
||||
def _parse_tech_rating(data: object) -> Union[None, Unset, float]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, float], data)
|
||||
|
||||
tech_rating = _parse_tech_rating(d.pop("techRating", UNSET))
|
||||
|
||||
type = d.pop("type", UNSET)
|
||||
|
||||
njs = d.pop("njs", UNSET)
|
||||
|
||||
nps = d.pop("nps", UNSET)
|
||||
|
||||
notes = d.pop("notes", UNSET)
|
||||
|
||||
bombs = d.pop("bombs", UNSET)
|
||||
|
||||
walls = d.pop("walls", UNSET)
|
||||
|
||||
max_score = d.pop("maxScore", UNSET)
|
||||
|
||||
duration = d.pop("duration", UNSET)
|
||||
|
||||
_requirements = d.pop("requirements", UNSET)
|
||||
requirements: Union[Unset, Requirements]
|
||||
if isinstance(_requirements, Unset):
|
||||
requirements = UNSET
|
||||
else:
|
||||
requirements = Requirements(_requirements)
|
||||
|
||||
difficulty_response = cls(
|
||||
id=id,
|
||||
value=value,
|
||||
mode=mode,
|
||||
difficulty_name=difficulty_name,
|
||||
mode_name=mode_name,
|
||||
status=status,
|
||||
modifier_values=modifier_values,
|
||||
modifiers_rating=modifiers_rating,
|
||||
nominated_time=nominated_time,
|
||||
qualified_time=qualified_time,
|
||||
ranked_time=ranked_time,
|
||||
speed_tags=speed_tags,
|
||||
style_tags=style_tags,
|
||||
feature_tags=feature_tags,
|
||||
stars=stars,
|
||||
predicted_acc=predicted_acc,
|
||||
pass_rating=pass_rating,
|
||||
acc_rating=acc_rating,
|
||||
tech_rating=tech_rating,
|
||||
type=type,
|
||||
njs=njs,
|
||||
nps=nps,
|
||||
notes=notes,
|
||||
bombs=bombs,
|
||||
walls=walls,
|
||||
max_score=max_score,
|
||||
duration=duration,
|
||||
requirements=requirements,
|
||||
)
|
||||
|
||||
return difficulty_response
|
15
src/clients/beatleader/models/difficulty_status.py
Normal file
15
src/clients/beatleader/models/difficulty_status.py
Normal file
@ -0,0 +1,15 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class DifficultyStatus(str, Enum):
|
||||
INEVENT = "inevent"
|
||||
NOMINATED = "nominated"
|
||||
OST = "oST"
|
||||
OUTDATED = "outdated"
|
||||
QUALIFIED = "qualified"
|
||||
RANKED = "ranked"
|
||||
UNRANKABLE = "unrankable"
|
||||
UNRANKED = "unranked"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
187
src/clients/beatleader/models/event_player.py
Normal file
187
src/clients/beatleader/models/event_player.py
Normal file
@ -0,0 +1,187 @@
|
||||
from typing import TYPE_CHECKING, Any, Dict, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.event_ranking import EventRanking
|
||||
|
||||
|
||||
T = TypeVar("T", bound="EventPlayer")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class EventPlayer:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[Unset, int]):
|
||||
event_ranking_id (Union[None, Unset, int]):
|
||||
event (Union[Unset, EventRanking]):
|
||||
event_name (Union[None, Unset, str]):
|
||||
player_name (Union[None, Unset, str]):
|
||||
player_id (Union[None, Unset, str]):
|
||||
country (Union[None, Unset, str]):
|
||||
rank (Union[Unset, int]):
|
||||
country_rank (Union[Unset, int]):
|
||||
pp (Union[Unset, float]):
|
||||
"""
|
||||
|
||||
id: Union[Unset, int] = UNSET
|
||||
event_ranking_id: Union[None, Unset, int] = UNSET
|
||||
event: Union[Unset, "EventRanking"] = UNSET
|
||||
event_name: Union[None, Unset, str] = UNSET
|
||||
player_name: Union[None, Unset, str] = UNSET
|
||||
player_id: Union[None, Unset, str] = UNSET
|
||||
country: Union[None, Unset, str] = UNSET
|
||||
rank: Union[Unset, int] = UNSET
|
||||
country_rank: Union[Unset, int] = UNSET
|
||||
pp: Union[Unset, float] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id = self.id
|
||||
|
||||
event_ranking_id: Union[None, Unset, int]
|
||||
if isinstance(self.event_ranking_id, Unset):
|
||||
event_ranking_id = UNSET
|
||||
else:
|
||||
event_ranking_id = self.event_ranking_id
|
||||
|
||||
event: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.event, Unset):
|
||||
event = self.event.to_dict()
|
||||
|
||||
event_name: Union[None, Unset, str]
|
||||
if isinstance(self.event_name, Unset):
|
||||
event_name = UNSET
|
||||
else:
|
||||
event_name = self.event_name
|
||||
|
||||
player_name: Union[None, Unset, str]
|
||||
if isinstance(self.player_name, Unset):
|
||||
player_name = UNSET
|
||||
else:
|
||||
player_name = self.player_name
|
||||
|
||||
player_id: Union[None, Unset, str]
|
||||
if isinstance(self.player_id, Unset):
|
||||
player_id = UNSET
|
||||
else:
|
||||
player_id = self.player_id
|
||||
|
||||
country: Union[None, Unset, str]
|
||||
if isinstance(self.country, Unset):
|
||||
country = UNSET
|
||||
else:
|
||||
country = self.country
|
||||
|
||||
rank = self.rank
|
||||
|
||||
country_rank = self.country_rank
|
||||
|
||||
pp = self.pp
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if event_ranking_id is not UNSET:
|
||||
field_dict["eventRankingId"] = event_ranking_id
|
||||
if event is not UNSET:
|
||||
field_dict["event"] = event
|
||||
if event_name is not UNSET:
|
||||
field_dict["eventName"] = event_name
|
||||
if player_name is not UNSET:
|
||||
field_dict["playerName"] = player_name
|
||||
if player_id is not UNSET:
|
||||
field_dict["playerId"] = player_id
|
||||
if country is not UNSET:
|
||||
field_dict["country"] = country
|
||||
if rank is not UNSET:
|
||||
field_dict["rank"] = rank
|
||||
if country_rank is not UNSET:
|
||||
field_dict["countryRank"] = country_rank
|
||||
if pp is not UNSET:
|
||||
field_dict["pp"] = pp
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
from ..models.event_ranking import EventRanking
|
||||
|
||||
d = src_dict.copy()
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
def _parse_event_ranking_id(data: object) -> Union[None, Unset, int]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, int], data)
|
||||
|
||||
event_ranking_id = _parse_event_ranking_id(d.pop("eventRankingId", UNSET))
|
||||
|
||||
_event = d.pop("event", UNSET)
|
||||
event: Union[Unset, EventRanking]
|
||||
if isinstance(_event, Unset):
|
||||
event = UNSET
|
||||
else:
|
||||
event = EventRanking.from_dict(_event)
|
||||
|
||||
def _parse_event_name(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
event_name = _parse_event_name(d.pop("eventName", UNSET))
|
||||
|
||||
def _parse_player_name(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
player_name = _parse_player_name(d.pop("playerName", UNSET))
|
||||
|
||||
def _parse_player_id(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
player_id = _parse_player_id(d.pop("playerId", UNSET))
|
||||
|
||||
def _parse_country(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
country = _parse_country(d.pop("country", UNSET))
|
||||
|
||||
rank = d.pop("rank", UNSET)
|
||||
|
||||
country_rank = d.pop("countryRank", UNSET)
|
||||
|
||||
pp = d.pop("pp", UNSET)
|
||||
|
||||
event_player = cls(
|
||||
id=id,
|
||||
event_ranking_id=event_ranking_id,
|
||||
event=event,
|
||||
event_name=event_name,
|
||||
player_name=player_name,
|
||||
player_id=player_id,
|
||||
country=country,
|
||||
rank=rank,
|
||||
country_rank=country_rank,
|
||||
pp=pp,
|
||||
)
|
||||
|
||||
return event_player
|
96
src/clients/beatleader/models/event_ranking.py
Normal file
96
src/clients/beatleader/models/event_ranking.py
Normal file
@ -0,0 +1,96 @@
|
||||
from typing import Any, Dict, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="EventRanking")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class EventRanking:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[Unset, int]):
|
||||
name (Union[None, Unset, str]):
|
||||
end_date (Union[Unset, int]):
|
||||
playlist_id (Union[Unset, int]):
|
||||
image (Union[None, Unset, str]):
|
||||
"""
|
||||
|
||||
id: Union[Unset, int] = UNSET
|
||||
name: Union[None, Unset, str] = UNSET
|
||||
end_date: Union[Unset, int] = UNSET
|
||||
playlist_id: Union[Unset, int] = UNSET
|
||||
image: Union[None, Unset, str] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id = self.id
|
||||
|
||||
name: Union[None, Unset, str]
|
||||
if isinstance(self.name, Unset):
|
||||
name = UNSET
|
||||
else:
|
||||
name = self.name
|
||||
|
||||
end_date = self.end_date
|
||||
|
||||
playlist_id = self.playlist_id
|
||||
|
||||
image: Union[None, Unset, str]
|
||||
if isinstance(self.image, Unset):
|
||||
image = UNSET
|
||||
else:
|
||||
image = self.image
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if name is not UNSET:
|
||||
field_dict["name"] = name
|
||||
if end_date is not UNSET:
|
||||
field_dict["endDate"] = end_date
|
||||
if playlist_id is not UNSET:
|
||||
field_dict["playlistId"] = playlist_id
|
||||
if image is not UNSET:
|
||||
field_dict["image"] = image
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
def _parse_name(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
name = _parse_name(d.pop("name", UNSET))
|
||||
|
||||
end_date = d.pop("endDate", UNSET)
|
||||
|
||||
playlist_id = d.pop("playlistId", UNSET)
|
||||
|
||||
def _parse_image(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
image = _parse_image(d.pop("image", UNSET))
|
||||
|
||||
event_ranking = cls(
|
||||
id=id,
|
||||
name=name,
|
||||
end_date=end_date,
|
||||
playlist_id=playlist_id,
|
||||
image=image,
|
||||
)
|
||||
|
||||
return event_ranking
|
164
src/clients/beatleader/models/external_status.py
Normal file
164
src/clients/beatleader/models/external_status.py
Normal file
@ -0,0 +1,164 @@
|
||||
from typing import Any, Dict, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..models.song_status import SongStatus
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="ExternalStatus")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class ExternalStatus:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[Unset, int]):
|
||||
status (Union[Unset, SongStatus]):
|
||||
timeset (Union[Unset, int]):
|
||||
link (Union[None, Unset, str]):
|
||||
responsible (Union[None, Unset, str]):
|
||||
details (Union[None, Unset, str]):
|
||||
title (Union[None, Unset, str]):
|
||||
title_color (Union[None, Unset, str]):
|
||||
"""
|
||||
|
||||
id: Union[Unset, int] = UNSET
|
||||
status: Union[Unset, SongStatus] = UNSET
|
||||
timeset: Union[Unset, int] = UNSET
|
||||
link: Union[None, Unset, str] = UNSET
|
||||
responsible: Union[None, Unset, str] = UNSET
|
||||
details: Union[None, Unset, str] = UNSET
|
||||
title: Union[None, Unset, str] = UNSET
|
||||
title_color: Union[None, Unset, str] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id = self.id
|
||||
|
||||
status: Union[Unset, str] = UNSET
|
||||
if not isinstance(self.status, Unset):
|
||||
status = self.status.value
|
||||
|
||||
timeset = self.timeset
|
||||
|
||||
link: Union[None, Unset, str]
|
||||
if isinstance(self.link, Unset):
|
||||
link = UNSET
|
||||
else:
|
||||
link = self.link
|
||||
|
||||
responsible: Union[None, Unset, str]
|
||||
if isinstance(self.responsible, Unset):
|
||||
responsible = UNSET
|
||||
else:
|
||||
responsible = self.responsible
|
||||
|
||||
details: Union[None, Unset, str]
|
||||
if isinstance(self.details, Unset):
|
||||
details = UNSET
|
||||
else:
|
||||
details = self.details
|
||||
|
||||
title: Union[None, Unset, str]
|
||||
if isinstance(self.title, Unset):
|
||||
title = UNSET
|
||||
else:
|
||||
title = self.title
|
||||
|
||||
title_color: Union[None, Unset, str]
|
||||
if isinstance(self.title_color, Unset):
|
||||
title_color = UNSET
|
||||
else:
|
||||
title_color = self.title_color
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if status is not UNSET:
|
||||
field_dict["status"] = status
|
||||
if timeset is not UNSET:
|
||||
field_dict["timeset"] = timeset
|
||||
if link is not UNSET:
|
||||
field_dict["link"] = link
|
||||
if responsible is not UNSET:
|
||||
field_dict["responsible"] = responsible
|
||||
if details is not UNSET:
|
||||
field_dict["details"] = details
|
||||
if title is not UNSET:
|
||||
field_dict["title"] = title
|
||||
if title_color is not UNSET:
|
||||
field_dict["titleColor"] = title_color
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
_status = d.pop("status", UNSET)
|
||||
status: Union[Unset, SongStatus]
|
||||
if isinstance(_status, Unset):
|
||||
status = UNSET
|
||||
else:
|
||||
status = SongStatus(_status)
|
||||
|
||||
timeset = d.pop("timeset", UNSET)
|
||||
|
||||
def _parse_link(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
link = _parse_link(d.pop("link", UNSET))
|
||||
|
||||
def _parse_responsible(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
responsible = _parse_responsible(d.pop("responsible", UNSET))
|
||||
|
||||
def _parse_details(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
details = _parse_details(d.pop("details", UNSET))
|
||||
|
||||
def _parse_title(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
title = _parse_title(d.pop("title", UNSET))
|
||||
|
||||
def _parse_title_color(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
title_color = _parse_title_color(d.pop("titleColor", UNSET))
|
||||
|
||||
external_status = cls(
|
||||
id=id,
|
||||
status=status,
|
||||
timeset=timeset,
|
||||
link=link,
|
||||
responsible=responsible,
|
||||
details=details,
|
||||
title=title,
|
||||
title_color=title_color,
|
||||
)
|
||||
|
||||
return external_status
|
178
src/clients/beatleader/models/featured_playlist.py
Normal file
178
src/clients/beatleader/models/featured_playlist.py
Normal file
@ -0,0 +1,178 @@
|
||||
from typing import Any, Dict, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="FeaturedPlaylist")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class FeaturedPlaylist:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[Unset, int]):
|
||||
playlist_link (Union[None, Unset, str]):
|
||||
cover (Union[None, Unset, str]):
|
||||
title (Union[None, Unset, str]):
|
||||
description (Union[None, Unset, str]):
|
||||
owner (Union[None, Unset, str]):
|
||||
owner_cover (Union[None, Unset, str]):
|
||||
owner_link (Union[None, Unset, str]):
|
||||
"""
|
||||
|
||||
id: Union[Unset, int] = UNSET
|
||||
playlist_link: Union[None, Unset, str] = UNSET
|
||||
cover: Union[None, Unset, str] = UNSET
|
||||
title: Union[None, Unset, str] = UNSET
|
||||
description: Union[None, Unset, str] = UNSET
|
||||
owner: Union[None, Unset, str] = UNSET
|
||||
owner_cover: Union[None, Unset, str] = UNSET
|
||||
owner_link: Union[None, Unset, str] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id = self.id
|
||||
|
||||
playlist_link: Union[None, Unset, str]
|
||||
if isinstance(self.playlist_link, Unset):
|
||||
playlist_link = UNSET
|
||||
else:
|
||||
playlist_link = self.playlist_link
|
||||
|
||||
cover: Union[None, Unset, str]
|
||||
if isinstance(self.cover, Unset):
|
||||
cover = UNSET
|
||||
else:
|
||||
cover = self.cover
|
||||
|
||||
title: Union[None, Unset, str]
|
||||
if isinstance(self.title, Unset):
|
||||
title = UNSET
|
||||
else:
|
||||
title = self.title
|
||||
|
||||
description: Union[None, Unset, str]
|
||||
if isinstance(self.description, Unset):
|
||||
description = UNSET
|
||||
else:
|
||||
description = self.description
|
||||
|
||||
owner: Union[None, Unset, str]
|
||||
if isinstance(self.owner, Unset):
|
||||
owner = UNSET
|
||||
else:
|
||||
owner = self.owner
|
||||
|
||||
owner_cover: Union[None, Unset, str]
|
||||
if isinstance(self.owner_cover, Unset):
|
||||
owner_cover = UNSET
|
||||
else:
|
||||
owner_cover = self.owner_cover
|
||||
|
||||
owner_link: Union[None, Unset, str]
|
||||
if isinstance(self.owner_link, Unset):
|
||||
owner_link = UNSET
|
||||
else:
|
||||
owner_link = self.owner_link
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if playlist_link is not UNSET:
|
||||
field_dict["playlistLink"] = playlist_link
|
||||
if cover is not UNSET:
|
||||
field_dict["cover"] = cover
|
||||
if title is not UNSET:
|
||||
field_dict["title"] = title
|
||||
if description is not UNSET:
|
||||
field_dict["description"] = description
|
||||
if owner is not UNSET:
|
||||
field_dict["owner"] = owner
|
||||
if owner_cover is not UNSET:
|
||||
field_dict["ownerCover"] = owner_cover
|
||||
if owner_link is not UNSET:
|
||||
field_dict["ownerLink"] = owner_link
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
def _parse_playlist_link(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
playlist_link = _parse_playlist_link(d.pop("playlistLink", UNSET))
|
||||
|
||||
def _parse_cover(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
cover = _parse_cover(d.pop("cover", UNSET))
|
||||
|
||||
def _parse_title(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
title = _parse_title(d.pop("title", UNSET))
|
||||
|
||||
def _parse_description(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
description = _parse_description(d.pop("description", UNSET))
|
||||
|
||||
def _parse_owner(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
owner = _parse_owner(d.pop("owner", UNSET))
|
||||
|
||||
def _parse_owner_cover(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
owner_cover = _parse_owner_cover(d.pop("ownerCover", UNSET))
|
||||
|
||||
def _parse_owner_link(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
owner_link = _parse_owner_link(d.pop("ownerLink", UNSET))
|
||||
|
||||
featured_playlist = cls(
|
||||
id=id,
|
||||
playlist_link=playlist_link,
|
||||
cover=cover,
|
||||
title=title,
|
||||
description=description,
|
||||
owner=owner,
|
||||
owner_cover=owner_cover,
|
||||
owner_link=owner_link,
|
||||
)
|
||||
|
||||
return featured_playlist
|
178
src/clients/beatleader/models/featured_playlist_response.py
Normal file
178
src/clients/beatleader/models/featured_playlist_response.py
Normal file
@ -0,0 +1,178 @@
|
||||
from typing import Any, Dict, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="FeaturedPlaylistResponse")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class FeaturedPlaylistResponse:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[Unset, int]):
|
||||
playlist_link (Union[None, Unset, str]):
|
||||
cover (Union[None, Unset, str]):
|
||||
title (Union[None, Unset, str]):
|
||||
description (Union[None, Unset, str]):
|
||||
owner (Union[None, Unset, str]):
|
||||
owner_cover (Union[None, Unset, str]):
|
||||
owner_link (Union[None, Unset, str]):
|
||||
"""
|
||||
|
||||
id: Union[Unset, int] = UNSET
|
||||
playlist_link: Union[None, Unset, str] = UNSET
|
||||
cover: Union[None, Unset, str] = UNSET
|
||||
title: Union[None, Unset, str] = UNSET
|
||||
description: Union[None, Unset, str] = UNSET
|
||||
owner: Union[None, Unset, str] = UNSET
|
||||
owner_cover: Union[None, Unset, str] = UNSET
|
||||
owner_link: Union[None, Unset, str] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id = self.id
|
||||
|
||||
playlist_link: Union[None, Unset, str]
|
||||
if isinstance(self.playlist_link, Unset):
|
||||
playlist_link = UNSET
|
||||
else:
|
||||
playlist_link = self.playlist_link
|
||||
|
||||
cover: Union[None, Unset, str]
|
||||
if isinstance(self.cover, Unset):
|
||||
cover = UNSET
|
||||
else:
|
||||
cover = self.cover
|
||||
|
||||
title: Union[None, Unset, str]
|
||||
if isinstance(self.title, Unset):
|
||||
title = UNSET
|
||||
else:
|
||||
title = self.title
|
||||
|
||||
description: Union[None, Unset, str]
|
||||
if isinstance(self.description, Unset):
|
||||
description = UNSET
|
||||
else:
|
||||
description = self.description
|
||||
|
||||
owner: Union[None, Unset, str]
|
||||
if isinstance(self.owner, Unset):
|
||||
owner = UNSET
|
||||
else:
|
||||
owner = self.owner
|
||||
|
||||
owner_cover: Union[None, Unset, str]
|
||||
if isinstance(self.owner_cover, Unset):
|
||||
owner_cover = UNSET
|
||||
else:
|
||||
owner_cover = self.owner_cover
|
||||
|
||||
owner_link: Union[None, Unset, str]
|
||||
if isinstance(self.owner_link, Unset):
|
||||
owner_link = UNSET
|
||||
else:
|
||||
owner_link = self.owner_link
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if playlist_link is not UNSET:
|
||||
field_dict["playlistLink"] = playlist_link
|
||||
if cover is not UNSET:
|
||||
field_dict["cover"] = cover
|
||||
if title is not UNSET:
|
||||
field_dict["title"] = title
|
||||
if description is not UNSET:
|
||||
field_dict["description"] = description
|
||||
if owner is not UNSET:
|
||||
field_dict["owner"] = owner
|
||||
if owner_cover is not UNSET:
|
||||
field_dict["ownerCover"] = owner_cover
|
||||
if owner_link is not UNSET:
|
||||
field_dict["ownerLink"] = owner_link
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
def _parse_playlist_link(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
playlist_link = _parse_playlist_link(d.pop("playlistLink", UNSET))
|
||||
|
||||
def _parse_cover(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
cover = _parse_cover(d.pop("cover", UNSET))
|
||||
|
||||
def _parse_title(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
title = _parse_title(d.pop("title", UNSET))
|
||||
|
||||
def _parse_description(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
description = _parse_description(d.pop("description", UNSET))
|
||||
|
||||
def _parse_owner(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
owner = _parse_owner(d.pop("owner", UNSET))
|
||||
|
||||
def _parse_owner_cover(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
owner_cover = _parse_owner_cover(d.pop("ownerCover", UNSET))
|
||||
|
||||
def _parse_owner_link(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
owner_link = _parse_owner_link(d.pop("ownerLink", UNSET))
|
||||
|
||||
featured_playlist_response = cls(
|
||||
id=id,
|
||||
playlist_link=playlist_link,
|
||||
cover=cover,
|
||||
title=title,
|
||||
description=description,
|
||||
owner=owner,
|
||||
owner_cover=owner_cover,
|
||||
owner_link=owner_link,
|
||||
)
|
||||
|
||||
return featured_playlist_response
|
9
src/clients/beatleader/models/follower_type.py
Normal file
9
src/clients/beatleader/models/follower_type.py
Normal file
@ -0,0 +1,9 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class FollowerType(str, Enum):
|
||||
FOLLOWERS = "followers"
|
||||
FOLLOWING = "following"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
141
src/clients/beatleader/models/global_map_history.py
Normal file
141
src/clients/beatleader/models/global_map_history.py
Normal file
@ -0,0 +1,141 @@
|
||||
from typing import TYPE_CHECKING, Any, Dict, Type, TypeVar, Union
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.clan import Clan
|
||||
|
||||
|
||||
T = TypeVar("T", bound="GlobalMapHistory")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class GlobalMapHistory:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[Unset, int]):
|
||||
timestamp (Union[Unset, int]):
|
||||
clan_id (Union[Unset, int]):
|
||||
clan (Union[Unset, Clan]):
|
||||
global_map_captured (Union[Unset, float]):
|
||||
players_count (Union[Unset, int]):
|
||||
pp (Union[Unset, float]):
|
||||
rank (Union[Unset, int]):
|
||||
average_rank (Union[Unset, float]):
|
||||
average_accuracy (Union[Unset, float]):
|
||||
capture_leaderboards_count (Union[Unset, int]):
|
||||
"""
|
||||
|
||||
id: Union[Unset, int] = UNSET
|
||||
timestamp: Union[Unset, int] = UNSET
|
||||
clan_id: Union[Unset, int] = UNSET
|
||||
clan: Union[Unset, "Clan"] = UNSET
|
||||
global_map_captured: Union[Unset, float] = UNSET
|
||||
players_count: Union[Unset, int] = UNSET
|
||||
pp: Union[Unset, float] = UNSET
|
||||
rank: Union[Unset, int] = UNSET
|
||||
average_rank: Union[Unset, float] = UNSET
|
||||
average_accuracy: Union[Unset, float] = UNSET
|
||||
capture_leaderboards_count: Union[Unset, int] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id = self.id
|
||||
|
||||
timestamp = self.timestamp
|
||||
|
||||
clan_id = self.clan_id
|
||||
|
||||
clan: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.clan, Unset):
|
||||
clan = self.clan.to_dict()
|
||||
|
||||
global_map_captured = self.global_map_captured
|
||||
|
||||
players_count = self.players_count
|
||||
|
||||
pp = self.pp
|
||||
|
||||
rank = self.rank
|
||||
|
||||
average_rank = self.average_rank
|
||||
|
||||
average_accuracy = self.average_accuracy
|
||||
|
||||
capture_leaderboards_count = self.capture_leaderboards_count
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if timestamp is not UNSET:
|
||||
field_dict["timestamp"] = timestamp
|
||||
if clan_id is not UNSET:
|
||||
field_dict["clanId"] = clan_id
|
||||
if clan is not UNSET:
|
||||
field_dict["clan"] = clan
|
||||
if global_map_captured is not UNSET:
|
||||
field_dict["globalMapCaptured"] = global_map_captured
|
||||
if players_count is not UNSET:
|
||||
field_dict["playersCount"] = players_count
|
||||
if pp is not UNSET:
|
||||
field_dict["pp"] = pp
|
||||
if rank is not UNSET:
|
||||
field_dict["rank"] = rank
|
||||
if average_rank is not UNSET:
|
||||
field_dict["averageRank"] = average_rank
|
||||
if average_accuracy is not UNSET:
|
||||
field_dict["averageAccuracy"] = average_accuracy
|
||||
if capture_leaderboards_count is not UNSET:
|
||||
field_dict["captureLeaderboardsCount"] = capture_leaderboards_count
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
from ..models.clan import Clan
|
||||
|
||||
d = src_dict.copy()
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
timestamp = d.pop("timestamp", UNSET)
|
||||
|
||||
clan_id = d.pop("clanId", UNSET)
|
||||
|
||||
_clan = d.pop("clan", UNSET)
|
||||
clan: Union[Unset, Clan]
|
||||
if isinstance(_clan, Unset):
|
||||
clan = UNSET
|
||||
else:
|
||||
clan = Clan.from_dict(_clan)
|
||||
|
||||
global_map_captured = d.pop("globalMapCaptured", UNSET)
|
||||
|
||||
players_count = d.pop("playersCount", UNSET)
|
||||
|
||||
pp = d.pop("pp", UNSET)
|
||||
|
||||
rank = d.pop("rank", UNSET)
|
||||
|
||||
average_rank = d.pop("averageRank", UNSET)
|
||||
|
||||
average_accuracy = d.pop("averageAccuracy", UNSET)
|
||||
|
||||
capture_leaderboards_count = d.pop("captureLeaderboardsCount", UNSET)
|
||||
|
||||
global_map_history = cls(
|
||||
id=id,
|
||||
timestamp=timestamp,
|
||||
clan_id=clan_id,
|
||||
clan=clan,
|
||||
global_map_captured=global_map_captured,
|
||||
players_count=players_count,
|
||||
pp=pp,
|
||||
rank=rank,
|
||||
average_rank=average_rank,
|
||||
average_accuracy=average_accuracy,
|
||||
capture_leaderboards_count=capture_leaderboards_count,
|
||||
)
|
||||
|
||||
return global_map_history
|
164
src/clients/beatleader/models/history_compact_response.py
Normal file
164
src/clients/beatleader/models/history_compact_response.py
Normal file
@ -0,0 +1,164 @@
|
||||
from typing import Any, Dict, Type, TypeVar, Union
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
T = TypeVar("T", bound="HistoryCompactResponse")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class HistoryCompactResponse:
|
||||
"""
|
||||
Attributes:
|
||||
timestamp (Union[Unset, int]):
|
||||
pp (Union[Unset, float]):
|
||||
rank (Union[Unset, int]):
|
||||
country_rank (Union[Unset, int]):
|
||||
average_ranked_accuracy (Union[Unset, float]):
|
||||
average_unranked_accuracy (Union[Unset, float]):
|
||||
average_accuracy (Union[Unset, float]):
|
||||
median_ranked_accuracy (Union[Unset, float]):
|
||||
median_accuracy (Union[Unset, float]):
|
||||
ranked_play_count (Union[Unset, int]):
|
||||
unranked_play_count (Union[Unset, int]):
|
||||
total_play_count (Union[Unset, int]):
|
||||
ranked_improvements_count (Union[Unset, int]):
|
||||
unranked_improvements_count (Union[Unset, int]):
|
||||
total_improvements_count (Union[Unset, int]):
|
||||
"""
|
||||
|
||||
timestamp: Union[Unset, int] = UNSET
|
||||
pp: Union[Unset, float] = UNSET
|
||||
rank: Union[Unset, int] = UNSET
|
||||
country_rank: Union[Unset, int] = UNSET
|
||||
average_ranked_accuracy: Union[Unset, float] = UNSET
|
||||
average_unranked_accuracy: Union[Unset, float] = UNSET
|
||||
average_accuracy: Union[Unset, float] = UNSET
|
||||
median_ranked_accuracy: Union[Unset, float] = UNSET
|
||||
median_accuracy: Union[Unset, float] = UNSET
|
||||
ranked_play_count: Union[Unset, int] = UNSET
|
||||
unranked_play_count: Union[Unset, int] = UNSET
|
||||
total_play_count: Union[Unset, int] = UNSET
|
||||
ranked_improvements_count: Union[Unset, int] = UNSET
|
||||
unranked_improvements_count: Union[Unset, int] = UNSET
|
||||
total_improvements_count: Union[Unset, int] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
timestamp = self.timestamp
|
||||
|
||||
pp = self.pp
|
||||
|
||||
rank = self.rank
|
||||
|
||||
country_rank = self.country_rank
|
||||
|
||||
average_ranked_accuracy = self.average_ranked_accuracy
|
||||
|
||||
average_unranked_accuracy = self.average_unranked_accuracy
|
||||
|
||||
average_accuracy = self.average_accuracy
|
||||
|
||||
median_ranked_accuracy = self.median_ranked_accuracy
|
||||
|
||||
median_accuracy = self.median_accuracy
|
||||
|
||||
ranked_play_count = self.ranked_play_count
|
||||
|
||||
unranked_play_count = self.unranked_play_count
|
||||
|
||||
total_play_count = self.total_play_count
|
||||
|
||||
ranked_improvements_count = self.ranked_improvements_count
|
||||
|
||||
unranked_improvements_count = self.unranked_improvements_count
|
||||
|
||||
total_improvements_count = self.total_improvements_count
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if timestamp is not UNSET:
|
||||
field_dict["timestamp"] = timestamp
|
||||
if pp is not UNSET:
|
||||
field_dict["pp"] = pp
|
||||
if rank is not UNSET:
|
||||
field_dict["rank"] = rank
|
||||
if country_rank is not UNSET:
|
||||
field_dict["countryRank"] = country_rank
|
||||
if average_ranked_accuracy is not UNSET:
|
||||
field_dict["averageRankedAccuracy"] = average_ranked_accuracy
|
||||
if average_unranked_accuracy is not UNSET:
|
||||
field_dict["averageUnrankedAccuracy"] = average_unranked_accuracy
|
||||
if average_accuracy is not UNSET:
|
||||
field_dict["averageAccuracy"] = average_accuracy
|
||||
if median_ranked_accuracy is not UNSET:
|
||||
field_dict["medianRankedAccuracy"] = median_ranked_accuracy
|
||||
if median_accuracy is not UNSET:
|
||||
field_dict["medianAccuracy"] = median_accuracy
|
||||
if ranked_play_count is not UNSET:
|
||||
field_dict["rankedPlayCount"] = ranked_play_count
|
||||
if unranked_play_count is not UNSET:
|
||||
field_dict["unrankedPlayCount"] = unranked_play_count
|
||||
if total_play_count is not UNSET:
|
||||
field_dict["totalPlayCount"] = total_play_count
|
||||
if ranked_improvements_count is not UNSET:
|
||||
field_dict["rankedImprovementsCount"] = ranked_improvements_count
|
||||
if unranked_improvements_count is not UNSET:
|
||||
field_dict["unrankedImprovementsCount"] = unranked_improvements_count
|
||||
if total_improvements_count is not UNSET:
|
||||
field_dict["totalImprovementsCount"] = total_improvements_count
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
d = src_dict.copy()
|
||||
timestamp = d.pop("timestamp", UNSET)
|
||||
|
||||
pp = d.pop("pp", UNSET)
|
||||
|
||||
rank = d.pop("rank", UNSET)
|
||||
|
||||
country_rank = d.pop("countryRank", UNSET)
|
||||
|
||||
average_ranked_accuracy = d.pop("averageRankedAccuracy", UNSET)
|
||||
|
||||
average_unranked_accuracy = d.pop("averageUnrankedAccuracy", UNSET)
|
||||
|
||||
average_accuracy = d.pop("averageAccuracy", UNSET)
|
||||
|
||||
median_ranked_accuracy = d.pop("medianRankedAccuracy", UNSET)
|
||||
|
||||
median_accuracy = d.pop("medianAccuracy", UNSET)
|
||||
|
||||
ranked_play_count = d.pop("rankedPlayCount", UNSET)
|
||||
|
||||
unranked_play_count = d.pop("unrankedPlayCount", UNSET)
|
||||
|
||||
total_play_count = d.pop("totalPlayCount", UNSET)
|
||||
|
||||
ranked_improvements_count = d.pop("rankedImprovementsCount", UNSET)
|
||||
|
||||
unranked_improvements_count = d.pop("unrankedImprovementsCount", UNSET)
|
||||
|
||||
total_improvements_count = d.pop("totalImprovementsCount", UNSET)
|
||||
|
||||
history_compact_response = cls(
|
||||
timestamp=timestamp,
|
||||
pp=pp,
|
||||
rank=rank,
|
||||
country_rank=country_rank,
|
||||
average_ranked_accuracy=average_ranked_accuracy,
|
||||
average_unranked_accuracy=average_unranked_accuracy,
|
||||
average_accuracy=average_accuracy,
|
||||
median_ranked_accuracy=median_ranked_accuracy,
|
||||
median_accuracy=median_accuracy,
|
||||
ranked_play_count=ranked_play_count,
|
||||
unranked_play_count=unranked_play_count,
|
||||
total_play_count=total_play_count,
|
||||
ranked_improvements_count=ranked_improvements_count,
|
||||
unranked_improvements_count=unranked_improvements_count,
|
||||
total_improvements_count=total_improvements_count,
|
||||
)
|
||||
|
||||
return history_compact_response
|
56
src/clients/beatleader/models/hmd.py
Normal file
56
src/clients/beatleader/models/hmd.py
Normal file
@ -0,0 +1,56 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class HMD(str, Enum):
|
||||
ACERWMR = "acerWmr"
|
||||
ARPARA = "arpara"
|
||||
ASUSWMR = "asusWmr"
|
||||
BIGSCREENBEYOND = "bigscreenbeyond"
|
||||
CLOUDXR = "cloudxr"
|
||||
CONTROLLABLE = "controllable"
|
||||
DELLVISOR = "dellVisor"
|
||||
DISCO = "disco"
|
||||
E3 = "e3"
|
||||
E4 = "e4"
|
||||
GLASSES20 = "glasses20"
|
||||
HEDY = "hedy"
|
||||
HPREVERB = "hpReverb"
|
||||
HUAWEIVR = "huaweivr"
|
||||
HYPEREAL = "hypereal"
|
||||
INDEX = "index"
|
||||
LENOVOEXPLORER = "lenovoExplorer"
|
||||
MEDION = "medion"
|
||||
MEGANE1 = "megane1"
|
||||
MIRAMAR = "miramar"
|
||||
NOLOSONIC = "nolosonic"
|
||||
PICONEO2 = "picoNeo2"
|
||||
PICONEO3 = "picoNeo3"
|
||||
PICONEO4 = "picoNeo4"
|
||||
PIMAX5K = "pimax5k"
|
||||
PIMAX8K = "pimax8k"
|
||||
PIMAXARTISAN = "pimaxArtisan"
|
||||
PIMAXCRYSTAL = "pimaxCrystal"
|
||||
PSVR2 = "psvr2"
|
||||
QIYUDREAM = "qiyuDream"
|
||||
QUEST = "quest"
|
||||
QUEST2 = "quest2"
|
||||
QUEST3 = "quest3"
|
||||
QUESTPRO = "questPro"
|
||||
RIFT = "rift"
|
||||
RIFTS = "riftS"
|
||||
SAMSUNGWMR = "samsungWmr"
|
||||
UNKNOWN = "unknown"
|
||||
VAPOREON = "vaporeon"
|
||||
VARJOAERO = "varjoaero"
|
||||
VIVE = "vive"
|
||||
VIVECOSMOS = "viveCosmos"
|
||||
VIVEDVT = "viveDvt"
|
||||
VIVEELITE = "viveElite"
|
||||
VIVEFOCUS = "viveFocus"
|
||||
VIVEPRO = "vivePro"
|
||||
VIVEPRO2 = "vivePro2"
|
||||
VRIDGE = "vridge"
|
||||
WMR = "wmr"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
10
src/clients/beatleader/models/info_to_highlight.py
Normal file
10
src/clients/beatleader/models/info_to_highlight.py
Normal file
@ -0,0 +1,10 @@
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class InfoToHighlight(str, Enum):
|
||||
NONE = "none"
|
||||
PLAYCOUNT = "playCount"
|
||||
WATCHCOUNT = "watchCount"
|
||||
|
||||
def __str__(self) -> str:
|
||||
return str(self.value)
|
340
src/clients/beatleader/models/leaderboard.py
Normal file
340
src/clients/beatleader/models/leaderboard.py
Normal file
@ -0,0 +1,340 @@
|
||||
from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.difficulty_description import DifficultyDescription
|
||||
from ..models.event_ranking import EventRanking
|
||||
from ..models.leaderboard_change import LeaderboardChange
|
||||
from ..models.rank_qualification import RankQualification
|
||||
from ..models.rank_update import RankUpdate
|
||||
from ..models.song import Song
|
||||
|
||||
|
||||
T = TypeVar("T", bound="Leaderboard")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class Leaderboard:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[None, Unset, str]):
|
||||
song_id (Union[None, Unset, str]):
|
||||
song (Union[Unset, Song]):
|
||||
difficulty (Union[Unset, DifficultyDescription]):
|
||||
qualification (Union[Unset, RankQualification]):
|
||||
reweight (Union[Unset, RankUpdate]):
|
||||
timestamp (Union[Unset, int]):
|
||||
changes (Union[List['LeaderboardChange'], None, Unset]):
|
||||
events (Union[List['EventRanking'], None, Unset]):
|
||||
plays (Union[Unset, int]):
|
||||
play_count (Union[Unset, int]):
|
||||
positive_votes (Union[Unset, int]):
|
||||
star_votes (Union[Unset, int]):
|
||||
negative_votes (Union[Unset, int]):
|
||||
vote_stars (Union[Unset, float]):
|
||||
clan_id (Union[None, Unset, int]):
|
||||
captured_time (Union[None, Unset, int]):
|
||||
clan_ranking_contested (Union[Unset, bool]):
|
||||
"""
|
||||
|
||||
id: Union[None, Unset, str] = UNSET
|
||||
song_id: Union[None, Unset, str] = UNSET
|
||||
song: Union[Unset, "Song"] = UNSET
|
||||
difficulty: Union[Unset, "DifficultyDescription"] = UNSET
|
||||
qualification: Union[Unset, "RankQualification"] = UNSET
|
||||
reweight: Union[Unset, "RankUpdate"] = UNSET
|
||||
timestamp: Union[Unset, int] = UNSET
|
||||
changes: Union[List["LeaderboardChange"], None, Unset] = UNSET
|
||||
events: Union[List["EventRanking"], None, Unset] = UNSET
|
||||
plays: Union[Unset, int] = UNSET
|
||||
play_count: Union[Unset, int] = UNSET
|
||||
positive_votes: Union[Unset, int] = UNSET
|
||||
star_votes: Union[Unset, int] = UNSET
|
||||
negative_votes: Union[Unset, int] = UNSET
|
||||
vote_stars: Union[Unset, float] = UNSET
|
||||
clan_id: Union[None, Unset, int] = UNSET
|
||||
captured_time: Union[None, Unset, int] = UNSET
|
||||
clan_ranking_contested: Union[Unset, bool] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id: Union[None, Unset, str]
|
||||
if isinstance(self.id, Unset):
|
||||
id = UNSET
|
||||
else:
|
||||
id = self.id
|
||||
|
||||
song_id: Union[None, Unset, str]
|
||||
if isinstance(self.song_id, Unset):
|
||||
song_id = UNSET
|
||||
else:
|
||||
song_id = self.song_id
|
||||
|
||||
song: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.song, Unset):
|
||||
song = self.song.to_dict()
|
||||
|
||||
difficulty: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.difficulty, Unset):
|
||||
difficulty = self.difficulty.to_dict()
|
||||
|
||||
qualification: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.qualification, Unset):
|
||||
qualification = self.qualification.to_dict()
|
||||
|
||||
reweight: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.reweight, Unset):
|
||||
reweight = self.reweight.to_dict()
|
||||
|
||||
timestamp = self.timestamp
|
||||
|
||||
changes: Union[List[Dict[str, Any]], None, Unset]
|
||||
if isinstance(self.changes, Unset):
|
||||
changes = UNSET
|
||||
elif isinstance(self.changes, list):
|
||||
changes = []
|
||||
for changes_type_0_item_data in self.changes:
|
||||
changes_type_0_item = changes_type_0_item_data.to_dict()
|
||||
changes.append(changes_type_0_item)
|
||||
|
||||
else:
|
||||
changes = self.changes
|
||||
|
||||
events: Union[List[Dict[str, Any]], None, Unset]
|
||||
if isinstance(self.events, Unset):
|
||||
events = UNSET
|
||||
elif isinstance(self.events, list):
|
||||
events = []
|
||||
for events_type_0_item_data in self.events:
|
||||
events_type_0_item = events_type_0_item_data.to_dict()
|
||||
events.append(events_type_0_item)
|
||||
|
||||
else:
|
||||
events = self.events
|
||||
|
||||
plays = self.plays
|
||||
|
||||
play_count = self.play_count
|
||||
|
||||
positive_votes = self.positive_votes
|
||||
|
||||
star_votes = self.star_votes
|
||||
|
||||
negative_votes = self.negative_votes
|
||||
|
||||
vote_stars = self.vote_stars
|
||||
|
||||
clan_id: Union[None, Unset, int]
|
||||
if isinstance(self.clan_id, Unset):
|
||||
clan_id = UNSET
|
||||
else:
|
||||
clan_id = self.clan_id
|
||||
|
||||
captured_time: Union[None, Unset, int]
|
||||
if isinstance(self.captured_time, Unset):
|
||||
captured_time = UNSET
|
||||
else:
|
||||
captured_time = self.captured_time
|
||||
|
||||
clan_ranking_contested = self.clan_ranking_contested
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if song_id is not UNSET:
|
||||
field_dict["songId"] = song_id
|
||||
if song is not UNSET:
|
||||
field_dict["song"] = song
|
||||
if difficulty is not UNSET:
|
||||
field_dict["difficulty"] = difficulty
|
||||
if qualification is not UNSET:
|
||||
field_dict["qualification"] = qualification
|
||||
if reweight is not UNSET:
|
||||
field_dict["reweight"] = reweight
|
||||
if timestamp is not UNSET:
|
||||
field_dict["timestamp"] = timestamp
|
||||
if changes is not UNSET:
|
||||
field_dict["changes"] = changes
|
||||
if events is not UNSET:
|
||||
field_dict["events"] = events
|
||||
if plays is not UNSET:
|
||||
field_dict["plays"] = plays
|
||||
if play_count is not UNSET:
|
||||
field_dict["playCount"] = play_count
|
||||
if positive_votes is not UNSET:
|
||||
field_dict["positiveVotes"] = positive_votes
|
||||
if star_votes is not UNSET:
|
||||
field_dict["starVotes"] = star_votes
|
||||
if negative_votes is not UNSET:
|
||||
field_dict["negativeVotes"] = negative_votes
|
||||
if vote_stars is not UNSET:
|
||||
field_dict["voteStars"] = vote_stars
|
||||
if clan_id is not UNSET:
|
||||
field_dict["clanId"] = clan_id
|
||||
if captured_time is not UNSET:
|
||||
field_dict["capturedTime"] = captured_time
|
||||
if clan_ranking_contested is not UNSET:
|
||||
field_dict["clanRankingContested"] = clan_ranking_contested
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
from ..models.difficulty_description import DifficultyDescription
|
||||
from ..models.event_ranking import EventRanking
|
||||
from ..models.leaderboard_change import LeaderboardChange
|
||||
from ..models.rank_qualification import RankQualification
|
||||
from ..models.rank_update import RankUpdate
|
||||
from ..models.song import Song
|
||||
|
||||
d = src_dict.copy()
|
||||
|
||||
def _parse_id(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
id = _parse_id(d.pop("id", UNSET))
|
||||
|
||||
def _parse_song_id(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
song_id = _parse_song_id(d.pop("songId", UNSET))
|
||||
|
||||
_song = d.pop("song", UNSET)
|
||||
song: Union[Unset, Song]
|
||||
if isinstance(_song, Unset):
|
||||
song = UNSET
|
||||
else:
|
||||
song = Song.from_dict(_song)
|
||||
|
||||
_difficulty = d.pop("difficulty", UNSET)
|
||||
difficulty: Union[Unset, DifficultyDescription]
|
||||
if isinstance(_difficulty, Unset):
|
||||
difficulty = UNSET
|
||||
else:
|
||||
difficulty = DifficultyDescription.from_dict(_difficulty)
|
||||
|
||||
_qualification = d.pop("qualification", UNSET)
|
||||
qualification: Union[Unset, RankQualification]
|
||||
if isinstance(_qualification, Unset):
|
||||
qualification = UNSET
|
||||
else:
|
||||
qualification = RankQualification.from_dict(_qualification)
|
||||
|
||||
_reweight = d.pop("reweight", UNSET)
|
||||
reweight: Union[Unset, RankUpdate]
|
||||
if isinstance(_reweight, Unset):
|
||||
reweight = UNSET
|
||||
else:
|
||||
reweight = RankUpdate.from_dict(_reweight)
|
||||
|
||||
timestamp = d.pop("timestamp", UNSET)
|
||||
|
||||
def _parse_changes(data: object) -> Union[List["LeaderboardChange"], None, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, list):
|
||||
raise TypeError()
|
||||
changes_type_0 = []
|
||||
_changes_type_0 = data
|
||||
for changes_type_0_item_data in _changes_type_0:
|
||||
changes_type_0_item = LeaderboardChange.from_dict(changes_type_0_item_data)
|
||||
|
||||
changes_type_0.append(changes_type_0_item)
|
||||
|
||||
return changes_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[List["LeaderboardChange"], None, Unset], data)
|
||||
|
||||
changes = _parse_changes(d.pop("changes", UNSET))
|
||||
|
||||
def _parse_events(data: object) -> Union[List["EventRanking"], None, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, list):
|
||||
raise TypeError()
|
||||
events_type_0 = []
|
||||
_events_type_0 = data
|
||||
for events_type_0_item_data in _events_type_0:
|
||||
events_type_0_item = EventRanking.from_dict(events_type_0_item_data)
|
||||
|
||||
events_type_0.append(events_type_0_item)
|
||||
|
||||
return events_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[List["EventRanking"], None, Unset], data)
|
||||
|
||||
events = _parse_events(d.pop("events", UNSET))
|
||||
|
||||
plays = d.pop("plays", UNSET)
|
||||
|
||||
play_count = d.pop("playCount", UNSET)
|
||||
|
||||
positive_votes = d.pop("positiveVotes", UNSET)
|
||||
|
||||
star_votes = d.pop("starVotes", UNSET)
|
||||
|
||||
negative_votes = d.pop("negativeVotes", UNSET)
|
||||
|
||||
vote_stars = d.pop("voteStars", UNSET)
|
||||
|
||||
def _parse_clan_id(data: object) -> Union[None, Unset, int]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, int], data)
|
||||
|
||||
clan_id = _parse_clan_id(d.pop("clanId", UNSET))
|
||||
|
||||
def _parse_captured_time(data: object) -> Union[None, Unset, int]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, int], data)
|
||||
|
||||
captured_time = _parse_captured_time(d.pop("capturedTime", UNSET))
|
||||
|
||||
clan_ranking_contested = d.pop("clanRankingContested", UNSET)
|
||||
|
||||
leaderboard = cls(
|
||||
id=id,
|
||||
song_id=song_id,
|
||||
song=song,
|
||||
difficulty=difficulty,
|
||||
qualification=qualification,
|
||||
reweight=reweight,
|
||||
timestamp=timestamp,
|
||||
changes=changes,
|
||||
events=events,
|
||||
plays=plays,
|
||||
play_count=play_count,
|
||||
positive_votes=positive_votes,
|
||||
star_votes=star_votes,
|
||||
negative_votes=negative_votes,
|
||||
vote_stars=vote_stars,
|
||||
clan_id=clan_id,
|
||||
captured_time=captured_time,
|
||||
clan_ranking_contested=clan_ranking_contested,
|
||||
)
|
||||
|
||||
return leaderboard
|
265
src/clients/beatleader/models/leaderboard_change.py
Normal file
265
src/clients/beatleader/models/leaderboard_change.py
Normal file
@ -0,0 +1,265 @@
|
||||
from typing import TYPE_CHECKING, Any, Dict, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.modifiers_map import ModifiersMap
|
||||
from ..models.modifiers_rating import ModifiersRating
|
||||
|
||||
|
||||
T = TypeVar("T", bound="LeaderboardChange")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class LeaderboardChange:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[Unset, int]):
|
||||
timeset (Union[Unset, int]):
|
||||
player_id (Union[None, Unset, str]):
|
||||
old_rankability (Union[Unset, float]):
|
||||
old_stars (Union[Unset, float]):
|
||||
old_acc_rating (Union[Unset, float]):
|
||||
old_pass_rating (Union[Unset, float]):
|
||||
old_tech_rating (Union[Unset, float]):
|
||||
old_type (Union[Unset, int]):
|
||||
old_criteria_met (Union[Unset, int]):
|
||||
old_modifiers (Union[Unset, ModifiersMap]):
|
||||
old_modifiers_rating (Union[Unset, ModifiersRating]):
|
||||
new_rankability (Union[Unset, float]):
|
||||
new_stars (Union[Unset, float]):
|
||||
new_acc_rating (Union[Unset, float]):
|
||||
new_pass_rating (Union[Unset, float]):
|
||||
new_tech_rating (Union[Unset, float]):
|
||||
new_type (Union[Unset, int]):
|
||||
new_criteria_met (Union[Unset, int]):
|
||||
new_modifiers (Union[Unset, ModifiersMap]):
|
||||
new_modifiers_rating (Union[Unset, ModifiersRating]):
|
||||
"""
|
||||
|
||||
id: Union[Unset, int] = UNSET
|
||||
timeset: Union[Unset, int] = UNSET
|
||||
player_id: Union[None, Unset, str] = UNSET
|
||||
old_rankability: Union[Unset, float] = UNSET
|
||||
old_stars: Union[Unset, float] = UNSET
|
||||
old_acc_rating: Union[Unset, float] = UNSET
|
||||
old_pass_rating: Union[Unset, float] = UNSET
|
||||
old_tech_rating: Union[Unset, float] = UNSET
|
||||
old_type: Union[Unset, int] = UNSET
|
||||
old_criteria_met: Union[Unset, int] = UNSET
|
||||
old_modifiers: Union[Unset, "ModifiersMap"] = UNSET
|
||||
old_modifiers_rating: Union[Unset, "ModifiersRating"] = UNSET
|
||||
new_rankability: Union[Unset, float] = UNSET
|
||||
new_stars: Union[Unset, float] = UNSET
|
||||
new_acc_rating: Union[Unset, float] = UNSET
|
||||
new_pass_rating: Union[Unset, float] = UNSET
|
||||
new_tech_rating: Union[Unset, float] = UNSET
|
||||
new_type: Union[Unset, int] = UNSET
|
||||
new_criteria_met: Union[Unset, int] = UNSET
|
||||
new_modifiers: Union[Unset, "ModifiersMap"] = UNSET
|
||||
new_modifiers_rating: Union[Unset, "ModifiersRating"] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id = self.id
|
||||
|
||||
timeset = self.timeset
|
||||
|
||||
player_id: Union[None, Unset, str]
|
||||
if isinstance(self.player_id, Unset):
|
||||
player_id = UNSET
|
||||
else:
|
||||
player_id = self.player_id
|
||||
|
||||
old_rankability = self.old_rankability
|
||||
|
||||
old_stars = self.old_stars
|
||||
|
||||
old_acc_rating = self.old_acc_rating
|
||||
|
||||
old_pass_rating = self.old_pass_rating
|
||||
|
||||
old_tech_rating = self.old_tech_rating
|
||||
|
||||
old_type = self.old_type
|
||||
|
||||
old_criteria_met = self.old_criteria_met
|
||||
|
||||
old_modifiers: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.old_modifiers, Unset):
|
||||
old_modifiers = self.old_modifiers.to_dict()
|
||||
|
||||
old_modifiers_rating: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.old_modifiers_rating, Unset):
|
||||
old_modifiers_rating = self.old_modifiers_rating.to_dict()
|
||||
|
||||
new_rankability = self.new_rankability
|
||||
|
||||
new_stars = self.new_stars
|
||||
|
||||
new_acc_rating = self.new_acc_rating
|
||||
|
||||
new_pass_rating = self.new_pass_rating
|
||||
|
||||
new_tech_rating = self.new_tech_rating
|
||||
|
||||
new_type = self.new_type
|
||||
|
||||
new_criteria_met = self.new_criteria_met
|
||||
|
||||
new_modifiers: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.new_modifiers, Unset):
|
||||
new_modifiers = self.new_modifiers.to_dict()
|
||||
|
||||
new_modifiers_rating: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.new_modifiers_rating, Unset):
|
||||
new_modifiers_rating = self.new_modifiers_rating.to_dict()
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if timeset is not UNSET:
|
||||
field_dict["timeset"] = timeset
|
||||
if player_id is not UNSET:
|
||||
field_dict["playerId"] = player_id
|
||||
if old_rankability is not UNSET:
|
||||
field_dict["oldRankability"] = old_rankability
|
||||
if old_stars is not UNSET:
|
||||
field_dict["oldStars"] = old_stars
|
||||
if old_acc_rating is not UNSET:
|
||||
field_dict["oldAccRating"] = old_acc_rating
|
||||
if old_pass_rating is not UNSET:
|
||||
field_dict["oldPassRating"] = old_pass_rating
|
||||
if old_tech_rating is not UNSET:
|
||||
field_dict["oldTechRating"] = old_tech_rating
|
||||
if old_type is not UNSET:
|
||||
field_dict["oldType"] = old_type
|
||||
if old_criteria_met is not UNSET:
|
||||
field_dict["oldCriteriaMet"] = old_criteria_met
|
||||
if old_modifiers is not UNSET:
|
||||
field_dict["oldModifiers"] = old_modifiers
|
||||
if old_modifiers_rating is not UNSET:
|
||||
field_dict["oldModifiersRating"] = old_modifiers_rating
|
||||
if new_rankability is not UNSET:
|
||||
field_dict["newRankability"] = new_rankability
|
||||
if new_stars is not UNSET:
|
||||
field_dict["newStars"] = new_stars
|
||||
if new_acc_rating is not UNSET:
|
||||
field_dict["newAccRating"] = new_acc_rating
|
||||
if new_pass_rating is not UNSET:
|
||||
field_dict["newPassRating"] = new_pass_rating
|
||||
if new_tech_rating is not UNSET:
|
||||
field_dict["newTechRating"] = new_tech_rating
|
||||
if new_type is not UNSET:
|
||||
field_dict["newType"] = new_type
|
||||
if new_criteria_met is not UNSET:
|
||||
field_dict["newCriteriaMet"] = new_criteria_met
|
||||
if new_modifiers is not UNSET:
|
||||
field_dict["newModifiers"] = new_modifiers
|
||||
if new_modifiers_rating is not UNSET:
|
||||
field_dict["newModifiersRating"] = new_modifiers_rating
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
from ..models.modifiers_map import ModifiersMap
|
||||
from ..models.modifiers_rating import ModifiersRating
|
||||
|
||||
d = src_dict.copy()
|
||||
id = d.pop("id", UNSET)
|
||||
|
||||
timeset = d.pop("timeset", UNSET)
|
||||
|
||||
def _parse_player_id(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
player_id = _parse_player_id(d.pop("playerId", UNSET))
|
||||
|
||||
old_rankability = d.pop("oldRankability", UNSET)
|
||||
|
||||
old_stars = d.pop("oldStars", UNSET)
|
||||
|
||||
old_acc_rating = d.pop("oldAccRating", UNSET)
|
||||
|
||||
old_pass_rating = d.pop("oldPassRating", UNSET)
|
||||
|
||||
old_tech_rating = d.pop("oldTechRating", UNSET)
|
||||
|
||||
old_type = d.pop("oldType", UNSET)
|
||||
|
||||
old_criteria_met = d.pop("oldCriteriaMet", UNSET)
|
||||
|
||||
_old_modifiers = d.pop("oldModifiers", UNSET)
|
||||
old_modifiers: Union[Unset, ModifiersMap]
|
||||
if isinstance(_old_modifiers, Unset):
|
||||
old_modifiers = UNSET
|
||||
else:
|
||||
old_modifiers = ModifiersMap.from_dict(_old_modifiers)
|
||||
|
||||
_old_modifiers_rating = d.pop("oldModifiersRating", UNSET)
|
||||
old_modifiers_rating: Union[Unset, ModifiersRating]
|
||||
if isinstance(_old_modifiers_rating, Unset):
|
||||
old_modifiers_rating = UNSET
|
||||
else:
|
||||
old_modifiers_rating = ModifiersRating.from_dict(_old_modifiers_rating)
|
||||
|
||||
new_rankability = d.pop("newRankability", UNSET)
|
||||
|
||||
new_stars = d.pop("newStars", UNSET)
|
||||
|
||||
new_acc_rating = d.pop("newAccRating", UNSET)
|
||||
|
||||
new_pass_rating = d.pop("newPassRating", UNSET)
|
||||
|
||||
new_tech_rating = d.pop("newTechRating", UNSET)
|
||||
|
||||
new_type = d.pop("newType", UNSET)
|
||||
|
||||
new_criteria_met = d.pop("newCriteriaMet", UNSET)
|
||||
|
||||
_new_modifiers = d.pop("newModifiers", UNSET)
|
||||
new_modifiers: Union[Unset, ModifiersMap]
|
||||
if isinstance(_new_modifiers, Unset):
|
||||
new_modifiers = UNSET
|
||||
else:
|
||||
new_modifiers = ModifiersMap.from_dict(_new_modifiers)
|
||||
|
||||
_new_modifiers_rating = d.pop("newModifiersRating", UNSET)
|
||||
new_modifiers_rating: Union[Unset, ModifiersRating]
|
||||
if isinstance(_new_modifiers_rating, Unset):
|
||||
new_modifiers_rating = UNSET
|
||||
else:
|
||||
new_modifiers_rating = ModifiersRating.from_dict(_new_modifiers_rating)
|
||||
|
||||
leaderboard_change = cls(
|
||||
id=id,
|
||||
timeset=timeset,
|
||||
player_id=player_id,
|
||||
old_rankability=old_rankability,
|
||||
old_stars=old_stars,
|
||||
old_acc_rating=old_acc_rating,
|
||||
old_pass_rating=old_pass_rating,
|
||||
old_tech_rating=old_tech_rating,
|
||||
old_type=old_type,
|
||||
old_criteria_met=old_criteria_met,
|
||||
old_modifiers=old_modifiers,
|
||||
old_modifiers_rating=old_modifiers_rating,
|
||||
new_rankability=new_rankability,
|
||||
new_stars=new_stars,
|
||||
new_acc_rating=new_acc_rating,
|
||||
new_pass_rating=new_pass_rating,
|
||||
new_tech_rating=new_tech_rating,
|
||||
new_type=new_type,
|
||||
new_criteria_met=new_criteria_met,
|
||||
new_modifiers=new_modifiers,
|
||||
new_modifiers_rating=new_modifiers_rating,
|
||||
)
|
||||
|
||||
return leaderboard_change
|
@ -0,0 +1,367 @@
|
||||
from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union, cast
|
||||
|
||||
from attrs import define as _attrs_define
|
||||
|
||||
from ..types import UNSET, Unset
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..models.clan_ranking_response import ClanRankingResponse
|
||||
from ..models.clan_response_full import ClanResponseFull
|
||||
from ..models.difficulty_response import DifficultyResponse
|
||||
from ..models.featured_playlist import FeaturedPlaylist
|
||||
from ..models.leaderboard_change import LeaderboardChange
|
||||
from ..models.leaderboard_group_entry import LeaderboardGroupEntry
|
||||
from ..models.rank_qualification import RankQualification
|
||||
from ..models.rank_update import RankUpdate
|
||||
from ..models.score_response import ScoreResponse
|
||||
from ..models.song_response import SongResponse
|
||||
|
||||
|
||||
T = TypeVar("T", bound="LeaderboardClanRankingResponse")
|
||||
|
||||
|
||||
@_attrs_define
|
||||
class LeaderboardClanRankingResponse:
|
||||
"""
|
||||
Attributes:
|
||||
id (Union[None, Unset, str]):
|
||||
song (Union[Unset, SongResponse]):
|
||||
difficulty (Union[Unset, DifficultyResponse]):
|
||||
scores (Union[List['ScoreResponse'], None, Unset]):
|
||||
changes (Union[List['LeaderboardChange'], None, Unset]):
|
||||
featured_playlists (Union[List['FeaturedPlaylist'], None, Unset]):
|
||||
qualification (Union[Unset, RankQualification]):
|
||||
reweight (Union[Unset, RankUpdate]):
|
||||
leaderboard_group (Union[List['LeaderboardGroupEntry'], None, Unset]):
|
||||
plays (Union[Unset, int]):
|
||||
clan (Union[Unset, ClanResponseFull]):
|
||||
clan_ranking_contested (Union[Unset, bool]):
|
||||
clan_ranking (Union[List['ClanRankingResponse'], None, Unset]):
|
||||
"""
|
||||
|
||||
id: Union[None, Unset, str] = UNSET
|
||||
song: Union[Unset, "SongResponse"] = UNSET
|
||||
difficulty: Union[Unset, "DifficultyResponse"] = UNSET
|
||||
scores: Union[List["ScoreResponse"], None, Unset] = UNSET
|
||||
changes: Union[List["LeaderboardChange"], None, Unset] = UNSET
|
||||
featured_playlists: Union[List["FeaturedPlaylist"], None, Unset] = UNSET
|
||||
qualification: Union[Unset, "RankQualification"] = UNSET
|
||||
reweight: Union[Unset, "RankUpdate"] = UNSET
|
||||
leaderboard_group: Union[List["LeaderboardGroupEntry"], None, Unset] = UNSET
|
||||
plays: Union[Unset, int] = UNSET
|
||||
clan: Union[Unset, "ClanResponseFull"] = UNSET
|
||||
clan_ranking_contested: Union[Unset, bool] = UNSET
|
||||
clan_ranking: Union[List["ClanRankingResponse"], None, Unset] = UNSET
|
||||
|
||||
def to_dict(self) -> Dict[str, Any]:
|
||||
id: Union[None, Unset, str]
|
||||
if isinstance(self.id, Unset):
|
||||
id = UNSET
|
||||
else:
|
||||
id = self.id
|
||||
|
||||
song: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.song, Unset):
|
||||
song = self.song.to_dict()
|
||||
|
||||
difficulty: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.difficulty, Unset):
|
||||
difficulty = self.difficulty.to_dict()
|
||||
|
||||
scores: Union[List[Dict[str, Any]], None, Unset]
|
||||
if isinstance(self.scores, Unset):
|
||||
scores = UNSET
|
||||
elif isinstance(self.scores, list):
|
||||
scores = []
|
||||
for scores_type_0_item_data in self.scores:
|
||||
scores_type_0_item = scores_type_0_item_data.to_dict()
|
||||
scores.append(scores_type_0_item)
|
||||
|
||||
else:
|
||||
scores = self.scores
|
||||
|
||||
changes: Union[List[Dict[str, Any]], None, Unset]
|
||||
if isinstance(self.changes, Unset):
|
||||
changes = UNSET
|
||||
elif isinstance(self.changes, list):
|
||||
changes = []
|
||||
for changes_type_0_item_data in self.changes:
|
||||
changes_type_0_item = changes_type_0_item_data.to_dict()
|
||||
changes.append(changes_type_0_item)
|
||||
|
||||
else:
|
||||
changes = self.changes
|
||||
|
||||
featured_playlists: Union[List[Dict[str, Any]], None, Unset]
|
||||
if isinstance(self.featured_playlists, Unset):
|
||||
featured_playlists = UNSET
|
||||
elif isinstance(self.featured_playlists, list):
|
||||
featured_playlists = []
|
||||
for featured_playlists_type_0_item_data in self.featured_playlists:
|
||||
featured_playlists_type_0_item = featured_playlists_type_0_item_data.to_dict()
|
||||
featured_playlists.append(featured_playlists_type_0_item)
|
||||
|
||||
else:
|
||||
featured_playlists = self.featured_playlists
|
||||
|
||||
qualification: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.qualification, Unset):
|
||||
qualification = self.qualification.to_dict()
|
||||
|
||||
reweight: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.reweight, Unset):
|
||||
reweight = self.reweight.to_dict()
|
||||
|
||||
leaderboard_group: Union[List[Dict[str, Any]], None, Unset]
|
||||
if isinstance(self.leaderboard_group, Unset):
|
||||
leaderboard_group = UNSET
|
||||
elif isinstance(self.leaderboard_group, list):
|
||||
leaderboard_group = []
|
||||
for leaderboard_group_type_0_item_data in self.leaderboard_group:
|
||||
leaderboard_group_type_0_item = leaderboard_group_type_0_item_data.to_dict()
|
||||
leaderboard_group.append(leaderboard_group_type_0_item)
|
||||
|
||||
else:
|
||||
leaderboard_group = self.leaderboard_group
|
||||
|
||||
plays = self.plays
|
||||
|
||||
clan: Union[Unset, Dict[str, Any]] = UNSET
|
||||
if not isinstance(self.clan, Unset):
|
||||
clan = self.clan.to_dict()
|
||||
|
||||
clan_ranking_contested = self.clan_ranking_contested
|
||||
|
||||
clan_ranking: Union[List[Dict[str, Any]], None, Unset]
|
||||
if isinstance(self.clan_ranking, Unset):
|
||||
clan_ranking = UNSET
|
||||
elif isinstance(self.clan_ranking, list):
|
||||
clan_ranking = []
|
||||
for clan_ranking_type_0_item_data in self.clan_ranking:
|
||||
clan_ranking_type_0_item = clan_ranking_type_0_item_data.to_dict()
|
||||
clan_ranking.append(clan_ranking_type_0_item)
|
||||
|
||||
else:
|
||||
clan_ranking = self.clan_ranking
|
||||
|
||||
field_dict: Dict[str, Any] = {}
|
||||
field_dict.update({})
|
||||
if id is not UNSET:
|
||||
field_dict["id"] = id
|
||||
if song is not UNSET:
|
||||
field_dict["song"] = song
|
||||
if difficulty is not UNSET:
|
||||
field_dict["difficulty"] = difficulty
|
||||
if scores is not UNSET:
|
||||
field_dict["scores"] = scores
|
||||
if changes is not UNSET:
|
||||
field_dict["changes"] = changes
|
||||
if featured_playlists is not UNSET:
|
||||
field_dict["featuredPlaylists"] = featured_playlists
|
||||
if qualification is not UNSET:
|
||||
field_dict["qualification"] = qualification
|
||||
if reweight is not UNSET:
|
||||
field_dict["reweight"] = reweight
|
||||
if leaderboard_group is not UNSET:
|
||||
field_dict["leaderboardGroup"] = leaderboard_group
|
||||
if plays is not UNSET:
|
||||
field_dict["plays"] = plays
|
||||
if clan is not UNSET:
|
||||
field_dict["clan"] = clan
|
||||
if clan_ranking_contested is not UNSET:
|
||||
field_dict["clanRankingContested"] = clan_ranking_contested
|
||||
if clan_ranking is not UNSET:
|
||||
field_dict["clanRanking"] = clan_ranking
|
||||
|
||||
return field_dict
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
|
||||
from ..models.clan_ranking_response import ClanRankingResponse
|
||||
from ..models.clan_response_full import ClanResponseFull
|
||||
from ..models.difficulty_response import DifficultyResponse
|
||||
from ..models.featured_playlist import FeaturedPlaylist
|
||||
from ..models.leaderboard_change import LeaderboardChange
|
||||
from ..models.leaderboard_group_entry import LeaderboardGroupEntry
|
||||
from ..models.rank_qualification import RankQualification
|
||||
from ..models.rank_update import RankUpdate
|
||||
from ..models.score_response import ScoreResponse
|
||||
from ..models.song_response import SongResponse
|
||||
|
||||
d = src_dict.copy()
|
||||
|
||||
def _parse_id(data: object) -> Union[None, Unset, str]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
return cast(Union[None, Unset, str], data)
|
||||
|
||||
id = _parse_id(d.pop("id", UNSET))
|
||||
|
||||
_song = d.pop("song", UNSET)
|
||||
song: Union[Unset, SongResponse]
|
||||
if isinstance(_song, Unset):
|
||||
song = UNSET
|
||||
else:
|
||||
song = SongResponse.from_dict(_song)
|
||||
|
||||
_difficulty = d.pop("difficulty", UNSET)
|
||||
difficulty: Union[Unset, DifficultyResponse]
|
||||
if isinstance(_difficulty, Unset):
|
||||
difficulty = UNSET
|
||||
else:
|
||||
difficulty = DifficultyResponse.from_dict(_difficulty)
|
||||
|
||||
def _parse_scores(data: object) -> Union[List["ScoreResponse"], None, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, list):
|
||||
raise TypeError()
|
||||
scores_type_0 = []
|
||||
_scores_type_0 = data
|
||||
for scores_type_0_item_data in _scores_type_0:
|
||||
scores_type_0_item = ScoreResponse.from_dict(scores_type_0_item_data)
|
||||
|
||||
scores_type_0.append(scores_type_0_item)
|
||||
|
||||
return scores_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[List["ScoreResponse"], None, Unset], data)
|
||||
|
||||
scores = _parse_scores(d.pop("scores", UNSET))
|
||||
|
||||
def _parse_changes(data: object) -> Union[List["LeaderboardChange"], None, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, list):
|
||||
raise TypeError()
|
||||
changes_type_0 = []
|
||||
_changes_type_0 = data
|
||||
for changes_type_0_item_data in _changes_type_0:
|
||||
changes_type_0_item = LeaderboardChange.from_dict(changes_type_0_item_data)
|
||||
|
||||
changes_type_0.append(changes_type_0_item)
|
||||
|
||||
return changes_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[List["LeaderboardChange"], None, Unset], data)
|
||||
|
||||
changes = _parse_changes(d.pop("changes", UNSET))
|
||||
|
||||
def _parse_featured_playlists(data: object) -> Union[List["FeaturedPlaylist"], None, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, list):
|
||||
raise TypeError()
|
||||
featured_playlists_type_0 = []
|
||||
_featured_playlists_type_0 = data
|
||||
for featured_playlists_type_0_item_data in _featured_playlists_type_0:
|
||||
featured_playlists_type_0_item = FeaturedPlaylist.from_dict(featured_playlists_type_0_item_data)
|
||||
|
||||
featured_playlists_type_0.append(featured_playlists_type_0_item)
|
||||
|
||||
return featured_playlists_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[List["FeaturedPlaylist"], None, Unset], data)
|
||||
|
||||
featured_playlists = _parse_featured_playlists(d.pop("featuredPlaylists", UNSET))
|
||||
|
||||
_qualification = d.pop("qualification", UNSET)
|
||||
qualification: Union[Unset, RankQualification]
|
||||
if isinstance(_qualification, Unset):
|
||||
qualification = UNSET
|
||||
else:
|
||||
qualification = RankQualification.from_dict(_qualification)
|
||||
|
||||
_reweight = d.pop("reweight", UNSET)
|
||||
reweight: Union[Unset, RankUpdate]
|
||||
if isinstance(_reweight, Unset):
|
||||
reweight = UNSET
|
||||
else:
|
||||
reweight = RankUpdate.from_dict(_reweight)
|
||||
|
||||
def _parse_leaderboard_group(data: object) -> Union[List["LeaderboardGroupEntry"], None, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, list):
|
||||
raise TypeError()
|
||||
leaderboard_group_type_0 = []
|
||||
_leaderboard_group_type_0 = data
|
||||
for leaderboard_group_type_0_item_data in _leaderboard_group_type_0:
|
||||
leaderboard_group_type_0_item = LeaderboardGroupEntry.from_dict(leaderboard_group_type_0_item_data)
|
||||
|
||||
leaderboard_group_type_0.append(leaderboard_group_type_0_item)
|
||||
|
||||
return leaderboard_group_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[List["LeaderboardGroupEntry"], None, Unset], data)
|
||||
|
||||
leaderboard_group = _parse_leaderboard_group(d.pop("leaderboardGroup", UNSET))
|
||||
|
||||
plays = d.pop("plays", UNSET)
|
||||
|
||||
_clan = d.pop("clan", UNSET)
|
||||
clan: Union[Unset, ClanResponseFull]
|
||||
if isinstance(_clan, Unset):
|
||||
clan = UNSET
|
||||
else:
|
||||
clan = ClanResponseFull.from_dict(_clan)
|
||||
|
||||
clan_ranking_contested = d.pop("clanRankingContested", UNSET)
|
||||
|
||||
def _parse_clan_ranking(data: object) -> Union[List["ClanRankingResponse"], None, Unset]:
|
||||
if data is None:
|
||||
return data
|
||||
if isinstance(data, Unset):
|
||||
return data
|
||||
try:
|
||||
if not isinstance(data, list):
|
||||
raise TypeError()
|
||||
clan_ranking_type_0 = []
|
||||
_clan_ranking_type_0 = data
|
||||
for clan_ranking_type_0_item_data in _clan_ranking_type_0:
|
||||
clan_ranking_type_0_item = ClanRankingResponse.from_dict(clan_ranking_type_0_item_data)
|
||||
|
||||
clan_ranking_type_0.append(clan_ranking_type_0_item)
|
||||
|
||||
return clan_ranking_type_0
|
||||
except: # noqa: E722
|
||||
pass
|
||||
return cast(Union[List["ClanRankingResponse"], None, Unset], data)
|
||||
|
||||
clan_ranking = _parse_clan_ranking(d.pop("clanRanking", UNSET))
|
||||
|
||||
leaderboard_clan_ranking_response = cls(
|
||||
id=id,
|
||||
song=song,
|
||||
difficulty=difficulty,
|
||||
scores=scores,
|
||||
changes=changes,
|
||||
featured_playlists=featured_playlists,
|
||||
qualification=qualification,
|
||||
reweight=reweight,
|
||||
leaderboard_group=leaderboard_group,
|
||||
plays=plays,
|
||||
clan=clan,
|
||||
clan_ranking_contested=clan_ranking_contested,
|
||||
clan_ranking=clan_ranking,
|
||||
)
|
||||
|
||||
return leaderboard_clan_ranking_response
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user