beatsaber-playlist-tool/docs/ClientUsage.md

28 lines
695 B
Markdown
Raw Permalink Normal View History

# openapi-python-client usage
Here's how to use the generated client for the BeatSaver API.
```python
import json
import os
import logging
from datetime import datetime, timedelta
from typing import Optional, Dict, Any
from clients.beatsaver.client import Client as beatsaver_client
from clients.beatsaver.api.maps import get_maps_latest
from clients.beatsaver.models import MapDetail, GetMapsLatestSort
logging.basicConfig(
format='%(asctime)s %(levelname)s: %(message)s',
datefmt='%Y-%m-%d %H:%M:%S',
level=logging.DEBUG
)
BASE_URL = "https://api.beatsaver.com"
beatsaver_client = beatsaver_client(base_url=BASE_URL)
maps = get_maps_latest.sync(client=beatsaver_client)
```