Metadata-Version: 2.4
Name: elaunira-r2index
Version: 0.1.0
Summary: Python library for uploading files to R2 and registering them with the r2index API
Project-URL: Homepage, https://github.com/elaunira/elaunira-r2-index
Project-URL: Repository, https://github.com/elaunira/elaunira-r2-index
Author: Elaunira
License-Expression: MIT
Keywords: cloudflare,index,r2,storage,upload
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.12
Requires-Dist: aioboto3>=12.0.0
Requires-Dist: boto3>=1.34.0
Requires-Dist: httpx>=0.25.0
Requires-Dist: pydantic>=2.0.0
Provides-Extra: dev
Requires-Dist: boto3-stubs[s3]>=1.34.0; extra == 'dev'
Requires-Dist: build>=1.0.0; extra == 'dev'
Requires-Dist: mypy>=1.8.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
Requires-Dist: pytest-httpx>=0.30.0; extra == 'dev'
Requires-Dist: pytest>=8.0.0; extra == 'dev'
Requires-Dist: ruff>=0.3.0; extra == 'dev'
Requires-Dist: twine>=5.0.0; extra == 'dev'
Description-Content-Type: text/markdown

# elaunira-r2index

Python library for uploading files to Cloudflare R2 and registering them with the r2index API.

## Installation

```bash
pip install elaunira-r2index
```

## Usage

### Sync Client

```python
from elaunira.r2index import R2IndexClient, R2Config

client = R2IndexClient(
    api_url="https://r2index.example.com",
    api_token="your-bearer-token",
    r2_config=R2Config(
        access_key_id="your-r2-access-key-id",
        secret_access_key="your-r2-secret-access-key",
        endpoint_url="https://your-account-id.r2.cloudflarestorage.com",
        bucket="your-bucket-name",
    ),
)

# Upload and register a file
record = client.upload_and_register(
    file_path="./myfile.zip",
    category="software",
    entity="myapp",
    remote_path="/releases",
    remote_filename="myapp-1.0.0.zip",
    remote_version="1.0.0",
    tags=["release", "stable"],
)
```

### Async Client

```python
from elaunira.r2index import AsyncR2IndexClient, R2Config

async with AsyncR2IndexClient(
    api_url="https://r2index.example.com",
    api_token="your-bearer-token",
    r2_config=R2Config(
        access_key_id="your-r2-access-key-id",
        secret_access_key="your-r2-secret-access-key",
        endpoint_url="https://your-account-id.r2.cloudflarestorage.com",
        bucket="your-bucket-name",
    ),
) as client:
    record = await client.upload_and_register(
        file_path="./myfile.zip",
        category="software",
        entity="myapp",
        remote_path="/releases",
        remote_filename="myapp-1.0.0.zip",
        remote_version="1.0.0",
        tags=["release", "stable"],
    )
```

## License

MIT
