python-moloni-fix 0.3.16__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.
- moloni/__init__.py +0 -0
- moloni/__version__.py +1 -0
- moloni/api/__init__.py +701 -0
- moloni/api/bankaccounts_client.py +372 -0
- moloni/api/billsoflading_client.py +693 -0
- moloni/api/companies_client.py +322 -0
- moloni/api/countries_client.py +171 -0
- moloni/api/creditnotes_client.py +615 -0
- moloni/api/currencies_client.py +171 -0
- moloni/api/customeralternateaddresses_client.py +519 -0
- moloni/api/customerreturnnotes_client.py +701 -0
- moloni/api/customers_client.py +1413 -0
- moloni/api/debitnotes_client.py +597 -0
- moloni/api/deductions_client.py +435 -0
- moloni/api/deliverymethods_client.py +431 -0
- moloni/api/deliverynotes_client.py +714 -0
- moloni/api/documentmodels_client.py +171 -0
- moloni/api/documents_client.py +472 -0
- moloni/api/documentsets_client.py +447 -0
- moloni/api/estimates_client.py +663 -0
- moloni/api/fiscalzones_client.py +219 -0
- moloni/api/identificationtemplates_client.py +513 -0
- moloni/api/invoicereceipts_client.py +705 -0
- moloni/api/invoices_client.py +705 -0
- moloni/api/languages_client.py +171 -0
- moloni/api/maturitydates_client.py +441 -0
- moloni/api/measurementunits_client.py +437 -0
- moloni/api/ownassetsmovementguides_client.py +683 -0
- moloni/api/paymentmethods_client.py +429 -0
- moloni/api/productcategories_client.py +400 -0
- moloni/api/products_client.py +1252 -0
- moloni/api/receipts_client.py +591 -0
- moloni/api/salesmen_client.py +580 -0
- moloni/api/simplifiedinvoices_client.py +705 -0
- moloni/api/subscription_client.py +104 -0
- moloni/api/suppliers_client.py +1264 -0
- moloni/api/taxes_client.py +477 -0
- moloni/api/taxexemptions_client.py +171 -0
- moloni/api/users_client.py +104 -0
- moloni/api/vehicles_client.py +435 -0
- moloni/api/warehouses_client.py +506 -0
- moloni/api/waybills_client.py +699 -0
- moloni/base/__init__.py +24 -0
- moloni/base/client.py +164 -0
- moloni/base/config.py +6 -0
- moloni/base/helpers.py +150 -0
- moloni/base/logger_config.py +49 -0
- python_moloni_fix-0.3.16.dist-info/METADATA +231 -0
- python_moloni_fix-0.3.16.dist-info/RECORD +52 -0
- python_moloni_fix-0.3.16.dist-info/WHEEL +5 -0
- python_moloni_fix-0.3.16.dist-info/licenses/LICENSE +21 -0
- python_moloni_fix-0.3.16.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
from pydantic import BaseModel, ValidationError
|
|
2
|
+
from typing import Union, Optional, List, Any
|
|
3
|
+
|
|
4
|
+
from moloni.base.client import MoloniBaseClient
|
|
5
|
+
from moloni.base.helpers import endpoint, fill_query_params, validate_data
|
|
6
|
+
from moloni.base import ApiResponse
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ApiRequestModel(BaseModel):
|
|
10
|
+
_api_client: Any = None
|
|
11
|
+
|
|
12
|
+
def connect(self, *args, **kwargs):
|
|
13
|
+
self._api_client = BankaccountsClient(*args, **kwargs)
|
|
14
|
+
return self
|
|
15
|
+
|
|
16
|
+
def __enter__(self):
|
|
17
|
+
return self.connect()
|
|
18
|
+
|
|
19
|
+
def __exit__(self, exc_type, exc_value, traceback):
|
|
20
|
+
pass
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class BankaccountsCountModifiedSinceModel(ApiRequestModel):
|
|
24
|
+
company_id: Union[str, int]
|
|
25
|
+
lastmodified: Optional[str] = None
|
|
26
|
+
|
|
27
|
+
def request(self) -> ApiResponse:
|
|
28
|
+
"""
|
|
29
|
+
request(self) -> ApiResponse
|
|
30
|
+
|
|
31
|
+
Make an API request using the initialized client.
|
|
32
|
+
|
|
33
|
+
This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
|
|
34
|
+
If the client is initialized, it will make an API request using the provided method name and the model's data,
|
|
35
|
+
excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
|
|
36
|
+
|
|
37
|
+
Returns:
|
|
38
|
+
The response from the API.
|
|
39
|
+
|
|
40
|
+
Raises:
|
|
41
|
+
ValueError: If the client is not initialized via the `connect` method.
|
|
42
|
+
|
|
43
|
+
Example:
|
|
44
|
+
|
|
45
|
+
# Assuming you have a model instance `request_model` and an API client `api_client`
|
|
46
|
+
|
|
47
|
+
..code-block:: python
|
|
48
|
+
|
|
49
|
+
with request_model.connect(auth_config=auth_config) as api:
|
|
50
|
+
response = api.request()
|
|
51
|
+
|
|
52
|
+
# The above example assumes that the `connect` method has been used to initialize the client.
|
|
53
|
+
# The request method then sends the model's data to the API and returns the API's response.
|
|
54
|
+
|
|
55
|
+
"""
|
|
56
|
+
if hasattr(self, "_api_client"):
|
|
57
|
+
response = self._api_client.count_modified_since(
|
|
58
|
+
self.model_dump(exclude={"_api_client"}, exclude_unset=True)
|
|
59
|
+
)
|
|
60
|
+
return response
|
|
61
|
+
else:
|
|
62
|
+
raise ValueError("Client not initialized. Use the 'connect' method.")
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class BankaccountsDeleteModel(ApiRequestModel):
|
|
66
|
+
company_id: Union[str, int]
|
|
67
|
+
bank_account_id: Optional[Union[str, int]] = None
|
|
68
|
+
|
|
69
|
+
def request(self) -> ApiResponse:
|
|
70
|
+
"""
|
|
71
|
+
request(self) -> ApiResponse
|
|
72
|
+
|
|
73
|
+
Make an API request using the initialized client.
|
|
74
|
+
|
|
75
|
+
This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
|
|
76
|
+
If the client is initialized, it will make an API request using the provided method name and the model's data,
|
|
77
|
+
excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
|
|
78
|
+
|
|
79
|
+
Returns:
|
|
80
|
+
The response from the API.
|
|
81
|
+
|
|
82
|
+
Raises:
|
|
83
|
+
ValueError: If the client is not initialized via the `connect` method.
|
|
84
|
+
|
|
85
|
+
Example:
|
|
86
|
+
|
|
87
|
+
# Assuming you have a model instance `request_model` and an API client `api_client`
|
|
88
|
+
|
|
89
|
+
..code-block:: python
|
|
90
|
+
|
|
91
|
+
with request_model.connect(auth_config=auth_config) as api:
|
|
92
|
+
response = api.request()
|
|
93
|
+
|
|
94
|
+
# The above example assumes that the `connect` method has been used to initialize the client.
|
|
95
|
+
# The request method then sends the model's data to the API and returns the API's response.
|
|
96
|
+
|
|
97
|
+
"""
|
|
98
|
+
if hasattr(self, "_api_client"):
|
|
99
|
+
response = self._api_client.delete(
|
|
100
|
+
self.model_dump(exclude={"_api_client"}, exclude_unset=True)
|
|
101
|
+
)
|
|
102
|
+
return response
|
|
103
|
+
else:
|
|
104
|
+
raise ValueError("Client not initialized. Use the 'connect' method.")
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
class BankaccountsGetAllModel(ApiRequestModel):
|
|
108
|
+
company_id: Union[str, int]
|
|
109
|
+
|
|
110
|
+
def request(self) -> ApiResponse:
|
|
111
|
+
"""
|
|
112
|
+
request(self) -> ApiResponse
|
|
113
|
+
|
|
114
|
+
Make an API request using the initialized client.
|
|
115
|
+
|
|
116
|
+
This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
|
|
117
|
+
If the client is initialized, it will make an API request using the provided method name and the model's data,
|
|
118
|
+
excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
|
|
119
|
+
|
|
120
|
+
Returns:
|
|
121
|
+
The response from the API.
|
|
122
|
+
|
|
123
|
+
Raises:
|
|
124
|
+
ValueError: If the client is not initialized via the `connect` method.
|
|
125
|
+
|
|
126
|
+
Example:
|
|
127
|
+
|
|
128
|
+
# Assuming you have a model instance `request_model` and an API client `api_client`
|
|
129
|
+
|
|
130
|
+
..code-block:: python
|
|
131
|
+
|
|
132
|
+
with request_model.connect(auth_config=auth_config) as api:
|
|
133
|
+
response = api.request()
|
|
134
|
+
|
|
135
|
+
# The above example assumes that the `connect` method has been used to initialize the client.
|
|
136
|
+
# The request method then sends the model's data to the API and returns the API's response.
|
|
137
|
+
|
|
138
|
+
"""
|
|
139
|
+
if hasattr(self, "_api_client"):
|
|
140
|
+
response = self._api_client.get_all(
|
|
141
|
+
self.model_dump(exclude={"_api_client"}, exclude_unset=True)
|
|
142
|
+
)
|
|
143
|
+
return response
|
|
144
|
+
else:
|
|
145
|
+
raise ValueError("Client not initialized. Use the 'connect' method.")
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
class BankaccountsInsertModel(ApiRequestModel):
|
|
149
|
+
company_id: Union[str, int]
|
|
150
|
+
name: Optional[str] = None
|
|
151
|
+
order: Optional[str] = None
|
|
152
|
+
value: Optional[str] = None
|
|
153
|
+
|
|
154
|
+
def request(self) -> ApiResponse:
|
|
155
|
+
"""
|
|
156
|
+
request(self) -> ApiResponse
|
|
157
|
+
|
|
158
|
+
Make an API request using the initialized client.
|
|
159
|
+
|
|
160
|
+
This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
|
|
161
|
+
If the client is initialized, it will make an API request using the provided method name and the model's data,
|
|
162
|
+
excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
|
|
163
|
+
|
|
164
|
+
Returns:
|
|
165
|
+
The response from the API.
|
|
166
|
+
|
|
167
|
+
Raises:
|
|
168
|
+
ValueError: If the client is not initialized via the `connect` method.
|
|
169
|
+
|
|
170
|
+
Example:
|
|
171
|
+
|
|
172
|
+
# Assuming you have a model instance `request_model` and an API client `api_client`
|
|
173
|
+
|
|
174
|
+
..code-block:: python
|
|
175
|
+
|
|
176
|
+
with request_model.connect(auth_config=auth_config) as api:
|
|
177
|
+
response = api.request()
|
|
178
|
+
|
|
179
|
+
# The above example assumes that the `connect` method has been used to initialize the client.
|
|
180
|
+
# The request method then sends the model's data to the API and returns the API's response.
|
|
181
|
+
|
|
182
|
+
"""
|
|
183
|
+
if hasattr(self, "_api_client"):
|
|
184
|
+
response = self._api_client.insert(
|
|
185
|
+
self.model_dump(exclude={"_api_client"}, exclude_unset=True)
|
|
186
|
+
)
|
|
187
|
+
return response
|
|
188
|
+
else:
|
|
189
|
+
raise ValueError("Client not initialized. Use the 'connect' method.")
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
class BankaccountsUpdateModel(ApiRequestModel):
|
|
193
|
+
company_id: Union[str, int]
|
|
194
|
+
bank_account_id: Optional[Union[str, int]] = None
|
|
195
|
+
name: Optional[str] = None
|
|
196
|
+
order: Optional[str] = None
|
|
197
|
+
value: Optional[str] = None
|
|
198
|
+
|
|
199
|
+
def request(self) -> ApiResponse:
|
|
200
|
+
"""
|
|
201
|
+
request(self) -> ApiResponse
|
|
202
|
+
|
|
203
|
+
Make an API request using the initialized client.
|
|
204
|
+
|
|
205
|
+
This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
|
|
206
|
+
If the client is initialized, it will make an API request using the provided method name and the model's data,
|
|
207
|
+
excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
|
|
208
|
+
|
|
209
|
+
Returns:
|
|
210
|
+
The response from the API.
|
|
211
|
+
|
|
212
|
+
Raises:
|
|
213
|
+
ValueError: If the client is not initialized via the `connect` method.
|
|
214
|
+
|
|
215
|
+
Example:
|
|
216
|
+
|
|
217
|
+
# Assuming you have a model instance `request_model` and an API client `api_client`
|
|
218
|
+
|
|
219
|
+
..code-block:: python
|
|
220
|
+
|
|
221
|
+
with request_model.connect(auth_config=auth_config) as api:
|
|
222
|
+
response = api.request()
|
|
223
|
+
|
|
224
|
+
# The above example assumes that the `connect` method has been used to initialize the client.
|
|
225
|
+
# The request method then sends the model's data to the API and returns the API's response.
|
|
226
|
+
|
|
227
|
+
"""
|
|
228
|
+
if hasattr(self, "_api_client"):
|
|
229
|
+
response = self._api_client.update(
|
|
230
|
+
self.model_dump(exclude={"_api_client"}, exclude_unset=True)
|
|
231
|
+
)
|
|
232
|
+
return response
|
|
233
|
+
else:
|
|
234
|
+
raise ValueError("Client not initialized. Use the 'connect' method.")
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
class BankaccountsClient(MoloniBaseClient):
|
|
238
|
+
|
|
239
|
+
@endpoint("/<version>/bankAccounts/countModifiedSince/", method="post")
|
|
240
|
+
def count_modified_since(
|
|
241
|
+
self, data: Union[BankaccountsCountModifiedSinceModel, dict], **kwargs
|
|
242
|
+
):
|
|
243
|
+
"""
|
|
244
|
+
count_modified_since(self, data: Union[BankaccountsCountModifiedSinceModel, dict], **kwargs)
|
|
245
|
+
|
|
246
|
+
Args:
|
|
247
|
+
|
|
248
|
+
data (Union[BankaccountsCountModifiedSinceModel, dict]): A model instance or dictionary containing the following fields:
|
|
249
|
+
|
|
250
|
+
- company_id (Union[str, int]): company_id of the BankaccountsCountModifiedSinceModel.
|
|
251
|
+
|
|
252
|
+
- lastmodified (str): lastmodified of the BankaccountsCountModifiedSinceModel.
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
Returns:
|
|
257
|
+
ApiResponse: The response from the API.
|
|
258
|
+
"""
|
|
259
|
+
|
|
260
|
+
data = validate_data(data, self.validate, BankaccountsCountModifiedSinceModel)
|
|
261
|
+
|
|
262
|
+
return self._request(
|
|
263
|
+
fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
|
|
264
|
+
)
|
|
265
|
+
|
|
266
|
+
@endpoint("/<version>/bankAccounts/delete/", method="post")
|
|
267
|
+
def delete(self, data: Union[BankaccountsDeleteModel, dict], **kwargs):
|
|
268
|
+
"""
|
|
269
|
+
delete(self, data: Union[BankaccountsDeleteModel, dict], **kwargs)
|
|
270
|
+
|
|
271
|
+
Args:
|
|
272
|
+
|
|
273
|
+
data (Union[BankaccountsDeleteModel, dict]): A model instance or dictionary containing the following fields:
|
|
274
|
+
|
|
275
|
+
- bank_account_id (Union[str, int]): bank_account_id of the BankaccountsDeleteModel.
|
|
276
|
+
|
|
277
|
+
- company_id (Union[str, int]): company_id of the BankaccountsDeleteModel.
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
Returns:
|
|
282
|
+
ApiResponse: The response from the API.
|
|
283
|
+
"""
|
|
284
|
+
|
|
285
|
+
data = validate_data(data, self.validate, BankaccountsDeleteModel)
|
|
286
|
+
|
|
287
|
+
return self._request(
|
|
288
|
+
fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
@endpoint("/<version>/bankAccounts/getAll/", method="post")
|
|
292
|
+
def get_all(self, data: Union[BankaccountsGetAllModel, dict], **kwargs):
|
|
293
|
+
"""
|
|
294
|
+
get_all(self, data: Union[BankaccountsGetAllModel, dict], **kwargs)
|
|
295
|
+
|
|
296
|
+
Args:
|
|
297
|
+
|
|
298
|
+
data (Union[BankaccountsGetAllModel, dict]): A model instance or dictionary containing the following fields:
|
|
299
|
+
|
|
300
|
+
- company_id (Union[str, int]): company_id of the BankaccountsGetAllModel.
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
Returns:
|
|
305
|
+
ApiResponse: The response from the API.
|
|
306
|
+
"""
|
|
307
|
+
|
|
308
|
+
data = validate_data(data, self.validate, BankaccountsGetAllModel)
|
|
309
|
+
|
|
310
|
+
return self._request(
|
|
311
|
+
fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
|
|
312
|
+
)
|
|
313
|
+
|
|
314
|
+
@endpoint("/<version>/bankAccounts/insert/", method="post")
|
|
315
|
+
def insert(self, data: Union[BankaccountsInsertModel, dict], **kwargs):
|
|
316
|
+
"""
|
|
317
|
+
insert(self, data: Union[BankaccountsInsertModel, dict], **kwargs)
|
|
318
|
+
|
|
319
|
+
Args:
|
|
320
|
+
|
|
321
|
+
data (Union[BankaccountsInsertModel, dict]): A model instance or dictionary containing the following fields:
|
|
322
|
+
|
|
323
|
+
- company_id (Union[str, int]): company_id of the BankaccountsInsertModel.
|
|
324
|
+
|
|
325
|
+
- name (str): name of the BankaccountsInsertModel.
|
|
326
|
+
|
|
327
|
+
- order (str): order of the BankaccountsInsertModel.
|
|
328
|
+
|
|
329
|
+
- value (str): value of the BankaccountsInsertModel.
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
Returns:
|
|
334
|
+
ApiResponse: The response from the API.
|
|
335
|
+
"""
|
|
336
|
+
|
|
337
|
+
data = validate_data(data, self.validate, BankaccountsInsertModel)
|
|
338
|
+
|
|
339
|
+
return self._request(
|
|
340
|
+
fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
|
|
341
|
+
)
|
|
342
|
+
|
|
343
|
+
@endpoint("/<version>/bankAccounts/update/", method="post")
|
|
344
|
+
def update(self, data: Union[BankaccountsUpdateModel, dict], **kwargs):
|
|
345
|
+
"""
|
|
346
|
+
update(self, data: Union[BankaccountsUpdateModel, dict], **kwargs)
|
|
347
|
+
|
|
348
|
+
Args:
|
|
349
|
+
|
|
350
|
+
data (Union[BankaccountsUpdateModel, dict]): A model instance or dictionary containing the following fields:
|
|
351
|
+
|
|
352
|
+
- bank_account_id (Union[str, int]): bank_account_id of the BankaccountsUpdateModel.
|
|
353
|
+
|
|
354
|
+
- company_id (Union[str, int]): company_id of the BankaccountsUpdateModel.
|
|
355
|
+
|
|
356
|
+
- name (str): name of the BankaccountsUpdateModel.
|
|
357
|
+
|
|
358
|
+
- order (str): order of the BankaccountsUpdateModel.
|
|
359
|
+
|
|
360
|
+
- value (str): value of the BankaccountsUpdateModel.
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
Returns:
|
|
365
|
+
ApiResponse: The response from the API.
|
|
366
|
+
"""
|
|
367
|
+
|
|
368
|
+
data = validate_data(data, self.validate, BankaccountsUpdateModel)
|
|
369
|
+
|
|
370
|
+
return self._request(
|
|
371
|
+
fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
|
|
372
|
+
)
|