sellapp-sdk 0.1.1

Official Rust SDK for the SellApp API: manage products, orders, subscriptions, and customers.
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
// This file is auto-generated by oagen. Do not edit.

use crate::client::Client;
#[allow(unused_imports)]
use crate::enums::*;
use crate::error::Error;
#[allow(unused_imports)]
use crate::models::*;
#[allow(unused_imports)]
use serde::Serialize;

pub struct InvoicesApi<'a> {
    pub(crate) client: &'a Client,
}

#[derive(Debug, Clone, Serialize)]
pub struct ListParams {
    /// Number of items to return per page.
    ///
    /// Defaults to `15`.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub limit: Option<i64>,
    /// Page number to return.
    ///
    /// Defaults to `1`.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub page: Option<i64>,
    /// Free-text search term.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub search: Option<String>,
    /// Which invoice field the search term should be matched against.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub search_by: Option<InvoicesSearchBy>,
    /// Filter by invoice ID.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    /// Filter by customer email.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub email: Option<String>,
    /// Filter by payment transaction ID.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub transaction_id: Option<String>,
    /// Filter by delivered serial.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub serial_code: Option<String>,
    /// Filter by customer-provided additional information.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub additional_info: Option<String>,
    /// Filter by product or variant title.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub product_name: Option<String>,
    /// Filter by attached Discord data.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub discord_data: Option<String>,
    /// Filter by crypto TXID.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub crypto_txid: Option<String>,
    /// Filter by crypto payment address.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub crypto_address: Option<String>,
    /// Filter by coupon code.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub coupon_code: Option<String>,
    /// Filter by one or more invoice statuses.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub status: Option<Vec<InvoicesStatus>>,
    /// Filter by one or more payment methods.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub payment_methods: Option<Vec<InvoicesPaymentMethods>>,
    /// Sort order for the result set.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub sort: Option<InvoicesSort>,
    /// Store slug. Required for OAuth access tokens. API keys may omit it to use their current store, or the first accessible store when no current store is selected.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(rename = "X-STORE")]
    pub x_store: Option<String>,
}

impl Default for ListParams {
    #[allow(deprecated)]
    fn default() -> Self {
        Self {
            limit: Some(15),
            page: Some(1),
            search: Default::default(),
            search_by: Default::default(),
            id: Default::default(),
            email: Default::default(),
            transaction_id: Default::default(),
            serial_code: Default::default(),
            additional_info: Default::default(),
            product_name: Default::default(),
            discord_data: Default::default(),
            crypto_txid: Default::default(),
            crypto_address: Default::default(),
            coupon_code: Default::default(),
            status: Default::default(),
            payment_methods: Default::default(),
            sort: Default::default(),
            x_store: Default::default(),
        }
    }
}

#[derive(Debug, Clone, Serialize)]
pub struct CreateParams {
    /// Store slug. Required for OAuth access tokens. API keys may omit it to use their current store, or the first accessible store when no current store is selected.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(rename = "X-STORE")]
    pub x_store: Option<String>,
    /// Request body sent with this call.
    ///
    /// Required.
    #[serde(skip)]
    pub body: SdkCreateInvoiceRequestApplicationJson,
}

impl CreateParams {
    /// Construct a new `CreateParams` with the required fields set.
    #[allow(deprecated)]
    pub fn new(body: SdkCreateInvoiceRequestApplicationJson) -> Self {
        Self {
            x_store: Default::default(),
            body,
        }
    }
}

#[derive(Debug, Clone, Serialize)]
pub struct SearchParams {
    /// Store slug. Required for OAuth access tokens. API keys may omit it to use their current store, or the first accessible store when no current store is selected.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(rename = "X-STORE")]
    pub x_store: Option<String>,
    /// Request body sent with this call.
    ///
    /// Required.
    #[serde(skip)]
    pub body: SdkSearchInvoicesRequestApplicationJson,
}

impl SearchParams {
    /// Construct a new `SearchParams` with the required fields set.
    #[allow(deprecated)]
    pub fn new(body: SdkSearchInvoicesRequestApplicationJson) -> Self {
        Self {
            x_store: Default::default(),
            body,
        }
    }
}

#[derive(Debug, Clone, Default, Serialize)]
pub struct GetParams {
    /// Store slug. Required for OAuth access tokens. API keys may omit it to use their current store, or the first accessible store when no current store is selected.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(rename = "X-STORE")]
    pub x_store: Option<String>,
}

