myle 0.1.0__py3-none-any.whl
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.
- myle/__init__.py +54 -0
- myle/_client.py +244 -0
- myle/_core.py +691 -0
- myle/_exceptions.py +192 -0
- myle/_version.py +9 -0
- myle/errors.py +1427 -0
- myle/models.py +4969 -0
- myle/py.typed +1 -0
- myle/resources/__init__.py +3 -0
- myle/resources/api_keys.py +714 -0
- myle/resources/companies.py +1352 -0
- myle/resources/company_email_addresses.py +507 -0
- myle/resources/company_postal_addresses.py +547 -0
- myle/resources/company_sepa_mandate.py +306 -0
- myle/resources/delivery_notes.py +124 -0
- myle/resources/einvoices.py +132 -0
- myle/resources/einvoicing_resource.py +655 -0
- myle/resources/incoming_einvoices.py +1094 -0
- myle/resources/invoice_correctable_invoices.py +148 -0
- myle/resources/invoice_credit_notes.py +152 -0
- myle/resources/invoice_payments.py +492 -0
- myle/resources/invoice_status_history.py +126 -0
- myle/resources/invoices.py +3607 -0
- myle/resources/me.py +109 -0
- myle/resources/my_api_keys.py +682 -0
- myle/resources/order_status_history.py +126 -0
- myle/resources/orders.py +2722 -0
- myle/resources/organization_scope.py +223 -0
- myle/resources/payments_account_resource.py +746 -0
- myle/resources/product_barcodes.py +488 -0
- myle/resources/products.py +973 -0
- myle/resources/quotation_status_history.py +126 -0
- myle/resources/quotations.py +2696 -0
- myle/resources/rights.py +108 -0
- myle/resources/search_companies.py +215 -0
- myle/resources/search_invoices.py +191 -0
- myle/resources/search_orders.py +217 -0
- myle/resources/search_products.py +211 -0
- myle/resources/search_quotations.py +207 -0
- myle-0.1.0.dist-info/METADATA +553 -0
- myle-0.1.0.dist-info/RECORD +43 -0
- myle-0.1.0.dist-info/WHEEL +4 -0
- myle-0.1.0.dist-info/licenses/LICENSE +55 -0
myle/__init__.py
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Generated by sdk/generator from the Myle API document (Myle-API-Version 2026-11-21).
|
|
2
|
+
# Do not edit: change the document or the generator, then run `python3 sdk/generator/generate.py`.
|
|
3
|
+
"""The official Python SDK of the Myle API (https://developers.myleapp.fr).
|
|
4
|
+
|
|
5
|
+
```python
|
|
6
|
+
from myle import Myle
|
|
7
|
+
|
|
8
|
+
myle = Myle() # MYLE_API_KEY
|
|
9
|
+
for product in myle.organization("organization_…").products.list(status="ACTIVE"):
|
|
10
|
+
print(product.name)
|
|
11
|
+
```
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from ._client import AsyncMyle as AsyncMyle, Myle as Myle
|
|
15
|
+
from ._core import (
|
|
16
|
+
NOT_GIVEN as NOT_GIVEN,
|
|
17
|
+
AsyncPage as AsyncPage,
|
|
18
|
+
AsyncPaginator as AsyncPaginator,
|
|
19
|
+
DeprecationNotice as DeprecationNotice,
|
|
20
|
+
FileDownload as FileDownload,
|
|
21
|
+
IfMatch as IfMatch,
|
|
22
|
+
MyleDeprecationWarning as MyleDeprecationWarning,
|
|
23
|
+
MyleObject as MyleObject,
|
|
24
|
+
NotGiven as NotGiven,
|
|
25
|
+
Page as Page,
|
|
26
|
+
Paginator as Paginator,
|
|
27
|
+
RequestOptions as RequestOptions,
|
|
28
|
+
ResponseInfo as ResponseInfo,
|
|
29
|
+
)
|
|
30
|
+
from ._version import API_VERSION as API_VERSION, VERSION as VERSION
|
|
31
|
+
from .errors import * # noqa: F403
|
|
32
|
+
from .errors import __all__ as _errors
|
|
33
|
+
from .models import * # noqa: F403
|
|
34
|
+
from .models import __all__ as _models
|
|
35
|
+
|
|
36
|
+
__all__ = [
|
|
37
|
+
"API_VERSION",
|
|
38
|
+
"AsyncMyle",
|
|
39
|
+
"AsyncPage",
|
|
40
|
+
"AsyncPaginator",
|
|
41
|
+
"DeprecationNotice",
|
|
42
|
+
"FileDownload",
|
|
43
|
+
"IfMatch",
|
|
44
|
+
"Myle",
|
|
45
|
+
"MyleDeprecationWarning",
|
|
46
|
+
"MyleObject",
|
|
47
|
+
"NOT_GIVEN",
|
|
48
|
+
"NotGiven",
|
|
49
|
+
"Page",
|
|
50
|
+
"Paginator",
|
|
51
|
+
"RequestOptions",
|
|
52
|
+
"ResponseInfo",
|
|
53
|
+
"VERSION",
|
|
54
|
+
] + _errors + _models
|
myle/_client.py
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
# Generated by sdk/generator from the Myle API document (Myle-API-Version 2026-11-21).
|
|
2
|
+
# Do not edit: change the document or the generator, then run `python3 sdk/generator/generate.py`.
|
|
3
|
+
"""The clients of the Myle API: ``Myle`` (sync) and ``AsyncMyle`` (async)."""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
from collections.abc import Callable, Mapping
|
|
8
|
+
from types import TracebackType
|
|
9
|
+
|
|
10
|
+
import httpx
|
|
11
|
+
|
|
12
|
+
from ._core import DEFAULT, DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT, AsyncClient, DeprecationNotice, SyncClient, _Default
|
|
13
|
+
from ._version import API_VERSION, VERSION
|
|
14
|
+
from .errors import ERROR_CLASSES
|
|
15
|
+
from .resources.me import AsyncMe, Me
|
|
16
|
+
from .resources.organization_scope import AsyncOrganizationScope, OrganizationScope
|
|
17
|
+
from .resources.rights import AsyncRights, Rights
|
|
18
|
+
from .resources.search_products import AsyncSearchProducts, SearchProducts
|
|
19
|
+
from .resources.search_companies import AsyncSearchCompanies, SearchCompanies
|
|
20
|
+
from .resources.search_invoices import AsyncSearchInvoices, SearchInvoices
|
|
21
|
+
from .resources.search_quotations import AsyncSearchQuotations, SearchQuotations
|
|
22
|
+
from .resources.search_orders import AsyncSearchOrders, SearchOrders
|
|
23
|
+
|
|
24
|
+
__all__ = ["AsyncMyle", "Myle"]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class Myle:
|
|
28
|
+
"""The client of the Myle API (https://api.myleapp.fr).
|
|
29
|
+
|
|
30
|
+
The API key is read from ``MYLE_API_KEY`` when not given. Every call sends ``Myle-API-Version``
|
|
31
|
+
(``2026-11-21`` unless ``api_version`` says otherwise), retries what is safe to retry, and raises a
|
|
32
|
+
``MyleApiError`` subclass named after the error code when the API refuses.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
api_key: An API key, user or organization (opaque); ``MYLE_API_KEY`` by default.
|
|
36
|
+
api_version: The ``Myle-API-Version`` to send (``YYYY-MM-DD``); this SDK's by default.
|
|
37
|
+
base_url: ``MYLE_BASE_URL``, else ``https://api.myleapp.fr``.
|
|
38
|
+
max_retries: Retries of a failed call (network, 429, 5xx when safe to repeat); 2.
|
|
39
|
+
timeout: The httpx timeout of an attempt, in seconds, for each phase (connect, each read, write); 60.
|
|
40
|
+
accept_language: The language of error messages: ``fr`` or ``en`` (the default).
|
|
41
|
+
default_headers: Headers sent with every request.
|
|
42
|
+
http_client: An ``httpx.Client`` of yours (proxies, transports).
|
|
43
|
+
on_deprecation: Called once per operation answered with an older behavior (``Deprecation``,
|
|
44
|
+
``Sunset``); a ``MyleDeprecationWarning`` by default, ``None`` to stay silent.
|
|
45
|
+
myle_client: The ``Myle-Client`` header (``<platform>/<version>``); ``sdk-python/<version>``.
|
|
46
|
+
|
|
47
|
+
Example:
|
|
48
|
+
```python
|
|
49
|
+
from myle import Myle
|
|
50
|
+
|
|
51
|
+
with Myle() as myle: # MYLE_API_KEY
|
|
52
|
+
org = myle.organization("organization_…")
|
|
53
|
+
for product in org.products.list(status="ACTIVE"):
|
|
54
|
+
print(product.name)
|
|
55
|
+
```
|
|
56
|
+
"""
|
|
57
|
+
|
|
58
|
+
def __init__(
|
|
59
|
+
self,
|
|
60
|
+
*,
|
|
61
|
+
api_key: str | None = None,
|
|
62
|
+
api_version: str = API_VERSION,
|
|
63
|
+
base_url: str | None = None,
|
|
64
|
+
max_retries: int = DEFAULT_MAX_RETRIES,
|
|
65
|
+
timeout: float = DEFAULT_TIMEOUT,
|
|
66
|
+
accept_language: str | None = None,
|
|
67
|
+
default_headers: Mapping[str, str] | None = None,
|
|
68
|
+
http_client: httpx.Client | None = None,
|
|
69
|
+
on_deprecation: Callable[[DeprecationNotice], None] | None | _Default = DEFAULT,
|
|
70
|
+
myle_client: str | None = None,
|
|
71
|
+
) -> None:
|
|
72
|
+
self._client = SyncClient(
|
|
73
|
+
http_client=http_client,
|
|
74
|
+
api_key=api_key,
|
|
75
|
+
api_version=api_version,
|
|
76
|
+
base_url=base_url,
|
|
77
|
+
max_retries=max_retries,
|
|
78
|
+
timeout=timeout,
|
|
79
|
+
accept_language=accept_language,
|
|
80
|
+
default_headers=default_headers,
|
|
81
|
+
on_deprecation=on_deprecation,
|
|
82
|
+
myle_client=myle_client or f"sdk-python/{VERSION}",
|
|
83
|
+
error_classes=ERROR_CLASSES,
|
|
84
|
+
)
|
|
85
|
+
self.me = Me(self._client)
|
|
86
|
+
"""The caller: the signed-in user, or the user an API key acts as (``/me``)."""
|
|
87
|
+
self.rights = Rights(self._client)
|
|
88
|
+
"""The rights of the Myle permission model, which members and API keys hold. ``/rights``."""
|
|
89
|
+
self.products = SearchProducts(self._client)
|
|
90
|
+
"""The organization's catalog: the products and services it sells, with their prices and barcodes.
|
|
91
|
+
``/products``.
|
|
92
|
+
"""
|
|
93
|
+
self.companies = SearchCompanies(self._client)
|
|
94
|
+
"""The organization's customers: businesses, consumers and foreign clients, with their addresses and e-mail
|
|
95
|
+
addresses. ``/companies``.
|
|
96
|
+
"""
|
|
97
|
+
self.invoices = SearchInvoices(self._client)
|
|
98
|
+
"""The organization's sales invoices: drafts, their validation (the legal number), their PDF and Factur-X.
|
|
99
|
+
``/invoices``.
|
|
100
|
+
"""
|
|
101
|
+
self.quotations = SearchQuotations(self._client)
|
|
102
|
+
"""The organization's quotations: the offers it makes its customers, sent, accepted or refused, extended,
|
|
103
|
+
and billed as invoices. ``/quotations``.
|
|
104
|
+
"""
|
|
105
|
+
self.orders = SearchOrders(self._client)
|
|
106
|
+
"""The organization's orders: what its customers order, confirmed, prepared, delivered (with the stock lots
|
|
107
|
+
the goods leave from) and billed. ``/orders``.
|
|
108
|
+
"""
|
|
109
|
+
|
|
110
|
+
@property
|
|
111
|
+
def api_version(self) -> str:
|
|
112
|
+
"""The ``Myle-API-Version`` this client sends."""
|
|
113
|
+
return self._client.api_version
|
|
114
|
+
|
|
115
|
+
def organization(self, organization_id: str) -> OrganizationScope:
|
|
116
|
+
"""The resources of one organization (``/organizations/{id}/…``). No request is made until you call a
|
|
117
|
+
method on it.
|
|
118
|
+
|
|
119
|
+
Args:
|
|
120
|
+
organization_id: The organization's id (``organization_…``; ``organisation_…`` is accepted).
|
|
121
|
+
"""
|
|
122
|
+
return OrganizationScope(self._client, organization_id)
|
|
123
|
+
|
|
124
|
+
def close(self) -> None:
|
|
125
|
+
"""Closes the HTTP connections (unless the httpx client was yours)."""
|
|
126
|
+
self._client.close()
|
|
127
|
+
|
|
128
|
+
def __enter__(self) -> Myle:
|
|
129
|
+
return self
|
|
130
|
+
|
|
131
|
+
def __exit__(
|
|
132
|
+
self, kind: type[BaseException] | None, error: BaseException | None, tb: TracebackType | None
|
|
133
|
+
) -> None:
|
|
134
|
+
self.close()
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
class AsyncMyle:
|
|
138
|
+
"""The async client of the Myle API (https://api.myleapp.fr).
|
|
139
|
+
|
|
140
|
+
The API key is read from ``MYLE_API_KEY`` when not given. Every call sends ``Myle-API-Version``
|
|
141
|
+
(``2026-11-21`` unless ``api_version`` says otherwise), retries what is safe to retry, and raises a
|
|
142
|
+
``MyleApiError`` subclass named after the error code when the API refuses.
|
|
143
|
+
|
|
144
|
+
Args:
|
|
145
|
+
api_key: An API key, user or organization (opaque); ``MYLE_API_KEY`` by default.
|
|
146
|
+
api_version: The ``Myle-API-Version`` to send (``YYYY-MM-DD``); this SDK's by default.
|
|
147
|
+
base_url: ``MYLE_BASE_URL``, else ``https://api.myleapp.fr``.
|
|
148
|
+
max_retries: Retries of a failed call (network, 429, 5xx when safe to repeat); 2.
|
|
149
|
+
timeout: The httpx timeout of an attempt, in seconds, for each phase (connect, each read, write); 60.
|
|
150
|
+
accept_language: The language of error messages: ``fr`` or ``en`` (the default).
|
|
151
|
+
default_headers: Headers sent with every request.
|
|
152
|
+
http_client: An ``httpx.AsyncClient`` of yours (proxies, transports).
|
|
153
|
+
on_deprecation: Called once per operation answered with an older behavior (``Deprecation``,
|
|
154
|
+
``Sunset``); a ``MyleDeprecationWarning`` by default, ``None`` to stay silent.
|
|
155
|
+
myle_client: The ``Myle-Client`` header (``<platform>/<version>``); ``sdk-python/<version>``.
|
|
156
|
+
|
|
157
|
+
Example:
|
|
158
|
+
```python
|
|
159
|
+
from myle import AsyncMyle
|
|
160
|
+
|
|
161
|
+
async with AsyncMyle() as myle: # MYLE_API_KEY
|
|
162
|
+
org = myle.organization("organization_…")
|
|
163
|
+
async for product in org.products.list(status="ACTIVE"):
|
|
164
|
+
print(product.name)
|
|
165
|
+
```
|
|
166
|
+
"""
|
|
167
|
+
|
|
168
|
+
def __init__(
|
|
169
|
+
self,
|
|
170
|
+
*,
|
|
171
|
+
api_key: str | None = None,
|
|
172
|
+
api_version: str = API_VERSION,
|
|
173
|
+
base_url: str | None = None,
|
|
174
|
+
max_retries: int = DEFAULT_MAX_RETRIES,
|
|
175
|
+
timeout: float = DEFAULT_TIMEOUT,
|
|
176
|
+
accept_language: str | None = None,
|
|
177
|
+
default_headers: Mapping[str, str] | None = None,
|
|
178
|
+
http_client: httpx.AsyncClient | None = None,
|
|
179
|
+
on_deprecation: Callable[[DeprecationNotice], None] | None | _Default = DEFAULT,
|
|
180
|
+
myle_client: str | None = None,
|
|
181
|
+
) -> None:
|
|
182
|
+
self._client = AsyncClient(
|
|
183
|
+
http_client=http_client,
|
|
184
|
+
api_key=api_key,
|
|
185
|
+
api_version=api_version,
|
|
186
|
+
base_url=base_url,
|
|
187
|
+
max_retries=max_retries,
|
|
188
|
+
timeout=timeout,
|
|
189
|
+
accept_language=accept_language,
|
|
190
|
+
default_headers=default_headers,
|
|
191
|
+
on_deprecation=on_deprecation,
|
|
192
|
+
myle_client=myle_client or f"sdk-python/{VERSION}",
|
|
193
|
+
error_classes=ERROR_CLASSES,
|
|
194
|
+
)
|
|
195
|
+
self.me = AsyncMe(self._client)
|
|
196
|
+
"""The caller: the signed-in user, or the user an API key acts as (``/me``)."""
|
|
197
|
+
self.rights = AsyncRights(self._client)
|
|
198
|
+
"""The rights of the Myle permission model, which members and API keys hold. ``/rights``."""
|
|
199
|
+
self.products = AsyncSearchProducts(self._client)
|
|
200
|
+
"""The organization's catalog: the products and services it sells, with their prices and barcodes.
|
|
201
|
+
``/products``.
|
|
202
|
+
"""
|
|
203
|
+
self.companies = AsyncSearchCompanies(self._client)
|
|
204
|
+
"""The organization's customers: businesses, consumers and foreign clients, with their addresses and e-mail
|
|
205
|
+
addresses. ``/companies``.
|
|
206
|
+
"""
|
|
207
|
+
self.invoices = AsyncSearchInvoices(self._client)
|
|
208
|
+
"""The organization's sales invoices: drafts, their validation (the legal number), their PDF and Factur-X.
|
|
209
|
+
``/invoices``.
|
|
210
|
+
"""
|
|
211
|
+
self.quotations = AsyncSearchQuotations(self._client)
|
|
212
|
+
"""The organization's quotations: the offers it makes its customers, sent, accepted or refused, extended,
|
|
213
|
+
and billed as invoices. ``/quotations``.
|
|
214
|
+
"""
|
|
215
|
+
self.orders = AsyncSearchOrders(self._client)
|
|
216
|
+
"""The organization's orders: what its customers order, confirmed, prepared, delivered (with the stock lots
|
|
217
|
+
the goods leave from) and billed. ``/orders``.
|
|
218
|
+
"""
|
|
219
|
+
|
|
220
|
+
@property
|
|
221
|
+
def api_version(self) -> str:
|
|
222
|
+
"""The ``Myle-API-Version`` this client sends."""
|
|
223
|
+
return self._client.api_version
|
|
224
|
+
|
|
225
|
+
def organization(self, organization_id: str) -> AsyncOrganizationScope:
|
|
226
|
+
"""The resources of one organization (``/organizations/{id}/…``). No request is made until you call a
|
|
227
|
+
method on it.
|
|
228
|
+
|
|
229
|
+
Args:
|
|
230
|
+
organization_id: The organization's id (``organization_…``; ``organisation_…`` is accepted).
|
|
231
|
+
"""
|
|
232
|
+
return AsyncOrganizationScope(self._client, organization_id)
|
|
233
|
+
|
|
234
|
+
async def close(self) -> None:
|
|
235
|
+
"""Closes the HTTP connections (unless the httpx client was yours)."""
|
|
236
|
+
await self._client.close()
|
|
237
|
+
|
|
238
|
+
async def __aenter__(self) -> AsyncMyle:
|
|
239
|
+
return self
|
|
240
|
+
|
|
241
|
+
async def __aexit__(
|
|
242
|
+
self, kind: type[BaseException] | None, error: BaseException | None, tb: TracebackType | None
|
|
243
|
+
) -> None:
|
|
244
|
+
await self.close()
|