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,219 @@
|
|
|
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 = FiscalzonesClient(*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 FiscalzonesCountModifiedSinceModel(ApiRequestModel):
|
|
24
|
+
lastmodified: Optional[str] = None
|
|
25
|
+
|
|
26
|
+
def request(self) -> ApiResponse:
|
|
27
|
+
"""
|
|
28
|
+
request(self) -> ApiResponse
|
|
29
|
+
|
|
30
|
+
Make an API request using the initialized client.
|
|
31
|
+
|
|
32
|
+
This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
|
|
33
|
+
If the client is initialized, it will make an API request using the provided method name and the model's data,
|
|
34
|
+
excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
|
|
35
|
+
|
|
36
|
+
Returns:
|
|
37
|
+
The response from the API.
|
|
38
|
+
|
|
39
|
+
Raises:
|
|
40
|
+
ValueError: If the client is not initialized via the `connect` method.
|
|
41
|
+
|
|
42
|
+
Example:
|
|
43
|
+
|
|
44
|
+
# Assuming you have a model instance `request_model` and an API client `api_client`
|
|
45
|
+
|
|
46
|
+
..code-block:: python
|
|
47
|
+
|
|
48
|
+
with request_model.connect(auth_config=auth_config) as api:
|
|
49
|
+
response = api.request()
|
|
50
|
+
|
|
51
|
+
# The above example assumes that the `connect` method has been used to initialize the client.
|
|
52
|
+
# The request method then sends the model's data to the API and returns the API's response.
|
|
53
|
+
|
|
54
|
+
"""
|
|
55
|
+
if hasattr(self, "_api_client"):
|
|
56
|
+
response = self._api_client.count_modified_since(
|
|
57
|
+
self.model_dump(exclude={"_api_client"}, exclude_unset=True)
|
|
58
|
+
)
|
|
59
|
+
return response
|
|
60
|
+
else:
|
|
61
|
+
raise ValueError("Client not initialized. Use the 'connect' method.")
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class FiscalzonesGetAllModel(ApiRequestModel):
|
|
65
|
+
country_id: Optional[Union[str, int]] = None
|
|
66
|
+
|
|
67
|
+
def request(self) -> ApiResponse:
|
|
68
|
+
"""
|
|
69
|
+
request(self) -> ApiResponse
|
|
70
|
+
|
|
71
|
+
Make an API request using the initialized client.
|
|
72
|
+
|
|
73
|
+
This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
|
|
74
|
+
If the client is initialized, it will make an API request using the provided method name and the model's data,
|
|
75
|
+
excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
|
|
76
|
+
|
|
77
|
+
Returns:
|
|
78
|
+
The response from the API.
|
|
79
|
+
|
|
80
|
+
Raises:
|
|
81
|
+
ValueError: If the client is not initialized via the `connect` method.
|
|
82
|
+
|
|
83
|
+
Example:
|
|
84
|
+
|
|
85
|
+
# Assuming you have a model instance `request_model` and an API client `api_client`
|
|
86
|
+
|
|
87
|
+
..code-block:: python
|
|
88
|
+
|
|
89
|
+
with request_model.connect(auth_config=auth_config) as api:
|
|
90
|
+
response = api.request()
|
|
91
|
+
|
|
92
|
+
# The above example assumes that the `connect` method has been used to initialize the client.
|
|
93
|
+
# The request method then sends the model's data to the API and returns the API's response.
|
|
94
|
+
|
|
95
|
+
"""
|
|
96
|
+
if hasattr(self, "_api_client"):
|
|
97
|
+
response = self._api_client.get_all(
|
|
98
|
+
self.model_dump(exclude={"_api_client"}, exclude_unset=True)
|
|
99
|
+
)
|
|
100
|
+
return response
|
|
101
|
+
else:
|
|
102
|
+
raise ValueError("Client not initialized. Use the 'connect' method.")
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class FiscalzonesGetModifiedSinceModel(ApiRequestModel):
|
|
106
|
+
lastmodified: Optional[str] = None
|
|
107
|
+
|
|
108
|
+
def request(self) -> ApiResponse:
|
|
109
|
+
"""
|
|
110
|
+
request(self) -> ApiResponse
|
|
111
|
+
|
|
112
|
+
Make an API request using the initialized client.
|
|
113
|
+
|
|
114
|
+
This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
|
|
115
|
+
If the client is initialized, it will make an API request using the provided method name and the model's data,
|
|
116
|
+
excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
|
|
117
|
+
|
|
118
|
+
Returns:
|
|
119
|
+
The response from the API.
|
|
120
|
+
|
|
121
|
+
Raises:
|
|
122
|
+
ValueError: If the client is not initialized via the `connect` method.
|
|
123
|
+
|
|
124
|
+
Example:
|
|
125
|
+
|
|
126
|
+
# Assuming you have a model instance `request_model` and an API client `api_client`
|
|
127
|
+
|
|
128
|
+
..code-block:: python
|
|
129
|
+
|
|
130
|
+
with request_model.connect(auth_config=auth_config) as api:
|
|
131
|
+
response = api.request()
|
|
132
|
+
|
|
133
|
+
# The above example assumes that the `connect` method has been used to initialize the client.
|
|
134
|
+
# The request method then sends the model's data to the API and returns the API's response.
|
|
135
|
+
|
|
136
|
+
"""
|
|
137
|
+
if hasattr(self, "_api_client"):
|
|
138
|
+
response = self._api_client.get_modified_since(
|
|
139
|
+
self.model_dump(exclude={"_api_client"}, exclude_unset=True)
|
|
140
|
+
)
|
|
141
|
+
return response
|
|
142
|
+
else:
|
|
143
|
+
raise ValueError("Client not initialized. Use the 'connect' method.")
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
class FiscalzonesClient(MoloniBaseClient):
|
|
147
|
+
|
|
148
|
+
@endpoint("/<version>/fiscalZones/countModifiedSince/", method="post")
|
|
149
|
+
def count_modified_since(
|
|
150
|
+
self, data: Union[FiscalzonesCountModifiedSinceModel, dict], **kwargs
|
|
151
|
+
):
|
|
152
|
+
"""
|
|
153
|
+
count_modified_since(self, data: Union[FiscalzonesCountModifiedSinceModel, dict], **kwargs)
|
|
154
|
+
|
|
155
|
+
Args:
|
|
156
|
+
|
|
157
|
+
data (Union[FiscalzonesCountModifiedSinceModel, dict]): A model instance or dictionary containing the following fields:
|
|
158
|
+
|
|
159
|
+
- lastmodified (str): lastmodified of the FiscalzonesCountModifiedSinceModel.
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
Returns:
|
|
164
|
+
ApiResponse: The response from the API.
|
|
165
|
+
"""
|
|
166
|
+
|
|
167
|
+
data = validate_data(data, self.validate, FiscalzonesCountModifiedSinceModel)
|
|
168
|
+
|
|
169
|
+
return self._request(
|
|
170
|
+
fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
@endpoint("/<version>/fiscalZones/getAll/", method="post")
|
|
174
|
+
def get_all(self, data: Union[FiscalzonesGetAllModel, dict], **kwargs):
|
|
175
|
+
"""
|
|
176
|
+
get_all(self, data: Union[FiscalzonesGetAllModel, dict], **kwargs)
|
|
177
|
+
|
|
178
|
+
Args:
|
|
179
|
+
|
|
180
|
+
data (Union[FiscalzonesGetAllModel, dict]): A model instance or dictionary containing the following fields:
|
|
181
|
+
|
|
182
|
+
- country_id (Union[str, int]): country_id of the FiscalzonesGetAllModel.
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
Returns:
|
|
187
|
+
ApiResponse: The response from the API.
|
|
188
|
+
"""
|
|
189
|
+
|
|
190
|
+
data = validate_data(data, self.validate, FiscalzonesGetAllModel)
|
|
191
|
+
|
|
192
|
+
return self._request(
|
|
193
|
+
fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
|
|
194
|
+
)
|
|
195
|
+
|
|
196
|
+
@endpoint("/<version>/fiscalZones/getModifiedSince/", method="post")
|
|
197
|
+
def get_modified_since(
|
|
198
|
+
self, data: Union[FiscalzonesGetModifiedSinceModel, dict], **kwargs
|
|
199
|
+
):
|
|
200
|
+
"""
|
|
201
|
+
get_modified_since(self, data: Union[FiscalzonesGetModifiedSinceModel, dict], **kwargs)
|
|
202
|
+
|
|
203
|
+
Args:
|
|
204
|
+
|
|
205
|
+
data (Union[FiscalzonesGetModifiedSinceModel, dict]): A model instance or dictionary containing the following fields:
|
|
206
|
+
|
|
207
|
+
- lastmodified (str): lastmodified of the FiscalzonesGetModifiedSinceModel.
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
Returns:
|
|
212
|
+
ApiResponse: The response from the API.
|
|
213
|
+
"""
|
|
214
|
+
|
|
215
|
+
data = validate_data(data, self.validate, FiscalzonesGetModifiedSinceModel)
|
|
216
|
+
|
|
217
|
+
return self._request(
|
|
218
|
+
fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
|
|
219
|
+
)
|