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
// 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 ProductsApi<'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>,
    /// Include draft products alongside published products.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub with_drafts: Option<bool>,
    /// Return only draft products.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub only_drafts: Option<bool>,
    /// 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),
            with_drafts: Default::default(),
            only_drafts: 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: SdkCreateProductRequestApplicationJson,
}

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

#[derive(Debug, Clone, Default, Serialize)]
pub struct GetParams {
    /// Include draft products alongside published products.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub with_drafts: Option<bool>,
    /// Return only draft products.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub only_drafts: Option<bool>,
    /// 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 ReplaceParams {
    /// 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: SdkReplaceProductRequestApplicationJson,
}

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

#[derive(Debug, Clone, Serialize)]
pub struct UpdateParams {
    /// 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: SdkUpdateProductRequestApplicationJson,
}

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

#[derive(Debug, Clone, Serialize)]
pub struct DeleteParams {
    /// 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: SdkDeleteProductRequestApplicationJson,
}

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

#[derive(Debug, Clone, Serialize)]
pub struct SearchParams {
    /// 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>,
    /// 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: SdkSearchProductsRequestApplicationJson,
}

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

#[derive(Debug, Clone, Serialize)]
pub struct BatchCreateParams {
    /// 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: SdkBatchCreateProductsRequestApplicationJson,
}

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

#[derive(Debug, Clone, Serialize)]
pub struct BatchUpdateParams {
    /// 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: SdkBatchUpdateProductsRequestApplicationJson,
}

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

#[derive(Debug, Clone, Serialize)]
pub struct BatchDeleteParams {
    /// 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: SdkBatchDeleteProductsRequestApplicationJson,
}

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

