square_api_client/models/
catalog_custom_attribute_definition.rs

1//! Model struct for CatalogCustomAttributeDefinition type.
2
3use serde::{Deserialize, Serialize};
4
5use super::{
6    enums::{
7        CatalogCustomAttributeDefinitionAppVisibility,
8        CatalogCustomAttributeDefinitionSellerVisibility, CatalogCustomAttributeDefinitionType,
9        CatalogObjectType,
10    },
11    CatalogCustomAttributeDefinitionNumberConfig, CatalogCustomAttributeDefinitionSelectionConfig,
12    CatalogCustomAttributeDefinitionStringConfig, SourceApplication,
13};
14
15/// Contains information defining a custom attribute.
16///
17/// Custom attributes are intended to store additional information about a catalog object or to
18/// associate a catalog object with an entity in another system. Do not use custom attributes to
19/// store any sensitive information (personally identifiable information, card details, etc.). [Read
20/// more about custom
21/// attributes](https://developer.squareup.com/docs/catalog-api/add-custom-attributes)
22#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
23pub struct CatalogCustomAttributeDefinition {
24    /// The type of this custom attribute. Cannot be modified after creation. Required.
25    pub r#type: CatalogCustomAttributeDefinitionType,
26    /// The name of this definition for API and seller-facing UI purposes. The name must be unique
27    /// within the (merchant, application) pair. Required. May not be empty and may not exceed 255
28    /// characters. Can be modified after creation.
29    pub name: String,
30    /// Seller-oriented description of the meaning of this Custom Attribute, any constraints that
31    /// the seller should observe, etc. May be displayed as a tooltip in Square UIs.
32    pub description: Option<String>,
33    /// **Read only.** Contains information about the application that created this custom attribute
34    /// definition.
35    pub source_application: Option<SourceApplication>,
36    /// The set of Catalog Object Types that this Custom Attribute may be applied to. Currently,
37    /// only `ITEM` and `ITEM_VARIATION` are allowed. At least one type must be included.
38    pub allowed_object_types: Vec<CatalogObjectType>,
39    /// The visibility of a custom attribute in seller-facing UIs (including Square Point of Sale
40    /// applications and Square Dashboard). May be modified.
41    pub seller_visibility: Option<CatalogCustomAttributeDefinitionSellerVisibility>,
42    /// The visibility of a custom attribute to applications other than the application that created
43    /// the attribute.
44    pub app_visibility: Option<CatalogCustomAttributeDefinitionAppVisibility>,
45    /// Optionally, populated when `type` = `STRING`, unset otherwise.
46    pub string_config: Option<CatalogCustomAttributeDefinitionStringConfig>,
47    /// Optionally, populated when `type` = `NUMBER`, unset otherwise.
48    pub number_config: Option<CatalogCustomAttributeDefinitionNumberConfig>,
49    /// Populated when `type` is set to `SELECTION`, unset otherwise.
50    pub selection_config: Option<CatalogCustomAttributeDefinitionSelectionConfig>,
51    /// **Read-only.** The number of custom attributes that reference this custom attribute
52    /// definition. Set by the server in response to a ListCatalog request with `include_counts` set
53    /// to `true`. If the actual count is greater than 100, `custom_attribute_usage_count` will be
54    /// set to `100`.
55    pub custom_attribute_usage_count: Option<i32>,
56    /// The name of the desired custom attribute key that can be used to access the custom attribute
57    /// value on catalog objects. Cannot be modified after the custom attribute definition has been
58    /// created. Must be between 1 and 60 characters, and may only contain the characters
59    /// `[a-zA-Z0-9_-]`.
60    pub key: Option<String>,
61}