Metadata-Version: 2.4
Name: campaigner-edapi-client
Version: 1.1.1
Summary: A client library for accessing Campaigner EDAPI
Requires-Python: >=3.10,<4.0
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
Requires-Dist: attrs (>=22.2.0)
Requires-Dist: httpx (>=0.23.0,<0.29.0)
Requires-Dist: python-dateutil (>=2.8.0,<3.0.0)
Description-Content-Type: text/markdown

# campaigner-edapi-client

A Python client library for accessing the [Campaigner EDAPI](https://campaigner.com/).

## Installation

```bash
pip install campaigner-edapi-client
```

Or with uv:

```bash
uv add campaigner-edapi-client
```

## Usage

First, create a client:

```python
from campaigner_edapi_client import AuthenticatedClient

client = AuthenticatedClient(base_url="https://edapi.campaigner.com", token="your-api-key")
```

Now call your endpoint and use your models:

```python
from campaigner_edapi_client.api.campaigns import get_campaigns
from campaigner_edapi_client.types import Response

with client as client:
    campaigns = get_campaigns.sync(client=client)
    # or if you need more info (e.g. status_code)
    response: Response = get_campaigns.sync_detailed(client=client)
```

Or do the same thing with an async version:

```python
async with client as client:
    campaigns = await get_campaigns.asyncio(client=client)
    response = await get_campaigns.asyncio_detailed(client=client)
```

## Available API Modules

All endpoint functions live under `campaigner_edapi_client.api`:

| Module | Description |
|--------|-------------|
| `bounces` | Bounce management |
| `campaigns` | Campaign CRUD and activation |
| `creatives` | Email creative/template management |
| `database` | Database field operations |
| `file_imports` | File import operations |
| `filters` | Subscriber filter management |
| `ftp` | FTP operations |
| `image_library` | Image library management |
| `image_upload` | Image upload operations |
| `lists` | Mailing list management |
| `orders` | Order management |
| `ping` | API health check |
| `products` | Product catalog |
| `product_categories` | Product category management |
| `publications` | Publication management |
| `relay_sends` | Transactional/relay sends |
| `short_urls` | URL shortening |
| `smtp` | SMTP relay |
| `sources` | Source tracking |
| `subscribers` | Subscriber management |
| `suppression_lists` | Suppression list management |
| `workflows` | Automation workflow management |

## API Pattern

Every path/method combo becomes a Python module with four functions:

| Function | Description |
|----------|-------------|
| `sync` | Blocking request, returns parsed data or `None` |
| `sync_detailed` | Blocking request, returns full `Response` with status code |
| `asyncio` | Async version of `sync` |
| `asyncio_detailed` | Async version of `sync_detailed` |

All path/query params and request bodies become function arguments.

## SSL Configuration

Custom certificate bundle:

```python
client = AuthenticatedClient(
    base_url="https://edapi.campaigner.com",
    token="your-api-key",
    verify_ssl="/path/to/certificate_bundle.pem",
)
```

## Advanced Customization

You can customize the underlying `httpx.Client` or `httpx.AsyncClient`:

```python
from campaigner_edapi_client import AuthenticatedClient

def log_request(request):
    print(f"{request.method} {request.url}")

def log_response(response):
    print(f"{response.status_code}")

client = AuthenticatedClient(
    base_url="https://edapi.campaigner.com",
    token="your-api-key",
    httpx_args={"event_hooks": {"request": [log_request], "response": [log_response]}},
)
```

## Building / Publishing

This package is automatically published to PyPI via GitHub Actions when the version in `pyproject.toml` is bumped on `main`. To release a new version:

1. Update `version` in `pyproject.toml`
2. Merge to `main`
3. The release workflow will create a git tag and publish to PyPI

For local development in another project:

```bash
uv add campaigner-edapi-client --dev --editable ../campaigner/sdk/python
```

