# Docufast Python SDK

Python SDK for the Docufast API. Provides programmatic CRUD access to workspaces, collections, documents, images, audio, videos, notes, entities, and locations.

## Installation

```bash
poetry add git+https://github.com/docufast/docufast-python.git
```

## Quick Start

```python
from docufast import Docufast

client = Docufast(api_key="df_sdk_xxx", base_url="http://localhost:5001")

# List workspaces
workspaces = client.workspaces.list()

# Upload a document
doc = client.documents.upload(
    collection_id="uuid",
    file_path="./invoice.pdf",
    external_metadata={"customer_id": "123"},
)

# Create a note
note = client.notes.create(
    collection_id="uuid",
    name="Meeting Notes",
    data="Discussion points...",
    external_metadata={"meeting_id": "456"},
)

# Entities and locations
entity = client.entities.create(name="Acme Corp", entity_type="company")
location = client.locations.create(name="Main Office", location="123 Main St")

client.close()
```

## Context Manager

```python
with Docufast(api_key="df_sdk_xxx") as client:
    workspaces = client.workspaces.list()
```

## Resources

| Resource | Methods |
|----------|---------|
| `client.workspaces` | `list()` |
| `client.collections` | `list(workspace_id)`, `create(...)`, `delete(id)` |
| `client.documents` | `upload(...)`, `get(id)`, `update_metadata(...)`, `download(id)`, `delete(id)` |
| `client.images` | `upload(...)`, `get(id)`, `update_metadata(...)`, `delete(id)` |
| `client.audio` | `upload(...)`, `get(id)`, `update_metadata(...)`, `delete(id)` |
| `client.videos` | `upload(...)`, `get(id)`, `update_metadata(...)`, `delete(id)` |
| `client.notes` | `create(...)`, `get(id)`, `update_metadata(...)`, `delete(id)` |
| `client.entities` | `list()`, `create(...)`, `get(id)`, `delete(id)`, `link_to_document(...)` |
| `client.locations` | `list()`, `create(...)`, `get(id)`, `delete(id)`, `link_to_document(...)` |

## Development

```bash
poetry install
poetry run pytest
```

## Deployment

```bash
./deploy.sh -m "fix: bug fix"              # Patch bump
./deploy.sh -m "feat: new feature" -i minor # Minor bump
./deploy.sh -d -m "test"                    # Dry run
```
