Metadata-Version: 2.4
Name: caronashow-api
Version: 0.5.5
Summary: Python client for CaronaShow APIs
Author-email: Lucas Santos <zerowhy.server@protonmail.com>
License-Expression: MIT
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
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: Programming Language :: Python :: 3.14
Classifier: Topic :: Internet
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: connectrpc>=0.9.0
Requires-Dist: protobuf>=7.34.0
Provides-Extra: dev
Requires-Dist: deptry>=0.25.0; extra == "dev"
Dynamic: license-file

# caronashow-api

Python client for CaronaShow APIs.

## Installation

```bash
pip install caronashow-api
```

## Usage

The code below is a minimal version and not comprehensive of all APIs.

To view the API definitions and types, consult the
`.protobuf` files or generated code.

### Pooler API client

```python
import asyncio

from caronashow.pooler.v1.pooler_connect import PoolerServiceClient
from caronashow.pooler.v1.pooler_pb2 import (
    MATCHING_ALGORITHM_RANDOM,
    ExecuteMatchingAlgorithmOnDatasetRequest,
)


async def main():
    # Create a client
    client = PoolerServiceClient("http://localhost:8080")

    # Make a request
    request = ExecuteMatchingAlgorithmOnDatasetRequest(
        dataset_id="dataset-123",
        algorithm=MATCHING_ALGORITHM_RANDOM,
    )

    # Call the service
    response = await client.execute_matching_algorithm_on_dataset(request)
    print(response.operation)


if __name__ == "__main__":
    asyncio.run(main())
```

### Pooler API server

```python
from caronashow.pooler.v1.pooler_connect import (
    PoolerService,
    PoolerServiceASGIApplication,
)
from caronashow.pooler.v1.pooler_pb2 import (
    ExecuteMatchingAlgorithmOnDatasetResponse,
    Operation,
    OperationState,
)


class Pooler(PoolerService):
    async def execute_matching_algorithm_on_dataset(self, request, ctx):
        print("Request headers:", ctx.request_headers())
        response = ExecuteMatchingAlgorithmOnDatasetResponse(
            operation=Operation(
                operation_id="op-123",
                dataset_id=request.dataset_id,
                state=OperationState.OPERATION_STATE_SUCCEEDED,
            )
        )
        return response


app = PoolerServiceASGIApplication(Pooler())
```

### Types

```python
from caronashow.types.v1 import user_pb2

# Create user objects
user = user_pb2.User(...)
```

## License

MIT License - see LICENSE file for details.

