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.
Files changed (52) hide show
  1. moloni/__init__.py +0 -0
  2. moloni/__version__.py +1 -0
  3. moloni/api/__init__.py +701 -0
  4. moloni/api/bankaccounts_client.py +372 -0
  5. moloni/api/billsoflading_client.py +693 -0
  6. moloni/api/companies_client.py +322 -0
  7. moloni/api/countries_client.py +171 -0
  8. moloni/api/creditnotes_client.py +615 -0
  9. moloni/api/currencies_client.py +171 -0
  10. moloni/api/customeralternateaddresses_client.py +519 -0
  11. moloni/api/customerreturnnotes_client.py +701 -0
  12. moloni/api/customers_client.py +1413 -0
  13. moloni/api/debitnotes_client.py +597 -0
  14. moloni/api/deductions_client.py +435 -0
  15. moloni/api/deliverymethods_client.py +431 -0
  16. moloni/api/deliverynotes_client.py +714 -0
  17. moloni/api/documentmodels_client.py +171 -0
  18. moloni/api/documents_client.py +472 -0
  19. moloni/api/documentsets_client.py +447 -0
  20. moloni/api/estimates_client.py +663 -0
  21. moloni/api/fiscalzones_client.py +219 -0
  22. moloni/api/identificationtemplates_client.py +513 -0
  23. moloni/api/invoicereceipts_client.py +705 -0
  24. moloni/api/invoices_client.py +705 -0
  25. moloni/api/languages_client.py +171 -0
  26. moloni/api/maturitydates_client.py +441 -0
  27. moloni/api/measurementunits_client.py +437 -0
  28. moloni/api/ownassetsmovementguides_client.py +683 -0
  29. moloni/api/paymentmethods_client.py +429 -0
  30. moloni/api/productcategories_client.py +400 -0
  31. moloni/api/products_client.py +1252 -0
  32. moloni/api/receipts_client.py +591 -0
  33. moloni/api/salesmen_client.py +580 -0
  34. moloni/api/simplifiedinvoices_client.py +705 -0
  35. moloni/api/subscription_client.py +104 -0
  36. moloni/api/suppliers_client.py +1264 -0
  37. moloni/api/taxes_client.py +477 -0
  38. moloni/api/taxexemptions_client.py +171 -0
  39. moloni/api/users_client.py +104 -0
  40. moloni/api/vehicles_client.py +435 -0
  41. moloni/api/warehouses_client.py +506 -0
  42. moloni/api/waybills_client.py +699 -0
  43. moloni/base/__init__.py +24 -0
  44. moloni/base/client.py +164 -0
  45. moloni/base/config.py +6 -0
  46. moloni/base/helpers.py +150 -0
  47. moloni/base/logger_config.py +49 -0
  48. python_moloni_fix-0.3.16.dist-info/METADATA +231 -0
  49. python_moloni_fix-0.3.16.dist-info/RECORD +52 -0
  50. python_moloni_fix-0.3.16.dist-info/WHEEL +5 -0
  51. python_moloni_fix-0.3.16.dist-info/licenses/LICENSE +21 -0
  52. python_moloni_fix-0.3.16.dist-info/top_level.txt +1 -0
