Metadata-Version: 2.4
Name: shopvirge-client
Version: 0.2.2
Summary: A Python client library for the ShopVirge API
License: MIT
License-File: LICENSE
Keywords: shopvirge,api,client,openapi
Author: Rene Dohmen
Author-email: acidjunk@gmail.com
Requires-Python: >=3.9,<4.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
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: 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)
Project-URL: Repository, https://github.com/acidjunk/shopvirge-client
Description-Content-Type: text/markdown

# shopvirge-client

A Python client library for the [ShopVirge API](https://api.shopvirge.com/docs), auto-generated from the OpenAPI specification using [openapi-python-client](https://github.com/openapi-generators/openapi-python-client).

## Installation

```bash
pip install shopvirge-client
```

## Quick Start

### Unauthenticated requests

```python
from shopvirge_client import Client

# Uses https://api.shopvirge.com by default
client = Client()

# Or point to a different environment
client = Client(base_url="https://staging-api.shopvirge.com")
```

### Authentication

Most endpoints require authentication via an OAuth2 access token. First, obtain a token:

```python
from shopvirge_client import Client, AuthenticatedClient
from shopvirge_client.api.login import login_access_token_login_access_token_post as login
from shopvirge_client.models import BodyLoginAccessTokenLoginAccessTokenPost

# Get an access token
client = Client()
credentials = BodyLoginAccessTokenLoginAccessTokenPost(
    username="user@example.com",
    password="your-password",
)
response = login.sync(client=client, body=credentials)
token = response["access_token"]

# Create an authenticated client
auth_client = AuthenticatedClient(token=token)
```

### Making API calls

Every API endpoint has four functions:

- `sync()` — make a synchronous request, return the parsed response
- `sync_detailed()` — make a synchronous request, return a `Response` object with status code, headers, and parsed body
- `asyncio()` — async version of `sync()`
- `asyncio_detailed()` — async version of `sync_detailed()`

#### List shops

```python
from shopvirge_client.api.shops import get_multi_shops_get

shops = get_multi_shops_get.sync(client=auth_client)
```

#### Get a specific shop

```python
from shopvirge_client.api.shops import get_by_id_shops_id_get

shop = get_by_id_shops_id_get.sync(id="shop-uuid", client=auth_client)
```

#### Create an order

```python
from shopvirge_client.api.orders import create_orders_post
from shopvirge_client.models import OrderCreate

order = OrderCreate(
    shop_id="shop-uuid",
    # ... other fields
)
result = create_orders_post.sync(client=auth_client, body=order)
```

#### List products for a shop

```python
from shopvirge_client.api.shops import create_shops_shop_id_products_post

# Products, categories, tags, and attributes are all scoped under a shop
```

### Async usage

```python
import asyncio
from shopvirge_client import AuthenticatedClient
from shopvirge_client.api.shops import get_multi_shops_get

async def main():
    async with AuthenticatedClient(token="your-token") as client:
        shops = await get_multi_shops_get.asyncio(client=client)
        print(shops)

asyncio.run(main())
```

### Custom base URL

By default the client points to `https://api.shopvirge.com`. Override it for local development or staging:

```python
from shopvirge_client import Client, AuthenticatedClient

# Local development
client = Client(base_url="http://localhost:8000")

# Staging
auth_client = AuthenticatedClient(
    base_url="https://staging-api.shopvirge.com",
    token="your-token",
)
```

### Advanced configuration

```python
import httpx
from shopvirge_client import Client

client = Client(
    base_url="https://api.shopvirge.com",
    timeout=httpx.Timeout(30.0),
    follow_redirects=True,
    headers={"X-Custom-Header": "value"},
    cookies={"session": "abc123"},
    raise_on_unexpected_status=True,
)
```

## Available API modules

| Module | Description |
|--------|-------------|
| `api.login` | Authentication (login, token test, password recovery) |
| `api.users` | User management |
| `api.shops` | Shop CRUD, configuration, products, categories, tags, attributes, prices |
| `api.orders` | Order management |
| `api.licenses` | License management |
| `api.downloads` | File downloads |
| `api.forms` | Form submissions |
| `api.faq` | FAQ management |
| `api.images` | Image uploads (signed URLs) |
| `api.stripe` | Stripe payment integration |
| `api.early_access` | Early access signups |

## License

MIT

