figma_api/models/
variable_update.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/// VariableUpdate : An object that contains details about updating a `Variable`.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct VariableUpdate {
17    /// The action to perform for the variable.
18    #[serde(rename = "action")]
19    pub action: Action,
20    /// The id of the variable to update.
21    #[serde(rename = "id")]
22    pub id: String,
23    /// The name of this variable.
24    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
25    pub name: Option<String>,
26    /// The description of this variable.
27    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
28    pub description: Option<String>,
29    /// Whether this variable is hidden when publishing the current file as a library.
30    #[serde(rename = "hiddenFromPublishing", skip_serializing_if = "Option::is_none")]
31    pub hidden_from_publishing: Option<bool>,
32    /// An array of scopes in the UI where this variable is shown. Setting this property will show/hide this variable in the variable picker UI for different fields.
33    #[serde(rename = "scopes", skip_serializing_if = "Option::is_none")]
34    pub scopes: Option<Vec<models::VariableScope>>,
35    #[serde(rename = "codeSyntax", skip_serializing_if = "Option::is_none")]
36    pub code_syntax: Option<Box<models::VariableCodeSyntax>>,
37}
38
39impl VariableUpdate {
40    /// An object that contains details about updating a `Variable`.
41    pub fn new(action: Action, id: String) -> VariableUpdate {
42        VariableUpdate {
43            action,
44            id,
45            name: None,
46            description: None,
47            hidden_from_publishing: None,
48            scopes: None,
49            code_syntax: None,
50        }
51    }
52}
53/// The action to perform for the variable.
54#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
55pub enum Action {
56    #[serde(rename = "UPDATE")]
57    Update,
58}
59
60impl Default for Action {
61    fn default() -> Action {
62        Self::Update
63    }
64}
65