#[derive(Debug, Clone, Default, Serialize)]
pub struct GoToCheckoutParams {
    /// Store slug. Required for OAuth access tokens. API keys may omit it to use their current store, or the first accessible store when no current store is selected.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(rename = "X-STORE")]
    pub x_store: Option<String>,
}

#[derive(Debug, Clone, Default, Serialize)]
pub struct GetDeliverablesParams {
    /// Store slug. Required for OAuth access tokens. API keys may omit it to use their current store, or the first accessible store when no current store is selected.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(rename = "X-STORE")]
    pub x_store: Option<String>,
}

#[derive(Debug, Clone, Serialize)]
pub struct MarkCompletedParams {
    /// Store slug. Required for OAuth access tokens. API keys may omit it to use their current store, or the first accessible store when no current store is selected.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(rename = "X-STORE")]
    pub x_store: Option<String>,
    /// Request body sent with this call.
    ///
    /// Required.
    #[serde(skip)]
    pub body: SdkMarkPendingInvoiceCompletedRequestApplicationJson,
}

impl MarkCompletedParams {
    /// Construct a new `MarkCompletedParams` with the required fields set.
    #[allow(deprecated)]
    pub fn new(body: SdkMarkPendingInvoiceCompletedRequestApplicationJson) -> Self {
        Self {
            x_store: Default::default(),
            body,
        }
    }
}

#[derive(Debug, Clone, Serialize)]
pub struct MarkVoidedParams {
    /// Store slug. Required for OAuth access tokens. API keys may omit it to use their current store, or the first accessible store when no current store is selected.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(rename = "X-STORE")]
    pub x_store: Option<String>,
    /// Request body sent with this call.
    ///
    /// Required.
    #[serde(skip)]
    pub body: SdkMarkPendingInvoiceVoidedRequestApplicationJson,
}

impl MarkVoidedParams {
    /// Construct a new `MarkVoidedParams` with the required fields set.
    #[allow(deprecated)]
    pub fn new(body: SdkMarkPendingInvoiceVoidedRequestApplicationJson) -> Self {
        Self {
            x_store: Default::default(),
            body,
        }
    }
}

#[derive(Debug, Clone, Serialize)]
pub struct IssueReplacementParams {
    /// Store slug. Required for OAuth access tokens. API keys may omit it to use their current store, or the first accessible store when no current store is selected.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(rename = "X-STORE")]
    pub x_store: Option<String>,
    /// Request body sent with this call.
    ///
    /// Required.
    #[serde(skip)]
    pub body: SdkIssueReplacementForCompletedInvoiceRequestApplicationJson,
}

impl IssueReplacementParams {
    /// Construct a new `IssueReplacementParams` with the required fields set.
    #[allow(deprecated)]
    pub fn new(body: SdkIssueReplacementForCompletedInvoiceRequestApplicationJson) -> Self {
        Self {
            x_store: Default::default(),
            body,
        }
    }
}

#[derive(Debug, Clone, Serialize)]
pub struct UpdateStatusParams {
    /// Store slug. Required for OAuth access tokens. API keys may omit it to use their current store, or the first accessible store when no current store is selected.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(rename = "X-STORE")]
    pub x_store: Option<String>,
    /// Request body sent with this call.
    ///
    /// Required.
    #[serde(skip)]
    pub body: SdkUpdateInvoiceStatusRequestApplicationJson,
}

impl UpdateStatusParams {
    /// Construct a new `UpdateStatusParams` with the required fields set.
    #[allow(deprecated)]
    pub fn new(body: SdkUpdateInvoiceStatusRequestApplicationJson) -> Self {
        Self {
            x_store: Default::default(),
            body,
        }
    }
}

#[derive(Debug, Clone, Serialize)]
pub struct CreateRefundParams {
    /// Store slug. Required for OAuth access tokens. API keys may omit it to use their current store, or the first accessible store when no current store is selected.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(rename = "X-STORE")]
    pub x_store: Option<String>,
    /// Request body sent with this call.
    ///
    /// Required.
    #[serde(skip)]
    pub body: SdkCreateInvoiceRefundRequestApplicationJson,
}

impl CreateRefundParams {
    /// Construct a new `CreateRefundParams` with the required fields set.
    #[allow(deprecated)]
    pub fn new(body: SdkCreateInvoiceRefundRequestApplicationJson) -> Self {
        Self {
            x_store: Default::default(),
            body,
        }
    }
}

