transynq 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- transynq-1.0.0/.gitignore +11 -0
- transynq-1.0.0/CHANGELOG.md +23 -0
- transynq-1.0.0/LICENSE +21 -0
- transynq-1.0.0/PKG-INFO +146 -0
- transynq-1.0.0/README.md +117 -0
- transynq-1.0.0/pyproject.toml +67 -0
- transynq-1.0.0/src/transynq/__init__.py +57 -0
- transynq-1.0.0/src/transynq/_client.py +282 -0
- transynq-1.0.0/src/transynq/_core/__init__.py +1 -0
- transynq-1.0.0/src/transynq/_core/credentials.py +264 -0
- transynq-1.0.0/src/transynq/_core/errors.py +158 -0
- transynq-1.0.0/src/transynq/_core/http.py +502 -0
- transynq-1.0.0/src/transynq/_core/jsonenc.py +102 -0
- transynq-1.0.0/src/transynq/_core/models.py +36 -0
- transynq-1.0.0/src/transynq/_core/paging.py +40 -0
- transynq-1.0.0/src/transynq/_core/types.py +205 -0
- transynq-1.0.0/src/transynq/_generated/__init__.py +3 -0
- transynq-1.0.0/src/transynq/_generated/client_services.py +286 -0
- transynq-1.0.0/src/transynq/_generated/models.py +6996 -0
- transynq-1.0.0/src/transynq/_generated/services/__init__.py +3 -0
- transynq-1.0.0/src/transynq/_generated/services/account_invoices.py +80 -0
- transynq-1.0.0/src/transynq/_generated/services/accounting_systems.py +222 -0
- transynq-1.0.0/src/transynq/_generated/services/admin.py +140 -0
- transynq-1.0.0/src/transynq/_generated/services/aged_debtors.py +74 -0
- transynq-1.0.0/src/transynq/_generated/services/ai.py +256 -0
- transynq-1.0.0/src/transynq/_generated/services/authentication.py +129 -0
- transynq-1.0.0/src/transynq/_generated/services/background_jobs.py +61 -0
- transynq-1.0.0/src/transynq/_generated/services/bookings.py +265 -0
- transynq-1.0.0/src/transynq/_generated/services/check_lists.py +75 -0
- transynq-1.0.0/src/transynq/_generated/services/company.py +86 -0
- transynq-1.0.0/src/transynq/_generated/services/company_settings.py +121 -0
- transynq-1.0.0/src/transynq/_generated/services/compliance.py +132 -0
- transynq-1.0.0/src/transynq/_generated/services/costing.py +142 -0
- transynq-1.0.0/src/transynq/_generated/services/custom_pages.py +84 -0
- transynq-1.0.0/src/transynq/_generated/services/customer_statements.py +100 -0
- transynq-1.0.0/src/transynq/_generated/services/customers.py +504 -0
- transynq-1.0.0/src/transynq/_generated/services/dashboard.py +72 -0
- transynq-1.0.0/src/transynq/_generated/services/delivery_reports.py +39 -0
- transynq-1.0.0/src/transynq/_generated/services/dispatch.py +543 -0
- transynq-1.0.0/src/transynq/_generated/services/documents.py +75 -0
- transynq-1.0.0/src/transynq/_generated/services/driver_app.py +461 -0
- transynq-1.0.0/src/transynq/_generated/services/drivers.py +134 -0
- transynq-1.0.0/src/transynq/_generated/services/fleet.py +142 -0
- transynq-1.0.0/src/transynq/_generated/services/geography.py +484 -0
- transynq-1.0.0/src/transynq/_generated/services/grids.py +208 -0
- transynq-1.0.0/src/transynq/_generated/services/imports.py +248 -0
- transynq-1.0.0/src/transynq/_generated/services/integrations.py +164 -0
- transynq-1.0.0/src/transynq/_generated/services/interest.py +76 -0
- transynq-1.0.0/src/transynq/_generated/services/invoicing.py +497 -0
- transynq-1.0.0/src/transynq/_generated/services/jobs.py +1200 -0
- transynq-1.0.0/src/transynq/_generated/services/leg_splits.py +63 -0
- transynq-1.0.0/src/transynq/_generated/services/leg_templates.py +87 -0
- transynq-1.0.0/src/transynq/_generated/services/long_operations.py +52 -0
- transynq-1.0.0/src/transynq/_generated/services/lookups.py +109 -0
- transynq-1.0.0/src/transynq/_generated/services/mail.py +37 -0
- transynq-1.0.0/src/transynq/_generated/services/meta.py +36 -0
- transynq-1.0.0/src/transynq/_generated/services/notifications.py +163 -0
- transynq-1.0.0/src/transynq/_generated/services/pallets.py +102 -0
- transynq-1.0.0/src/transynq/_generated/services/photo_galleries.py +116 -0
- transynq-1.0.0/src/transynq/_generated/services/planning.py +101 -0
- transynq-1.0.0/src/transynq/_generated/services/pricing.py +353 -0
- transynq-1.0.0/src/transynq/_generated/services/products.py +138 -0
- transynq-1.0.0/src/transynq/_generated/services/reference_data.py +252 -0
- transynq-1.0.0/src/transynq/_generated/services/report_setup.py +94 -0
- transynq-1.0.0/src/transynq/_generated/services/sales_ledger.py +327 -0
- transynq-1.0.0/src/transynq/_generated/services/settings.py +286 -0
- transynq-1.0.0/src/transynq/_generated/services/spa.py +342 -0
- transynq-1.0.0/src/transynq/_generated/services/subcontractors.py +222 -0
- transynq-1.0.0/src/transynq/_generated/services/tracking.py +87 -0
- transynq-1.0.0/src/transynq/_generated/services/users.py +252 -0
- transynq-1.0.0/src/transynq/_generated/services/whats_app.py +211 -0
- transynq-1.0.0/src/transynq/_generated/services/yard.py +182 -0
- transynq-1.0.0/src/transynq/py.typed +0 -0
- transynq-1.0.0/tests/test_core.py +495 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this SDK are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
|
|
4
|
+
and the project uses [semantic versioning](https://semver.org/).
|
|
5
|
+
|
|
6
|
+
## [Unreleased]
|
|
7
|
+
|
|
8
|
+
## [1.0.0] - 2026-11-16
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- First release of the Python SDK, generated from the Transynq API OpenAPI contract v1.0.0
|
|
13
|
+
(SHA-256 `b48b3082dfaf0d1b177dd7b8704dfbeae4bfae2d3e57fae39705242e37a6a558`): 705 operations in 52 resource groups, 560 models.
|
|
14
|
+
- Credentials: API key (`X-Transynq-APIKey`), session sign-in with cookie and CSRF handling, driver login and driver token.
|
|
15
|
+
- Typed errors from ProblemDetails; retries with exponential back-off, jitter and `Retry-After`; per-call options.
|
|
16
|
+
- ETag / If-Match helpers, idempotent creates by client id, `Idempotency-Key`.
|
|
17
|
+
- Auto-paging, grid row iteration, long-running operation poller, multipart uploads and streamed downloads.
|
|
18
|
+
- Request/response hooks with secret redaction, correlation ids and `X-Api-Version` on every response.
|
|
19
|
+
- Requires Python 3.10 or later.
|
|
20
|
+
- Transynq branding for README, docs and package metadata.
|
|
21
|
+
|
|
22
|
+
[Unreleased]: https://github.com/qadir0108/transynq-sdk-python/compare/v1.0.0...HEAD
|
|
23
|
+
[1.0.0]: https://github.com/qadir0108/transynq-sdk-python/releases/tag/v1.0.0
|
transynq-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Transynq
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
transynq-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: transynq
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Official Python client for the Transynq TMS API
|
|
5
|
+
Project-URL: Homepage, https://github.com/qadir0108/transynq-sdk-python
|
|
6
|
+
Project-URL: Documentation, https://github.com/qadir0108/transynq-sdk-python/tree/main/docs
|
|
7
|
+
Project-URL: Repository, https://github.com/qadir0108/transynq-sdk-python
|
|
8
|
+
Project-URL: Changelog, https://github.com/qadir0108/transynq-sdk-python/blob/main/CHANGELOG.md
|
|
9
|
+
Author: Transynq
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Typing :: Typed
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Requires-Dist: httpx<1,>=0.25
|
|
17
|
+
Requires-Dist: pydantic<3,>=2.5
|
|
18
|
+
Requires-Dist: typing-extensions>=4.7
|
|
19
|
+
Provides-Extra: dev
|
|
20
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
21
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
22
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
23
|
+
Requires-Dist: respx>=0.21; extra == 'dev'
|
|
24
|
+
Requires-Dist: ruff>=0.5; extra == 'dev'
|
|
25
|
+
Provides-Extra: docs
|
|
26
|
+
Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
|
|
27
|
+
Requires-Dist: mkdocstrings[python]>=0.26; extra == 'docs'
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
<p align="center">
|
|
31
|
+
<img alt="Transynq - Intelligent Transport Operations" src="https://raw.githubusercontent.com/qadir0108/transynq-sdk-python/main/assets/brand/transynq-readme-banner.png" width="720">
|
|
32
|
+
</p>
|
|
33
|
+
|
|
34
|
+
<h1 align="center">Python SDK for the Transynq TMS API</h1>
|
|
35
|
+
|
|
36
|
+
<p align="center"><em>Intelligent Transport Operations</em></p>
|
|
37
|
+
|
|
38
|
+
<p align="center">
|
|
39
|
+
<a href="https://github.com/qadir0108/transynq-sdk-python/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/qadir0108/transynq-sdk-python/actions/workflows/ci.yml/badge.svg?branch=main"></a>
|
|
40
|
+
<a href="https://github.com/qadir0108/transynq-sdk-python/actions/workflows/release.yml"><img alt="Release" src="https://github.com/qadir0108/transynq-sdk-python/actions/workflows/release.yml/badge.svg"></a>
|
|
41
|
+
<a href="https://pypi.org/project/transynq/"><img alt="PyPI" src="https://img.shields.io/pypi/v/transynq?logo=pypi&logoColor=white&color=2563EB"></a>
|
|
42
|
+
<a href="https://pypi.org/project/transynq/"><img alt="Downloads" src="https://img.shields.io/pypi/dm/transynq?color=06B6D4"></a>
|
|
43
|
+
<img alt="Runtime" src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-3776AB?logo=python&logoColor=white">
|
|
44
|
+
<a href="LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-8B5CF6"></a>
|
|
45
|
+
<a href="docs/"><img alt="Docs" src="https://img.shields.io/badge/docs-guides-2563EB"></a>
|
|
46
|
+
<img alt="API operations" src="https://img.shields.io/badge/API%20operations-705-0B1220">
|
|
47
|
+
</p>
|
|
48
|
+
|
|
49
|
+
The official Python client for **Transynq TMS** (`/api/v1`): all 705 operations of the API, grouped by area (jobs,
|
|
50
|
+
bookings, dispatch, invoicing, customers, driver app...), with typed models, authentication, retries, typed errors, paging,
|
|
51
|
+
optimistic concurrency, file transfer and long-running operations handled for you.
|
|
52
|
+
|
|
53
|
+
- Package: `transynq` - version 1.0.0 (semantic versioning, independent of the API version)
|
|
54
|
+
- Generated from the Transynq API OpenAPI 3.1 contract v1.0.0 plus a hand-written core
|
|
55
|
+
- Licence: [MIT](LICENSE)
|
|
56
|
+
|
|
57
|
+
## Requirements
|
|
58
|
+
|
|
59
|
+
- Python 3.10 or later
|
|
60
|
+
- `httpx`, `pydantic` (v2) and `typing_extensions` (installed automatically)
|
|
61
|
+
|
|
62
|
+
## Install
|
|
63
|
+
|
|
64
|
+
```shell
|
|
65
|
+
pip install transynq
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Quick start
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
import os
|
|
72
|
+
|
|
73
|
+
from transynq import ApiKeyCredential, TransynqClient
|
|
74
|
+
|
|
75
|
+
with TransynqClient("https://api.example.com", credential=ApiKeyCredential(os.environ["TRANSYNQ_API_KEY"])) as client:
|
|
76
|
+
countries = client.reference_data.list_countries()
|
|
77
|
+
for country in countries.data:
|
|
78
|
+
print(country.name)
|
|
79
|
+
print(f"Answered by API {countries.api_version}, correlation id {countries.correlation_id}")
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
One attribute per OpenAPI tag (`client.jobs`, `client.reference_data`, `client.driver_app`...), one method per operation named after its `operationId` in snake case (`get_job`, `list_countries`). Path parameters are positional, then the body; query parameters and upload parts are keyword arguments (a name that is a Python keyword gets a trailing underscore: `from_`); `options=` takes `RequestOptions`. `AsyncTransynqClient` has the same surface with `async` methods.
|
|
83
|
+
|
|
84
|
+
Every call returns an `ApiResponse`: `ApiResponse[T]` exposes `data`, `status_code`, `headers`, `etag`, `api_version` (`X-Api-Version`), `correlation_id` (`X-Correlation-Id`), `location` and `is_accepted`.
|
|
85
|
+
|
|
86
|
+
## Authentication
|
|
87
|
+
|
|
88
|
+
The API accepts three non-browser credentials; pick the one that matches your integration.
|
|
89
|
+
|
|
90
|
+
| Credential | When | Wire |
|
|
91
|
+
|---|---|---|
|
|
92
|
+
| `ApiKeyCredential` | server-to-server integrations | `X-Transynq-APIKey: <key>` |
|
|
93
|
+
| `SessionCredential` | tools acting as a named user | `POST /api/v1/auth/login`, then the session cookie + `X-CSRF-Token` |
|
|
94
|
+
| `DriverLoginCredential` / `DriverTokenCredential` | driver / POD apps (`/api/v1/driver/*`) | `Authorization: Bearer <token>` |
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
client = TransynqClient("https://api.example.com", credential=ApiKeyCredential("tq_example_key_123")) # sent as X-Transynq-APIKey
|
|
98
|
+
who = client.authentication.get_api_client() # {"companyId": ..., "description": ...}
|
|
99
|
+
print(who.data.json())
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
See [docs/authentication.md](docs/authentication.md) for sessions, CSRF and driver tokens.
|
|
103
|
+
|
|
104
|
+
## Documentation
|
|
105
|
+
|
|
106
|
+
- [Getting started](docs/getting-started.md)
|
|
107
|
+
- [Authentication](docs/authentication.md)
|
|
108
|
+
- [Configuration](docs/configuration.md)
|
|
109
|
+
- [Error handling](docs/error-handling.md)
|
|
110
|
+
- [Pagination and grid queries](docs/pagination.md)
|
|
111
|
+
- [Concurrency (ETag / If-Match)](docs/concurrency.md)
|
|
112
|
+
- [Idempotency](docs/idempotency.md)
|
|
113
|
+
- [Long-running operations](docs/long-running-operations.md)
|
|
114
|
+
- [File upload and download](docs/files.md)
|
|
115
|
+
- [Logging and observability](docs/logging-and-observability.md)
|
|
116
|
+
- [Dates, money and enums (type mapping)](docs/types.md)
|
|
117
|
+
- [Testing your integration](docs/testing.md)
|
|
118
|
+
- [Versioning and compatibility](docs/versioning.md)
|
|
119
|
+
- [Troubleshooting and FAQ](docs/troubleshooting.md)
|
|
120
|
+
- [Resource index (every operation, generated)](docs/resources/README.md)
|
|
121
|
+
|
|
122
|
+
Runnable samples of real flows (sign in, list and page grid rows, create a booking idempotently, update with If-Match, list
|
|
123
|
+
invoices, upload a POD, wait on a long operation) are in [`examples/flows.py`](examples/flows.py).
|
|
124
|
+
|
|
125
|
+
The API reference is built from the docstrings with MkDocs Material + mkdocstrings (`mkdocs.yml` in this repository):
|
|
126
|
+
|
|
127
|
+
```shell
|
|
128
|
+
pip install -e ".[docs]"
|
|
129
|
+
mkdocs build --strict # writes site/ (not checked in)
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Support
|
|
133
|
+
|
|
134
|
+
- Bugs and feature requests: [GitHub issues](https://github.com/qadir0108/transynq-sdk-python/issues) (use the templates; never paste real keys, passwords or customer data).
|
|
135
|
+
- Security problems: see [SECURITY.md](SECURITY.md) - do not open a public issue.
|
|
136
|
+
- When the API answers with an error, quote its correlation id (`correlationId` on the error).
|
|
137
|
+
|
|
138
|
+
## Contributing
|
|
139
|
+
|
|
140
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) and the [code of conduct](CODE_OF_CONDUCT.md).
|
|
141
|
+
|
|
142
|
+
## Licence
|
|
143
|
+
|
|
144
|
+
[MIT](LICENSE) - Copyright (c) 2026 Transynq.
|
|
145
|
+
|
|
146
|
+
The Transynq name and logos are trademarks of Transynq and are not covered by the MIT licence; you may use them only to refer to Transynq.
|
transynq-1.0.0/README.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img alt="Transynq - Intelligent Transport Operations" src="https://raw.githubusercontent.com/qadir0108/transynq-sdk-python/main/assets/brand/transynq-readme-banner.png" width="720">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">Python SDK for the Transynq TMS API</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center"><em>Intelligent Transport Operations</em></p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://github.com/qadir0108/transynq-sdk-python/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/qadir0108/transynq-sdk-python/actions/workflows/ci.yml/badge.svg?branch=main"></a>
|
|
11
|
+
<a href="https://github.com/qadir0108/transynq-sdk-python/actions/workflows/release.yml"><img alt="Release" src="https://github.com/qadir0108/transynq-sdk-python/actions/workflows/release.yml/badge.svg"></a>
|
|
12
|
+
<a href="https://pypi.org/project/transynq/"><img alt="PyPI" src="https://img.shields.io/pypi/v/transynq?logo=pypi&logoColor=white&color=2563EB"></a>
|
|
13
|
+
<a href="https://pypi.org/project/transynq/"><img alt="Downloads" src="https://img.shields.io/pypi/dm/transynq?color=06B6D4"></a>
|
|
14
|
+
<img alt="Runtime" src="https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12%20%7C%203.13%20%7C%203.14-3776AB?logo=python&logoColor=white">
|
|
15
|
+
<a href="LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/license-MIT-8B5CF6"></a>
|
|
16
|
+
<a href="docs/"><img alt="Docs" src="https://img.shields.io/badge/docs-guides-2563EB"></a>
|
|
17
|
+
<img alt="API operations" src="https://img.shields.io/badge/API%20operations-705-0B1220">
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
The official Python client for **Transynq TMS** (`/api/v1`): all 705 operations of the API, grouped by area (jobs,
|
|
21
|
+
bookings, dispatch, invoicing, customers, driver app...), with typed models, authentication, retries, typed errors, paging,
|
|
22
|
+
optimistic concurrency, file transfer and long-running operations handled for you.
|
|
23
|
+
|
|
24
|
+
- Package: `transynq` - version 1.0.0 (semantic versioning, independent of the API version)
|
|
25
|
+
- Generated from the Transynq API OpenAPI 3.1 contract v1.0.0 plus a hand-written core
|
|
26
|
+
- Licence: [MIT](LICENSE)
|
|
27
|
+
|
|
28
|
+
## Requirements
|
|
29
|
+
|
|
30
|
+
- Python 3.10 or later
|
|
31
|
+
- `httpx`, `pydantic` (v2) and `typing_extensions` (installed automatically)
|
|
32
|
+
|
|
33
|
+
## Install
|
|
34
|
+
|
|
35
|
+
```shell
|
|
36
|
+
pip install transynq
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Quick start
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
import os
|
|
43
|
+
|
|
44
|
+
from transynq import ApiKeyCredential, TransynqClient
|
|
45
|
+
|
|
46
|
+
with TransynqClient("https://api.example.com", credential=ApiKeyCredential(os.environ["TRANSYNQ_API_KEY"])) as client:
|
|
47
|
+
countries = client.reference_data.list_countries()
|
|
48
|
+
for country in countries.data:
|
|
49
|
+
print(country.name)
|
|
50
|
+
print(f"Answered by API {countries.api_version}, correlation id {countries.correlation_id}")
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
One attribute per OpenAPI tag (`client.jobs`, `client.reference_data`, `client.driver_app`...), one method per operation named after its `operationId` in snake case (`get_job`, `list_countries`). Path parameters are positional, then the body; query parameters and upload parts are keyword arguments (a name that is a Python keyword gets a trailing underscore: `from_`); `options=` takes `RequestOptions`. `AsyncTransynqClient` has the same surface with `async` methods.
|
|
54
|
+
|
|
55
|
+
Every call returns an `ApiResponse`: `ApiResponse[T]` exposes `data`, `status_code`, `headers`, `etag`, `api_version` (`X-Api-Version`), `correlation_id` (`X-Correlation-Id`), `location` and `is_accepted`.
|
|
56
|
+
|
|
57
|
+
## Authentication
|
|
58
|
+
|
|
59
|
+
The API accepts three non-browser credentials; pick the one that matches your integration.
|
|
60
|
+
|
|
61
|
+
| Credential | When | Wire |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
| `ApiKeyCredential` | server-to-server integrations | `X-Transynq-APIKey: <key>` |
|
|
64
|
+
| `SessionCredential` | tools acting as a named user | `POST /api/v1/auth/login`, then the session cookie + `X-CSRF-Token` |
|
|
65
|
+
| `DriverLoginCredential` / `DriverTokenCredential` | driver / POD apps (`/api/v1/driver/*`) | `Authorization: Bearer <token>` |
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
client = TransynqClient("https://api.example.com", credential=ApiKeyCredential("tq_example_key_123")) # sent as X-Transynq-APIKey
|
|
69
|
+
who = client.authentication.get_api_client() # {"companyId": ..., "description": ...}
|
|
70
|
+
print(who.data.json())
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
See [docs/authentication.md](docs/authentication.md) for sessions, CSRF and driver tokens.
|
|
74
|
+
|
|
75
|
+
## Documentation
|
|
76
|
+
|
|
77
|
+
- [Getting started](docs/getting-started.md)
|
|
78
|
+
- [Authentication](docs/authentication.md)
|
|
79
|
+
- [Configuration](docs/configuration.md)
|
|
80
|
+
- [Error handling](docs/error-handling.md)
|
|
81
|
+
- [Pagination and grid queries](docs/pagination.md)
|
|
82
|
+
- [Concurrency (ETag / If-Match)](docs/concurrency.md)
|
|
83
|
+
- [Idempotency](docs/idempotency.md)
|
|
84
|
+
- [Long-running operations](docs/long-running-operations.md)
|
|
85
|
+
- [File upload and download](docs/files.md)
|
|
86
|
+
- [Logging and observability](docs/logging-and-observability.md)
|
|
87
|
+
- [Dates, money and enums (type mapping)](docs/types.md)
|
|
88
|
+
- [Testing your integration](docs/testing.md)
|
|
89
|
+
- [Versioning and compatibility](docs/versioning.md)
|
|
90
|
+
- [Troubleshooting and FAQ](docs/troubleshooting.md)
|
|
91
|
+
- [Resource index (every operation, generated)](docs/resources/README.md)
|
|
92
|
+
|
|
93
|
+
Runnable samples of real flows (sign in, list and page grid rows, create a booking idempotently, update with If-Match, list
|
|
94
|
+
invoices, upload a POD, wait on a long operation) are in [`examples/flows.py`](examples/flows.py).
|
|
95
|
+
|
|
96
|
+
The API reference is built from the docstrings with MkDocs Material + mkdocstrings (`mkdocs.yml` in this repository):
|
|
97
|
+
|
|
98
|
+
```shell
|
|
99
|
+
pip install -e ".[docs]"
|
|
100
|
+
mkdocs build --strict # writes site/ (not checked in)
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Support
|
|
104
|
+
|
|
105
|
+
- Bugs and feature requests: [GitHub issues](https://github.com/qadir0108/transynq-sdk-python/issues) (use the templates; never paste real keys, passwords or customer data).
|
|
106
|
+
- Security problems: see [SECURITY.md](SECURITY.md) - do not open a public issue.
|
|
107
|
+
- When the API answers with an error, quote its correlation id (`correlationId` on the error).
|
|
108
|
+
|
|
109
|
+
## Contributing
|
|
110
|
+
|
|
111
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) and the [code of conduct](CODE_OF_CONDUCT.md).
|
|
112
|
+
|
|
113
|
+
## Licence
|
|
114
|
+
|
|
115
|
+
[MIT](LICENSE) - Copyright (c) 2026 Transynq.
|
|
116
|
+
|
|
117
|
+
The Transynq name and logos are trademarks of Transynq and are not covered by the MIT licence; you may use them only to refer to Transynq.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.27"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "transynq"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Official Python client for the Transynq TMS API"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{ name = "Transynq" }]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Typing :: Typed",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
]
|
|
19
|
+
dependencies = [
|
|
20
|
+
"httpx>=0.25,<1",
|
|
21
|
+
"pydantic>=2.5,<3",
|
|
22
|
+
"typing_extensions>=4.7",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[project.urls]
|
|
26
|
+
Homepage = "https://github.com/qadir0108/transynq-sdk-python"
|
|
27
|
+
Documentation = "https://github.com/qadir0108/transynq-sdk-python/tree/main/docs"
|
|
28
|
+
Repository = "https://github.com/qadir0108/transynq-sdk-python"
|
|
29
|
+
Changelog = "https://github.com/qadir0108/transynq-sdk-python/blob/main/CHANGELOG.md"
|
|
30
|
+
|
|
31
|
+
[project.optional-dependencies]
|
|
32
|
+
dev = ["pytest>=8", "pytest-asyncio>=0.23", "respx>=0.21", "mypy>=1.10", "ruff>=0.5"]
|
|
33
|
+
docs = ["mkdocs-material>=9.5", "mkdocstrings[python]>=0.26"]
|
|
34
|
+
|
|
35
|
+
[tool.hatch.build.targets.wheel]
|
|
36
|
+
packages = ["src/transynq"]
|
|
37
|
+
|
|
38
|
+
[tool.hatch.build.targets.sdist]
|
|
39
|
+
include = ["src/transynq", "tests", "README.md", "CHANGELOG.md", "LICENSE", "pyproject.toml"]
|
|
40
|
+
exclude = ["assets", "docs", "site"]
|
|
41
|
+
|
|
42
|
+
[tool.pytest.ini_options]
|
|
43
|
+
testpaths = ["tests"]
|
|
44
|
+
asyncio_mode = "auto"
|
|
45
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
46
|
+
|
|
47
|
+
[tool.mypy]
|
|
48
|
+
strict = true
|
|
49
|
+
python_version = "3.10"
|
|
50
|
+
plugins = ["pydantic.mypy"]
|
|
51
|
+
files = ["src/transynq", "tests", "examples"]
|
|
52
|
+
|
|
53
|
+
[tool.pydantic-mypy]
|
|
54
|
+
init_forbid_extra = true
|
|
55
|
+
init_typed = true
|
|
56
|
+
|
|
57
|
+
[tool.ruff]
|
|
58
|
+
line-length = 160
|
|
59
|
+
target-version = "py310"
|
|
60
|
+
src = ["src", "tests"]
|
|
61
|
+
|
|
62
|
+
[tool.ruff.lint]
|
|
63
|
+
select = ["E", "F", "W", "I", "B", "UP", "RUF"]
|
|
64
|
+
ignore = ["UP006", "UP007", "UP035", "UP037", "UP045", "RUF022"]
|
|
65
|
+
|
|
66
|
+
[tool.ruff.lint.per-file-ignores]
|
|
67
|
+
"src/transynq/_generated/**" = ["E501", "RUF001", "RUF002", "RUF003"]
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"""Official Python client for the Transynq TMS API."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
from ._client import (
|
|
5
|
+
FAILED,
|
|
6
|
+
QUEUED,
|
|
7
|
+
RUNNING,
|
|
8
|
+
SUCCEEDED,
|
|
9
|
+
AsyncLongOperationPoller,
|
|
10
|
+
AsyncTransynqClient,
|
|
11
|
+
LongOperationPoller,
|
|
12
|
+
TransynqClient,
|
|
13
|
+
new_id,
|
|
14
|
+
new_idempotency_key,
|
|
15
|
+
read_modify_write,
|
|
16
|
+
read_modify_write_async,
|
|
17
|
+
)
|
|
18
|
+
from ._core.credentials import (
|
|
19
|
+
ApiKeyCredential,
|
|
20
|
+
Credential,
|
|
21
|
+
DriverLoginCredential,
|
|
22
|
+
DriverTokenCredential,
|
|
23
|
+
SessionCredential,
|
|
24
|
+
)
|
|
25
|
+
from ._core.errors import (
|
|
26
|
+
ApiError,
|
|
27
|
+
AuthenticationError,
|
|
28
|
+
BusinessRuleError,
|
|
29
|
+
ConflictError,
|
|
30
|
+
ConnectionError,
|
|
31
|
+
LongOperationFailedError,
|
|
32
|
+
NotFoundError,
|
|
33
|
+
PermissionDeniedError,
|
|
34
|
+
RateLimitError,
|
|
35
|
+
ServerError,
|
|
36
|
+
StaleVersionError,
|
|
37
|
+
TimeoutError,
|
|
38
|
+
TransynqError,
|
|
39
|
+
ValidationError,
|
|
40
|
+
)
|
|
41
|
+
from ._core.http import SDK_VERSION, ClientOptions
|
|
42
|
+
from ._core.models import PagedResponse, TransynqModel
|
|
43
|
+
from ._core.types import ApiResponse, FileDownload, FileUpload, RequestOptions, ResponseBody
|
|
44
|
+
from ._generated import models
|
|
45
|
+
from ._generated.client_services import API_VERSION, OPERATION_COUNT, SPEC_SHA256
|
|
46
|
+
|
|
47
|
+
__version__ = SDK_VERSION
|
|
48
|
+
|
|
49
|
+
__all__ = [
|
|
50
|
+
"API_VERSION", "FAILED", "OPERATION_COUNT", "QUEUED", "RUNNING", "SDK_VERSION", "SPEC_SHA256", "SUCCEEDED",
|
|
51
|
+
"ApiError", "ApiKeyCredential", "ApiResponse", "AsyncLongOperationPoller", "AsyncTransynqClient", "AuthenticationError",
|
|
52
|
+
"BusinessRuleError", "ClientOptions", "ConflictError", "ConnectionError", "Credential", "DriverLoginCredential",
|
|
53
|
+
"DriverTokenCredential", "FileDownload", "FileUpload", "LongOperationFailedError", "LongOperationPoller", "NotFoundError",
|
|
54
|
+
"PagedResponse", "PermissionDeniedError", "RateLimitError", "RequestOptions", "ResponseBody", "ServerError",
|
|
55
|
+
"SessionCredential", "StaleVersionError", "TimeoutError", "TransynqClient", "TransynqError", "TransynqModel",
|
|
56
|
+
"ValidationError", "models", "new_id", "new_idempotency_key", "read_modify_write", "read_modify_write_async",
|
|
57
|
+
]
|