# Examples

Runnable example scripts are available in the [`examples/`](https://github.com/camodotgg/mcsrranked-python/tree/main/examples) directory.

## Available Examples

| Example | Description |
|---------|-------------|
| [`basic_usage.py`](#basic-usage) | Get started with the SDK |
| [`async_usage.py`](#async-usage) | Async client with concurrent requests |
| [`leaderboards.py`](#leaderboards) | Elo, phase, and record leaderboards |
| [`matches.py`](#matches) | Match listings and details |
| [`versus.py`](#versus) | Head-to-head player statistics |
| [`weekly_race.py`](#weekly-race) | Weekly race data |
| [`error_handling.py`](#error-handling) | Exception handling patterns |

## Running Examples

```bash
# Clone the repository
git clone https://github.com/camodotgg/mcsrranked-python
cd mcsrranked-python

# Install dependencies
uv sync

# Run an example
uv run python examples/basic_usage.py
```

---

## Basic Usage

```python title="examples/basic_usage.py"
--8<-- "examples/basic_usage.py"
```

---

## Async Usage

```python title="examples/async_usage.py"
--8<-- "examples/async_usage.py"
```

---

## Leaderboards

```python title="examples/leaderboards.py"
--8<-- "examples/leaderboards.py"
```

---

## Matches

```python title="examples/matches.py"
--8<-- "examples/matches.py"
```

---

## Versus

```python title="examples/versus.py"
--8<-- "examples/versus.py"
```

---

## Weekly Race

```python title="examples/weekly_race.py"
--8<-- "examples/weekly_race.py"
```

---

## Error Handling

```python title="examples/error_handling.py"
--8<-- "examples/error_handling.py"
```