#[derive(Debug, Clone, Serialize)]
pub struct RetryFulfillmentParams {
    /// Store slug. Required for OAuth access tokens. API keys may omit it to use their current store, or the first accessible store when no current store is selected.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(rename = "X-STORE")]
    pub x_store: Option<String>,
    /// Request body sent with this call.
    ///
    /// Required.
    #[serde(skip)]
    pub body: SdkCreateFulfillmentRetryRequestApplicationJson,
}

impl RetryFulfillmentParams {
    /// Construct a new `RetryFulfillmentParams` with the required fields set.
    #[allow(deprecated)]
    pub fn new(body: SdkCreateFulfillmentRetryRequestApplicationJson) -> Self {
        Self {
            x_store: Default::default(),
            body,
        }
    }
}

#[derive(Debug, Clone, Serialize)]
pub struct RetryDynamicDeliveryParams {
    /// Store slug. Required for OAuth access tokens. API keys may omit it to use their current store, or the first accessible store when no current store is selected.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(rename = "X-STORE")]
    pub x_store: Option<String>,
    /// Request body sent with this call.
    ///
    /// Required.
    #[serde(skip)]
    pub body: SdkCreateDynamicDeliveryRetryRequestApplicationJson,
}

impl RetryDynamicDeliveryParams {
    /// Construct a new `RetryDynamicDeliveryParams` with the required fields set.
    #[allow(deprecated)]
    pub fn new(body: SdkCreateDynamicDeliveryRetryRequestApplicationJson) -> Self {
        Self {
            x_store: Default::default(),
            body,
        }
    }
}

#[derive(Debug, Clone, Serialize)]
pub struct NotifyFulfillmentParams {
    /// Store slug. Required for OAuth access tokens. API keys may omit it to use their current store, or the first accessible store when no current store is selected.
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(rename = "X-STORE")]
    pub x_store: Option<String>,
    /// Request body sent with this call.
    ///
    /// Required.
    #[serde(skip)]
    pub body: SdkCreateFulfillmentNotificationsRequestApplicationJson,
}

impl NotifyFulfillmentParams {
    /// Construct a new `NotifyFulfillmentParams` with the required fields set.
    #[allow(deprecated)]
    pub fn new(body: SdkCreateFulfillmentNotificationsRequestApplicationJson) -> Self {
        Self {
            x_store: Default::default(),
            body,
        }
    }
}

impl<'a> InvoicesApi<'a> {
    /// List all invoices
    ///
    /// List your store's invoices, 15 per page by default. OAuth callers use the admin grant and select a store with X-STORE. Current membership and role permissions apply to every request.
    pub async fn list(
        &self,
        params: ListParams,
    ) -> Result<SdkListInvoicesResponseValue200ApplicationJson, Error> {
        self.list_with_options(params, None).await
    }

