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,400 @@
|
|
|
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 = ProductcategoriesClient(*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 Suppliers(BaseModel):
|
|
24
|
+
cost_price: Optional[Any] = None
|
|
25
|
+
supplier_id: Optional[Any] = None
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class Taxes(BaseModel):
|
|
29
|
+
cumulative: Optional[Any] = None
|
|
30
|
+
order: Optional[Any] = None
|
|
31
|
+
tax_id: Optional[Any] = None
|
|
32
|
+
value: Optional[Any] = None
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class Warehouses(BaseModel):
|
|
36
|
+
stock: Optional[Any] = None
|
|
37
|
+
warehouse_id: Optional[Any] = None
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class ProductcategoriesDeleteModel(ApiRequestModel):
|
|
41
|
+
company_id: Union[str, int]
|
|
42
|
+
category_id: Optional[Union[str, int]] = None
|
|
43
|
+
|
|
44
|
+
def request(self) -> ApiResponse:
|
|
45
|
+
"""
|
|
46
|
+
request(self) -> ApiResponse
|
|
47
|
+
|
|
48
|
+
Make an API request using the initialized client.
|
|
49
|
+
|
|
50
|
+
This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
|
|
51
|
+
If the client is initialized, it will make an API request using the provided method name and the model's data,
|
|
52
|
+
excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
|
|
53
|
+
|
|
54
|
+
Returns:
|
|
55
|
+
The response from the API.
|
|
56
|
+
|
|
57
|
+
Raises:
|
|
58
|
+
ValueError: If the client is not initialized via the `connect` method.
|
|
59
|
+
|
|
60
|
+
Example:
|
|
61
|
+
|
|
62
|
+
# Assuming you have a model instance `request_model` and an API client `api_client`
|
|
63
|
+
|
|
64
|
+
..code-block:: python
|
|
65
|
+
|
|
66
|
+
with request_model.connect(auth_config=auth_config) as api:
|
|
67
|
+
response = api.request()
|
|
68
|
+
|
|
69
|
+
# The above example assumes that the `connect` method has been used to initialize the client.
|
|
70
|
+
# The request method then sends the model's data to the API and returns the API's response.
|
|
71
|
+
|
|
72
|
+
"""
|
|
73
|
+
if hasattr(self, "_api_client"):
|
|
74
|
+
response = self._api_client.delete(
|
|
75
|
+
self.model_dump(exclude={"_api_client"}, exclude_unset=True)
|
|
76
|
+
)
|
|
77
|
+
return response
|
|
78
|
+
else:
|
|
79
|
+
raise ValueError("Client not initialized. Use the 'connect' method.")
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class ProductcategoriesGetAllModel(ApiRequestModel):
|
|
83
|
+
company_id: Union[str, int]
|
|
84
|
+
parent_id: Optional[Union[str, int]] = None
|
|
85
|
+
|
|
86
|
+
def request(self) -> ApiResponse:
|
|
87
|
+
"""
|
|
88
|
+
request(self) -> ApiResponse
|
|
89
|
+
|
|
90
|
+
Make an API request using the initialized client.
|
|
91
|
+
|
|
92
|
+
This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
|
|
93
|
+
If the client is initialized, it will make an API request using the provided method name and the model's data,
|
|
94
|
+
excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
|
|
95
|
+
|
|
96
|
+
Returns:
|
|
97
|
+
The response from the API.
|
|
98
|
+
|
|
99
|
+
Raises:
|
|
100
|
+
ValueError: If the client is not initialized via the `connect` method.
|
|
101
|
+
|
|
102
|
+
Example:
|
|
103
|
+
|
|
104
|
+
# Assuming you have a model instance `request_model` and an API client `api_client`
|
|
105
|
+
|
|
106
|
+
..code-block:: python
|
|
107
|
+
|
|
108
|
+
with request_model.connect(auth_config=auth_config) as api:
|
|
109
|
+
response = api.request()
|
|
110
|
+
|
|
111
|
+
# The above example assumes that the `connect` method has been used to initialize the client.
|
|
112
|
+
# The request method then sends the model's data to the API and returns the API's response.
|
|
113
|
+
|
|
114
|
+
"""
|
|
115
|
+
if hasattr(self, "_api_client"):
|
|
116
|
+
response = self._api_client.get_all(
|
|
117
|
+
self.model_dump(exclude={"_api_client"}, exclude_unset=True)
|
|
118
|
+
)
|
|
119
|
+
return response
|
|
120
|
+
else:
|
|
121
|
+
raise ValueError("Client not initialized. Use the 'connect' method.")
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
class ProductcategoriesGetModifiedSinceModel(ApiRequestModel):
|
|
125
|
+
company_id: Union[str, int]
|
|
126
|
+
lastmodified: Optional[str] = None
|
|
127
|
+
|
|
128
|
+
def request(self) -> ApiResponse:
|
|
129
|
+
"""
|
|
130
|
+
request(self) -> ApiResponse
|
|
131
|
+
|
|
132
|
+
Make an API request using the initialized client.
|
|
133
|
+
|
|
134
|
+
This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
|
|
135
|
+
If the client is initialized, it will make an API request using the provided method name and the model's data,
|
|
136
|
+
excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
|
|
137
|
+
|
|
138
|
+
Returns:
|
|
139
|
+
The response from the API.
|
|
140
|
+
|
|
141
|
+
Raises:
|
|
142
|
+
ValueError: If the client is not initialized via the `connect` method.
|
|
143
|
+
|
|
144
|
+
Example:
|
|
145
|
+
|
|
146
|
+
# Assuming you have a model instance `request_model` and an API client `api_client`
|
|
147
|
+
|
|
148
|
+
..code-block:: python
|
|
149
|
+
|
|
150
|
+
with request_model.connect(auth_config=auth_config) as api:
|
|
151
|
+
response = api.request()
|
|
152
|
+
|
|
153
|
+
# The above example assumes that the `connect` method has been used to initialize the client.
|
|
154
|
+
# The request method then sends the model's data to the API and returns the API's response.
|
|
155
|
+
|
|
156
|
+
"""
|
|
157
|
+
if hasattr(self, "_api_client"):
|
|
158
|
+
response = self._api_client.get_modified_since(
|
|
159
|
+
self.model_dump(exclude={"_api_client"}, exclude_unset=True)
|
|
160
|
+
)
|
|
161
|
+
return response
|
|
162
|
+
else:
|
|
163
|
+
raise ValueError("Client not initialized. Use the 'connect' method.")
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
class ProductcategoriesInsertModel(ApiRequestModel):
|
|
167
|
+
company_id: Union[str, int]
|
|
168
|
+
description: Optional[str] = None
|
|
169
|
+
name: Optional[str] = None
|
|
170
|
+
parent_id: Optional[Union[str, int]] = None
|
|
171
|
+
pos_enabled: Optional[str] = None
|
|
172
|
+
|
|
173
|
+
def request(self) -> ApiResponse:
|
|
174
|
+
"""
|
|
175
|
+
request(self) -> ApiResponse
|
|
176
|
+
|
|
177
|
+
Make an API request using the initialized client.
|
|
178
|
+
|
|
179
|
+
This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
|
|
180
|
+
If the client is initialized, it will make an API request using the provided method name and the model's data,
|
|
181
|
+
excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
|
|
182
|
+
|
|
183
|
+
Returns:
|
|
184
|
+
The response from the API.
|
|
185
|
+
|
|
186
|
+
Raises:
|
|
187
|
+
ValueError: If the client is not initialized via the `connect` method.
|
|
188
|
+
|
|
189
|
+
Example:
|
|
190
|
+
|
|
191
|
+
# Assuming you have a model instance `request_model` and an API client `api_client`
|
|
192
|
+
|
|
193
|
+
..code-block:: python
|
|
194
|
+
|
|
195
|
+
with request_model.connect(auth_config=auth_config) as api:
|
|
196
|
+
response = api.request()
|
|
197
|
+
|
|
198
|
+
# The above example assumes that the `connect` method has been used to initialize the client.
|
|
199
|
+
# The request method then sends the model's data to the API and returns the API's response.
|
|
200
|
+
|
|
201
|
+
"""
|
|
202
|
+
if hasattr(self, "_api_client"):
|
|
203
|
+
response = self._api_client.insert(
|
|
204
|
+
self.model_dump(exclude={"_api_client"}, exclude_unset=True)
|
|
205
|
+
)
|
|
206
|
+
return response
|
|
207
|
+
else:
|
|
208
|
+
raise ValueError("Client not initialized. Use the 'connect' method.")
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
class ProductcategoriesUpdateModel(ApiRequestModel):
|
|
212
|
+
company_id: Union[str, int]
|
|
213
|
+
category_id: Optional[Union[str, int]] = None
|
|
214
|
+
description: Optional[str] = None
|
|
215
|
+
name: Optional[str] = None
|
|
216
|
+
parent_id: Optional[Union[str, int]] = None
|
|
217
|
+
pos_enabled: Optional[str] = None
|
|
218
|
+
|
|
219
|
+
def request(self) -> ApiResponse:
|
|
220
|
+
"""
|
|
221
|
+
request(self) -> ApiResponse
|
|
222
|
+
|
|
223
|
+
Make an API request using the initialized client.
|
|
224
|
+
|
|
225
|
+
This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
|
|
226
|
+
If the client is initialized, it will make an API request using the provided method name and the model's data,
|
|
227
|
+
excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
|
|
228
|
+
|
|
229
|
+
Returns:
|
|
230
|
+
The response from the API.
|
|
231
|
+
|
|
232
|
+
Raises:
|
|
233
|
+
ValueError: If the client is not initialized via the `connect` method.
|
|
234
|
+
|
|
235
|
+
Example:
|
|
236
|
+
|
|
237
|
+
# Assuming you have a model instance `request_model` and an API client `api_client`
|
|
238
|
+
|
|
239
|
+
..code-block:: python
|
|
240
|
+
|
|
241
|
+
with request_model.connect(auth_config=auth_config) as api:
|
|
242
|
+
response = api.request()
|
|
243
|
+
|
|
244
|
+
# The above example assumes that the `connect` method has been used to initialize the client.
|
|
245
|
+
# The request method then sends the model's data to the API and returns the API's response.
|
|
246
|
+
|
|
247
|
+
"""
|
|
248
|
+
if hasattr(self, "_api_client"):
|
|
249
|
+
response = self._api_client.update(
|
|
250
|
+
self.model_dump(exclude={"_api_client"}, exclude_unset=True)
|
|
251
|
+
)
|
|
252
|
+
return response
|
|
253
|
+
else:
|
|
254
|
+
raise ValueError("Client not initialized. Use the 'connect' method.")
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
class ProductcategoriesClient(MoloniBaseClient):
|
|
258
|
+
|
|
259
|
+
@endpoint("/<version>/productCategories/delete/", method="post")
|
|
260
|
+
def delete(self, data: Union[ProductcategoriesDeleteModel, dict], **kwargs):
|
|
261
|
+
"""
|
|
262
|
+
delete(self, data: Union[ProductcategoriesDeleteModel, dict], **kwargs)
|
|
263
|
+
|
|
264
|
+
Args:
|
|
265
|
+
|
|
266
|
+
data (Union[ProductcategoriesDeleteModel, dict]): A model instance or dictionary containing the following fields:
|
|
267
|
+
|
|
268
|
+
- category_id (Union[str, int]): category_id of the ProductcategoriesDeleteModel.
|
|
269
|
+
|
|
270
|
+
- company_id (Union[str, int]): company_id of the ProductcategoriesDeleteModel.
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
Returns:
|
|
275
|
+
ApiResponse: The response from the API.
|
|
276
|
+
"""
|
|
277
|
+
|
|
278
|
+
data = validate_data(data, self.validate, ProductcategoriesDeleteModel)
|
|
279
|
+
|
|
280
|
+
return self._request(
|
|
281
|
+
fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
@endpoint("/<version>/productCategories/getAll/", method="post")
|
|
285
|
+
def get_all(self, data: Union[ProductcategoriesGetAllModel, dict], **kwargs):
|
|
286
|
+
"""
|
|
287
|
+
get_all(self, data: Union[ProductcategoriesGetAllModel, dict], **kwargs)
|
|
288
|
+
|
|
289
|
+
Args:
|
|
290
|
+
|
|
291
|
+
data (Union[ProductcategoriesGetAllModel, dict]): A model instance or dictionary containing the following fields:
|
|
292
|
+
|
|
293
|
+
- company_id (Union[str, int]): company_id of the ProductcategoriesGetAllModel.
|
|
294
|
+
|
|
295
|
+
- parent_id (Union[str, int]): parent_id of the ProductcategoriesGetAllModel.
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
Returns:
|
|
300
|
+
ApiResponse: The response from the API.
|
|
301
|
+
"""
|
|
302
|
+
|
|
303
|
+
data = validate_data(data, self.validate, ProductcategoriesGetAllModel)
|
|
304
|
+
|
|
305
|
+
return self._request(
|
|
306
|
+
fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
|
|
307
|
+
)
|
|
308
|
+
|
|
309
|
+
@endpoint("/<version>/productCategories/getModifiedSince/", method="post")
|
|
310
|
+
def get_modified_since(
|
|
311
|
+
self, data: Union[ProductcategoriesGetModifiedSinceModel, dict], **kwargs
|
|
312
|
+
):
|
|
313
|
+
"""
|
|
314
|
+
get_modified_since(self, data: Union[ProductcategoriesGetModifiedSinceModel, dict], **kwargs)
|
|
315
|
+
|
|
316
|
+
Args:
|
|
317
|
+
|
|
318
|
+
data (Union[ProductcategoriesGetModifiedSinceModel, dict]): A model instance or dictionary containing the following fields:
|
|
319
|
+
|
|
320
|
+
- company_id (Union[str, int]): company_id of the ProductcategoriesGetModifiedSinceModel.
|
|
321
|
+
|
|
322
|
+
- lastmodified (str): lastmodified of the ProductcategoriesGetModifiedSinceModel.
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
Returns:
|
|
327
|
+
ApiResponse: The response from the API.
|
|
328
|
+
"""
|
|
329
|
+
|
|
330
|
+
data = validate_data(
|
|
331
|
+
data, self.validate, ProductcategoriesGetModifiedSinceModel
|
|
332
|
+
)
|
|
333
|
+
|
|
334
|
+
return self._request(
|
|
335
|
+
fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
|
|
336
|
+
)
|
|
337
|
+
|
|
338
|
+
@endpoint("/<version>/productCategories/insert/", method="post")
|
|
339
|
+
def insert(self, data: Union[ProductcategoriesInsertModel, dict], **kwargs):
|
|
340
|
+
"""
|
|
341
|
+
insert(self, data: Union[ProductcategoriesInsertModel, dict], **kwargs)
|
|
342
|
+
|
|
343
|
+
Args:
|
|
344
|
+
|
|
345
|
+
data (Union[ProductcategoriesInsertModel, dict]): A model instance or dictionary containing the following fields:
|
|
346
|
+
|
|
347
|
+
- company_id (Union[str, int]): company_id of the ProductcategoriesInsertModel.
|
|
348
|
+
|
|
349
|
+
- description (str): description of the ProductcategoriesInsertModel.
|
|
350
|
+
|
|
351
|
+
- name (str): name of the ProductcategoriesInsertModel.
|
|
352
|
+
|
|
353
|
+
- parent_id (Union[str, int]): parent_id of the ProductcategoriesInsertModel.
|
|
354
|
+
|
|
355
|
+
- pos_enabled (str): pos_enabled of the ProductcategoriesInsertModel.
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
Returns:
|
|
360
|
+
ApiResponse: The response from the API.
|
|
361
|
+
"""
|
|
362
|
+
|
|
363
|
+
data = validate_data(data, self.validate, ProductcategoriesInsertModel)
|
|
364
|
+
|
|
365
|
+
return self._request(
|
|
366
|
+
fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
|
|
367
|
+
)
|
|
368
|
+
|
|
369
|
+
@endpoint("/<version>/productCategories/update/", method="post")
|
|
370
|
+
def update(self, data: Union[ProductcategoriesUpdateModel, dict], **kwargs):
|
|
371
|
+
"""
|
|
372
|
+
update(self, data: Union[ProductcategoriesUpdateModel, dict], **kwargs)
|
|
373
|
+
|
|
374
|
+
Args:
|
|
375
|
+
|
|
376
|
+
data (Union[ProductcategoriesUpdateModel, dict]): A model instance or dictionary containing the following fields:
|
|
377
|
+
|
|
378
|
+
- category_id (Union[str, int]): category_id of the ProductcategoriesUpdateModel.
|
|
379
|
+
|
|
380
|
+
- company_id (Union[str, int]): company_id of the ProductcategoriesUpdateModel.
|
|
381
|
+
|
|
382
|
+
- description (str): description of the ProductcategoriesUpdateModel.
|
|
383
|
+
|
|
384
|
+
- name (str): name of the ProductcategoriesUpdateModel.
|
|
385
|
+
|
|
386
|
+
- parent_id (Union[str, int]): parent_id of the ProductcategoriesUpdateModel.
|
|
387
|
+
|
|
388
|
+
- pos_enabled (str): pos_enabled of the ProductcategoriesUpdateModel.
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
Returns:
|
|
393
|
+
ApiResponse: The response from the API.
|
|
394
|
+
"""
|
|
395
|
+
|
|
396
|
+
data = validate_data(data, self.validate, ProductcategoriesUpdateModel)
|
|
397
|
+
|
|
398
|
+
return self._request(
|
|
399
|
+
fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
|
|
400
|
+
)
|