Metadata-Version: 2.5
Name: linkit
Version: 0.4.0
Summary: Python client for the Linkit public API.
Project-URL: Homepage, https://github.com/thehamdiz/linkit
Project-URL: Documentation, https://docs.linkit.works/docs/guide/sdks/dart
Project-URL: Repository, https://github.com/thehamdiz/linkit
Author: thehamdiz
License-Expression: MIT
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: AsyncIO
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: httpx[http2]>=0.28
Requires-Dist: msgspec>=0.19
Provides-Extra: dev
Requires-Dist: build; extra == 'dev'
Requires-Dist: hatchling; extra == 'dev'
Requires-Dist: packaging>=24; extra == 'dev'
Requires-Dist: ruff>=0.8; extra == 'dev'
Provides-Extra: test
Requires-Dist: mypy>=1.13; extra == 'test'
Requires-Dist: pytest-asyncio>=0.24; extra == 'test'
Requires-Dist: pytest>=8.0; extra == 'test'
Requires-Dist: respx>=0.22; extra == 'test'
Description-Content-Type: text/markdown

# Linkit Python SDK

Runtime: Python 3.11 or later.

[Download the SDK](https://linkit.works/docs/downloads/sdks/python/linkit-0.4.0.tar.gz) and extract it into your application.

Extract the source archive and make its `src` directory available on your application's import path. The required runtime libraries are listed in `pyproject.toml`: httpx with HTTP/2 support and msgspec.

`orders.get` and `orders.list` decode the served order envelopes. `get_canonical`, `list_canonical`, `changes` and `iter_changes` expose canonical data and the cursor feed. Generated `public_api` calls return raw JSON bytes; decode those bytes with your application's JSON reader.

## Connect

```python
import asyncio
from linkit import LinkitClient, LinkitConfiguration

async def main():
    configuration = LinkitConfiguration(base_url="https://linkit.works", jwt_token=token)
    async with LinkitClient.create(configuration) as client:
        order = await client.orders.get("order-record-id")
        print(order.id)

asyncio.run(main())
```

## API use

Use the server origin, such as `https://linkit.works`, as the base URL. Pass IDs as stored; the SDK adds `/api/v1` and escapes path parameters. A branch's `iv_id`, its record `id`, a product ID and a SKU's `iv_id` are different identifiers.

Create branches and products before the SKUs that refer to them. Create orders with existing tenant records and a stable source identity. Order reads return snapshot envelopes; canonical reads normalize channel, status, amounts and lines. Persist the change-feed cursor after processing a page. A `304` means no changes; a `410` requires a new snapshot and cursor.

The generated public API service covers all 136 published operations. It also exposes customer addresses and groups, catalog metadata, offers, payment flows, queue status, analytics and webhook subscription management. Consult the API reference for each request body's fields. A method's route coverage does not grant permission to call it.

POST and PATCH are sent once. GET, HEAD, OPTIONS, PUT and DELETE may be retried after transient failures. Confirm the result of an uncertain write before repeating it. Health and ping omit bearer authentication; system health requires it.

Branch creation uses the dashboard's wallet rules. Trial and grace accounts are exempt; later, a shortfall returns `BILLING_INSUFFICIENT_WALLET_BALANCE` with the required and available SAR amounts. Only successfully inserted new branches incur activation fees.

## Order deletion

The existing raw `delete_orders_bulk` method has no body argument, so it cannot supply the `order_ids` required by bulk deletion. For individual deletes, call `client.public_api.delete_v1_orders(id)` for each order and check each result; separate deletes are not an atomic batch.

[API reference](https://linkit.works/docs/guide/api/overview) · [SDK coverage](https://linkit.works/docs/guide/sdks/coverage-matrix)

From the repository root, run `it sdk test --lang python --strict`.
