Metadata-Version: 2.4
Name: enfuce-nextgen-sdk
Version: 0.0.8
Summary: Enfuce nextgen client SDK (Python). One sub-package per API under enfuce_nextgen.
Author: Enfuce
License-Expression: MIT
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: urllib3<3.0.0,>=2.1.0
Requires-Dist: python_dateutil>=2.8.2
Requires-Dist: pydantic>=2.11
Requires-Dist: typing-extensions>=4.7.1

# enfuce-nextgen-sdk

Enfuce nextgen client SDK for Python. Each API is an isolated sub-package under
`enfuce_nextgen`, so identically-named models across APIs never collide.

## Installation

```bash
pip install enfuce-nextgen-sdk
```

## Usage

Every API module ships a fluent `<Module>Client` (e.g. `CardClient`, `ExchangeRateClient`) that
builds the `ApiClient`, installs OAuth, applies the host, and exposes each API:

```python
from enfuce_nextgen.oauth import client_credentials
from enfuce_nextgen.config import TenantEnvironment, issuer_base_url, token_url
from enfuce_nextgen.card import CardClient

# Identify the host by tenant + environment; the config helper derives every URL from it.
te = TenantEnvironment("<tenant>", "eu.live.prod")

# One token manager (cached client-credentials grant) — reuse it across every module.
clientCredentialsManager = client_credentials(
    token_url(te),
    "<client-id>", "<client-secret>", scopes=["issuer/admin.read"],
)

client = (
    CardClient.builder()
    .base_url(issuer_base_url(te))
    .oauth(clientCredentialsManager)                                          # token on every request + 401 retry
    .configure(lambda c: setattr(c, "proxy", "http://proxy:8080"))  # optional: TLS, retries, pool …
    .build()
)

card = client.get_card_api().get_card(card_id, x_audit_user="you@example.com")
```

`build()` works without `.oauth(...)` (unauthenticated), and `configure(lambda c: …)` hands you the
`Configuration` for transport settings (proxy, TLS, retries, connection pool). The same builder is
available for every module, including ones whose spec declares no security scheme
(e.g. `ExchangeRateClient`).

Timeouts are **per request** in the Python client — pass `_request_timeout` (seconds, or a
`(connect, read)` tuple) on any call:

```python
client.get_card_api().get_card(card_id, x_audit_user="you@example.com", _request_timeout=10)
```

Prefer the lower level? `enfuce_nextgen.oauth.oauth_configuration` / `oauth_api_client` build an
OAuth-enabled `Configuration` / `ApiClient` you can pass to an API class directly.

Keeping the token URL separate from the client identity? Pass a `ClientCredentials` — e.g. with the
`config` helper deriving the URL:
```python
from enfuce_nextgen.oauth import ClientCredentials, client_credentials
from enfuce_nextgen.config import TenantEnvironment, token_url

te = TenantEnvironment("<tenant>", "eu.live.prod")
clientCredentialsManager = client_credentials(
    token_url(te),
    ClientCredentials("<client-id>", "<client-secret>", ["issuer/admin.read"]),
)
```

## Available APIs

- `enfuce_nextgen.card`
- `enfuce_nextgen.wallet`
- `enfuce_nextgen.cardholder`
- `enfuce_nextgen.pin`
- `enfuce_nextgen.issuer_events`
- `enfuce_nextgen.authorisation_control`
- `enfuce_nextgen.cards`
- `enfuce_nextgen.threeds`
- `enfuce_nextgen.threeds_oob`
- `enfuce_nextgen.clearing_file_copy`
- `enfuce_nextgen.transaction_event`

## Requirements

- Python `>=3.9`
- pydantic `>=2`

## License

MIT