@@ -0,0 +1,513 @@
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 = IdentificationtemplatesClient(*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 IdentificationtemplatesCountModifiedSinceModel(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 IdentificationtemplatesDeleteModel(ApiRequestModel):
66
+ company_id: Union[str, int]
67
+ template_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 IdentificationtemplatesGetAllModel(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 IdentificationtemplatesGetModifiedSinceModel(ApiRequestModel):
149
+ company_id: Union[str, int]
150
+ lastmodified: Optional[str] = None
151
+
152
+ def request(self) -> ApiResponse:
153
+ """
154
+ request(self) -> ApiResponse
155
+
156
+ Make an API request using the initialized client.
157
+
158
+ This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
159
+ If the client is initialized, it will make an API request using the provided method name and the model's data,
160
+ excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
161
+
162
+ Returns:
163
+ The response from the API.
164
+
165
+ Raises:
166
+ ValueError: If the client is not initialized via the `connect` method.
167
+
168
+ Example:
169
+
170
+ # Assuming you have a model instance `request_model` and an API client `api_client`
171
+
172
+ ..code-block:: python
173
+
174
+ with request_model.connect(auth_config=auth_config) as api:
175
+ response = api.request()
176
+
177
+ # The above example assumes that the `connect` method has been used to initialize the client.
178
+ # The request method then sends the model's data to the API and returns the API's response.
179
+
180
+ """
181
+ if hasattr(self, "_api_client"):
182
+ response = self._api_client.get_modified_since(
183
+ self.model_dump(exclude={"_api_client"}, exclude_unset=True)
184
+ )
185
+ return response
186
+ else:
187
+ raise ValueError("Client not initialized. Use the 'connect' method.")
188
+
189
+
190
+ class IdentificationtemplatesInsertModel(ApiRequestModel):
191
+ company_id: Union[str, int]
192
+ address: Optional[str] = None
193
+ business_name: Optional[str] = None
194
+ city: Optional[str] = None
195
+ country_id: Optional[Union[str, int]] = None
196
+ documents_footnote: Optional[str] = None
197
+ email: Optional[str] = None
198
+ email_sender_address: Optional[str] = None
199
+ email_sender_name: Optional[str] = None
200
+ fax: Optional[str] = None
201
+ name: Optional[str] = None
202
+ notes: Optional[str] = None
203
+ phone: Optional[str] = None
204
+ website: Optional[str] = None
205
+ zip_code: Optional[str] = None
206
+
207
+ def request(self) -> ApiResponse:
208
+ """
209
+ request(self) -> ApiResponse
210
+
211
+ Make an API request using the initialized client.
212
+
213
+ This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
214
+ If the client is initialized, it will make an API request using the provided method name and the model's data,
215
+ excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
216
+
217
+ Returns:
218
+ The response from the API.
219
+
220
+ Raises:
221
+ ValueError: If the client is not initialized via the `connect` method.
222
+
223
+ Example:
224
+
225
+ # Assuming you have a model instance `request_model` and an API client `api_client`
226
+
227
+ ..code-block:: python
228
+
229
+ with request_model.connect(auth_config=auth_config) as api:
230
+ response = api.request()
231
+
232
+ # The above example assumes that the `connect` method has been used to initialize the client.
233
+ # The request method then sends the model's data to the API and returns the API's response.
234
+
235
+ """
236
+ if hasattr(self, "_api_client"):
237
+ response = self._api_client.insert(
238
+ self.model_dump(exclude={"_api_client"}, exclude_unset=True)
239
+ )
240
+ return response
241
+ else:
242
+ raise ValueError("Client not initialized. Use the 'connect' method.")
243
+
244
+
245
+ class IdentificationtemplatesUpdateModel(ApiRequestModel):
246
+ company_id: Union[str, int]
247
+ address: Optional[str] = None
248
+ business_name: Optional[str] = None
249
+ city: Optional[str] = None
250
+ country_id: Optional[Union[str, int]] = None
251
+ documents_footnote: Optional[str] = None
252
+ email: Optional[str] = None
253
+ email_sender_address: Optional[str] = None
254
+ email_sender_name: Optional[str] = None
255
+ fax: Optional[str] = None
256
+ name: Optional[str] = None
257
+ notes: Optional[str] = None
258
+ phone: Optional[str] = None
259
+ template_id: Optional[Union[str, int]] = None
260
+ website: Optional[str] = None
261
+ zip_code: Optional[str] = None
262
+
263
+ def request(self) -> ApiResponse:
264
+ """
265
+ request(self) -> ApiResponse
266
+
267
+ Make an API request using the initialized client.
268
+
269
+ This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
270
+ If the client is initialized, it will make an API request using the provided method name and the model's data,
271
+ excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
272
+
273
+ Returns:
274
+ The response from the API.
275
+
276
+ Raises:
277
+ ValueError: If the client is not initialized via the `connect` method.
278
+
279
+ Example:
280
+
281
+ # Assuming you have a model instance `request_model` and an API client `api_client`
282
+
283
+ ..code-block:: python
284
+
285
+ with request_model.connect(auth_config=auth_config) as api:
286
+ response = api.request()
287
+
288
+ # The above example assumes that the `connect` method has been used to initialize the client.
289
+ # The request method then sends the model's data to the API and returns the API's response.
290
+
291
+ """
292
+ if hasattr(self, "_api_client"):
293
+ response = self._api_client.update(
294
+ self.model_dump(exclude={"_api_client"}, exclude_unset=True)
295
+ )
296
+ return response
297
+ else:
298
+ raise ValueError("Client not initialized. Use the 'connect' method.")
299
+
300
+
301
+ class IdentificationtemplatesClient(MoloniBaseClient):
302
+
303
+ @endpoint("/<version>/identificationTemplates/countModifiedSince/", method="post")
304
+ def count_modified_since(
305
+ self,
306
+ data: Union[IdentificationtemplatesCountModifiedSinceModel, dict],
307
+ **kwargs
308
+ ):
309
+ """
310
+ count_modified_since(self, data: Union[IdentificationtemplatesCountModifiedSinceModel, dict], **kwargs)
311
+
312
+ Args:
313
+
314
+ data (Union[IdentificationtemplatesCountModifiedSinceModel, dict]): A model instance or dictionary containing the following fields:
315
+
316
+ - company_id (Union[str, int]): company_id of the IdentificationtemplatesCountModifiedSinceModel.
317
+
318
+ - lastmodified (str): lastmodified of the IdentificationtemplatesCountModifiedSinceModel.
319
+
320
+
321
+
322
+ Returns:
323
+ ApiResponse: The response from the API.
324
+ """
325
+
326
+ data = validate_data(
327
+ data, self.validate, IdentificationtemplatesCountModifiedSinceModel
328
+ )
329
+
330
+ return self._request(
331
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
332
+ )
333
+
334
+ @endpoint("/<version>/identificationTemplates/delete/", method="post")
335
+ def delete(self, data: Union[IdentificationtemplatesDeleteModel, dict], **kwargs):
336
+ """
337
+ delete(self, data: Union[IdentificationtemplatesDeleteModel, dict], **kwargs)
338
+
339
+ Args:
340
+
341
+ data (Union[IdentificationtemplatesDeleteModel, dict]): A model instance or dictionary containing the following fields:
342
+
343
+ - company_id (Union[str, int]): company_id of the IdentificationtemplatesDeleteModel.
344
+
345
+ - template_id (Union[str, int]): template_id of the IdentificationtemplatesDeleteModel.
346
+
347
+
348
+
349
+ Returns:
350
+ ApiResponse: The response from the API.
351
+ """
352
+
353
+ data = validate_data(data, self.validate, IdentificationtemplatesDeleteModel)
354
+
355
+ return self._request(
356
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
357
+ )
358
+
359
+ @endpoint("/<version>/identificationTemplates/getAll/", method="post")
360
+ def get_all(self, data: Union[IdentificationtemplatesGetAllModel, dict], **kwargs):
361
+ """
362
+ get_all(self, data: Union[IdentificationtemplatesGetAllModel, dict], **kwargs)
363
+
364
+ Args:
365
+
366
+ data (Union[IdentificationtemplatesGetAllModel, dict]): A model instance or dictionary containing the following fields:
367
+
368
+ - company_id (Union[str, int]): company_id of the IdentificationtemplatesGetAllModel.
369
+
370
+
371
+
372
+ Returns:
373
+ ApiResponse: The response from the API.
374
+ """
375
+
376
+ data = validate_data(data, self.validate, IdentificationtemplatesGetAllModel)
377
+
378
+ return self._request(
379
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
380
+ )
381
+
382
+ @endpoint("/<version>/identificationTemplates/getModifiedSince/", method="post")
383
+ def get_modified_since(
384
+ self, data: Union[IdentificationtemplatesGetModifiedSinceModel, dict], **kwargs
385
+ ):
386
+ """
387
+ get_modified_since(self, data: Union[IdentificationtemplatesGetModifiedSinceModel, dict], **kwargs)
388
+
389
+ Args:
390
+
391
+ data (Union[IdentificationtemplatesGetModifiedSinceModel, dict]): A model instance or dictionary containing the following fields:
392
+
393
+ - company_id (Union[str, int]): company_id of the IdentificationtemplatesGetModifiedSinceModel.
394
+
395
+ - lastmodified (str): lastmodified of the IdentificationtemplatesGetModifiedSinceModel.
396
+
397
+
398
+
399
+ Returns:
400
+ ApiResponse: The response from the API.
401
+ """
402
+
403
+ data = validate_data(
404
+ data, self.validate, IdentificationtemplatesGetModifiedSinceModel
405
+ )
406
+
407
+ return self._request(
408
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
409
+ )
410
+
411
+ @endpoint("/<version>/identificationTemplates/insert/", method="post")
412
+ def insert(self, data: Union[IdentificationtemplatesInsertModel, dict], **kwargs):
413
+ """
414
+ insert(self, data: Union[IdentificationtemplatesInsertModel, dict], **kwargs)
415
+
416
+ Args:
417
+
418
+ data (Union[IdentificationtemplatesInsertModel, dict]): A model instance or dictionary containing the following fields:
419
+
420
+ - address (str): address of the IdentificationtemplatesInsertModel.
421
+
422
+ - business_name (str): business_name of the IdentificationtemplatesInsertModel.
423
+
424
+ - city (str): city of the IdentificationtemplatesInsertModel.
425
+
426
+ - company_id (Union[str, int]): company_id of the IdentificationtemplatesInsertModel.
427
+
428
+ - country_id (Union[str, int]): country_id of the IdentificationtemplatesInsertModel.
429
+
430
+ - documents_footnote (str): documents_footnote of the IdentificationtemplatesInsertModel.
431
+
432
+ - email (str): email of the IdentificationtemplatesInsertModel.
433
+
434
+ - email_sender_address (str): email_sender_address of the IdentificationtemplatesInsertModel.
435
+
436
+ - email_sender_name (str): email_sender_name of the IdentificationtemplatesInsertModel.
437
+
438
+ - fax (str): fax of the IdentificationtemplatesInsertModel.
439
+
440
+ - name (str): name of the IdentificationtemplatesInsertModel.
441
+
442
+ - notes (str): notes of the IdentificationtemplatesInsertModel.
443
+
444
+ - phone (str): phone of the IdentificationtemplatesInsertModel.
445
+
446
+ - website (str): website of the IdentificationtemplatesInsertModel.
447
+
448
+ - zip_code (str): zip_code of the IdentificationtemplatesInsertModel.
449
+
450
+
451
+
452
+ Returns:
453
+ ApiResponse: The response from the API.
454
+ """
455
+
456
+ data = validate_data(data, self.validate, IdentificationtemplatesInsertModel)
457
+
458
+ return self._request(
459
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
460
+ )
461
+
462
+ @endpoint("/<version>/identificationTemplates/update/", method="post")
463
+ def update(self, data: Union[IdentificationtemplatesUpdateModel, dict], **kwargs):
464
+ """
465
+ update(self, data: Union[IdentificationtemplatesUpdateModel, dict], **kwargs)
466
+
467
+ Args:
468
+
469
+ data (Union[IdentificationtemplatesUpdateModel, dict]): A model instance or dictionary containing the following fields:
470
+
471
+ - address (str): address of the IdentificationtemplatesUpdateModel.
472
+
473
+ - business_name (str): business_name of the IdentificationtemplatesUpdateModel.
474
+
475
+ - city (str): city of the IdentificationtemplatesUpdateModel.
476
+
477
+ - company_id (Union[str, int]): company_id of the IdentificationtemplatesUpdateModel.
478
+
479
+ - country_id (Union[str, int]): country_id of the IdentificationtemplatesUpdateModel.
480
+
481
+ - documents_footnote (str): documents_footnote of the IdentificationtemplatesUpdateModel.
482
+
483
+ - email (str): email of the IdentificationtemplatesUpdateModel.
484
+
485
+ - email_sender_address (str): email_sender_address of the IdentificationtemplatesUpdateModel.
486
+
487
+ - email_sender_name (str): email_sender_name of the IdentificationtemplatesUpdateModel.
488
+
489
+ - fax (str): fax of the IdentificationtemplatesUpdateModel.
490
+
491
+ - name (str): name of the IdentificationtemplatesUpdateModel.
492
+
493
+ - notes (str): notes of the IdentificationtemplatesUpdateModel.
494
+
495
+ - phone (str): phone of the IdentificationtemplatesUpdateModel.
496
+
497
+ - template_id (Union[str, int]): template_id of the IdentificationtemplatesUpdateModel.
498
+
499
+ - website (str): website of the IdentificationtemplatesUpdateModel.
500
+
501
+ - zip_code (str): zip_code of the IdentificationtemplatesUpdateModel.
502
+
503
+
504
+
505
+ Returns:
506
+ ApiResponse: The response from the API.
507
+ """
508
+
509
+ data = validate_data(data, self.validate, IdentificationtemplatesUpdateModel)
510
+
511
+ return self._request(
512
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
513
+ )