square_api_client/models/
catalog_item.rs

1//! Model struct for CatalogItem type.
2
3use serde::{Deserialize, Serialize};
4
5use super::{
6    enums::CatalogItemProductType, CatalogItemModifierListInfo, CatalogItemOptionForItem,
7    CatalogObject,
8};
9
10/// A [CatalogObject] instance of the `ITEM` type, also referred to as an item, in the catalog.
11#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
12pub struct CatalogItem {
13    /// The item's name. This is a searchable attribute for use in applicable query filters, its
14    /// value must not be empty, and the length is of Unicode code points.
15    pub name: Option<String>,
16    /// The item's description. This is a searchable attribute for use in applicable query filters,
17    /// and its value length is of Unicode code points.
18    pub description: Option<String>,
19    /// The text of the item's display label in the Square Point of Sale app. Only up to the first
20    /// five characters of the string are used. This attribute is searchable, and its value length
21    /// is of Unicode code points.
22    pub abbreviation: Option<String>,
23    /// The color of the item's display label in the Square Point of Sale app. This must be a valid
24    /// hex color code.
25    pub label_color: Option<String>,
26    /// If `true`, the item can be added to shipping orders from the merchant's online store.
27    pub available_online: Option<bool>,
28    /// If `true`, the item can be added to pickup orders from the merchant's online store.
29    pub available_for_pickup: Option<bool>,
30    /// If `true`, the item can be added to electronically fulfilled orders from the merchant's
31    /// online store.
32    pub available_electronically: Option<bool>,
33    /// The ID of the item's category, if any.
34    pub category_id: Option<String>,
35    /// A set of IDs indicating the taxes enabled for this item. When updating an item, any taxes
36    /// listed here will be added to the item. Taxes may also be added to or deleted from an item
37    /// using `UpdateItemTaxes`.
38    pub tax_ids: Option<Vec<String>>,
39    /// A set of `CatalogItemModifierListInfo` objects representing the modifier lists that apply to
40    /// this item, along with the overrides and min and max limits that are specific to this item.
41    /// Modifier lists may also be added to or deleted from an item using `UpdateItemModifierLists`.
42    pub modifier_list_info: Option<Vec<CatalogItemModifierListInfo>>,
43    /// A list of [CatalogItemVariation] objects for this item. An item must have at least one
44    /// variation.
45    pub variations: Option<Vec<CatalogObject>>,
46    /// The product type of the item. May not be changed once an item has been created.
47    ///
48    /// Only items of product type `REGULAR` or `APPOINTMENTS_SERVICE` may be created by this API;
49    /// items with other product types are read-only.
50    pub product_type: Option<CatalogItemProductType>,
51    /// If `false`, the Square Point of Sale app will present the `CatalogItem`'s details screen
52    /// immediately, allowing the merchant to choose `CatalogModifier`s before adding the item to
53    /// the cart. This is the default behavior.
54    ///
55    /// If `true`, the Square Point of Sale app will immediately add the item to the cart with the
56    /// pre-selected modifiers, and merchants can edit modifiers by drilling down onto the item's
57    /// details.
58    ///
59    /// Third-party clients are encouraged to implement similar behaviors.
60    pub skip_modifier_screen: Option<bool>,
61    /// List of item options IDs for this item. Used to manage and group item variations in a
62    /// specified order.
63    ///
64    /// Maximum: 6 item options.
65    pub item_options: Option<Vec<CatalogItemOptionForItem>>,
66    /// The IDs of images associated with this `CatalogItem` instance. These images will be shown to
67    /// customers in Square Online Store. The first image will show up as the icon for this item in
68    /// POS.
69    pub image_ids: Option<Vec<String>>,
70    /// A name to sort the item by. If this name is unspecified, namely, the `sort_name` field is
71    /// absent, the regular `name` field is used for sorting.
72    ///
73    /// It is currently supported for sellers of the Japanese locale only.
74    pub sort_name: Option<String>,
75}