impl<'a> ProductsApi<'a> {
    /// List all products
    ///
    /// List your store's products, 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<SdkListProductsResponseValue200ApplicationJson, 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<SdkListProductsResponseValue200ApplicationJson, 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<SdkListProductsResponseValue200ApplicationJson>, Error> {
        let path = "/v2/products".to_string();
        let method = http::Method::GET;
        let mut merged = options.cloned().unwrap_or_default();
        merged.idempotency_supported = false;
        merged.operation_id = Some("listProducts".to_string());
        let options = Some(&merged);
        self.client
            .request_with_query_schema_opts_raw(method, &path, &params, options, "GET /v2/products")
            .await
    }

    /// Create a product
    ///
    /// Create a product in the selected store. Requires a token with the `listing` ability. The same product rules apply as in the dashboard. Add a variant before offering the product at checkout. Include variants to create the product and its initial variants atomically. For a complete bundle, set type to bundle, supply one BUNDLE variant with empty deliverable.data, and include bundle_items. The response includes the created variant IDs in data.variants. Omit these fields to retain separate creation. These options apply to single-product creation, not batch creation. 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<SdkCreateProductResponseValue201ApplicationJson, 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<SdkCreateProductResponseValue201ApplicationJson, 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<SdkCreateProductResponseValue201ApplicationJson>, Error> {
        let path = "/v2/products".to_string();
        let method = http::Method::POST;
        let mut merged = options.cloned().unwrap_or_default();
        merged.idempotency_supported = false;
        merged.operation_id = Some("createProduct".to_string());
        let options = Some(&merged);
        self.client
            .request_with_body_schema_opts_raw(
                method,
                &path,
                &params,
                Some(&params.body),
                options,
                "POST /v2/products",
            )
            .await
    }

    /// Retrieve a product
    ///
    /// Retrieve a product by its ID. 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,
        product: &str,
        params: GetParams,
    ) -> Result<SdkGetProductResponseValue200ApplicationJson, Error> {
        self.get_with_options(product, params, None).await
    }

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

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

    /// Update a product
    ///
    /// Update a product in the authenticated store. Requires a token with the `listing` ability. Send `expected_updated_at` to reject stale writes instead of overwriting a newer change. 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 replace(
        &self,
        product: &str,
        params: ReplaceParams,
    ) -> Result<SdkReplaceProductResponseValue200ApplicationJson, Error> {
        self.replace_with_options(product, params, None).await
    }

    /// Variant of [`Self::replace`] that accepts per-request [`crate::RequestOptions`].
    pub async fn replace_with_options(
        &self,
        product: &str,
        params: ReplaceParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<SdkReplaceProductResponseValue200ApplicationJson, Error> {
        self.replace_raw(product, params, options)
            .await
            .map(|response| response.data)
    }

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

    /// Update a product
    ///
    /// Update a product in the authenticated store. Requires a token with the `listing` ability. Send `expected_updated_at` to reject stale writes instead of overwriting a newer change. 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(
        &self,
        product: &str,
        params: UpdateParams,
    ) -> Result<SdkUpdateProductResponseValue200ApplicationJson, Error> {
        self.update_with_options(product, params, None).await
    }

    /// Variant of [`Self::update`] that accepts per-request [`crate::RequestOptions`].
    pub async fn update_with_options(
        &self,
        product: &str,
        params: UpdateParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<SdkUpdateProductResponseValue200ApplicationJson, Error> {
        self.update_raw(product, params, options)
            .await
            .map(|response| response.data)
    }

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

    /// Delete a product
    ///
    /// Soft-delete a product in the authenticated store. Products with active or past-due subscriptions cannot be deleted. Send `expected_updated_at` to reject a stale deletion. 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 delete(
        &self,
        product: &str,
        params: DeleteParams,
    ) -> Result<SdkDeleteProductResponseValue200ApplicationJson, Error> {
        self.delete_with_options(product, params, None).await
    }

    /// Variant of [`Self::delete`] that accepts per-request [`crate::RequestOptions`].
    pub async fn delete_with_options(
        &self,
        product: &str,
        params: DeleteParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<SdkDeleteProductResponseValue200ApplicationJson, Error> {
        self.delete_raw(product, params, options)
            .await
            .map(|response| response.data)
    }

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

    /// Search products
    ///
    /// Search products using JSON body filters, search terms, includes, and sort instructions. 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<SdkSearchProductsResponseValue200ApplicationJson, 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<SdkSearchProductsResponseValue200ApplicationJson, 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<SdkSearchProductsResponseValue200ApplicationJson>, Error> {
        let path = "/v2/products/search".to_string();
        let method = http::Method::POST;
        let mut merged = options.cloned().unwrap_or_default();
        merged.idempotency_supported = false;
        merged.operation_id = Some("searchProducts".to_string());
        let options = Some(&merged);
        self.client
            .request_with_body_schema_opts_raw(
                method,
                &path,
                &params,
                Some(&params.body),
                options,
                "POST /v2/products/search",
            )
            .await
    }

    /// Batch create products
    ///
    /// Create multiple products in one request by sending a `resources` array. 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 batch_create(
        &self,
        params: BatchCreateParams,
    ) -> Result<SdkBatchCreateProductsResponseValue200ApplicationJson, Error> {
        self.batch_create_with_options(params, None).await
    }

    /// Variant of [`Self::batch_create`] that accepts per-request [`crate::RequestOptions`].
    pub async fn batch_create_with_options(
        &self,
        params: BatchCreateParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<SdkBatchCreateProductsResponseValue200ApplicationJson, Error> {
        self.batch_create_raw(params, options)
            .await
            .map(|response| response.data)
    }

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

    /// Batch update products
    ///
    /// Update multiple products in one request by sending a `resources` object keyed by product ID. 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 batch_update(
        &self,
        params: BatchUpdateParams,
    ) -> Result<SdkBatchUpdateProductsResponseValue200ApplicationJson, Error> {
        self.batch_update_with_options(params, None).await
    }

    /// Variant of [`Self::batch_update`] that accepts per-request [`crate::RequestOptions`].
    pub async fn batch_update_with_options(
        &self,
        params: BatchUpdateParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<SdkBatchUpdateProductsResponseValue200ApplicationJson, Error> {
        self.batch_update_raw(params, options)
            .await
            .map(|response| response.data)
    }

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

    /// Batch delete products
    ///
    /// Delete multiple products in one request by sending the product IDs in `resources`. 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 batch_delete(
        &self,
        params: BatchDeleteParams,
    ) -> Result<SdkBatchDeleteProductsResponseValue200ApplicationJson, Error> {
        self.batch_delete_with_options(params, None).await
    }

    /// Variant of [`Self::batch_delete`] that accepts per-request [`crate::RequestOptions`].
    pub async fn batch_delete_with_options(
        &self,
        params: BatchDeleteParams,
        options: Option<&crate::RequestOptions>,
    ) -> Result<SdkBatchDeleteProductsResponseValue200ApplicationJson, Error> {
        self.batch_delete_raw(params, options)
            .await
            .map(|response| response.data)
    }

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