figma_api/models/
published_variable.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/// PublishedVariable : A Variable is a single design token that defines values for each of the modes in its VariableCollection. These values can be applied to various kinds of design properties.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct PublishedVariable {
17    /// The unique identifier of this variable.
18    #[serde(rename = "id")]
19    pub id: String,
20    /// The ID of the variable that is used by subscribing files. This ID changes every time the variable is modified and published.
21    #[serde(rename = "subscribed_id")]
22    pub subscribed_id: String,
23    /// The name of this variable.
24    #[serde(rename = "name")]
25    pub name: String,
26    /// The key of this variable.
27    #[serde(rename = "key")]
28    pub key: String,
29    /// The id of the variable collection that contains this variable.
30    #[serde(rename = "variableCollectionId")]
31    pub variable_collection_id: String,
32    /// The resolved type of the variable.
33    #[serde(rename = "resolvedDataType")]
34    pub resolved_data_type: ResolvedDataType,
35    /// The UTC ISO 8601 time at which the variable was last updated.
36    #[serde(rename = "updatedAt")]
37    pub updated_at: String,
38}
39
40impl PublishedVariable {
41    /// A Variable is a single design token that defines values for each of the modes in its VariableCollection. These values can be applied to various kinds of design properties.
42    pub fn new(id: String, subscribed_id: String, name: String, key: String, variable_collection_id: String, resolved_data_type: ResolvedDataType, updated_at: String) -> PublishedVariable {
43        PublishedVariable {
44            id,
45            subscribed_id,
46            name,
47            key,
48            variable_collection_id,
49            resolved_data_type,
50            updated_at,
51        }
52    }
53}
54/// The resolved type of the variable.
55#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
56pub enum ResolvedDataType {
57    #[serde(rename = "BOOLEAN")]
58    Boolean,
59    #[serde(rename = "FLOAT")]
60    Float,
61    #[serde(rename = "STRING")]
62    String,
63    #[serde(rename = "COLOR")]
64    Color,
65}
66
67impl Default for ResolvedDataType {
68    fn default() -> ResolvedDataType {
69        Self::Boolean
70    }
71}
72