Metadata-Version: 2.5
Name: uploadcenter
Version: 0.3.0
Summary: Official Python SDK for the UploadCenter API — file uploads, processing, and delivery.
Project-URL: Homepage, https://uploadcenter.com
Project-URL: Repository, https://github.com/uploadcenter/uploadcenter
Author: UploadCenter
License-Expression: MIT
Keywords: file-upload,sdk,storage,uploadcenter
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.9
Requires-Dist: attrs>=22.2.0
Requires-Dist: httpx<1.0.0,>=0.23.0
Requires-Dist: python-dateutil>=2.8.0
Requires-Dist: typing-extensions>=4.0.0
Description-Content-Type: text/markdown

# uploadcenter

Official Python SDK for the [UploadCenter](https://uploadcenter.com) API — presigned uploads, file processing, transforms, webhooks, AI generation, and more, fully typed and generated from UploadCenter's OpenAPI schema.

## Install

```bash
pip install uploadcenter
```

## Usage

```python
import httpx

from uploadcenter import create_client
from uploadcenter.generated.api.uploads import (
    complete_upload_endpoint_v1_uploads_complete_post as complete_upload,
)
from uploadcenter.generated.api.uploads import (
    presign_upload_endpoint_v1_uploads_presign_post as presign_upload,
)
from uploadcenter.generated.models import CompleteUploadRequest, PresignUploadRequest

client = create_client(
    base_url="https://api.uploadcenter.com",
    token="sk_live_...",  # an API key from your project settings
)

presigned = presign_upload.sync(
    client=client,
    body=PresignUploadRequest(
        project_id="project_...",
        filename="photo.jpg",
        size_bytes=len(file_bytes),
        mime_type="image/jpeg",
        visibility="private",
    ),
)

httpx.put(
    presigned.upload_url,
    content=file_bytes,
    headers={"Content-Type": "image/jpeg"},
)

complete_upload.sync(
    client=client,
    body=CompleteUploadRequest(file_id=presigned.file_id),
)
```

Async equivalents (`presign_upload.asyncio`, `complete_upload.asyncio`, ...) are available for every endpoint — use them with `httpx.AsyncClient` and `await` your own PUT request.

Every module under `uploadcenter.generated.api.<group>` mirrors an OpenAPI tag (`uploads`, `files`, `folders`, `projects`, `organizations`, `api_keys`, `domains`, `webhooks`, `notifications`, `usage`, `billing`, `auth`, `ai`, `brand_kit`), and exposes four functions per endpoint: `sync`, `sync_detailed`, `asyncio`, `asyncio_detailed`. Request/response models live under `uploadcenter.generated.models` and mirror the OpenAPI schema directly.

## AI generation

Image/video generation, editing, and semantic search — one provider per capability behind the scenes, swappable without any change to this SDK (see [docs/media-ai-platform.md](https://github.com/uploadcenter/uploadcenter/blob/main/docs/media-ai-platform.md)). Every generation call returns `202` immediately with a generation id; poll it (or listen for the `ai.generation.completed`/`ai.generation.failed` webhook) until it settles.

```python
from uploadcenter.generated.api.ai import (
    generate_image_endpoint_v1_ai_images_generate_post as generate_image,
)
from uploadcenter.generated.api.ai import (
    get_generation_endpoint_v1_ai_generations_generation_id_get as get_generation,
)
from uploadcenter.generated.models import GenerateImageRequest

generation = generate_image.sync(
    client=client,
    body=GenerateImageRequest(
        project_id="project_...",
        prompt="a minimalist logo of a fox, flat vector style",
        use_brand_kit=True,  # pulls in this org's brand_kit colors/fonts as style guidance
    ),
)

# Poll until it settles, then read the resulting file id(s) from result.file_ids.
result = get_generation.sync(generation.id, client=client, project_id="project_...")
```

The `ai` module also has `edit_image_endpoint_...`, `background_remove_endpoint_...`, `upscale_image_endpoint_...`, `image_variations_endpoint_...`, `analyze_image_endpoint_...` (auto-tagging/captioning), `generate_video_endpoint_...`, `image_to_video_endpoint_...`, `transcribe_video_endpoint_...`, and `semantic_search_endpoint_...` (natural-language search over your files). `uploadcenter.generated.api.files.similar_files_endpoint_...` finds files with a similar AI-generated caption.

`uploadcenter.generated.api.brand_kit` manages the org-level brand kit (colors, fonts, logo) referenced above — `get_brand_kit_endpoint_...` and `update_brand_kit_endpoint_...`.

## Regenerating (maintainers)

```bash
openapi-python-client generate --url http://127.0.0.1:8000/openapi.json --output-path src/uploadcenter/generated --meta none --overwrite
```

Requires the API running locally (`uvicorn app.main:app --reload` from `apps/api`, or adjust the port if running via Docker Compose) and `pip install openapi-python-client`.

## License

MIT
