# Generated Centrifugo RPC Client

**DO NOT EDIT** - This file is auto-generated.

## Overview

This directory contains auto-generated Python client code for Centrifugo WebSocket RPC.

## Regeneration

Base command:

```bash
poetry run python manage.py generate_centrifugo_clients --python
```

**Note**: Check `core/management/commands/` for a project-specific wrapper command or a Makefile target that handles output paths and file copying.

## Documentation

Full documentation: https://djangocfg.com/docs/features/integrations/centrifugo/

## Source

- **Generator**: `django_cfg.apps.integrations.centrifugo.codegen`
- **Command**: `generate_centrifugo_clients`
- **Django handlers**: Check your project's Centrifugo RPC handlers decorated with `@websocket_rpc`

## Files

| File | Description |
|------|-------------|
| `models.py` | Pydantic models for request/response types |
| `client.py` | Thin wrapper with typed RPC methods |
| `rpc_client.py` | Base Centrifugo RPC client |
| `__init__.py` | Public exports |

## Available Methods

{% if methods %}
{% for method in methods %}
- `{{ method.name_python }}()` - {{ method.docstring }}
{% endfor %}
{% else %}
No RPC methods discovered. Add `@websocket_rpc` decorated handlers.
{% endif %}

## CRITICAL: Authentication

### Token Types

| Token Type | Format | Usage |
|------------|--------|-------|
| **Centrifugo JWT** | `eyJhbGciOi...` | WebSocket connection - USE THIS! |
| CLI Token | `clit_xxx...` | REST API only - NOT for Centrifugo! |

### Getting Centrifugo JWT Token

```json
// GET /cfg/accounts/profile/
{
  "centrifugo": {
    "token": "eyJhbGciOi...",      // <-- Use for CentrifugoRPCClient
    "centrifugo_url": "ws://...",
    "channels": ["user#4"]
  }
}
```

Or use endpoint: `GET /cfg/centrifugo/auth/token/`

### Debugging

If Centrifugo server logs show `user: ""` (empty), authentication failed.
Check that you're using Centrifugo JWT, not CLI token!

## Usage Example

```python
from . import APIClient, CentrifugoRPCClient

# Create RPC client with JWT from profile["centrifugo"]["token"]
rpc = CentrifugoRPCClient(
    ws_url=profile["centrifugo"]["centrifugo_url"],
    token=profile["centrifugo"]["token"],  # Must be Centrifugo JWT!
)

# Create API client
api = APIClient(rpc)

# Call RPC methods
{% if methods %}
result = await api.{{ methods[0].name_python }}(params)
{% else %}
result = await api.some_method(params)
{% endif %}
```

---
Generated: {{ timestamp }}
