square_api_client/models/batch_upsert_catalog_objects_request.rs
1//! Request struct for the Batch Upsert Catalog Objects API
2
3use serde::Serialize;
4
5use super::CatalogObjectBatch;
6
7/// This is a model class for BatchUpsertCatalogObjectsRequest type.
8#[derive(Clone, Debug, Default, Eq, PartialEq, Serialize)]
9pub struct BatchUpsertCatalogObjectsRequest {
10 /// A value you specify that uniquely identifies this request among all your requests. A common
11 /// way to create a valid idempotency key is to use a Universally unique identifier (UUID).
12 ///
13 /// If you're unsure whether a particular request was successful, you can reattempt it with the
14 /// same idempotency key without worrying about creating duplicate objects.
15 ///
16 /// See [Idempotency](https://developer.squareup.com/docs/basics/api101/idempotency) for more
17 /// information.
18 pub idempotency_key: Option<String>,
19 /// A batch of CatalogObjects to be inserted/updated atomically. The objects within a batch will
20 /// be inserted in an all-or-nothing fashion, i.e., if an error occurs attempting to insert or
21 /// update an object within a batch, the entire batch will be rejected. However, an error in one
22 /// batch will not affect other batches within the same request.
23 ///
24 /// For each object, its `updated_at` field is ignored and replaced with a current timestamp,
25 /// and its `is_deleted` field must not be set to `true`.
26 ///
27 /// To modify an existing object, supply its ID. To create a new object, use an ID starting with
28 /// `#`. These IDs may be used to create relationships between an object and attributes of other
29 /// objects that reference it. For example, you can create a CatalogItem with ID `#ABC` and a
30 /// CatalogItemVariation with its `item_id` attribute set to `#ABC` in order to associate the
31 /// CatalogItemVariation with its parent CatalogItem.
32 ///
33 /// Any `#`-prefixed IDs are valid only within a single atomic batch, and will be replaced by
34 /// server-generated IDs.
35 ///
36 /// Each batch may contain up to 1,000 objects. The total number of objects across all batches
37 /// for a single request may not exceed 10,000. If either of these limits is violated, an error
38 /// will be returned and no objects will be inserted or updated.
39 pub batches: Vec<CatalogObjectBatch>,
40}