    /// Variant of [`Self::list`] that accepts per-request [`crate::RequestOptions`].
    pub async fn list_with_options(
        &self,
        params: ListParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<SdkListInvoicesResponseValue200ApplicationJson, Error> {
        self.list_raw(params, options)
            .await
            .map(|response| response.data)
    }

    /// Returns the typed result together with status, headers, and request ID.
    pub async fn list_raw(
        &self,
        params: ListParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<crate::RawResponse<SdkListInvoicesResponseValue200ApplicationJson>, Error> {
        let path = "/v2/invoices".to_string();
        let method = http::Method::GET;
        let mut merged = options.cloned().unwrap_or_default();
        merged.idempotency_supported = false;
        merged.operation_id = Some("listInvoices".to_string());
        let options = Some(&merged);
        self.client
            .request_with_query_schema_opts_raw(method, &path, &params, options, "GET /v2/invoices")
            .await
    }

    /// Create an invoice
    ///
    /// Create an invoice for one or more product variants. Credit products are direct-only: send a credits variant by itself, use a quantity covered by its credit rate tiers, and respect the variant quantity increment rules. OAuth callers use the admin grant and select a store with X-STORE. Current membership and role permissions apply to every request.
    pub async fn create(
        &self,
        params: CreateParams,
    ) -> Result<SdkCreateInvoiceResponseValue201ApplicationJson, Error> {
        self.create_with_options(params, None).await
    }

    /// Variant of [`Self::create`] that accepts per-request [`crate::RequestOptions`].
    pub async fn create_with_options(
        &self,
        params: CreateParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<SdkCreateInvoiceResponseValue201ApplicationJson, Error> {
        self.create_raw(params, options)
            .await
            .map(|response| response.data)
    }

    /// Returns the typed result together with status, headers, and request ID.
    pub async fn create_raw(
        &self,
        params: CreateParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<crate::RawResponse<SdkCreateInvoiceResponseValue201ApplicationJson>, Error> {
        let path = "/v2/invoices".to_string();
        let method = http::Method::POST;
        let mut merged = options.cloned().unwrap_or_default();
        merged.idempotency_supported = false;
        merged.operation_id = Some("createInvoice".to_string());
        let options = Some(&merged);
        self.client
            .request_with_body_schema_opts_raw(
                method,
                &path,
                &params,
                Some(&params.body),
                options,
                "POST /v2/invoices",
            )
            .await
    }

    /// Search invoices
    ///
    /// Search invoices with the same filters as the list endpoint, sent in a JSON body instead of query parameters. OAuth callers use the admin grant and select a store with X-STORE. Current membership and role permissions apply to every request.
    pub async fn search(
        &self,
        params: SearchParams,
    ) -> Result<SdkSearchInvoicesResponseValue200ApplicationJson, Error> {
        self.search_with_options(params, None).await
    }

    /// Variant of [`Self::search`] that accepts per-request [`crate::RequestOptions`].
    pub async fn search_with_options(
        &self,
        params: SearchParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<SdkSearchInvoicesResponseValue200ApplicationJson, Error> {
        self.search_raw(params, options)
            .await
            .map(|response| response.data)
    }

    /// Returns the typed result together with status, headers, and request ID.
    pub async fn search_raw(
        &self,
        params: SearchParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<crate::RawResponse<SdkSearchInvoicesResponseValue200ApplicationJson>, Error> {
        let path = "/v2/invoices/search".to_string();
        let method = http::Method::POST;
        let mut merged = options.cloned().unwrap_or_default();
        merged.idempotency_supported = false;
        merged.operation_id = Some("searchInvoices".to_string());
        let options = Some(&merged);
        self.client
            .request_with_body_schema_opts_raw(
                method,
                &path,
                &params,
                Some(&params.body),
                options,
                "POST /v2/invoices/search",
            )
            .await
    }

    /// Retrieve an invoice
    ///
    /// Retrieve an invoice by its ID to check its current payment and delivery state. OAuth callers use the admin grant and select a store with X-STORE. Current membership and role permissions apply to every request.
    pub async fn get(
        &self,
        invoice: &str,
        params: GetParams,
    ) -> Result<SdkGetInvoiceResponseValue200ApplicationJson, Error> {
        self.get_with_options(invoice, params, None).await
    }

    /// Variant of [`Self::get`] that accepts per-request [`crate::RequestOptions`].
    pub async fn get_with_options(
        &self,
        invoice: &str,
        params: GetParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<SdkGetInvoiceResponseValue200ApplicationJson, Error> {
        self.get_raw(invoice, params, options)
            .await
            .map(|response| response.data)
    }

    /// Returns the typed result together with status, headers, and request ID.
    pub async fn get_raw(
        &self,
        invoice: &str,
        params: GetParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<crate::RawResponse<SdkGetInvoiceResponseValue200ApplicationJson>, Error> {
        let invoice = crate::client::path_segment(invoice);
        let path = format!("/v2/invoices/{invoice}");
        let method = http::Method::GET;
        let mut merged = options.cloned().unwrap_or_default();
        merged.idempotency_supported = false;
        merged.operation_id = Some("getInvoice".to_string());
        let options = Some(&merged);
        self.client
            .request_with_query_schema_opts_raw(
                method,
                &path,
                &params,
                options,
                "GET /v2/invoices/{invoice}",
            )
            .await
    }

    /// Create a checkout session
    ///
    /// Create or reuse a payment session for a pending invoice. Create the invoice first, then send the customer to the returned top-level `payment_url`. A zero-priced checkout can return a paid invoice without a URL; delivery may still be queued. Check for a URL before redirecting and verify payment through signed events or a fresh read. OAuth callers use the admin grant and select a store with X-STORE. Current membership and role permissions apply to every request.
    pub async fn go_to_checkout(
        &self,
        invoice: &str,
        params: GoToCheckoutParams,
    ) -> Result<SdkCreateCheckoutSessionResponseValue200ApplicationJson, Error> {
        self.go_to_checkout_with_options(invoice, params, None)
            .await
    }

    /// Variant of [`Self::go_to_checkout`] that accepts per-request [`crate::RequestOptions`].
    pub async fn go_to_checkout_with_options(
        &self,
        invoice: &str,
        params: GoToCheckoutParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<SdkCreateCheckoutSessionResponseValue200ApplicationJson, Error> {
        self.go_to_checkout_raw(invoice, params, options)
            .await
            .map(|response| response.data)
    }

    /// Returns the typed result together with status, headers, and request ID.
    pub async fn go_to_checkout_raw(
        &self,
        invoice: &str,
        params: GoToCheckoutParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<crate::RawResponse<SdkCreateCheckoutSessionResponseValue200ApplicationJson>, Error>
    {
        let invoice = crate::client::path_segment(invoice);
        let path = format!("/v2/invoices/{invoice}/checkout");
        let method = http::Method::POST;
        let mut merged = options.cloned().unwrap_or_default();
        merged.idempotency_supported = false;
        merged.operation_id = Some("createCheckoutSession".to_string());
        let options = Some(&merged);
        self.client
            .request_with_query_schema_opts_raw(
                method,
                &path,
                &params,
                options,
                "POST /v2/invoices/{invoice}/checkout",
            )
            .await
    }

    /// View invoice deliverables
    ///
    /// Retrieve the deliverables sent to the customer, including each product in a multi-product purchase. OAuth callers use the admin grant and select a store with X-STORE. Current membership and role permissions apply to every request.
    pub async fn get_deliverables(
        &self,
        invoice: &str,
        params: GetDeliverablesParams,
    ) -> Result<SdkGetInvoiceDeliverablesResponseValue200ApplicationJson, Error> {
        self.get_deliverables_with_options(invoice, params, None)
            .await
    }

    /// Variant of [`Self::get_deliverables`] that accepts per-request [`crate::RequestOptions`].
    pub async fn get_deliverables_with_options(
        &self,
        invoice: &str,
        params: GetDeliverablesParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<SdkGetInvoiceDeliverablesResponseValue200ApplicationJson, Error> {
        self.get_deliverables_raw(invoice, params, options)
            .await
            .map(|response| response.data)
    }

    /// Returns the typed result together with status, headers, and request ID.
    pub async fn get_deliverables_raw(
        &self,
        invoice: &str,
        params: GetDeliverablesParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<crate::RawResponse<SdkGetInvoiceDeliverablesResponseValue200ApplicationJson>, Error>
    {
        let invoice = crate::client::path_segment(invoice);
        let path = format!("/v2/invoices/{invoice}/deliverables");
        let method = http::Method::GET;
        let mut merged = options.cloned().unwrap_or_default();
        merged.idempotency_supported = false;
        merged.operation_id = Some("getInvoiceDeliverables".to_string());
        let options = Some(&merged);
        self.client
            .request_with_query_schema_opts_raw(
                method,
                &path,
                &params,
                options,
                "GET /v2/invoices/{invoice}/deliverables",
            )
            .await
    }

    /// Mark pending invoice completed
    ///
    /// Mark a pending invoice completed and start the normal delivery flow. SellApp normally handles completion after payment is confirmed. Use this only after independently confirming payment or deliberately authorizing delivery without it; the action can release purchased products. OAuth callers use the admin grant and select a store with X-STORE. Current membership and role permissions apply to every request.
    pub async fn mark_completed(
        &self,
        invoice: &str,
        params: MarkCompletedParams,
    ) -> Result<SdkMarkPendingInvoiceCompletedResponseValue200ApplicationJson, Error> {
        self.mark_completed_with_options(invoice, params, None)
            .await
    }

    /// Variant of [`Self::mark_completed`] that accepts per-request [`crate::RequestOptions`].
    pub async fn mark_completed_with_options(
        &self,
        invoice: &str,
        params: MarkCompletedParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<SdkMarkPendingInvoiceCompletedResponseValue200ApplicationJson, Error> {
        self.mark_completed_raw(invoice, params, options)
            .await
            .map(|response| response.data)
    }

    /// Returns the typed result together with status, headers, and request ID.
    pub async fn mark_completed_raw(
        &self,
        invoice: &str,
        params: MarkCompletedParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<
        crate::RawResponse<SdkMarkPendingInvoiceCompletedResponseValue200ApplicationJson>,
        Error,
    > {
        let invoice = crate::client::path_segment(invoice);
        let path = format!("/v2/invoices/{invoice}/mark-completed");
        let method = http::Method::PATCH;
        let mut merged = options.cloned().unwrap_or_default();
        merged.idempotency_supported = false;
        merged.operation_id = Some("markPendingInvoiceCompleted".to_string());
        let options = Some(&merged);
        self.client
            .request_with_body_schema_opts_raw(
                method,
                &path,
                &params,
                Some(&params.body),
                options,
                "PATCH /v2/invoices/{invoice}/mark-completed",
            )
            .await
    }

    /// Mark pending invoice voided
    ///
    /// Void a pending invoice so it does not proceed to product delivery. OAuth callers use the admin grant and select a store with X-STORE. Current membership and role permissions apply to every request.
    pub async fn mark_voided(
        &self,
        invoice: &str,
        params: MarkVoidedParams,
    ) -> Result<SdkMarkPendingInvoiceVoidedResponseValue200ApplicationJson, Error> {
        self.mark_voided_with_options(invoice, params, None).await
    }

    /// Variant of [`Self::mark_voided`] that accepts per-request [`crate::RequestOptions`].
    pub async fn mark_voided_with_options(
        &self,
        invoice: &str,
        params: MarkVoidedParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<SdkMarkPendingInvoiceVoidedResponseValue200ApplicationJson, Error> {
        self.mark_voided_raw(invoice, params, options)
            .await
            .map(|response| response.data)
    }

    /// Returns the typed result together with status, headers, and request ID.
    pub async fn mark_voided_raw(
        &self,
        invoice: &str,
        params: MarkVoidedParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<crate::RawResponse<SdkMarkPendingInvoiceVoidedResponseValue200ApplicationJson>, Error>
    {
        let invoice = crate::client::path_segment(invoice);
        let path = format!("/v2/invoices/{invoice}/mark-voided");
        let method = http::Method::PATCH;
        let mut merged = options.cloned().unwrap_or_default();
        merged.idempotency_supported = false;
        merged.operation_id = Some("markPendingInvoiceVoided".to_string());
        let options = Some(&merged);
        self.client
            .request_with_body_schema_opts_raw(
                method,
                &path,
                &params,
                Some(&params.body),
                options,
                "PATCH /v2/invoices/{invoice}/mark-voided",
            )
            .await
    }

    /// Issue replacement for completed invoice
    ///
    /// Issue replacement deliverables for a completed purchase. This creates a new invoice and marks it completed, then starts the normal delivery and sales-notification flow. It is not just an edit to the old delivery. OAuth callers use the admin grant and select a store with X-STORE. Current membership and role permissions apply to every request.
    pub async fn issue_replacement(
        &self,
        invoice: &str,
        params: IssueReplacementParams,
    ) -> Result<SdkIssueReplacementForCompletedInvoiceResponseValue200ApplicationJson, Error> {
        self.issue_replacement_with_options(invoice, params, None)
            .await
    }

    /// Variant of [`Self::issue_replacement`] that accepts per-request [`crate::RequestOptions`].
    pub async fn issue_replacement_with_options(
        &self,
        invoice: &str,
        params: IssueReplacementParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<SdkIssueReplacementForCompletedInvoiceResponseValue200ApplicationJson, Error> {
        self.issue_replacement_raw(invoice, params, options)
            .await
            .map(|response| response.data)
    }

    /// Returns the typed result together with status, headers, and request ID.
    pub async fn issue_replacement_raw(
        &self,
        invoice: &str,
        params: IssueReplacementParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<
        crate::RawResponse<SdkIssueReplacementForCompletedInvoiceResponseValue200ApplicationJson>,
        Error,
    > {
        let invoice = crate::client::path_segment(invoice);
        let path = format!("/v2/invoices/{invoice}/issue-replacement");
        let method = http::Method::PATCH;
        let mut merged = options.cloned().unwrap_or_default();
        merged.idempotency_supported = false;
        merged.operation_id = Some("issueReplacementForCompletedInvoice".to_string());
        let options = Some(&merged);
        self.client
            .request_with_body_schema_opts_raw(
                method,
                &path,
                &params,
                Some(&params.body),
                options,
                "PATCH /v2/invoices/{invoice}/issue-replacement",
            )
            .await
    }

    /// Update invoice status
    ///
    /// Change a purchase through the invoice compatibility operation. Set status to COMPLETED, VOIDED, REVIEW, or DISPUTING. Dispute transitions schedule community-access revocation and a dispute webhook. Requires the `invoice` credential ability and store ownership. OAuth callers use the admin grant and select a store with X-STORE. Current membership and role permissions apply to every request.
    pub async fn update_status(
        &self,
        invoice: &str,
        params: UpdateStatusParams,
    ) -> Result<SdkUpdateInvoiceStatusResponseValue200ApplicationJson, Error> {
        self.update_status_with_options(invoice, params, None).await
    }

    /// Variant of [`Self::update_status`] that accepts per-request [`crate::RequestOptions`].
    pub async fn update_status_with_options(
        &self,
        invoice: &str,
        params: UpdateStatusParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<SdkUpdateInvoiceStatusResponseValue200ApplicationJson, Error> {
        self.update_status_raw(invoice, params, options)
            .await
            .map(|response| response.data)
    }

    /// Returns the typed result together with status, headers, and request ID.
    pub async fn update_status_raw(
        &self,
        invoice: &str,
        params: UpdateStatusParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<crate::RawResponse<SdkUpdateInvoiceStatusResponseValue200ApplicationJson>, Error>
    {
        let invoice = crate::client::path_segment(invoice);
        let path = format!("/v2/invoices/{invoice}/status");
        let method = http::Method::PATCH;
        let mut merged = options.cloned().unwrap_or_default();
        merged.idempotency_supported = false;
        merged.operation_id = Some("updateInvoiceStatus".to_string());
        let options = Some(&merged);
        self.client
            .request_with_body_schema_opts_raw(
                method,
                &path,
                &params,
                Some(&params.body),
                options,
                "PATCH /v2/invoices/{invoice}/status",
            )
            .await
    }

    /// Create invoice refund
    ///
    /// Request a full or partial provider refund using the same idempotent refund ledger as the dashboard. Amounts are decimal currency strings, never floating-point numbers. Requires the `invoice` token ability. OAuth callers use the admin grant and select a store with X-STORE. Current membership and role permissions apply to every request.
    pub async fn create_refund(
        &self,
        invoice: &str,
        params: CreateRefundParams,
    ) -> Result<SdkCreateInvoiceRefundResponseValue200ApplicationJson, Error> {
        self.create_refund_with_options(invoice, params, None).await
    }

    /// Variant of [`Self::create_refund`] that accepts per-request [`crate::RequestOptions`].
    pub async fn create_refund_with_options(
        &self,
        invoice: &str,
        params: CreateRefundParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<SdkCreateInvoiceRefundResponseValue200ApplicationJson, Error> {
        self.create_refund_raw(invoice, params, options)
            .await
            .map(|response| response.data)
    }

    /// Returns the typed result together with status, headers, and request ID.
    pub async fn create_refund_raw(
        &self,
        invoice: &str,
        params: CreateRefundParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<crate::RawResponse<SdkCreateInvoiceRefundResponseValue200ApplicationJson>, Error>
    {
        let invoice = crate::client::path_segment(invoice);
        let path = format!("/v2/invoices/{invoice}/refunds");
        let method = http::Method::POST;
        let mut merged = options.cloned().unwrap_or_default();
        merged.idempotency_supported = false;
        merged.operation_id = Some("createInvoiceRefund".to_string());
        let options = Some(&merged);
        self.client
            .request_with_body_schema_opts_raw(
                method,
                &path,
                &params,
                Some(&params.body),
                options,
                "POST /v2/invoices/{invoice}/refunds",
            )
            .await
    }

    /// Create fulfillment retry
    ///
    /// Retry failed delivery steps for a paid or partially fulfilled purchase. Repeated requests retry the same failed steps without creating duplicate work. OAuth callers use the admin grant and select a store with X-STORE. Current membership and role permissions apply to every request.
    pub async fn retry_fulfillment(
        &self,
        invoice: &str,
        params: RetryFulfillmentParams,
    ) -> Result<SdkCreateFulfillmentRetryResponseValue200ApplicationJson, Error> {
        self.retry_fulfillment_with_options(invoice, params, None)
            .await
    }

    /// Variant of [`Self::retry_fulfillment`] that accepts per-request [`crate::RequestOptions`].
    pub async fn retry_fulfillment_with_options(
        &self,
        invoice: &str,
        params: RetryFulfillmentParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<SdkCreateFulfillmentRetryResponseValue200ApplicationJson, Error> {
        self.retry_fulfillment_raw(invoice, params, options)
            .await
            .map(|response| response.data)
    }

    /// Returns the typed result together with status, headers, and request ID.
    pub async fn retry_fulfillment_raw(
        &self,
        invoice: &str,
        params: RetryFulfillmentParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<crate::RawResponse<SdkCreateFulfillmentRetryResponseValue200ApplicationJson>, Error>
    {
        let invoice = crate::client::path_segment(invoice);
        let path = format!("/v2/invoices/{invoice}/fulfillment-retries");
        let method = http::Method::POST;
        let mut merged = options.cloned().unwrap_or_default();
        merged.idempotency_supported = false;
        merged.operation_id = Some("createFulfillmentRetry".to_string());
        let options = Some(&merged);
        self.client
            .request_with_body_schema_opts_raw(
                method,
                &path,
                &params,
                Some(&params.body),
                options,
                "POST /v2/invoices/{invoice}/fulfillment-retries",
            )
            .await
    }

    /// Create dynamic delivery retry
    ///
    /// Retry one same-store dynamic delivered product after validating order, line-item, variant, and webhook ownership. Callers should avoid concurrent retries for the same delivered product. OAuth callers use the admin grant and select a store with X-STORE. Current membership and role permissions apply to every request.
    pub async fn retry_dynamic_delivery(
        &self,
        invoice: &str,
        params: RetryDynamicDeliveryParams,
    ) -> Result<SdkCreateDynamicDeliveryRetryResponseValue200ApplicationJson, Error> {
        self.retry_dynamic_delivery_with_options(invoice, params, None)
            .await
    }

    /// Variant of [`Self::retry_dynamic_delivery`] that accepts per-request [`crate::RequestOptions`].
    pub async fn retry_dynamic_delivery_with_options(
        &self,
        invoice: &str,
        params: RetryDynamicDeliveryParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<SdkCreateDynamicDeliveryRetryResponseValue200ApplicationJson, Error> {
        self.retry_dynamic_delivery_raw(invoice, params, options)
            .await
            .map(|response| response.data)
    }

    /// Returns the typed result together with status, headers, and request ID.
    pub async fn retry_dynamic_delivery_raw(
        &self,
        invoice: &str,
        params: RetryDynamicDeliveryParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<
        crate::RawResponse<SdkCreateDynamicDeliveryRetryResponseValue200ApplicationJson>,
        Error,
    > {
        let invoice = crate::client::path_segment(invoice);
        let path = format!("/v2/invoices/{invoice}/dynamic-delivery-retries");
        let method = http::Method::POST;
        let mut merged = options.cloned().unwrap_or_default();
        merged.idempotency_supported = false;
        merged.operation_id = Some("createDynamicDeliveryRetry".to_string());
        let options = Some(&merged);
        self.client
            .request_with_body_schema_opts_raw(
                method,
                &path,
                &params,
                Some(&params.body),
                options,
                "POST /v2/invoices/{invoice}/dynamic-delivery-retries",
            )
            .await
    }

    /// Create fulfillment notifications
    ///
    /// Resend fulfillment notifications for all or selected same-store product variants on a completed invoice. OAuth callers use the admin grant and select a store with X-STORE. Current membership and role permissions apply to every request.
    pub async fn notify_fulfillment(
        &self,
        invoice: &str,
        params: NotifyFulfillmentParams,
    ) -> Result<SdkCreateFulfillmentNotificationsResponseValue200ApplicationJson, Error> {
        self.notify_fulfillment_with_options(invoice, params, None)
            .await
    }

    /// Variant of [`Self::notify_fulfillment`] that accepts per-request [`crate::RequestOptions`].
    pub async fn notify_fulfillment_with_options(
        &self,
        invoice: &str,
        params: NotifyFulfillmentParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<SdkCreateFulfillmentNotificationsResponseValue200ApplicationJson, Error> {
        self.notify_fulfillment_raw(invoice, params, options)
            .await
            .map(|response| response.data)
    }

    /// Returns the typed result together with status, headers, and request ID.
    pub async fn notify_fulfillment_raw(
        &self,
        invoice: &str,
        params: NotifyFulfillmentParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<
        crate::RawResponse<SdkCreateFulfillmentNotificationsResponseValue200ApplicationJson>,
        Error,
    > {
        let invoice = crate::client::path_segment(invoice);
        let path = format!("/v2/invoices/{invoice}/fulfillment-notifications");
        let method = http::Method::POST;
        let mut merged = options.cloned().unwrap_or_default();
        merged.idempotency_supported = false;
        merged.operation_id = Some("createFulfillmentNotifications".to_string());
        let options = Some(&merged);
        self.client
            .request_with_body_schema_opts_raw(
                method,
                &path,
                &params,
                Some(&params.body),
                options,
                "POST /v2/invoices/{invoice}/fulfillment-notifications",
            )
            .await
    }
}