nordlet 0.5.6

Official Rust SDK for the Nordlet Accounting API
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
use crate::api::*;
use crate::{ApiError, ClientConfig, HttpClient, RequestOptions};
use reqwest::Method;

pub struct PartnersClient {
    pub http_client: HttpClient,
}

impl PartnersClient {
    pub fn new(config: ClientConfig) -> Result<Self, ApiError> {
        Ok(Self {
            http_client: HttpClient::new(config.clone())?,
        })
    }

    /// Adds an address of type billing, shipping, registered or other to the partner in `partnerId`.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn addresses_create(
        &self,
        request: &AddressesCreatePartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<AddressesCreatePartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/addresses/create",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Changes the given fields of a partner address.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn addresses_update(
        &self,
        request: &AddressesUpdatePartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<AddressesUpdatePartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/addresses/update",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Deletes a partner address.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn addresses_delete(
        &self,
        request: &AddressesDeletePartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<AddressesDeletePartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/addresses/delete",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Lists partner addresses; filterable by `partnerId`, `type` and `city`, sortable by `createdAt`.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn addresses_list(
        &self,
        request: &AddressesListPartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<AddressesListPartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/addresses/list",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Adds a contact person to the partner in `partnerId`.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn contacts_create(
        &self,
        request: &ContactsCreatePartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<ContactsCreatePartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/contacts/create",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Changes the given fields of a partner contact.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn contacts_update(
        &self,
        request: &ContactsUpdatePartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<ContactsUpdatePartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/contacts/update",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Deletes a partner contact.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn contacts_delete(
        &self,
        request: &ContactsDeletePartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<ContactsDeletePartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/contacts/delete",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Lists partner contacts; filterable by `partnerId`, `name` and `email`, sortable by `createdAt`.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn contacts_list(
        &self,
        request: &ContactsListPartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<ContactsListPartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/contacts/list",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Adds a bank account to the partner in `partnerId`. The IBAN is stored without spaces in upper case; an IBAN the partner already has is refused with 409. With `isDefault` true the partner's other accounts lose their default mark.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn bank_accounts_create(
        &self,
        request: &BankAccountsCreatePartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<BankAccountsCreatePartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/bank-accounts/create",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Changes the given fields of a partner bank account. A new IBAN is stored without spaces in upper case and is refused with 409 when the partner already has it; when the account is the default after the change, the partner's other accounts lose their default mark.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn bank_accounts_update(
        &self,
        request: &BankAccountsUpdatePartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<BankAccountsUpdatePartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/bank-accounts/update",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Deletes a partner bank account.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn bank_accounts_delete(
        &self,
        request: &BankAccountsDeletePartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<BankAccountsDeletePartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/bank-accounts/delete",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Lists partner bank accounts; filterable by `partnerId` and `iban`, sortable by `createdAt`.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn bank_accounts_list(
        &self,
        request: &BankAccountsListPartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<BankAccountsListPartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/bank-accounts/list",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Lists the files attached to a partner, newest first. `partners/create` attaches one with `documentRef`, and `leads/convert` moves the lead's files here.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn files_list(
        &self,
        request: &FilesListPartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<FilesListPartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/files/list",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Runs the overdue selection of the daily debt-reminder job for this company as of the company's current date and returns the overdue reminders it would send, without sending or recording anything. A partner is included when it has `autoDebtReminder`, is active, has an e-mail address, got no overdue reminder in the last `repeatDays` days (`partners/debt-reminders/settings/get`) and has issued invoices or advance invoices past their due date with an unpaid remainder; the interest per invoice is the remainder times the partner's `lateInterestPercent` times the days late over 365, and the totals are per currency. Sent reminders are listed by `partners/debt-reminders/list`.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn debt_reminders_preview(
        &self,
        request: &DebtRemindersPreviewPartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<DebtRemindersPreviewPartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/debt-reminders/preview",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Lists the debt reminders the daily job has sent, one row per partner and currency with the ids of the invoices it covered and its `kind` (`before_due` or `overdue`); filterable by `partnerId`, sortable by `sentAt`.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn debt_reminders_list(
        &self,
        request: &DebtRemindersListPartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<DebtRemindersListPartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/debt-reminders/list",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Returns the debt-reminder schedule of the company: `daysBefore`, the days before the due date on which the first reminder is sent (null when no reminder is sent before the due date), and `repeatDays`, the days between overdue reminders to a partner.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn debt_reminders_settings_get(
        &self,
        request: &DebtRemindersSettingsGetPartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<DebtRemindersSettingsGetPartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/debt-reminders/settings/get",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Changes the given fields of the company's debt-reminder schedule. `daysBefore` (1 to 90, or null to send nothing before the due date) makes the daily job send one "payment due soon" reminder per invoice that many days before its due date; `repeatDays` (1 to 90) is the number of days between overdue reminders to a partner. Only partners with `autoDebtReminder` get reminders. A body without fields is refused with 400.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn debt_reminders_settings_update(
        &self,
        request: &DebtRemindersSettingsUpdatePartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<DebtRemindersSettingsUpdatePartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/debt-reminders/settings/update",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Returns the next reminder the daily debt-reminder job would send for each unpaid issued invoice or advance invoice of the partners that get reminders (`autoDebtReminder`, active, with an e-mail address), as of the company's current date and sorted by `date`. A `before_due` reminder is sent once per invoice, `daysBefore` days before its due date or on the first daily run after that while the due date is still ahead; `overdue` reminders start the day after the due date and repeat every `repeatDays` days per partner, counting only overdue reminders. Nothing is sent or recorded.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn debt_reminders_upcoming(
        &self,
        request: &DebtRemindersUpcomingPartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<DebtRemindersUpcomingPartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/debt-reminders/upcoming",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Checks a VAT number against VIES, either a free `vatCode` or the VAT code of the partner in `partnerId` (exactly one of the two); a code without an EU country prefix and 2 to 12 alphanumeric characters is refused with 422, as is a partner without a VAT code, and a VIES outage answers 503. With a partner the outcome is written to it (`vatValid`, `vatValidatedAt`): an invalid number or a VIES name that shares no word with the partner's name opens or refreshes the partner's VAT review (`vat_review.opened`), a VIES failure opens one with reason `service_error`, and a valid matching number resolves the open review as `revalidated` (`vat_review.resolved`). Reviews are listed and closed with `partners/vat-reviews/list` and `partners/vat-reviews/resolve`.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn validate_vat(
        &self,
        request: &ValidateVatPartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<ValidateVatPartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/validate-vat",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Lists the VAT reviews opened by VIES checks of partners' VAT codes, with reason `invalid`, `name_mismatch` or `service_error`; filterable by `partnerId`, `status` and `reason`, sortable by `createdAt`.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn vat_reviews_list(
        &self,
        request: &VatReviewsListPartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<VatReviewsListPartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/vat-reviews/list",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Closes an open VAT review as `confirmed_valid`, `confirmed_invalid` or `dismissed`, with an optional note. The first two also set the partner's `vatValid` and stamp `vatValidatedAt` when the partner still carries the reviewed VAT code; `dismissed` leaves the partner unchanged. A review that is already resolved answers 409; emits `vat_review.resolved`.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn vat_reviews_resolve(
        &self,
        request: &VatReviewsResolvePartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<VatReviewsResolvePartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/vat-reviews/resolve",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Creates a partner. `groupId`, `statusId` and `priceListId` must belong to the company; without `legalCountryClass` the class is derived from the address country (`lt`, `eu` or `non_eu`); `documentRef` attaches an uploaded file that is not yet linked to a record; a `code` already used by a live partner of the company is refused with 409. A `vatCode` is checked against VIES at once and the result stored on the partner: an invalid number, a VIES name that shares no word with the partner's name, or a VIES failure opens a VAT review (`vat_review.opened`), while a code that is not an EU VAT number is stored unchecked (see `partners/validate-vat`).
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn create(
        &self,
        request: &CreatePartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<CreatePartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/create",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Returns the live partner matched by `code`, then `vatCode`, then `email` (at least one is required), or creates one from the body with the same validation and VIES check as `partners/create`; `created` says which happened. A creation that loses a race on the partner code returns the partner the other call created.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn find_or_create(
        &self,
        request: &FindOrCreatePartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<FindOrCreatePartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/find-or-create",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Returns one partner; a deleted partner answers 404.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn get(
        &self,
        request: &GetPartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<GetPartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/get",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Changes the given fields of a partner; the clearable fields accept null. A new address country re-derives `legalCountryClass` unless the class is given, and a `code` already used by another live partner of the company is refused with 409. A changed `vatCode` resets the VIES result and is checked at once as in `partners/create`; a removed code, or one that is not an EU VAT number, resolves the partner's open VAT review as `superseded` (`vat_review.resolved`).
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn update(
        &self,
        request: &UpdatePartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<UpdatePartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/update",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Marks a partner as deleted; it no longer appears in lists or lookups.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn delete(
        &self,
        request: &DeletePartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<DeletePartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/delete",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Moves every row that references the duplicate `sourceId` through a foreign key to partners (looked up in the database catalogue, within the company) to `targetId`, then marks the source partner as deleted; `moved` lists the tables, columns and row counts. Merging a partner into itself is 422, and when both partners hold the same unique entry (for example the same IBAN or item supplier row) the merge is refused with 409 until it is removed from one of them. When the kept partner has an open VAT review, the duplicate's open review is resolved as `superseded` (`vat_review.resolved`).
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn merge(
        &self,
        request: &MergePartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<MergePartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/merge",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Removes birth date, self-employment certificate number, email, phone, address, notes, contacts, addresses and bank accounts, then hides the partner. The name, code and VAT number stay because issued invoices must keep identifying the counterparty for the statutory retention period.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn anonymize(
        &self,
        request: &AnonymizePartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<AnonymizePartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/anonymize",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Lists live partners; filterable by `name`, `code`, `vatCode`, `email`, `type`, `isCustomer`, `isSupplier`, `isActive`, `legalCountryClass`, `isEmployee`, `groupId`, `statusId` and `nextCallDate`, sortable by `name`, `code`, `createdAt`, `nextCallDate` and `rating`.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn list(
        &self,
        request: &ListPartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<ListPartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/list",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Creates a partner group; a `code` already used by a group of the company is refused with 409.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn groups_create(
        &self,
        request: &GroupsCreatePartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<GroupsCreatePartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/groups/create",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Changes the code or name of a partner group; a code already used by another group of the company is refused with 409.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn groups_update(
        &self,
        request: &GroupsUpdatePartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<GroupsUpdatePartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/groups/update",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Deletes a partner group; a group still assigned to a live partner is refused with 409.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn groups_delete(
        &self,
        request: &GroupsDeletePartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<GroupsDeletePartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/groups/delete",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Lists the company's partner groups ordered by code.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn groups_list(
        &self,
        request: &GroupsListPartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<GroupsListPartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/groups/list",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Creates a partner status with a `sortOrder`; a `code` already used by a status of the company is refused with 409.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn statuses_create(
        &self,
        request: &StatusesCreatePartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<StatusesCreatePartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/statuses/create",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Changes the code, name or sort order of a partner status; a code already used by another status of the company is refused with 409.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn statuses_update(
        &self,
        request: &StatusesUpdatePartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<StatusesUpdatePartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/statuses/update",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Deletes a partner status; a status still assigned to a live partner is refused with 409.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn statuses_delete(
        &self,
        request: &StatusesDeletePartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<StatusesDeletePartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/statuses/delete",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Lists the company's partner statuses ordered by sort order, then code.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn statuses_list(
        &self,
        request: &StatusesListPartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<StatusesListPartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/statuses/list",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Records an inquiry in status `new`, from a partner (`partnerId`) or from a contact given by `contactName` or `contactEmail`; without any of the three it is refused with 422. `assignedUserId` must be a member of the company. Emits `partner_inquiry.created`.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn inquiries_create(
        &self,
        request: &InquiriesCreatePartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<InquiriesCreatePartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/inquiries/create",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Changes the given fields of an inquiry; `partnerId` and `assignedUserId` accept null. Setting `status` to `closed` stamps `closedAt`, and moving a closed inquiry to another status clears it.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn inquiries_update(
        &self,
        request: &InquiriesUpdatePartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<InquiriesUpdatePartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/inquiries/update",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Returns one inquiry with the name of its partner.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn inquiries_get(
        &self,
        request: &InquiriesGetPartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<InquiriesGetPartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/inquiries/get",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Lists inquiries with their partner names; filterable by `status`, `channel`, `partnerId`, `assignedUserId` and `subject`, sortable by `createdAt` and `updatedAt`.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn inquiries_list(
        &self,
        request: &InquiriesListPartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<InquiriesListPartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/inquiries/list",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Compares a partner's open receivables plus an optional `additionalAmount` with its `creditLimit`. The open receivables are the unpaid remainder of the partner's issued invoices, advance invoices and credit notes (credit notes negative), converted to the company's base currency at each invoice's `fxRate`. Without a credit limit `available` is null and `exceeded` is false.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn credit_check(
        &self,
        request: &CreditCheckPartnersRequest,
        options: Option<RequestOptions>,
    ) -> Result<CreditCheckPartnersResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/partners/credit-check",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }
}