figma_api/models/
component_property.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/// ComponentProperty : A property of a component.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct ComponentProperty {
17    /// Type of this component property.
18    #[serde(rename = "type")]
19    pub r#type: models::ComponentPropertyType,
20    #[serde(rename = "value")]
21    pub value: Box<models::ComponentPropertyValue>,
22    /// Preferred values for this property. Only applicable if type is `INSTANCE_SWAP`.
23    #[serde(rename = "preferredValues", skip_serializing_if = "Option::is_none")]
24    pub preferred_values: Option<Vec<models::InstanceSwapPreferredValue>>,
25    #[serde(rename = "boundVariables", skip_serializing_if = "Option::is_none")]
26    pub bound_variables: Option<Box<models::ComponentPropertyBoundVariables>>,
27}
28
29impl ComponentProperty {
30    /// A property of a component.
31    pub fn new(r#type: models::ComponentPropertyType, value: models::ComponentPropertyValue) -> ComponentProperty {
32        ComponentProperty {
33            r#type,
34            value: Box::new(value),
35            preferred_values: None,
36            bound_variables: None,
37        }
38    }
39}
40