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,429 @@
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 = PaymentmethodsClient(*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 PaymentmethodsCountModifiedSinceModel(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 PaymentmethodsDeleteModel(ApiRequestModel):
66
+ company_id: Union[str, int]
67
+ payment_method_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 PaymentmethodsGetAllModel(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 PaymentmethodsGetModifiedSinceModel(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 PaymentmethodsInsertModel(ApiRequestModel):
191
+ company_id: Union[str, int]
192
+ name: Optional[str] = None
193
+
194
+ def request(self) -> ApiResponse:
195
+ """
196
+ request(self) -> ApiResponse
197
+
198
+ Make an API request using the initialized client.
199
+
200
+ This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
201
+ If the client is initialized, it will make an API request using the provided method name and the model's data,
202
+ excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
203
+
204
+ Returns:
205
+ The response from the API.
206
+
207
+ Raises:
208
+ ValueError: If the client is not initialized via the `connect` method.
209
+
210
+ Example:
211
+
212
+ # Assuming you have a model instance `request_model` and an API client `api_client`
213
+
214
+ ..code-block:: python
215
+
216
+ with request_model.connect(auth_config=auth_config) as api:
217
+ response = api.request()
218
+
219
+ # The above example assumes that the `connect` method has been used to initialize the client.
220
+ # The request method then sends the model's data to the API and returns the API's response.
221
+
222
+ """
223
+ if hasattr(self, "_api_client"):
224
+ response = self._api_client.insert(
225
+ self.model_dump(exclude={"_api_client"}, exclude_unset=True)
226
+ )
227
+ return response
228
+ else:
229
+ raise ValueError("Client not initialized. Use the 'connect' method.")
230
+
231
+
232
+ class PaymentmethodsUpdateModel(ApiRequestModel):
233
+ company_id: Union[str, int]
234
+ name: Optional[str] = None
235
+ payment_method_id: Optional[Union[str, int]] = None
236
+
237
+ def request(self) -> ApiResponse:
238
+ """
239
+ request(self) -> ApiResponse
240
+
241
+ Make an API request using the initialized client.
242
+
243
+ This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
244
+ If the client is initialized, it will make an API request using the provided method name and the model's data,
245
+ excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
246
+
247
+ Returns:
248
+ The response from the API.
249
+
250
+ Raises:
251
+ ValueError: If the client is not initialized via the `connect` method.
252
+
253
+ Example:
254
+
255
+ # Assuming you have a model instance `request_model` and an API client `api_client`
256
+
257
+ ..code-block:: python
258
+
259
+ with request_model.connect(auth_config=auth_config) as api:
260
+ response = api.request()
261
+
262
+ # The above example assumes that the `connect` method has been used to initialize the client.
263
+ # The request method then sends the model's data to the API and returns the API's response.
264
+
265
+ """
266
+ if hasattr(self, "_api_client"):
267
+ response = self._api_client.update(
268
+ self.model_dump(exclude={"_api_client"}, exclude_unset=True)
269
+ )
270
+ return response
271
+ else:
272
+ raise ValueError("Client not initialized. Use the 'connect' method.")
273
+
274
+
275
+ class PaymentmethodsClient(MoloniBaseClient):
276
+
277
+ @endpoint("/<version>/paymentMethods/countModifiedSince/", method="post")
278
+ def count_modified_since(
279
+ self, data: Union[PaymentmethodsCountModifiedSinceModel, dict], **kwargs
280
+ ):
281
+ """
282
+ count_modified_since(self, data: Union[PaymentmethodsCountModifiedSinceModel, dict], **kwargs)
283
+
284
+ Args:
285
+
286
+ data (Union[PaymentmethodsCountModifiedSinceModel, dict]): A model instance or dictionary containing the following fields:
287
+
288
+ - company_id (Union[str, int]): company_id of the PaymentmethodsCountModifiedSinceModel.
289
+
290
+ - lastmodified (str): lastmodified of the PaymentmethodsCountModifiedSinceModel.
291
+
292
+
293
+
294
+ Returns:
295
+ ApiResponse: The response from the API.
296
+ """
297
+
298
+ data = validate_data(data, self.validate, PaymentmethodsCountModifiedSinceModel)
299
+
300
+ return self._request(
301
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
302
+ )
303
+
304
+ @endpoint("/<version>/paymentMethods/delete/", method="post")
305
+ def delete(self, data: Union[PaymentmethodsDeleteModel, dict], **kwargs):
306
+ """
307
+ delete(self, data: Union[PaymentmethodsDeleteModel, dict], **kwargs)
308
+
309
+ Args:
310
+
311
+ data (Union[PaymentmethodsDeleteModel, dict]): A model instance or dictionary containing the following fields:
312
+
313
+ - company_id (Union[str, int]): company_id of the PaymentmethodsDeleteModel.
314
+
315
+ - payment_method_id (Union[str, int]): payment_method_id of the PaymentmethodsDeleteModel.
316
+
317
+
318
+
319
+ Returns:
320
+ ApiResponse: The response from the API.
321
+ """
322
+
323
+ data = validate_data(data, self.validate, PaymentmethodsDeleteModel)
324
+
325
+ return self._request(
326
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
327
+ )
328
+
329
+ @endpoint("/<version>/paymentMethods/getAll/", method="post")
330
+ def get_all(self, data: Union[PaymentmethodsGetAllModel, dict], **kwargs):
331
+ """
332
+ get_all(self, data: Union[PaymentmethodsGetAllModel, dict], **kwargs)
333
+
334
+ Args:
335
+
336
+ data (Union[PaymentmethodsGetAllModel, dict]): A model instance or dictionary containing the following fields:
337
+
338
+ - company_id (Union[str, int]): company_id of the PaymentmethodsGetAllModel.
339
+
340
+
341
+
342
+ Returns:
343
+ ApiResponse: The response from the API.
344
+ """
345
+
346
+ data = validate_data(data, self.validate, PaymentmethodsGetAllModel)
347
+
348
+ return self._request(
349
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
350
+ )
351
+
352
+ @endpoint("/<version>/paymentMethods/getModifiedSince/", method="post")
353
+ def get_modified_since(
354
+ self, data: Union[PaymentmethodsGetModifiedSinceModel, dict], **kwargs
355
+ ):
356
+ """
357
+ get_modified_since(self, data: Union[PaymentmethodsGetModifiedSinceModel, dict], **kwargs)
358
+
359
+ Args:
360
+
361
+ data (Union[PaymentmethodsGetModifiedSinceModel, dict]): A model instance or dictionary containing the following fields:
362
+
363
+ - company_id (Union[str, int]): company_id of the PaymentmethodsGetModifiedSinceModel.
364
+
365
+ - lastmodified (str): lastmodified of the PaymentmethodsGetModifiedSinceModel.
366
+
367
+
368
+
369
+ Returns:
370
+ ApiResponse: The response from the API.
371
+ """
372
+
373
+ data = validate_data(data, self.validate, PaymentmethodsGetModifiedSinceModel)
374
+
375
+ return self._request(
376
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
377
+ )
378
+
379
+ @endpoint("/<version>/paymentMethods/insert/", method="post")
380
+ def insert(self, data: Union[PaymentmethodsInsertModel, dict], **kwargs):
381
+ """
382
+ insert(self, data: Union[PaymentmethodsInsertModel, dict], **kwargs)
383
+
384
+ Args:
385
+
386
+ data (Union[PaymentmethodsInsertModel, dict]): A model instance or dictionary containing the following fields:
387
+
388
+ - company_id (Union[str, int]): company_id of the PaymentmethodsInsertModel.
389
+
390
+ - name (str): name of the PaymentmethodsInsertModel.
391
+
392
+
393
+
394
+ Returns:
395
+ ApiResponse: The response from the API.
396
+ """
397
+
398
+ data = validate_data(data, self.validate, PaymentmethodsInsertModel)
399
+
400
+ return self._request(
401
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
402
+ )
403
+
404
+ @endpoint("/<version>/paymentMethods/update/", method="post")
405
+ def update(self, data: Union[PaymentmethodsUpdateModel, dict], **kwargs):
406
+ """
407
+ update(self, data: Union[PaymentmethodsUpdateModel, dict], **kwargs)
408
+
409
+ Args:
410
+
411
+ data (Union[PaymentmethodsUpdateModel, dict]): A model instance or dictionary containing the following fields:
412
+
413
+ - company_id (Union[str, int]): company_id of the PaymentmethodsUpdateModel.
414
+
415
+ - name (str): name of the PaymentmethodsUpdateModel.
416
+
417
+ - payment_method_id (Union[str, int]): payment_method_id of the PaymentmethodsUpdateModel.
418
+
419
+
420
+
421
+ Returns:
422
+ ApiResponse: The response from the API.
423
+ """
424
+
425
+ data = validate_data(data, self.validate, PaymentmethodsUpdateModel)
426
+
427
+ return self._request(
428
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
429
+ )