figma_api/models/
component_property_definition.rs

1/*
2 * Figma API
3 *
4 * This is the OpenAPI specification for the [Figma REST API](https://www.figma.com/developers/api).  Note: we are releasing the OpenAPI specification as a beta given the large surface area and complexity of the REST API. If you notice any inaccuracies with the specification, please [file an issue](https://github.com/figma/rest-api-spec/issues).
5 *
6 * The version of the OpenAPI document: 0.31.0
7 * Contact: support@figma.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// ComponentPropertyDefinition : A property of a component.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct ComponentPropertyDefinition {
17    /// Type of this component property.
18    #[serde(rename = "type")]
19    pub r#type: models::ComponentPropertyType,
20    #[serde(rename = "defaultValue")]
21    pub default_value: Box<models::ComponentPropertyDefinitionDefaultValue>,
22    /// All possible values for this property. Only exists on VARIANT properties.
23    #[serde(rename = "variantOptions", skip_serializing_if = "Option::is_none")]
24    pub variant_options: Option<Vec<String>>,
25    /// Preferred values for this property. Only applicable if type is `INSTANCE_SWAP`.
26    #[serde(rename = "preferredValues", skip_serializing_if = "Option::is_none")]
27    pub preferred_values: Option<Vec<models::InstanceSwapPreferredValue>>,
28}
29
30impl ComponentPropertyDefinition {
31    /// A property of a component.
32    pub fn new(r#type: models::ComponentPropertyType, default_value: models::ComponentPropertyDefinitionDefaultValue) -> ComponentPropertyDefinition {
33        ComponentPropertyDefinition {
34            r#type,
35            default_value: Box::new(default_value),
36            variant_options: None,
37            preferred_values: None,
38        }
39    }
40}
41