Metadata-Version: 2.4
Name: antistock-api
Version: 0.1.0
Summary: Python wrapper for the Antistock Developer API.
Project-URL: Homepage, https://github.com/forgivenforget/antistock-api
Project-URL: Repository, https://github.com/forgivenforget/antistock-api
Project-URL: Issues, https://github.com/forgivenforget/antistock-api/issues
Author: forgivenforget
Maintainer: forgivenforget
License: MIT License
        
        Copyright (c) 2026 forgivenforget
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: antistock,api,ecommerce,sdk,wrapper
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: requests>=2.28
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == 'dev'
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Requires-Dist: twine>=5.0; extra == 'dev'
Description-Content-Type: text/markdown

# antistock-api

A typed Python wrapper for the [Antistock Developer API](https://business-api.antistock.io).

Covers all 88 endpoints across 17 resource groups (orders, products, customers, charges, coupons, FAQs, fraud rules, telegram broadcasts/users, tickets, warehouses, and more).

## Install

```bash
pip install antistock-api
```

Requires Python 3.11+.

## Quick start

```python
from antistock_api import AntistockClient, OrderStatus

with AntistockClient('your-jwt-token') as client:
    me = client.user.get_current()

    for order in client.orders.iter_all(
        shop_id = 'shop-uuid',
        status_filter = OrderStatus.COMPLETED,
        page_size = 100,
    ):
        print(order)

    client.products.create(
        shop_id = 'shop-uuid',
        body = {'name': 'New product', 'price': 10},
    )
```

## Features

- **Full coverage** — every endpoint in the OpenAPI spec, organized by resource (`client.orders`, `client.products`, `client.warehouses`, etc.)
- **Typed** — full `from __future__ import annotations` type hints, `py.typed` marker, enums for every spec enum
- **Pagination** — every list endpoint has a paired `iter_all(...)` generator that walks all pages
- **Auth** — bearer token (string) or callable `TokenProvider` for dynamic refresh
- **Errors** — typed exception hierarchy (`AntistockAuthenticationError`, `AntistockNotFoundError`, `AntistockRateLimitError`, etc.)
- **Retries** — exponential backoff on `429` and `5xx`, honors `Retry-After`
- **Context manager** — `with AntistockClient(...) as client:` for clean session shutdown

## Auth

```python
from antistock_api import AntistockClient

client = AntistockClient('your-jwt-token')

def get_token() -> str:
    return load_token_from_secrets_manager()

client = AntistockClient(get_token)
```

## Configuration

```python
from antistock_api import AntistockClient

client = AntistockClient(
    'your-jwt-token',
    base_url = 'https://business-api.antistock.io',
    timeout_seconds = 30.0,
    max_retries = 3,
    retry_backoff_seconds = 0.5,
)
```

## Errors

```python
from antistock_api import (
    AntistockClient,
    AntistockNotFoundError,
    AntistockRateLimitError,
)

try:
    client.orders.get('shop-uuid', 'missing-id')

except AntistockNotFoundError as E:
    print('order not found:', E.errors)

except AntistockRateLimitError as E:
    print('rate limited, retry after', E.retry_after_seconds)
```

## License

MIT
