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,1413 @@
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 = CustomersClient(*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 CustomersCountModel(ApiRequestModel):
24
+ company_id: Union[str, int]
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(
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 CustomersCountByNameModel(ApiRequestModel):
65
+ company_id: Union[str, int]
66
+ name: Optional[str] = None
67
+
68
+ def request(self) -> ApiResponse:
69
+ """
70
+ request(self) -> ApiResponse
71
+
72
+ Make an API request using the initialized client.
73
+
74
+ This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
75
+ If the client is initialized, it will make an API request using the provided method name and the model's data,
76
+ excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
77
+
78
+ Returns:
79
+ The response from the API.
80
+
81
+ Raises:
82
+ ValueError: If the client is not initialized via the `connect` method.
83
+
84
+ Example:
85
+
86
+ # Assuming you have a model instance `request_model` and an API client `api_client`
87
+
88
+ ..code-block:: python
89
+
90
+ with request_model.connect(auth_config=auth_config) as api:
91
+ response = api.request()
92
+
93
+ # The above example assumes that the `connect` method has been used to initialize the client.
94
+ # The request method then sends the model's data to the API and returns the API's response.
95
+
96
+ """
97
+ if hasattr(self, "_api_client"):
98
+ response = self._api_client.count_by_name(
99
+ self.model_dump(exclude={"_api_client"}, exclude_unset=True)
100
+ )
101
+ return response
102
+ else:
103
+ raise ValueError("Client not initialized. Use the 'connect' method.")
104
+
105
+
106
+ class CustomersCountByNumberModel(ApiRequestModel):
107
+ company_id: Union[str, int]
108
+ number: Optional[str] = None
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.count_by_number(
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 CustomersCountBySearchModel(ApiRequestModel):
149
+ company_id: Union[str, int]
150
+ search: 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.count_by_search(
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 CustomersCountByVatModel(ApiRequestModel):
191
+ company_id: Union[str, int]
192
+ vat: 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.count_by_vat(
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 CustomersCountModifiedSinceModel(ApiRequestModel):
233
+ company_id: Union[str, int]
234
+ lastmodified: Optional[str] = None
235
+
236
+ def request(self) -> ApiResponse:
237
+ """
238
+ request(self) -> ApiResponse
239
+
240
+ Make an API request using the initialized client.
241
+
242
+ This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
243
+ If the client is initialized, it will make an API request using the provided method name and the model's data,
244
+ excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
245
+
246
+ Returns:
247
+ The response from the API.
248
+
249
+ Raises:
250
+ ValueError: If the client is not initialized via the `connect` method.
251
+
252
+ Example:
253
+
254
+ # Assuming you have a model instance `request_model` and an API client `api_client`
255
+
256
+ ..code-block:: python
257
+
258
+ with request_model.connect(auth_config=auth_config) as api:
259
+ response = api.request()
260
+
261
+ # The above example assumes that the `connect` method has been used to initialize the client.
262
+ # The request method then sends the model's data to the API and returns the API's response.
263
+
264
+ """
265
+ if hasattr(self, "_api_client"):
266
+ response = self._api_client.count_modified_since(
267
+ self.model_dump(exclude={"_api_client"}, exclude_unset=True)
268
+ )
269
+ return response
270
+ else:
271
+ raise ValueError("Client not initialized. Use the 'connect' method.")
272
+
273
+
274
+ class CustomersDeleteModel(ApiRequestModel):
275
+ company_id: Union[str, int]
276
+ customer_id: Optional[Union[str, int]] = None
277
+
278
+ def request(self) -> ApiResponse:
279
+ """
280
+ request(self) -> ApiResponse
281
+
282
+ Make an API request using the initialized client.
283
+
284
+ This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
285
+ If the client is initialized, it will make an API request using the provided method name and the model's data,
286
+ excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
287
+
288
+ Returns:
289
+ The response from the API.
290
+
291
+ Raises:
292
+ ValueError: If the client is not initialized via the `connect` method.
293
+
294
+ Example:
295
+
296
+ # Assuming you have a model instance `request_model` and an API client `api_client`
297
+
298
+ ..code-block:: python
299
+
300
+ with request_model.connect(auth_config=auth_config) as api:
301
+ response = api.request()
302
+
303
+ # The above example assumes that the `connect` method has been used to initialize the client.
304
+ # The request method then sends the model's data to the API and returns the API's response.
305
+
306
+ """
307
+ if hasattr(self, "_api_client"):
308
+ response = self._api_client.delete(
309
+ self.model_dump(exclude={"_api_client"}, exclude_unset=True)
310
+ )
311
+ return response
312
+ else:
313
+ raise ValueError("Client not initialized. Use the 'connect' method.")
314
+
315
+
316
+ class CustomersGetAllModel(ApiRequestModel):
317
+ company_id: Union[str, int]
318
+ offset: Optional[Union[str, int]] = 0
319
+ qty: Optional[Union[str, int]] = 25
320
+
321
+ def request(self) -> ApiResponse:
322
+ """
323
+ request(self) -> ApiResponse
324
+
325
+ Make an API request using the initialized client.
326
+
327
+ This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
328
+ If the client is initialized, it will make an API request using the provided method name and the model's data,
329
+ excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
330
+
331
+ Returns:
332
+ The response from the API.
333
+
334
+ Raises:
335
+ ValueError: If the client is not initialized via the `connect` method.
336
+
337
+ Example:
338
+
339
+ # Assuming you have a model instance `request_model` and an API client `api_client`
340
+
341
+ ..code-block:: python
342
+
343
+ with request_model.connect(auth_config=auth_config) as api:
344
+ response = api.request()
345
+
346
+ # The above example assumes that the `connect` method has been used to initialize the client.
347
+ # The request method then sends the model's data to the API and returns the API's response.
348
+
349
+ """
350
+ if hasattr(self, "_api_client"):
351
+ response = self._api_client.get_all(
352
+ self.model_dump(exclude={"_api_client"}, exclude_unset=True)
353
+ )
354
+ return response
355
+ else:
356
+ raise ValueError("Client not initialized. Use the 'connect' method.")
357
+
358
+
359
+ class CustomersGetByNameModel(ApiRequestModel):
360
+ company_id: Union[str, int]
361
+ name: Optional[str] = None
362
+ offset: Optional[Union[str, int]] = 0
363
+ qty: Optional[Union[str, int]] = 25
364
+
365
+ def request(self) -> ApiResponse:
366
+ """
367
+ request(self) -> ApiResponse
368
+
369
+ Make an API request using the initialized client.
370
+
371
+ This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
372
+ If the client is initialized, it will make an API request using the provided method name and the model's data,
373
+ excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
374
+
375
+ Returns:
376
+ The response from the API.
377
+
378
+ Raises:
379
+ ValueError: If the client is not initialized via the `connect` method.
380
+
381
+ Example:
382
+
383
+ # Assuming you have a model instance `request_model` and an API client `api_client`
384
+
385
+ ..code-block:: python
386
+
387
+ with request_model.connect(auth_config=auth_config) as api:
388
+ response = api.request()
389
+
390
+ # The above example assumes that the `connect` method has been used to initialize the client.
391
+ # The request method then sends the model's data to the API and returns the API's response.
392
+
393
+ """
394
+ if hasattr(self, "_api_client"):
395
+ response = self._api_client.get_by_name(
396
+ self.model_dump(exclude={"_api_client"}, exclude_unset=True)
397
+ )
398
+ return response
399
+ else:
400
+ raise ValueError("Client not initialized. Use the 'connect' method.")
401
+
402
+
403
+ class CustomersGetByEmailModel(ApiRequestModel):
404
+ company_id: Union[str, int]
405
+ email: Optional[str] = None
406
+ offset: Optional[Union[str, int]] = 0
407
+ qty: Optional[Union[str, int]] = 25
408
+
409
+ def request(self) -> ApiResponse:
410
+ """
411
+ request(self) -> ApiResponse
412
+
413
+ Make an API request using the initialized client.
414
+
415
+ This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
416
+ If the client is initialized, it will make an API request using the provided method name and the model's data,
417
+ excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
418
+
419
+ Returns:
420
+ The response from the API.
421
+
422
+ Raises:
423
+ ValueError: If the client is not initialized via the `connect` method.
424
+
425
+ Example:
426
+
427
+ # Assuming you have a model instance `request_model` and an API client `api_client`
428
+
429
+ ..code-block:: python
430
+
431
+ with request_model.connect(auth_config=auth_config) as api:
432
+ response = api.request()
433
+
434
+ # The above example assumes that the `connect` method has been used to initialize the client.
435
+ # The request method then sends the model's data to the API and returns the API's response.
436
+
437
+ """
438
+ if hasattr(self, "_api_client"):
439
+ response = self._api_client.get_by_email(
440
+ self.model_dump(exclude={"_api_client"}, exclude_unset=True)
441
+ )
442
+ return response
443
+ else:
444
+ raise ValueError("Client not initialized. Use the 'connect' method.")
445
+
446
+
447
+ class CustomersGetByNumberModel(ApiRequestModel):
448
+ company_id: Union[str, int]
449
+ number: Optional[str] = None
450
+ offset: Optional[Union[str, int]] = 0
451
+ qty: Optional[Union[str, int]] = 25
452
+
453
+ def request(self) -> ApiResponse:
454
+ """
455
+ request(self) -> ApiResponse
456
+
457
+ Make an API request using the initialized client.
458
+
459
+ This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
460
+ If the client is initialized, it will make an API request using the provided method name and the model's data,
461
+ excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
462
+
463
+ Returns:
464
+ The response from the API.
465
+
466
+ Raises:
467
+ ValueError: If the client is not initialized via the `connect` method.
468
+
469
+ Example:
470
+
471
+ # Assuming you have a model instance `request_model` and an API client `api_client`
472
+
473
+ ..code-block:: python
474
+
475
+ with request_model.connect(auth_config=auth_config) as api:
476
+ response = api.request()
477
+
478
+ # The above example assumes that the `connect` method has been used to initialize the client.
479
+ # The request method then sends the model's data to the API and returns the API's response.
480
+
481
+ """
482
+ if hasattr(self, "_api_client"):
483
+ response = self._api_client.get_by_number(
484
+ self.model_dump(exclude={"_api_client"}, exclude_unset=True)
485
+ )
486
+ return response
487
+ else:
488
+ raise ValueError("Client not initialized. Use the 'connect' method.")
489
+
490
+
491
+ class CustomersGetBySearchModel(ApiRequestModel):
492
+ company_id: Union[str, int]
493
+ offset: Optional[Union[str, int]] = 0
494
+ qty: Optional[Union[str, int]] = 25
495
+ search: Optional[str] = None
496
+
497
+ def request(self) -> ApiResponse:
498
+ """
499
+ request(self) -> ApiResponse
500
+
501
+ Make an API request using the initialized client.
502
+
503
+ This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
504
+ If the client is initialized, it will make an API request using the provided method name and the model's data,
505
+ excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
506
+
507
+ Returns:
508
+ The response from the API.
509
+
510
+ Raises:
511
+ ValueError: If the client is not initialized via the `connect` method.
512
+
513
+ Example:
514
+
515
+ # Assuming you have a model instance `request_model` and an API client `api_client`
516
+
517
+ ..code-block:: python
518
+
519
+ with request_model.connect(auth_config=auth_config) as api:
520
+ response = api.request()
521
+
522
+ # The above example assumes that the `connect` method has been used to initialize the client.
523
+ # The request method then sends the model's data to the API and returns the API's response.
524
+
525
+ """
526
+ if hasattr(self, "_api_client"):
527
+ response = self._api_client.get_by_search(
528
+ self.model_dump(exclude={"_api_client"}, exclude_unset=True)
529
+ )
530
+ return response
531
+ else:
532
+ raise ValueError("Client not initialized. Use the 'connect' method.")
533
+
534
+
535
+ class CustomersGetByVatModel(ApiRequestModel):
536
+ company_id: Union[str, int]
537
+ offset: Optional[Union[str, int]] = 0
538
+ qty: Optional[Union[str, int]] = 25
539
+ vat: Optional[str] = None
540
+
541
+ def request(self) -> ApiResponse:
542
+ """
543
+ request(self) -> ApiResponse
544
+
545
+ Make an API request using the initialized client.
546
+
547
+ This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
548
+ If the client is initialized, it will make an API request using the provided method name and the model's data,
549
+ excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
550
+
551
+ Returns:
552
+ The response from the API.
553
+
554
+ Raises:
555
+ ValueError: If the client is not initialized via the `connect` method.
556
+
557
+ Example:
558
+
559
+ # Assuming you have a model instance `request_model` and an API client `api_client`
560
+
561
+ ..code-block:: python
562
+
563
+ with request_model.connect(auth_config=auth_config) as api:
564
+ response = api.request()
565
+
566
+ # The above example assumes that the `connect` method has been used to initialize the client.
567
+ # The request method then sends the model's data to the API and returns the API's response.
568
+
569
+ """
570
+ if hasattr(self, "_api_client"):
571
+ response = self._api_client.get_by_vat(
572
+ self.model_dump(exclude={"_api_client"}, exclude_unset=True)
573
+ )
574
+ return response
575
+ else:
576
+ raise ValueError("Client not initialized. Use the 'connect' method.")
577
+
578
+
579
+ class CustomersGetLastNumberModel(ApiRequestModel):
580
+ company_id: Union[str, int]
581
+
582
+ def request(self) -> ApiResponse:
583
+ """
584
+ request(self) -> ApiResponse
585
+
586
+ Make an API request using the initialized client.
587
+
588
+ This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
589
+ If the client is initialized, it will make an API request using the provided method name and the model's data,
590
+ excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
591
+
592
+ Returns:
593
+ The response from the API.
594
+
595
+ Raises:
596
+ ValueError: If the client is not initialized via the `connect` method.
597
+
598
+ Example:
599
+
600
+ # Assuming you have a model instance `request_model` and an API client `api_client`
601
+
602
+ ..code-block:: python
603
+
604
+ with request_model.connect(auth_config=auth_config) as api:
605
+ response = api.request()
606
+
607
+ # The above example assumes that the `connect` method has been used to initialize the client.
608
+ # The request method then sends the model's data to the API and returns the API's response.
609
+
610
+ """
611
+ if hasattr(self, "_api_client"):
612
+ response = self._api_client.get_last_number(
613
+ self.model_dump(exclude={"_api_client"}, exclude_unset=True)
614
+ )
615
+ return response
616
+ else:
617
+ raise ValueError("Client not initialized. Use the 'connect' method.")
618
+
619
+
620
+ class CustomersGetModifiedSinceModel(ApiRequestModel):
621
+ company_id: Union[str, int]
622
+ lastmodified: Optional[str] = None
623
+ offset: Optional[Union[str, int]] = 0
624
+ qty: Optional[Union[str, int]] = 25
625
+
626
+ def request(self) -> ApiResponse:
627
+ """
628
+ request(self) -> ApiResponse
629
+
630
+ Make an API request using the initialized client.
631
+
632
+ This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
633
+ If the client is initialized, it will make an API request using the provided method name and the model's data,
634
+ excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
635
+
636
+ Returns:
637
+ The response from the API.
638
+
639
+ Raises:
640
+ ValueError: If the client is not initialized via the `connect` method.
641
+
642
+ Example:
643
+
644
+ # Assuming you have a model instance `request_model` and an API client `api_client`
645
+
646
+ ..code-block:: python
647
+
648
+ with request_model.connect(auth_config=auth_config) as api:
649
+ response = api.request()
650
+
651
+ # The above example assumes that the `connect` method has been used to initialize the client.
652
+ # The request method then sends the model's data to the API and returns the API's response.
653
+
654
+ """
655
+ if hasattr(self, "_api_client"):
656
+ response = self._api_client.get_modified_since(
657
+ self.model_dump(exclude={"_api_client"}, exclude_unset=True)
658
+ )
659
+ return response
660
+ else:
661
+ raise ValueError("Client not initialized. Use the 'connect' method.")
662
+
663
+
664
+ class CustomersGetOneModel(ApiRequestModel):
665
+ company_id: Union[str, int]
666
+ customer_id: Optional[Union[str, int]] = None
667
+
668
+ def request(self) -> ApiResponse:
669
+ """
670
+ request(self) -> ApiResponse
671
+
672
+ Make an API request using the initialized client.
673
+
674
+ This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
675
+ If the client is initialized, it will make an API request using the provided method name and the model's data,
676
+ excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
677
+
678
+ Returns:
679
+ The response from the API.
680
+
681
+ Raises:
682
+ ValueError: If the client is not initialized via the `connect` method.
683
+
684
+ Example:
685
+
686
+ # Assuming you have a model instance `request_model` and an API client `api_client`
687
+
688
+ ..code-block:: python
689
+
690
+ with request_model.connect(auth_config=auth_config) as api:
691
+ response = api.request()
692
+
693
+ # The above example assumes that the `connect` method has been used to initialize the client.
694
+ # The request method then sends the model's data to the API and returns the API's response.
695
+
696
+ """
697
+ if hasattr(self, "_api_client"):
698
+ response = self._api_client.get_one(
699
+ self.model_dump(exclude={"_api_client"}, exclude_unset=True)
700
+ )
701
+ return response
702
+ else:
703
+ raise ValueError("Client not initialized. Use the 'connect' method.")
704
+
705
+
706
+ class CustomersInsertModel(ApiRequestModel):
707
+ company_id: Union[str, int]
708
+ address: Optional[str] = None
709
+ city: Optional[str] = None
710
+ contact_email: Optional[str] = None
711
+ contact_name: Optional[str] = None
712
+ contact_phone: Optional[str] = None
713
+ country_id: Optional[Union[str, int]] = None
714
+ credit_limit: Optional[str] = None
715
+ delivery_method_id: Optional[Union[str, int]] = None
716
+ discount: Optional[str] = None
717
+ email: Optional[str] = None
718
+ fax: Optional[str] = None
719
+ field_notes: Optional[str] = None
720
+ language_id: Optional[Union[str, int]] = None
721
+ maturity_date_id: Optional[Union[str, int]] = None
722
+ name: Optional[str] = None
723
+ notes: Optional[str] = None
724
+ number: Optional[str] = None
725
+ payment_day: Optional[str] = None
726
+ payment_method_id: Optional[Union[str, int]] = None
727
+ phone: Optional[str] = None
728
+ qty_copies_document: Optional[str] = None
729
+ salesman_id: Optional[Union[str, int]] = None
730
+ vat: Optional[str] = None
731
+ website: Optional[str] = None
732
+ zip_code: Optional[str] = None
733
+
734
+ def request(self) -> ApiResponse:
735
+ """
736
+ request(self) -> ApiResponse
737
+
738
+ Make an API request using the initialized client.
739
+
740
+ This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
741
+ If the client is initialized, it will make an API request using the provided method name and the model's data,
742
+ excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
743
+
744
+ Returns:
745
+ The response from the API.
746
+
747
+ Raises:
748
+ ValueError: If the client is not initialized via the `connect` method.
749
+
750
+ Example:
751
+
752
+ # Assuming you have a model instance `request_model` and an API client `api_client`
753
+
754
+ ..code-block:: python
755
+
756
+ with request_model.connect(auth_config=auth_config) as api:
757
+ response = api.request()
758
+
759
+ # The above example assumes that the `connect` method has been used to initialize the client.
760
+ # The request method then sends the model's data to the API and returns the API's response.
761
+
762
+ """
763
+ if hasattr(self, "_api_client"):
764
+ response = self._api_client.insert(
765
+ self.model_dump(exclude={"_api_client"}, exclude_unset=True)
766
+ )
767
+ return response
768
+ else:
769
+ raise ValueError("Client not initialized. Use the 'connect' method.")
770
+
771
+
772
+ class CustomersUpdateModel(ApiRequestModel):
773
+ company_id: Union[str, int]
774
+ address: Optional[str] = None
775
+ city: Optional[str] = None
776
+ contact_email: Optional[str] = None
777
+ contact_name: Optional[str] = None
778
+ contact_phone: Optional[str] = None
779
+ country_id: Optional[Union[str, int]] = None
780
+ credit_limit: Optional[str] = None
781
+ customer_id: Optional[Union[str, int]] = None
782
+ delivery_method_id: Optional[Union[str, int]] = None
783
+ discount: Optional[str] = None
784
+ email: Optional[str] = None
785
+ fax: Optional[str] = None
786
+ field_notes: Optional[str] = None
787
+ language_id: Optional[Union[str, int]] = None
788
+ maturity_date_id: Optional[Union[str, int]] = None
789
+ name: Optional[str] = None
790
+ notes: Optional[str] = None
791
+ number: Optional[str] = None
792
+ payment_day: Optional[str] = None
793
+ payment_method_id: Optional[Union[str, int]] = None
794
+ phone: Optional[str] = None
795
+ qty_copies_document: Optional[str] = None
796
+ salesman_id: Optional[Union[str, int]] = None
797
+ vat: Optional[str] = None
798
+ website: Optional[str] = None
799
+ zip_code: Optional[str] = None
800
+
801
+ def request(self) -> ApiResponse:
802
+ """
803
+ request(self) -> ApiResponse
804
+
805
+ Make an API request using the initialized client.
806
+
807
+ This method checks if the `_api_client` attribute is set (i.e., if the client has been initialized via the `connect` method).
808
+ If the client is initialized, it will make an API request using the provided method name and the model's data,
809
+ excluding the `_api_client` attribute itself from the request payload. If the client is not initialized, it will raise a `ValueError`.
810
+
811
+ Returns:
812
+ The response from the API.
813
+
814
+ Raises:
815
+ ValueError: If the client is not initialized via the `connect` method.
816
+
817
+ Example:
818
+
819
+ # Assuming you have a model instance `request_model` and an API client `api_client`
820
+
821
+ ..code-block:: python
822
+
823
+ with request_model.connect(auth_config=auth_config) as api:
824
+ response = api.request()
825
+
826
+ # The above example assumes that the `connect` method has been used to initialize the client.
827
+ # The request method then sends the model's data to the API and returns the API's response.
828
+
829
+ """
830
+ if hasattr(self, "_api_client"):
831
+ response = self._api_client.update(
832
+ self.model_dump(exclude={"_api_client"}, exclude_unset=True)
833
+ )
834
+ return response
835
+ else:
836
+ raise ValueError("Client not initialized. Use the 'connect' method.")
837
+
838
+
839
+ class CustomersClient(MoloniBaseClient):
840
+
841
+ @endpoint("/<version>/customers/count/", method="post")
842
+ def count(self, data: Union[CustomersCountModel, dict], **kwargs):
843
+ """
844
+ count(self, data: Union[CustomersCountModel, dict], **kwargs)
845
+
846
+ Args:
847
+
848
+ data (Union[CustomersCountModel, dict]): A model instance or dictionary containing the following fields:
849
+
850
+ - company_id (Union[str, int]): company_id of the CustomersCountModel.
851
+
852
+
853
+
854
+ Returns:
855
+ ApiResponse: The response from the API.
856
+ """
857
+
858
+ data = validate_data(data, self.validate, CustomersCountModel)
859
+
860
+ return self._request(
861
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
862
+ )
863
+
864
+ @endpoint("/<version>/customers/countByName/", method="post")
865
+ def count_by_name(self, data: Union[CustomersCountByNameModel, dict], **kwargs):
866
+ """
867
+ count_by_name(self, data: Union[CustomersCountByNameModel, dict], **kwargs)
868
+
869
+ Args:
870
+
871
+ data (Union[CustomersCountByNameModel, dict]): A model instance or dictionary containing the following fields:
872
+
873
+ - company_id (Union[str, int]): company_id of the CustomersCountByNameModel.
874
+
875
+ - name (str): name of the CustomersCountByNameModel.
876
+
877
+
878
+
879
+ Returns:
880
+ ApiResponse: The response from the API.
881
+ """
882
+
883
+ data = validate_data(data, self.validate, CustomersCountByNameModel)
884
+
885
+ return self._request(
886
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
887
+ )
888
+
889
+ @endpoint("/<version>/customers/countByNumber/", method="post")
890
+ def count_by_number(self, data: Union[CustomersCountByNumberModel, dict], **kwargs):
891
+ """
892
+ count_by_number(self, data: Union[CustomersCountByNumberModel, dict], **kwargs)
893
+
894
+ Args:
895
+
896
+ data (Union[CustomersCountByNumberModel, dict]): A model instance or dictionary containing the following fields:
897
+
898
+ - company_id (Union[str, int]): company_id of the CustomersCountByNumberModel.
899
+
900
+ - number (str): number of the CustomersCountByNumberModel.
901
+
902
+
903
+
904
+ Returns:
905
+ ApiResponse: The response from the API.
906
+ """
907
+
908
+ data = validate_data(data, self.validate, CustomersCountByNumberModel)
909
+
910
+ return self._request(
911
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
912
+ )
913
+
914
+ @endpoint("/<version>/customers/countBySearch/", method="post")
915
+ def count_by_search(self, data: Union[CustomersCountBySearchModel, dict], **kwargs):
916
+ """
917
+ count_by_search(self, data: Union[CustomersCountBySearchModel, dict], **kwargs)
918
+
919
+ Args:
920
+
921
+ data (Union[CustomersCountBySearchModel, dict]): A model instance or dictionary containing the following fields:
922
+
923
+ - company_id (Union[str, int]): company_id of the CustomersCountBySearchModel.
924
+
925
+ - search (str): search of the CustomersCountBySearchModel.
926
+
927
+
928
+
929
+ Returns:
930
+ ApiResponse: The response from the API.
931
+ """
932
+
933
+ data = validate_data(data, self.validate, CustomersCountBySearchModel)
934
+
935
+ return self._request(
936
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
937
+ )
938
+
939
+ @endpoint("/<version>/customers/countByVat/", method="post")
940
+ def count_by_vat(self, data: Union[CustomersCountByVatModel, dict], **kwargs):
941
+ """
942
+ count_by_vat(self, data: Union[CustomersCountByVatModel, dict], **kwargs)
943
+
944
+ Args:
945
+
946
+ data (Union[CustomersCountByVatModel, dict]): A model instance or dictionary containing the following fields:
947
+
948
+ - company_id (Union[str, int]): company_id of the CustomersCountByVatModel.
949
+
950
+ - vat (str): vat of the CustomersCountByVatModel.
951
+
952
+
953
+
954
+ Returns:
955
+ ApiResponse: The response from the API.
956
+ """
957
+
958
+ data = validate_data(data, self.validate, CustomersCountByVatModel)
959
+
960
+ return self._request(
961
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
962
+ )
963
+
964
+ @endpoint("/<version>/customers/countModifiedSince/", method="post")
965
+ def count_modified_since(
966
+ self, data: Union[CustomersCountModifiedSinceModel, dict], **kwargs
967
+ ):
968
+ """
969
+ count_modified_since(self, data: Union[CustomersCountModifiedSinceModel, dict], **kwargs)
970
+
971
+ Args:
972
+
973
+ data (Union[CustomersCountModifiedSinceModel, dict]): A model instance or dictionary containing the following fields:
974
+
975
+ - company_id (Union[str, int]): company_id of the CustomersCountModifiedSinceModel.
976
+
977
+ - lastmodified (str): lastmodified of the CustomersCountModifiedSinceModel.
978
+
979
+
980
+
981
+ Returns:
982
+ ApiResponse: The response from the API.
983
+ """
984
+
985
+ data = validate_data(data, self.validate, CustomersCountModifiedSinceModel)
986
+
987
+ return self._request(
988
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
989
+ )
990
+
991
+ @endpoint("/<version>/customers/delete/", method="post")
992
+ def delete(self, data: Union[CustomersDeleteModel, dict], **kwargs):
993
+ """
994
+ delete(self, data: Union[CustomersDeleteModel, dict], **kwargs)
995
+
996
+ Args:
997
+
998
+ data (Union[CustomersDeleteModel, dict]): A model instance or dictionary containing the following fields:
999
+
1000
+ - company_id (Union[str, int]): company_id of the CustomersDeleteModel.
1001
+
1002
+ - customer_id (Union[str, int]): customer_id of the CustomersDeleteModel.
1003
+
1004
+
1005
+
1006
+ Returns:
1007
+ ApiResponse: The response from the API.
1008
+ """
1009
+
1010
+ data = validate_data(data, self.validate, CustomersDeleteModel)
1011
+
1012
+ return self._request(
1013
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
1014
+ )
1015
+
1016
+ @endpoint("/<version>/customers/getAll/", method="post")
1017
+ def get_all(self, data: Union[CustomersGetAllModel, dict], **kwargs):
1018
+ """
1019
+ get_all(self, data: Union[CustomersGetAllModel, dict], **kwargs)
1020
+
1021
+ Args:
1022
+
1023
+ data (Union[CustomersGetAllModel, dict]): A model instance or dictionary containing the following fields:
1024
+
1025
+ - company_id (Union[str, int]): company_id of the CustomersGetAllModel.
1026
+
1027
+ - offset (str): offset of the CustomersGetAllModel.
1028
+
1029
+ - qty (str): qty of the CustomersGetAllModel.
1030
+
1031
+
1032
+
1033
+ Returns:
1034
+ ApiResponse: The response from the API.
1035
+ """
1036
+
1037
+ data = validate_data(data, self.validate, CustomersGetAllModel)
1038
+
1039
+ return self._request(
1040
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
1041
+ )
1042
+
1043
+ @endpoint("/<version>/customers/getByName/", method="post")
1044
+ def get_by_name(self, data: Union[CustomersGetByNameModel, dict], **kwargs):
1045
+ """
1046
+ get_by_name(self, data: Union[CustomersGetByNameModel, dict], **kwargs)
1047
+
1048
+ Args:
1049
+
1050
+ data (Union[CustomersGetByNameModel, dict]): A model instance or dictionary containing the following fields:
1051
+
1052
+ - company_id (Union[str, int]): company_id of the CustomersGetByNameModel.
1053
+
1054
+ - name (str): name of the CustomersGetByNameModel.
1055
+
1056
+ - offset (str): offset of the CustomersGetByNameModel.
1057
+
1058
+ - qty (str): qty of the CustomersGetByNameModel.
1059
+
1060
+
1061
+
1062
+ Returns:
1063
+ ApiResponse: The response from the API.
1064
+ """
1065
+
1066
+ data = validate_data(data, self.validate, CustomersGetByNameModel)
1067
+
1068
+ return self._request(
1069
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
1070
+ )
1071
+
1072
+ @endpoint("/<version>/customers/getByEmail/", method="post")
1073
+ def get_by_email(self, data: Union[CustomersGetByEmailModel, dict], **kwargs):
1074
+ """
1075
+ get_by_email(self, data: Union[CustomersGetByEmailModel, dict], **kwargs)
1076
+
1077
+ Args:
1078
+
1079
+ data (Union[CustomersGetByEmailModel, dict]): A model instance or dictionary containing the following fields:
1080
+
1081
+ - company_id (Union[str, int]): company_id of the CustomersGetByEmailModel.
1082
+
1083
+ - email (str): email of the CustomersGetByEmailModel.
1084
+
1085
+ - offset (str): offset of the CustomersGetByEmailModel.
1086
+
1087
+ - qty (str): qty of the CustomersGetByEmailModel.
1088
+
1089
+
1090
+
1091
+ Returns:
1092
+ ApiResponse: The response from the API.
1093
+ """
1094
+
1095
+ data = validate_data(data, self.validate, CustomersGetByEmailModel)
1096
+
1097
+ return self._request(
1098
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
1099
+ )
1100
+
1101
+ @endpoint("/<version>/customers/getByNumber/", method="post")
1102
+ def get_by_number(self, data: Union[CustomersGetByNumberModel, dict], **kwargs):
1103
+ """
1104
+ get_by_number(self, data: Union[CustomersGetByNumberModel, dict], **kwargs)
1105
+
1106
+ Args:
1107
+
1108
+ data (Union[CustomersGetByNumberModel, dict]): A model instance or dictionary containing the following fields:
1109
+
1110
+ - company_id (Union[str, int]): company_id of the CustomersGetByNumberModel.
1111
+
1112
+ - number (str): number of the CustomersGetByNumberModel.
1113
+
1114
+ - offset (str): offset of the CustomersGetByNumberModel.
1115
+
1116
+ - qty (str): qty of the CustomersGetByNumberModel.
1117
+
1118
+
1119
+
1120
+ Returns:
1121
+ ApiResponse: The response from the API.
1122
+ """
1123
+
1124
+ data = validate_data(data, self.validate, CustomersGetByNumberModel)
1125
+
1126
+ return self._request(
1127
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
1128
+ )
1129
+
1130
+ @endpoint("/<version>/customers/getBySearch/", method="post")
1131
+ def get_by_search(self, data: Union[CustomersGetBySearchModel, dict], **kwargs):
1132
+ """
1133
+ get_by_search(self, data: Union[CustomersGetBySearchModel, dict], **kwargs)
1134
+
1135
+ Args:
1136
+
1137
+ data (Union[CustomersGetBySearchModel, dict]): A model instance or dictionary containing the following fields:
1138
+
1139
+ - company_id (Union[str, int]): company_id of the CustomersGetBySearchModel.
1140
+
1141
+ - offset (str): offset of the CustomersGetBySearchModel.
1142
+
1143
+ - qty (str): qty of the CustomersGetBySearchModel.
1144
+
1145
+ - search (str): search of the CustomersGetBySearchModel.
1146
+
1147
+
1148
+
1149
+ Returns:
1150
+ ApiResponse: The response from the API.
1151
+ """
1152
+
1153
+ data = validate_data(data, self.validate, CustomersGetBySearchModel)
1154
+
1155
+ return self._request(
1156
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
1157
+ )
1158
+
1159
+ @endpoint("/<version>/customers/getByVat/", method="post")
1160
+ def get_by_vat(self, data: Union[CustomersGetByVatModel, dict], **kwargs):
1161
+ """
1162
+ get_by_vat(self, data: Union[CustomersGetByVatModel, dict], **kwargs)
1163
+
1164
+ Args:
1165
+
1166
+ data (Union[CustomersGetByVatModel, dict]): A model instance or dictionary containing the following fields:
1167
+
1168
+ - company_id (Union[str, int]): company_id of the CustomersGetByVatModel.
1169
+
1170
+ - offset (str): offset of the CustomersGetByVatModel.
1171
+
1172
+ - qty (str): qty of the CustomersGetByVatModel.
1173
+
1174
+ - vat (str): vat of the CustomersGetByVatModel.
1175
+
1176
+
1177
+
1178
+ Returns:
1179
+ ApiResponse: The response from the API.
1180
+ """
1181
+
1182
+ data = validate_data(data, self.validate, CustomersGetByVatModel)
1183
+
1184
+ return self._request(
1185
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
1186
+ )
1187
+
1188
+ @endpoint("/<version>/customers/getLastNumber/", method="post")
1189
+ def get_last_number(self, data: Union[CustomersGetLastNumberModel, dict], **kwargs):
1190
+ """
1191
+ get_last_number(self, data: Union[CustomersGetLastNumberModel, dict], **kwargs)
1192
+
1193
+ Args:
1194
+
1195
+ data (Union[CustomersGetLastNumberModel, dict]): A model instance or dictionary containing the following fields:
1196
+
1197
+ - company_id (Union[str, int]): company_id of the CustomersGetLastNumberModel.
1198
+
1199
+
1200
+
1201
+ Returns:
1202
+ ApiResponse: The response from the API.
1203
+ """
1204
+
1205
+ data = validate_data(data, self.validate, CustomersGetLastNumberModel)
1206
+
1207
+ return self._request(
1208
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
1209
+ )
1210
+
1211
+ @endpoint("/<version>/customers/getModifiedSince/", method="post")
1212
+ def get_modified_since(
1213
+ self, data: Union[CustomersGetModifiedSinceModel, dict], **kwargs
1214
+ ):
1215
+ """
1216
+ get_modified_since(self, data: Union[CustomersGetModifiedSinceModel, dict], **kwargs)
1217
+
1218
+ Args:
1219
+
1220
+ data (Union[CustomersGetModifiedSinceModel, dict]): A model instance or dictionary containing the following fields:
1221
+
1222
+ - company_id (Union[str, int]): company_id of the CustomersGetModifiedSinceModel.
1223
+
1224
+ - lastmodified (str): lastmodified of the CustomersGetModifiedSinceModel.
1225
+
1226
+ - offset (str): offset of the CustomersGetModifiedSinceModel.
1227
+
1228
+ - qty (str): qty of the CustomersGetModifiedSinceModel.
1229
+
1230
+
1231
+
1232
+ Returns:
1233
+ ApiResponse: The response from the API.
1234
+ """
1235
+
1236
+ data = validate_data(data, self.validate, CustomersGetModifiedSinceModel)
1237
+
1238
+ return self._request(
1239
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
1240
+ )
1241
+
1242
+ @endpoint("/<version>/customers/getOne/", method="post")
1243
+ def get_one(self, data: Union[CustomersGetOneModel, dict], **kwargs):
1244
+ """
1245
+ get_one(self, data: Union[CustomersGetOneModel, dict], **kwargs)
1246
+
1247
+ Args:
1248
+
1249
+ data (Union[CustomersGetOneModel, dict]): A model instance or dictionary containing the following fields:
1250
+
1251
+ - company_id (Union[str, int]): company_id of the CustomersGetOneModel.
1252
+
1253
+ - customer_id (Union[str, int]): customer_id of the CustomersGetOneModel.
1254
+
1255
+
1256
+
1257
+ Returns:
1258
+ ApiResponse: The response from the API.
1259
+ """
1260
+
1261
+ data = validate_data(data, self.validate, CustomersGetOneModel)
1262
+
1263
+ return self._request(
1264
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
1265
+ )
1266
+
1267
+ @endpoint("/<version>/customers/insert/", method="post")
1268
+ def insert(self, data: Union[CustomersInsertModel, dict], **kwargs):
1269
+ """
1270
+ insert(self, data: Union[CustomersInsertModel, dict], **kwargs)
1271
+
1272
+ Args:
1273
+
1274
+ data (Union[CustomersInsertModel, dict]): A model instance or dictionary containing the following fields:
1275
+
1276
+ - address (str): address of the CustomersInsertModel.
1277
+
1278
+ - city (str): city of the CustomersInsertModel.
1279
+
1280
+ - company_id (Union[str, int]): company_id of the CustomersInsertModel.
1281
+
1282
+ - contact_email (str): contact_email of the CustomersInsertModel.
1283
+
1284
+ - contact_name (str): contact_name of the CustomersInsertModel.
1285
+
1286
+ - contact_phone (str): contact_phone of the CustomersInsertModel.
1287
+
1288
+ - country_id (Union[str, int]): country_id of the CustomersInsertModel.
1289
+
1290
+ - credit_limit (str): credit_limit of the CustomersInsertModel.
1291
+
1292
+ - delivery_method_id (Union[str, int]): delivery_method_id of the CustomersInsertModel.
1293
+
1294
+ - discount (str): discount of the CustomersInsertModel.
1295
+
1296
+ - email (str): email of the CustomersInsertModel.
1297
+
1298
+ - fax (str): fax of the CustomersInsertModel.
1299
+
1300
+ - field_notes (str): field_notes of the CustomersInsertModel.
1301
+
1302
+ - language_id (Union[str, int]): language_id of the CustomersInsertModel.
1303
+
1304
+ - maturity_date_id (Union[str, int]): maturity_date_id of the CustomersInsertModel.
1305
+
1306
+ - name (str): name of the CustomersInsertModel.
1307
+
1308
+ - notes (str): notes of the CustomersInsertModel.
1309
+
1310
+ - number (str): number of the CustomersInsertModel.
1311
+
1312
+ - payment_day (str): payment_day of the CustomersInsertModel.
1313
+
1314
+ - payment_method_id (Union[str, int]): payment_method_id of the CustomersInsertModel.
1315
+
1316
+ - phone (str): phone of the CustomersInsertModel.
1317
+
1318
+ - qty_copies_document (str): qty_copies_document of the CustomersInsertModel.
1319
+
1320
+ - salesman_id (Union[str, int]): salesman_id of the CustomersInsertModel.
1321
+
1322
+ - vat (str): vat of the CustomersInsertModel.
1323
+
1324
+ - website (str): website of the CustomersInsertModel.
1325
+
1326
+ - zip_code (str): zip_code of the CustomersInsertModel.
1327
+
1328
+
1329
+
1330
+ Returns:
1331
+ ApiResponse: The response from the API.
1332
+ """
1333
+
1334
+ data = validate_data(data, self.validate, CustomersInsertModel)
1335
+
1336
+ return self._request(
1337
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
1338
+ )
1339
+
1340
+ @endpoint("/<version>/customers/update/", method="post")
1341
+ def update(self, data: Union[CustomersUpdateModel, dict], **kwargs):
1342
+ """
1343
+ update(self, data: Union[CustomersUpdateModel, dict], **kwargs)
1344
+
1345
+ Args:
1346
+
1347
+ data (Union[CustomersUpdateModel, dict]): A model instance or dictionary containing the following fields:
1348
+
1349
+ - address (str): address of the CustomersUpdateModel.
1350
+
1351
+ - city (str): city of the CustomersUpdateModel.
1352
+
1353
+ - company_id (Union[str, int]): company_id of the CustomersUpdateModel.
1354
+
1355
+ - contact_email (str): contact_email of the CustomersUpdateModel.
1356
+
1357
+ - contact_name (str): contact_name of the CustomersUpdateModel.
1358
+
1359
+ - contact_phone (str): contact_phone of the CustomersUpdateModel.
1360
+
1361
+ - country_id (Union[str, int]): country_id of the CustomersUpdateModel.
1362
+
1363
+ - credit_limit (str): credit_limit of the CustomersUpdateModel.
1364
+
1365
+ - customer_id (Union[str, int]): customer_id of the CustomersUpdateModel.
1366
+
1367
+ - delivery_method_id (Union[str, int]): delivery_method_id of the CustomersUpdateModel.
1368
+
1369
+ - discount (str): discount of the CustomersUpdateModel.
1370
+
1371
+ - email (str): email of the CustomersUpdateModel.
1372
+
1373
+ - fax (str): fax of the CustomersUpdateModel.
1374
+
1375
+ - field_notes (str): field_notes of the CustomersUpdateModel.
1376
+
1377
+ - language_id (Union[str, int]): language_id of the CustomersUpdateModel.
1378
+
1379
+ - maturity_date_id (Union[str, int]): maturity_date_id of the CustomersUpdateModel.
1380
+
1381
+ - name (str): name of the CustomersUpdateModel.
1382
+
1383
+ - notes (str): notes of the CustomersUpdateModel.
1384
+
1385
+ - number (str): number of the CustomersUpdateModel.
1386
+
1387
+ - payment_day (str): payment_day of the CustomersUpdateModel.
1388
+
1389
+ - payment_method_id (Union[str, int]): payment_method_id of the CustomersUpdateModel.
1390
+
1391
+ - phone (str): phone of the CustomersUpdateModel.
1392
+
1393
+ - qty_copies_document (str): qty_copies_document of the CustomersUpdateModel.
1394
+
1395
+ - salesman_id (Union[str, int]): salesman_id of the CustomersUpdateModel.
1396
+
1397
+ - vat (str): vat of the CustomersUpdateModel.
1398
+
1399
+ - website (str): website of the CustomersUpdateModel.
1400
+
1401
+ - zip_code (str): zip_code of the CustomersUpdateModel.
1402
+
1403
+
1404
+
1405
+ Returns:
1406
+ ApiResponse: The response from the API.
1407
+ """
1408
+
1409
+ data = validate_data(data, self.validate, CustomersUpdateModel)
1410
+
1411
+ return self._request(
1412
+ fill_query_params(kwargs.pop("path"), self.version), data={**data, **kwargs}
1413
+ )