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 = DocumentmodelsClient(*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 DocumentmodelsCountModifiedSinceModel(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 DocumentmodelsGetModifiedSinceModel(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 DocumentmodelsClient(MoloniBaseClient):
|
|
106
|
+
|
|
107
|
+
@endpoint("/<version>/documentModels/countModifiedSince/", method="post")
|
|
108
|
+
def count_modified_since(
|
|
109
|
+
self, data: Union[DocumentmodelsCountModifiedSinceModel, dict], **kwargs
|
|
110
|
+
):
|
|
111
|
+
"""
|
|
112
|
+
count_modified_since(self, data: Union[DocumentmodelsCountModifiedSinceModel, dict], **kwargs)
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
|
|
116
|
+
data (Union[DocumentmodelsCountModifiedSinceModel, dict]): A model instance or dictionary containing the following fields:
|
|
117
|
+
|
|
118
|
+
- lastmodified (str): lastmodified of the DocumentmodelsCountModifiedSinceModel.
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
Returns:
|
|
123
|
+
ApiResponse: The response from the API.
|
|
124
|
+
"""
|
|
125
|
+
|
|
126
|
+
data = validate_data(data, self.validate, DocumentmodelsCountModifiedSinceModel)
|
|
127
|
+
|
|
128
|
+
return self._request(
|
|
129
|
+
fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
@endpoint("/<version>/documentModels/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>/documentModels/getModifiedSince/", method="post")
|
|
149
|
+
def get_modified_since(
|
|
150
|
+
self, data: Union[DocumentmodelsGetModifiedSinceModel, dict], **kwargs
|
|
151
|
+
):
|
|
152
|
+
"""
|
|
153
|
+
get_modified_since(self, data: Union[DocumentmodelsGetModifiedSinceModel, dict], **kwargs)
|
|
154
|
+
|
|
155
|
+
Args:
|
|
156
|
+
|
|
157
|
+
data (Union[DocumentmodelsGetModifiedSinceModel, dict]): A model instance or dictionary containing the following fields:
|
|
158
|
+
|
|
159
|
+
- lastmodified (str): lastmodified of the DocumentmodelsGetModifiedSinceModel.
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
Returns:
|
|
164
|
+
ApiResponse: The response from the API.
|
|
165
|
+
"""
|
|
166
|
+
|
|
167
|
+
data = validate_data(data, self.validate, DocumentmodelsGetModifiedSinceModel)
|
|
168
|
+
|
|
169
|
+
return self._request(
|
|
170
|
+
fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
|
|
171
|
+
)
|
|
@@ -0,0 +1,472 @@
|
|
|
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 = DocumentsClient(*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 Associated_documents(BaseModel):
|
|
24
|
+
associated_id: Optional[Any] = None
|
|
25
|
+
value: Optional[Any] = None
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class Payments(BaseModel):
|
|
29
|
+
date: Optional[Any] = None
|
|
30
|
+
notes: Optional[Any] = None
|
|
31
|
+
payment_method_id: Optional[Any] = None
|
|
32
|
+
value: Optional[Any] = None
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class Products(BaseModel):
|
|
36
|
+
discount: Optional[Any] = None
|
|
37
|
+
exemption_reason: Optional[Any] = None
|
|
38
|
+
name: Optional[Any] = None
|
|
39
|
+
order: Optional[Any] = None
|
|
40
|
+
price: Optional[Any] = None
|
|
41
|
+
product_id: Optional[Any] = None
|
|
42
|
+
qty: Optional[Any] = None
|
|
43
|
+
summary: Optional[Any] = None
|
|
44
|
+
taxes: Optional[Any] = None
|
|
45
|
+
warehouse_id: Optional[Any] = None
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class DocumentsCountModel(ApiRequestModel):
|
|
49
|
+
company_id: Union[str, int]
|
|
50
|
+
customer_id: Optional[Union[str, int]] = None
|
|
51
|
+
date: Optional[str] = None
|
|
52
|
+
document_set_id: Optional[Union[str, int]] = None
|
|
53
|
+
expiration_date: Optional[str] = None
|
|
54
|
+
number: Optional[str] = None
|
|
55
|
+
our_reference: Optional[str] = None
|
|
56
|
+
salesman_id: Optional[Union[str, int]] = None
|
|
57
|
+
supplier_id: Optional[Union[str, int]] = None
|
|
58
|
+
year: Optional[str] = None
|
|
59
|
+
your_reference: Optional[str] = None
|
|
60
|
+
|
|
61
|
+
def request(self) -> ApiResponse:
|
|
62
|
+
"""
|
|
63
|
+
request(self) -> ApiResponse
|
|
64
|
+
|
|
65
|
+
Make an API request using the initialized client.
|
|
66
|
+
|
|
67
|
+
This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
|
|
68
|
+
If the client is initialized, it will make an API request using the provided method name and the model's data,
|
|
69
|
+
excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
|
|
70
|
+
|
|
71
|
+
Returns:
|
|
72
|
+
The response from the API.
|
|
73
|
+
|
|
74
|
+
Raises:
|
|
75
|
+
ValueError: If the client is not initialized via the `connect` method.
|
|
76
|
+
|
|
77
|
+
Example:
|
|
78
|
+
|
|
79
|
+
# Assuming you have a model instance `request_model` and an API client `api_client`
|
|
80
|
+
|
|
81
|
+
..code-block:: python
|
|
82
|
+
|
|
83
|
+
with request_model.connect(auth_config=auth_config) as api:
|
|
84
|
+
response = api.request()
|
|
85
|
+
|
|
86
|
+
# The above example assumes that the `connect` method has been used to initialize the client.
|
|
87
|
+
# The request method then sends the model's data to the API and returns the API's response.
|
|
88
|
+
|
|
89
|
+
"""
|
|
90
|
+
if hasattr(self, "_api_client"):
|
|
91
|
+
response = self._api_client.count(
|
|
92
|
+
self.model_dump(exclude={"_api_client"}, exclude_unset=True)
|
|
93
|
+
)
|
|
94
|
+
return response
|
|
95
|
+
else:
|
|
96
|
+
raise ValueError("Client not initialized. Use the 'connect' method.")
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
class DocumentsGetAllModel(ApiRequestModel):
|
|
100
|
+
company_id: Union[str, int]
|
|
101
|
+
customer_id: Optional[Union[str, int]] = None
|
|
102
|
+
date: Optional[str] = None
|
|
103
|
+
document_set_id: Optional[Union[str, int]] = None
|
|
104
|
+
expiration_date: Optional[str] = None
|
|
105
|
+
number: Optional[str] = None
|
|
106
|
+
offset: Optional[Union[str, int]] = 0
|
|
107
|
+
our_reference: Optional[str] = None
|
|
108
|
+
qty: Optional[Union[str, int]] = 25
|
|
109
|
+
salesman_id: Optional[Union[str, int]] = None
|
|
110
|
+
supplier_id: Optional[Union[str, int]] = None
|
|
111
|
+
year: Optional[str] = None
|
|
112
|
+
your_reference: Optional[str] = None
|
|
113
|
+
|
|
114
|
+
def request(self) -> ApiResponse:
|
|
115
|
+
"""
|
|
116
|
+
request(self) -> ApiResponse
|
|
117
|
+
|
|
118
|
+
Make an API request using the initialized client.
|
|
119
|
+
|
|
120
|
+
This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
|
|
121
|
+
If the client is initialized, it will make an API request using the provided method name and the model's data,
|
|
122
|
+
excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
|
|
123
|
+
|
|
124
|
+
Returns:
|
|
125
|
+
The response from the API.
|
|
126
|
+
|
|
127
|
+
Raises:
|
|
128
|
+
ValueError: If the client is not initialized via the `connect` method.
|
|
129
|
+
|
|
130
|
+
Example:
|
|
131
|
+
|
|
132
|
+
# Assuming you have a model instance `request_model` and an API client `api_client`
|
|
133
|
+
|
|
134
|
+
..code-block:: python
|
|
135
|
+
|
|
136
|
+
with request_model.connect(auth_config=auth_config) as api:
|
|
137
|
+
response = api.request()
|
|
138
|
+
|
|
139
|
+
# The above example assumes that the `connect` method has been used to initialize the client.
|
|
140
|
+
# The request method then sends the model's data to the API and returns the API's response.
|
|
141
|
+
|
|
142
|
+
"""
|
|
143
|
+
if hasattr(self, "_api_client"):
|
|
144
|
+
response = self._api_client.get_all(
|
|
145
|
+
self.model_dump(exclude={"_api_client"}, exclude_unset=True)
|
|
146
|
+
)
|
|
147
|
+
return response
|
|
148
|
+
else:
|
|
149
|
+
raise ValueError("Client not initialized. Use the 'connect' method.")
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
class DocumentsGetAllDocumentTypesModel(ApiRequestModel):
|
|
153
|
+
language_id: Optional[Union[str, int]] = None
|
|
154
|
+
|
|
155
|
+
def request(self) -> ApiResponse:
|
|
156
|
+
"""
|
|
157
|
+
request(self) -> ApiResponse
|
|
158
|
+
|
|
159
|
+
Make an API request using the initialized client.
|
|
160
|
+
|
|
161
|
+
This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
|
|
162
|
+
If the client is initialized, it will make an API request using the provided method name and the model's data,
|
|
163
|
+
excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
|
|
164
|
+
|
|
165
|
+
Returns:
|
|
166
|
+
The response from the API.
|
|
167
|
+
|
|
168
|
+
Raises:
|
|
169
|
+
ValueError: If the client is not initialized via the `connect` method.
|
|
170
|
+
|
|
171
|
+
Example:
|
|
172
|
+
|
|
173
|
+
# Assuming you have a model instance `request_model` and an API client `api_client`
|
|
174
|
+
|
|
175
|
+
..code-block:: python
|
|
176
|
+
|
|
177
|
+
with request_model.connect(auth_config=auth_config) as api:
|
|
178
|
+
response = api.request()
|
|
179
|
+
|
|
180
|
+
# The above example assumes that the `connect` method has been used to initialize the client.
|
|
181
|
+
# The request method then sends the model's data to the API and returns the API's response.
|
|
182
|
+
|
|
183
|
+
"""
|
|
184
|
+
if hasattr(self, "_api_client"):
|
|
185
|
+
response = self._api_client.get_all_document_types(
|
|
186
|
+
self.model_dump(exclude={"_api_client"}, exclude_unset=True)
|
|
187
|
+
)
|
|
188
|
+
return response
|
|
189
|
+
else:
|
|
190
|
+
raise ValueError("Client not initialized. Use the 'connect' method.")
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
class DocumentsGetOneModel(ApiRequestModel):
|
|
194
|
+
company_id: Union[str, int]
|
|
195
|
+
customer_id: Optional[Union[str, int]] = None
|
|
196
|
+
date: Optional[str] = None
|
|
197
|
+
document_id: Optional[Union[str, int]] = None
|
|
198
|
+
document_set_id: Optional[Union[str, int]] = None
|
|
199
|
+
expiration_date: Optional[str] = None
|
|
200
|
+
number: Optional[str] = None
|
|
201
|
+
our_reference: Optional[str] = None
|
|
202
|
+
salesman_id: Optional[Union[str, int]] = None
|
|
203
|
+
supplier_id: Optional[Union[str, int]] = None
|
|
204
|
+
year: Optional[str] = None
|
|
205
|
+
your_reference: 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.get_one(
|
|
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 DocumentsGetPdfLinkModel(ApiRequestModel):
|
|
246
|
+
company_id: Union[str, int]
|
|
247
|
+
document_id: Optional[Union[str, int]] = None
|
|
248
|
+
|
|
249
|
+
def request(self) -> ApiResponse:
|
|
250
|
+
"""
|
|
251
|
+
request(self) -> ApiResponse
|
|
252
|
+
|
|
253
|
+
Make an API request using the initialized client.
|
|
254
|
+
|
|
255
|
+
This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
|
|
256
|
+
If the client is initialized, it will make an API request using the provided method name and the model's data,
|
|
257
|
+
excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
|
|
258
|
+
|
|
259
|
+
Returns:
|
|
260
|
+
The response from the API.
|
|
261
|
+
|
|
262
|
+
Raises:
|
|
263
|
+
ValueError: If the client is not initialized via the `connect` method.
|
|
264
|
+
|
|
265
|
+
Example:
|
|
266
|
+
|
|
267
|
+
# Assuming you have a model instance `request_model` and an API client `api_client`
|
|
268
|
+
|
|
269
|
+
..code-block:: python
|
|
270
|
+
|
|
271
|
+
with request_model.connect(auth_config=auth_config) as api:
|
|
272
|
+
response = api.request()
|
|
273
|
+
|
|
274
|
+
# The above example assumes that the `connect` method has been used to initialize the client.
|
|
275
|
+
# The request method then sends the model's data to the API and returns the API's response.
|
|
276
|
+
|
|
277
|
+
"""
|
|
278
|
+
if hasattr(self, "_api_client"):
|
|
279
|
+
response = self._api_client.get_pdf_link(
|
|
280
|
+
self.model_dump(exclude={"_api_client"}, exclude_unset=True)
|
|
281
|
+
)
|
|
282
|
+
return response
|
|
283
|
+
else:
|
|
284
|
+
raise ValueError("Client not initialized. Use the 'connect' method.")
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
class DocumentsClient(MoloniBaseClient):
|
|
288
|
+
|
|
289
|
+
@endpoint("/<version>/documents/count/", method="post")
|
|
290
|
+
def count(self, data: Union[DocumentsCountModel, dict], **kwargs):
|
|
291
|
+
"""
|
|
292
|
+
count(self, data: Union[DocumentsCountModel, dict], **kwargs)
|
|
293
|
+
|
|
294
|
+
Args:
|
|
295
|
+
|
|
296
|
+
data (Union[DocumentsCountModel, dict]): A model instance or dictionary containing the following fields:
|
|
297
|
+
|
|
298
|
+
- company_id (Union[str, int]): company_id of the DocumentsCountModel.
|
|
299
|
+
|
|
300
|
+
- customer_id (Union[str, int]): customer_id of the DocumentsCountModel.
|
|
301
|
+
|
|
302
|
+
- date (str): date of the DocumentsCountModel.
|
|
303
|
+
|
|
304
|
+
- document_set_id (Union[str, int]): document_set_id of the DocumentsCountModel.
|
|
305
|
+
|
|
306
|
+
- expiration_date (str): expiration_date of the DocumentsCountModel.
|
|
307
|
+
|
|
308
|
+
- number (str): number of the DocumentsCountModel.
|
|
309
|
+
|
|
310
|
+
- our_reference (str): our_reference of the DocumentsCountModel.
|
|
311
|
+
|
|
312
|
+
- salesman_id (Union[str, int]): salesman_id of the DocumentsCountModel.
|
|
313
|
+
|
|
314
|
+
- supplier_id (Union[str, int]): supplier_id of the DocumentsCountModel.
|
|
315
|
+
|
|
316
|
+
- year (str): year of the DocumentsCountModel.
|
|
317
|
+
|
|
318
|
+
- your_reference (str): your_reference of the DocumentsCountModel.
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
Returns:
|
|
323
|
+
ApiResponse: The response from the API.
|
|
324
|
+
"""
|
|
325
|
+
|
|
326
|
+
data = validate_data(data, self.validate, DocumentsCountModel)
|
|
327
|
+
|
|
328
|
+
return self._request(
|
|
329
|
+
fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
|
|
330
|
+
)
|
|
331
|
+
|
|
332
|
+
@endpoint("/<version>/documents/getAll/", method="post")
|
|
333
|
+
def get_all(self, data: Union[DocumentsGetAllModel, dict], **kwargs):
|
|
334
|
+
"""
|
|
335
|
+
get_all(self, data: Union[DocumentsGetAllModel, dict], **kwargs)
|
|
336
|
+
|
|
337
|
+
Args:
|
|
338
|
+
|
|
339
|
+
data (Union[DocumentsGetAllModel, dict]): A model instance or dictionary containing the following fields:
|
|
340
|
+
|
|
341
|
+
- company_id (Union[str, int]): company_id of the DocumentsGetAllModel.
|
|
342
|
+
|
|
343
|
+
- customer_id (Union[str, int]): customer_id of the DocumentsGetAllModel.
|
|
344
|
+
|
|
345
|
+
- date (str): date of the DocumentsGetAllModel.
|
|
346
|
+
|
|
347
|
+
- document_set_id (Union[str, int]): document_set_id of the DocumentsGetAllModel.
|
|
348
|
+
|
|
349
|
+
- expiration_date (str): expiration_date of the DocumentsGetAllModel.
|
|
350
|
+
|
|
351
|
+
- number (str): number of the DocumentsGetAllModel.
|
|
352
|
+
|
|
353
|
+
- offset (str): offset of the DocumentsGetAllModel.
|
|
354
|
+
|
|
355
|
+
- our_reference (str): our_reference of the DocumentsGetAllModel.
|
|
356
|
+
|
|
357
|
+
- qty (str): qty of the DocumentsGetAllModel.
|
|
358
|
+
|
|
359
|
+
- salesman_id (Union[str, int]): salesman_id of the DocumentsGetAllModel.
|
|
360
|
+
|
|
361
|
+
- supplier_id (Union[str, int]): supplier_id of the DocumentsGetAllModel.
|
|
362
|
+
|
|
363
|
+
- year (str): year of the DocumentsGetAllModel.
|
|
364
|
+
|
|
365
|
+
- your_reference (str): your_reference of the DocumentsGetAllModel.
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
Returns:
|
|
370
|
+
ApiResponse: The response from the API.
|
|
371
|
+
"""
|
|
372
|
+
|
|
373
|
+
data = validate_data(data, self.validate, DocumentsGetAllModel)
|
|
374
|
+
|
|
375
|
+
return self._request(
|
|
376
|
+
fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
|
|
377
|
+
)
|
|
378
|
+
|
|
379
|
+
@endpoint("/<version>/documents/getAllDocumentTypes/", method="post")
|
|
380
|
+
def get_all_document_types(
|
|
381
|
+
self, data: Union[DocumentsGetAllDocumentTypesModel, dict], **kwargs
|
|
382
|
+
):
|
|
383
|
+
"""
|
|
384
|
+
get_all_document_types(self, data: Union[DocumentsGetAllDocumentTypesModel, dict], **kwargs)
|
|
385
|
+
|
|
386
|
+
Args:
|
|
387
|
+
|
|
388
|
+
data (Union[DocumentsGetAllDocumentTypesModel, dict]): A model instance or dictionary containing the following fields:
|
|
389
|
+
|
|
390
|
+
- language_id (Union[str, int]): language_id of the DocumentsGetAllDocumentTypesModel.
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
Returns:
|
|
395
|
+
ApiResponse: The response from the API.
|
|
396
|
+
"""
|
|
397
|
+
|
|
398
|
+
data = validate_data(data, self.validate, DocumentsGetAllDocumentTypesModel)
|
|
399
|
+
|
|
400
|
+
return self._request(
|
|
401
|
+
fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
|
|
402
|
+
)
|
|
403
|
+
|
|
404
|
+
@endpoint("/<version>/documents/getOne/", method="post")
|
|
405
|
+
def get_one(self, data: Union[DocumentsGetOneModel, dict], **kwargs):
|
|
406
|
+
"""
|
|
407
|
+
get_one(self, data: Union[DocumentsGetOneModel, dict], **kwargs)
|
|
408
|
+
|
|
409
|
+
Args:
|
|
410
|
+
|
|
411
|
+
data (Union[DocumentsGetOneModel, dict]): A model instance or dictionary containing the following fields:
|
|
412
|
+
|
|
413
|
+
- company_id (Union[str, int]): company_id of the DocumentsGetOneModel.
|
|
414
|
+
|
|
415
|
+
- customer_id (Union[str, int]): customer_id of the DocumentsGetOneModel.
|
|
416
|
+
|
|
417
|
+
- date (str): date of the DocumentsGetOneModel.
|
|
418
|
+
|
|
419
|
+
- document_id (Union[str, int]): document_id of the DocumentsGetOneModel.
|
|
420
|
+
|
|
421
|
+
- document_set_id (Union[str, int]): document_set_id of the DocumentsGetOneModel.
|
|
422
|
+
|
|
423
|
+
- expiration_date (str): expiration_date of the DocumentsGetOneModel.
|
|
424
|
+
|
|
425
|
+
- number (str): number of the DocumentsGetOneModel.
|
|
426
|
+
|
|
427
|
+
- our_reference (str): our_reference of the DocumentsGetOneModel.
|
|
428
|
+
|
|
429
|
+
- salesman_id (Union[str, int]): salesman_id of the DocumentsGetOneModel.
|
|
430
|
+
|
|
431
|
+
- supplier_id (Union[str, int]): supplier_id of the DocumentsGetOneModel.
|
|
432
|
+
|
|
433
|
+
- year (str): year of the DocumentsGetOneModel.
|
|
434
|
+
|
|
435
|
+
- your_reference (str): your_reference of the DocumentsGetOneModel.
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
Returns:
|
|
440
|
+
ApiResponse: The response from the API.
|
|
441
|
+
"""
|
|
442
|
+
|
|
443
|
+
data = validate_data(data, self.validate, DocumentsGetOneModel)
|
|
444
|
+
|
|
445
|
+
return self._request(
|
|
446
|
+
fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
|
|
447
|
+
)
|
|
448
|
+
|
|
449
|
+
@endpoint("/<version>/documents/getPDFLink/", method="post")
|
|
450
|
+
def get_pdf_link(self, data: Union[DocumentsGetPdfLinkModel, dict], **kwargs):
|
|
451
|
+
"""
|
|
452
|
+
get_pdf_link(self, data: Union[DocumentsGetPdfLinkModel, dict], **kwargs)
|
|
453
|
+
|
|
454
|
+
Args:
|
|
455
|
+
|
|
456
|
+
data (Union[DocumentsGetPdfLinkModel, dict]): A model instance or dictionary containing the following fields:
|
|
457
|
+
|
|
458
|
+
- company_id (Union[str, int]): company_id of the DocumentsGetPdfLinkModel.
|
|
459
|
+
|
|
460
|
+
- document_id (Union[str, int]): document_id of the DocumentsGetPdfLinkModel.
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
Returns:
|
|
465
|
+
ApiResponse: The response from the API.
|
|
466
|
+
"""
|
|
467
|
+
|
|
468
|
+
data = validate_data(data, self.validate, DocumentsGetPdfLinkModel)
|
|
469
|
+
|
|
470
|
+
return self._request(
|
|
471
|
+
fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
|
|
472
|
+
)
|