# docstream-api-sdk

Generated server stubs and Pydantic models for the Docstream API, produced from the TypeSpec specification by the custom `@docstream/fastapi-server-emitter`.

## Installation

### From the private devpi registry

```bash
uv pip install --index-url "https://pypi.registry.hochguertel.work/root/dev/+simple/" docstream-api-sdk
```

Or with pip:

```bash
pip install --index-url "https://pypi.registry.hochguertel.work/root/dev/+simple/" docstream-api-sdk
```

### From the monorepo (development)

```bash
cd /path/to/docstream
uv sync --all-packages
```

## Usage

The SDK provides Pydantic models and FastAPI router stubs that match the TypeSpec API specification:

```python
from docstream_api_sdk.models.contexts import Context, Source, Transport
from docstream_api_sdk.models.common import RendererConfig
from docstream_api_sdk.models.errors import NotFoundError, ConflictError, ValidationError
```

The router stubs in `docstream_api_sdk.routers` raise `NotImplementedError` — they serve as the contract reference. Real implementations live in `apps/api-server/src/docstream_api/routes.py` and `apps/docstream-server/src/docstream_server/management_api.py`.

## Regeneration

The SDK is regenerated from the TypeSpec spec:

```bash
cd specs/api
npx tsp compile main.tsp --emit @docstream/fastapi-server-emitter
```

Output goes to `specs/api/generated-server/`.
