nordlet 0.5.5

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
use crate::api::*;
use crate::{ApiError, ClientConfig, HttpClient, RequestOptions};
use reqwest::Method;

pub struct AccountClient {
    pub http_client: HttpClient,
}

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

    /// Create a sign-in link for the e-mail address and send it; the link is valid for 15 minutes and is consumed with `account/login-link/consume`. When an unused link was requested for the same address within the last minute, the call answers `sent` without sending another. `locale` sets the language of the e-mail and of the link; `acceptTerms`, `acceptDpa` and `referralCode` are stored with the link and used when the address has no account yet.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn login_link_request(
        &self,
        request: &LoginLinkRequestAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<LoginLinkRequestAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/login-link/request",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Exchange a sign-in link token for a session; an unknown, used or expired token is refused with 401. When no account has the address, one is created (`isNewUser`), which is refused with 422 unless the link was requested with `acceptTerms` and `acceptDpa`; a `referralCode` on the link records who referred the new user. A link from `account/email/change-request` changes the signed-in user's address instead, refused with 409 when another account has it.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn login_link_consume(
        &self,
        request: &LoginLinkConsumeAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<LoginLinkConsumeAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/login-link/consume",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Delete the session the call was made with.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn logout(
        &self,
        request: &LogoutAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<LogoutAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/logout",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Return the signed-in user, their active company and role in it, the companies they belong to and their consent state. `billing` is the billing account that pays for the active company (its payer, or the user when there is none or no company), with `isPayer` saying whether that is the user; `referralPoints` is the user's current points balance.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn me(
        &self,
        request: &MeAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<MeAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/me",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// List the members of the active company with their role.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn members_list(
        &self,
        request: &MembersListAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<MembersListAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/members/list",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Change the role of a member of the active company; owners and admins may call it. Refused with 422 for the caller's own role and with 403 for the owner's, which only `account/members/transfer-ownership` changes.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn members_set_role(
        &self,
        request: &MembersSetRoleAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<MembersSetRoleAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/members/set-role",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Make another member the owner of the active company; the caller must be its owner and becomes an admin. Refused with 422 when `userId` is the caller. With `movePayer` the company's billing also moves to the new owner, which only the member currently paying for it may do (403).
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn members_transfer_ownership(
        &self,
        request: &MembersTransferOwnershipAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<MembersTransferOwnershipAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/members/transfer-ownership",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Remove a member from the active company; owners and admins may call it. Their sessions lose this company as the active one and the API keys they created for it are revoked. Refused with 422 for the caller themself and with 403 for the owner.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn members_remove(
        &self,
        request: &MembersRemoveAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<MembersRemoveAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/members/remove",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Create an invitation to the active company for an e-mail address with the given role and send it by e-mail in `locale`; owners and admins may call it. The invitation is valid for 7 days and replaces an earlier pending one for the same address. Refused with 409 when the address already belongs to a member.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn invites_create(
        &self,
        request: &InvitesCreateAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<InvitesCreateAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/invites/create",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// List the pending invitations of the active company; `expired` marks those past their expiry.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn invites_list(
        &self,
        request: &InvitesListAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<InvitesListAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/invites/list",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Delete a pending invitation of the active company.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn invites_revoke(
        &self,
        request: &InvitesRevokeAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<InvitesRevokeAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/invites/revoke",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Read a pending invitation by its token: the invited address, role and company name, whether it has expired and whether an account with that address already exists (`userExists`), in which case `account/invites/accept` must be called signed in as that account.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn invites_get(
        &self,
        request: &InvitesGetAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<InvitesGetAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/invites/get",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Accept an invitation and return a session with the invited company active. When the address has no account, one is created with `name` and `locale`, which is refused with 422 unless `acceptTerms` and `acceptDpa` are true; when it has one, the call must be made signed in as that account (401 otherwise). An expired invitation is refused with 422.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn invites_accept(
        &self,
        request: &InvitesAcceptAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<InvitesAcceptAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/invites/accept",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Set the user's language: with an active company it is stored on their membership of that company (`scope` = `membership`), otherwise on the user (`scope` = `user`).
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn locale_set(
        &self,
        request: &LocaleSetAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<LocaleSetAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/locale/set",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Create a company with the caller as its owner and payer, seed its chart of accounts from the template of `countryCode`, and make it the active company of the session. `timeZone` defaults to the country's, `isVatPayer` to true and `defaultInvoiceCurrency` to the base currency. Refused with 422 when `baseCurrency` is not a supported currency.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn companies_create(
        &self,
        request: &CompaniesCreateAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<CompaniesCreateAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/companies/create",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Make one of the caller's companies the active company of the session. Refused with 403 when the caller is not a member and with 422 when the company is archived or deleted.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn companies_select(
        &self,
        request: &CompaniesSelectAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<CompaniesSelectAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/companies/select",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Return the profile of the active company.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn companies_profile(
        &self,
        request: &CompaniesProfileAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<CompaniesProfileAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/companies/profile",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Change the profile of the active company; owners and admins may call it. Only the fields sent are changed, and the nullable ones can be sent as null to clear them. `logo` stores a base64-encoded image as a file of the company and sets `logoFileId`. The country, base currency and sandbox flag are fixed at creation.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn companies_update(
        &self,
        request: &CompaniesUpdateAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<CompaniesUpdateAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/companies/update",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Set the company named by `companyId` to `archived`; the caller must be its owner. Every session that had it active loses it. Refused with 409 unless the company is active; `account/companies/activate` reverses it.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn companies_archive(
        &self,
        request: &CompaniesArchiveAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<CompaniesArchiveAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/companies/archive",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Set the company named by `companyId` to `deleted`; the caller must be its owner, and every session that had it active loses it. A sandbox company is purged at once; any other is purged by the scheduled purge after `purgeAfter` (10 days) and can be restored until then with `account/companies/activate`. Refused with 409 when it is already deleted.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn companies_delete(
        &self,
        request: &CompaniesDeleteAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<CompaniesDeleteAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/companies/delete",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Set an archived or deleted company named by `companyId` back to `active`; the caller must be its owner. Refused with 409 when it is already active.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn companies_activate(
        &self,
        request: &CompaniesActivateAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<CompaniesActivateAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/companies/activate",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Create an API key for the active company and return the key itself once; owners, admins and developers may call it. `scopes` defaults to the caller's own scopes and may not exceed them (403); without `expiresInDays` the key does not expire.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn api_keys_create(
        &self,
        request: &ApiKeysCreateAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<ApiKeysCreateAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/api-keys/create",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// List the API keys of the active company, including expired and revoked ones.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn api_keys_list(
        &self,
        request: &ApiKeysListAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<ApiKeysListAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/api-keys/list",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Create a new key with the name and scopes of the key `id` and return it once; the old key keeps working for `overlapHours` and then expires, and its `replacedByKeyId` points to the new one. `expiresInDays` applies to the new key. Refused with 409 when the old key is revoked.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn api_keys_rotate(
        &self,
        request: &ApiKeysRotateAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<ApiKeysRotateAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/api-keys/rotate",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Revoke an API key of the active company at once.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn api_keys_revoke(
        &self,
        request: &ApiKeysRevokeAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<ApiKeysRevokeAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/api-keys/revoke",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Record the signed-in user's acceptance of the current Terms of Service and Data Processing Agreement versions and return the consent state.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn consent_accept(
        &self,
        request: &ConsentAcceptAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<ConsentAcceptAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/consent/accept",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Set the signed-in user's name; null or a blank string clears it.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn profile_update(
        &self,
        request: &ProfileUpdateAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<ProfileUpdateAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/profile/update",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Send a confirmation link to `newEmail`; the address changes when that link is consumed with `account/login-link/consume`. When an unused link was sent to the address within the last minute, the call answers `sent` without sending another. Refused with 422 when it is already the user's address and with 409 when another account has it.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn email_change_request(
        &self,
        request: &EmailChangeRequestAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<EmailChangeRequestAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/email/change-request",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// List the signed-in user's sessions that have not expired; `current` marks the one the call was made with.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn sessions_list(
        &self,
        request: &SessionsListAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<SessionsListAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/sessions/list",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Delete one of the signed-in user's sessions.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn sessions_revoke(
        &self,
        request: &SessionsRevokeAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<SessionsRevokeAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/sessions/revoke",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Delete every session of the signed-in user except the one the call was made with, and return how many were deleted.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn sessions_revoke_others(
        &self,
        request: &SessionsRevokeOthersAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<SessionsRevokeOthersAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/sessions/revoke-others",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Return the user's profile, consent state, memberships, unexpired sessions, billing account, credit transactions and the audit entries they made in their companies (the most recent 5000 of each of the last two).
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn export(
        &self,
        request: &ExportAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<ExportAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/export",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Removes the user: sessions, sign-in links, memberships and pending invitations are deleted at once; the email and name are replaced by an anonymous placeholder immediately and the remaining row is removed after 30 days. Refused while the user still owns or pays for a company that is not deleted.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn delete(
        &self,
        request: &DeleteAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<DeleteAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/delete",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Return the user's referral code (allocated on first call) and sign-up link, their points balance, the number of accounts they referred and the last 50 points entries. `rates.perEur` is the points the referrer earns per euro a referred user tops up, `rates.pointCents` the credit one point converts to with `account/referral/convert`.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn referral_get(
        &self,
        request: &ReferralGetAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<ReferralGetAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/referral/get",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Convert `points` of the user's referral points into credit on their billing account at `rates.pointCents` per point, booked as an `adjustment` credit transaction; a billing account past its trial is set to active when the new balance allows. Refused with 422 when the user has fewer points than requested.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn referral_convert(
        &self,
        request: &ReferralConvertAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<ReferralConvertAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/referral/convert",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Return the signed-in user's saved column list and page size for the table `tableKey`; both are null when nothing is saved.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn table_settings_get(
        &self,
        request: &TableSettingsGetAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<TableSettingsGetAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/table-settings/get",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// Save the signed-in user's column list and page size for the table `tableKey`; only the fields sent are changed, and null clears one.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn table_settings_set(
        &self,
        request: &TableSettingsSetAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<TableSettingsSetAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/table-settings/set",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }

    /// List the signed-in user's saved table settings.
    ///
    /// # Arguments
    ///
    /// * `options` - Additional request options such as headers, timeout, etc.
    ///
    /// # Returns
    ///
    /// JSON response from the API
    pub async fn table_settings_list(
        &self,
        request: &TableSettingsListAccountRequest,
        options: Option<RequestOptions>,
    ) -> Result<TableSettingsListAccountResponse, ApiError> {
        self.http_client
            .execute_request(
                Method::POST,
                "v1/account/table-settings/list",
                Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
                None,
                options,
            )
            .await
    }
}