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,171 @@
|
|
|
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 = LanguagesClient(*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 LanguagesCountModifiedSinceModel(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 LanguagesGetModifiedSinceModel(ApiRequestModel):
|
|
65
|
+
lastmodified: Optional[str] = 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_modified_since(
|
|
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 LanguagesClient(MoloniBaseClient):
|
|
106
|
+
|
|
107
|
+
@endpoint("/<version>/languages/countModifiedSince/", method="post")
|
|
108
|
+
def count_modified_since(
|
|
109
|
+
self, data: Union[LanguagesCountModifiedSinceModel, dict], **kwargs
|
|
110
|
+
):
|
|
111
|
+
"""
|
|
112
|
+
count_modified_since(self, data: Union[LanguagesCountModifiedSinceModel, dict], **kwargs)
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
|
|
116
|
+
data (Union[LanguagesCountModifiedSinceModel, dict]): A model instance or dictionary containing the following fields:
|
|
117
|
+
|
|
118
|
+
- lastmodified (str): lastmodified of the LanguagesCountModifiedSinceModel.
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
Returns:
|
|
123
|
+
ApiResponse: The response from the API.
|
|
124
|
+
"""
|
|
125
|
+
|
|
126
|
+
data = validate_data(data, self.validate, LanguagesCountModifiedSinceModel)
|
|
127
|
+
|
|
128
|
+
return self._request(
|
|
129
|
+
fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
@endpoint("/<version>/languages/getAll/", method="post")
|
|
133
|
+
def get_all(self, **kwargs):
|
|
134
|
+
"""
|
|
135
|
+
get_all(self, **kwargs)
|
|
136
|
+
|
|
137
|
+
Args:
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
Returns:
|
|
141
|
+
ApiResponse: The response from the API.
|
|
142
|
+
"""
|
|
143
|
+
|
|
144
|
+
return self._request(
|
|
145
|
+
fill_query_params(kwargs.pop("path"), self.version), data={**kwargs}
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
@endpoint("/<version>/languages/getModifiedSince/", method="post")
|
|
149
|
+
def get_modified_since(
|
|
150
|
+
self, data: Union[LanguagesGetModifiedSinceModel, dict], **kwargs
|
|
151
|
+
):
|
|
152
|
+
"""
|
|
153
|
+
get_modified_since(self, data: Union[LanguagesGetModifiedSinceModel, dict], **kwargs)
|
|
154
|
+
|
|
155
|
+
Args:
|
|
156
|
+
|
|
157
|
+
data (Union[LanguagesGetModifiedSinceModel, dict]): A model instance or dictionary containing the following fields:
|
|
158
|
+
|
|
159
|
+
- lastmodified (str): lastmodified of the LanguagesGetModifiedSinceModel.
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
Returns:
|
|
164
|
+
ApiResponse: The response from the API.
|
|
165
|
+
"""
|
|
166
|
+
|
|
167
|
+
data = validate_data(data, self.validate, LanguagesGetModifiedSinceModel)
|
|
168
|
+
|
|
169
|
+
return self._request(
|
|
170
|
+
fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
|
|
171
|
+
)
|
|
@@ -0,0 +1,441 @@
|
|
|
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 = MaturitydatesClient(*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 MaturitydatesCountModifiedSinceModel(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 MaturitydatesDeleteModel(ApiRequestModel):
|
|
66
|
+
company_id: Union[str, int]
|
|
67
|
+
maturity_date_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 MaturitydatesGetAllModel(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 MaturitydatesGetModifiedSinceModel(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 MaturitydatesInsertModel(ApiRequestModel):
|
|
191
|
+
company_id: Union[str, int]
|
|
192
|
+
associated_discount: Optional[str] = None
|
|
193
|
+
days: Optional[str] = None
|
|
194
|
+
name: Optional[str] = None
|
|
195
|
+
|
|
196
|
+
def request(self) -> ApiResponse:
|
|
197
|
+
"""
|
|
198
|
+
request(self) -> ApiResponse
|
|
199
|
+
|
|
200
|
+
Make an API request using the initialized client.
|
|
201
|
+
|
|
202
|
+
This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
|
|
203
|
+
If the client is initialized, it will make an API request using the provided method name and the model's data,
|
|
204
|
+
excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
|
|
205
|
+
|
|
206
|
+
Returns:
|
|
207
|
+
The response from the API.
|
|
208
|
+
|
|
209
|
+
Raises:
|
|
210
|
+
ValueError: If the client is not initialized via the `connect` method.
|
|
211
|
+
|
|
212
|
+
Example:
|
|
213
|
+
|
|
214
|
+
# Assuming you have a model instance `request_model` and an API client `api_client`
|
|
215
|
+
|
|
216
|
+
..code-block:: python
|
|
217
|
+
|
|
218
|
+
with request_model.connect(auth_config=auth_config) as api:
|
|
219
|
+
response = api.request()
|
|
220
|
+
|
|
221
|
+
# The above example assumes that the `connect` method has been used to initialize the client.
|
|
222
|
+
# The request method then sends the model's data to the API and returns the API's response.
|
|
223
|
+
|
|
224
|
+
"""
|
|
225
|
+
if hasattr(self, "_api_client"):
|
|
226
|
+
response = self._api_client.insert(
|
|
227
|
+
self.model_dump(exclude={"_api_client"}, exclude_unset=True)
|
|
228
|
+
)
|
|
229
|
+
return response
|
|
230
|
+
else:
|
|
231
|
+
raise ValueError("Client not initialized. Use the 'connect' method.")
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
class MaturitydatesUpdateModel(ApiRequestModel):
|
|
235
|
+
company_id: Union[str, int]
|
|
236
|
+
associated_discount: Optional[str] = None
|
|
237
|
+
days: Optional[str] = None
|
|
238
|
+
maturity_date_id: Optional[Union[str, int]] = None
|
|
239
|
+
name: Optional[str] = None
|
|
240
|
+
|
|
241
|
+
def request(self) -> ApiResponse:
|
|
242
|
+
"""
|
|
243
|
+
request(self) -> ApiResponse
|
|
244
|
+
|
|
245
|
+
Make an API request using the initialized client.
|
|
246
|
+
|
|
247
|
+
This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
|
|
248
|
+
If the client is initialized, it will make an API request using the provided method name and the model's data,
|
|
249
|
+
excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
|
|
250
|
+
|
|
251
|
+
Returns:
|
|
252
|
+
The response from the API.
|
|
253
|
+
|
|
254
|
+
Raises:
|
|
255
|
+
ValueError: If the client is not initialized via the `connect` method.
|
|
256
|
+
|
|
257
|
+
Example:
|
|
258
|
+
|
|
259
|
+
# Assuming you have a model instance `request_model` and an API client `api_client`
|
|
260
|
+
|
|
261
|
+
..code-block:: python
|
|
262
|
+
|
|
263
|
+
with request_model.connect(auth_config=auth_config) as api:
|
|
264
|
+
response = api.request()
|
|
265
|
+
|
|
266
|
+
# The above example assumes that the `connect` method has been used to initialize the client.
|
|
267
|
+
# The request method then sends the model's data to the API and returns the API's response.
|
|
268
|
+
|
|
269
|
+
"""
|
|
270
|
+
if hasattr(self, "_api_client"):
|
|
271
|
+
response = self._api_client.update(
|
|
272
|
+
self.model_dump(exclude={"_api_client"}, exclude_unset=True)
|
|
273
|
+
)
|
|
274
|
+
return response
|
|
275
|
+
else:
|
|
276
|
+
raise ValueError("Client not initialized. Use the 'connect' method.")
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
class MaturitydatesClient(MoloniBaseClient):
|
|
280
|
+
|
|
281
|
+
@endpoint("/<version>/maturityDates/countModifiedSince/", method="post")
|
|
282
|
+
def count_modified_since(
|
|
283
|
+
self, data: Union[MaturitydatesCountModifiedSinceModel, dict], **kwargs
|
|
284
|
+
):
|
|
285
|
+
"""
|
|
286
|
+
count_modified_since(self, data: Union[MaturitydatesCountModifiedSinceModel, dict], **kwargs)
|
|
287
|
+
|
|
288
|
+
Args:
|
|
289
|
+
|
|
290
|
+
data (Union[MaturitydatesCountModifiedSinceModel, dict]): A model instance or dictionary containing the following fields:
|
|
291
|
+
|
|
292
|
+
- company_id (Union[str, int]): company_id of the MaturitydatesCountModifiedSinceModel.
|
|
293
|
+
|
|
294
|
+
- lastmodified (str): lastmodified of the MaturitydatesCountModifiedSinceModel.
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
Returns:
|
|
299
|
+
ApiResponse: The response from the API.
|
|
300
|
+
"""
|
|
301
|
+
|
|
302
|
+
data = validate_data(data, self.validate, MaturitydatesCountModifiedSinceModel)
|
|
303
|
+
|
|
304
|
+
return self._request(
|
|
305
|
+
fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
|
|
306
|
+
)
|
|
307
|
+
|
|
308
|
+
@endpoint("/<version>/maturityDates/delete/", method="post")
|
|
309
|
+
def delete(self, data: Union[MaturitydatesDeleteModel, dict], **kwargs):
|
|
310
|
+
"""
|
|
311
|
+
delete(self, data: Union[MaturitydatesDeleteModel, dict], **kwargs)
|
|
312
|
+
|
|
313
|
+
Args:
|
|
314
|
+
|
|
315
|
+
data (Union[MaturitydatesDeleteModel, dict]): A model instance or dictionary containing the following fields:
|
|
316
|
+
|
|
317
|
+
- company_id (Union[str, int]): company_id of the MaturitydatesDeleteModel.
|
|
318
|
+
|
|
319
|
+
- maturity_date_id (Union[str, int]): maturity_date_id of the MaturitydatesDeleteModel.
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
Returns:
|
|
324
|
+
ApiResponse: The response from the API.
|
|
325
|
+
"""
|
|
326
|
+
|
|
327
|
+
data = validate_data(data, self.validate, MaturitydatesDeleteModel)
|
|
328
|
+
|
|
329
|
+
return self._request(
|
|
330
|
+
fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
|
|
331
|
+
)
|
|
332
|
+
|
|
333
|
+
@endpoint("/<version>/maturityDates/getAll/", method="post")
|
|
334
|
+
def get_all(self, data: Union[MaturitydatesGetAllModel, dict], **kwargs):
|
|
335
|
+
"""
|
|
336
|
+
get_all(self, data: Union[MaturitydatesGetAllModel, dict], **kwargs)
|
|
337
|
+
|
|
338
|
+
Args:
|
|
339
|
+
|
|
340
|
+
data (Union[MaturitydatesGetAllModel, dict]): A model instance or dictionary containing the following fields:
|
|
341
|
+
|
|
342
|
+
- company_id (Union[str, int]): company_id of the MaturitydatesGetAllModel.
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
Returns:
|
|
347
|
+
ApiResponse: The response from the API.
|
|
348
|
+
"""
|
|
349
|
+
|
|
350
|
+
data = validate_data(data, self.validate, MaturitydatesGetAllModel)
|
|
351
|
+
|
|
352
|
+
return self._request(
|
|
353
|
+
fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
|
|
354
|
+
)
|
|
355
|
+
|
|
356
|
+
@endpoint("/<version>/maturityDates/getModifiedSince/", method="post")
|
|
357
|
+
def get_modified_since(
|
|
358
|
+
self, data: Union[MaturitydatesGetModifiedSinceModel, dict], **kwargs
|
|
359
|
+
):
|
|
360
|
+
"""
|
|
361
|
+
get_modified_since(self, data: Union[MaturitydatesGetModifiedSinceModel, dict], **kwargs)
|
|
362
|
+
|
|
363
|
+
Args:
|
|
364
|
+
|
|
365
|
+
data (Union[MaturitydatesGetModifiedSinceModel, dict]): A model instance or dictionary containing the following fields:
|
|
366
|
+
|
|
367
|
+
- company_id (Union[str, int]): company_id of the MaturitydatesGetModifiedSinceModel.
|
|
368
|
+
|
|
369
|
+
- lastmodified (str): lastmodified of the MaturitydatesGetModifiedSinceModel.
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
Returns:
|
|
374
|
+
ApiResponse: The response from the API.
|
|
375
|
+
"""
|
|
376
|
+
|
|
377
|
+
data = validate_data(data, self.validate, MaturitydatesGetModifiedSinceModel)
|
|
378
|
+
|
|
379
|
+
return self._request(
|
|
380
|
+
fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
|
|
381
|
+
)
|
|
382
|
+
|
|
383
|
+
@endpoint("/<version>/maturityDates/insert/", method="post")
|
|
384
|
+
def insert(self, data: Union[MaturitydatesInsertModel, dict], **kwargs):
|
|
385
|
+
"""
|
|
386
|
+
insert(self, data: Union[MaturitydatesInsertModel, dict], **kwargs)
|
|
387
|
+
|
|
388
|
+
Args:
|
|
389
|
+
|
|
390
|
+
data (Union[MaturitydatesInsertModel, dict]): A model instance or dictionary containing the following fields:
|
|
391
|
+
|
|
392
|
+
- associated_discount (str): associated_discount of the MaturitydatesInsertModel.
|
|
393
|
+
|
|
394
|
+
- company_id (Union[str, int]): company_id of the MaturitydatesInsertModel.
|
|
395
|
+
|
|
396
|
+
- days (str): days of the MaturitydatesInsertModel.
|
|
397
|
+
|
|
398
|
+
- name (str): name of the MaturitydatesInsertModel.
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
Returns:
|
|
403
|
+
ApiResponse: The response from the API.
|
|
404
|
+
"""
|
|
405
|
+
|
|
406
|
+
data = validate_data(data, self.validate, MaturitydatesInsertModel)
|
|
407
|
+
|
|
408
|
+
return self._request(
|
|
409
|
+
fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
|
|
410
|
+
)
|
|
411
|
+
|
|
412
|
+
@endpoint("/<version>/maturityDates/update/", method="post")
|
|
413
|
+
def update(self, data: Union[MaturitydatesUpdateModel, dict], **kwargs):
|
|
414
|
+
"""
|
|
415
|
+
update(self, data: Union[MaturitydatesUpdateModel, dict], **kwargs)
|
|
416
|
+
|
|
417
|
+
Args:
|
|
418
|
+
|
|
419
|
+
data (Union[MaturitydatesUpdateModel, dict]): A model instance or dictionary containing the following fields:
|
|
420
|
+
|
|
421
|
+
- associated_discount (str): associated_discount of the MaturitydatesUpdateModel.
|
|
422
|
+
|
|
423
|
+
- company_id (Union[str, int]): company_id of the MaturitydatesUpdateModel.
|
|
424
|
+
|
|
425
|
+
- days (str): days of the MaturitydatesUpdateModel.
|
|
426
|
+
|
|
427
|
+
- maturity_date_id (Union[str, int]): maturity_date_id of the MaturitydatesUpdateModel.
|
|
428
|
+
|
|
429
|
+
- name (str): name of the MaturitydatesUpdateModel.
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
Returns:
|
|
434
|
+
ApiResponse: The response from the API.
|
|
435
|
+
"""
|
|
436
|
+
|
|
437
|
+
data = validate_data(data, self.validate, MaturitydatesUpdateModel)
|
|
438
|
+
|
|
439
|
+
return self._request(
|
|
440
|
+
fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
|
|
441
|
+
)
|