figma_api/models/
variable_scope.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/// VariableScope : Scopes allow a variable to be shown or hidden in the variable picker for various fields. This declutters the Figma UI if you have a large number of variables. Variable scopes are currently supported on `FLOAT`, `STRING`, and `COLOR` variables.  `ALL_SCOPES` is a special scope that means that the variable will be shown in the variable picker for all variable fields. If `ALL_SCOPES` is set, no additional scopes can be set.  `ALL_FILLS` is a special scope that means that the variable will be shown in the variable picker for all fill fields. If `ALL_FILLS` is set, no additional fill scopes can be set.  Valid scopes for `FLOAT` variables: - `ALL_SCOPES` - `TEXT_CONTENT` - `WIDTH_HEIGHT` - `GAP` - `STROKE_FLOAT` - `EFFECT_FLOAT` - `OPACITY` - `FONT_WEIGHT` - `FONT_SIZE` - `LINE_HEIGHT` - `LETTER_SPACING` - `PARAGRAPH_SPACING` - `PARAGRAPH_INDENT`  Valid scopes for `STRING` variables: - `ALL_SCOPES` - `TEXT_CONTENT` - `FONT_FAMILY` - `FONT_STYLE`  Valid scopes for `COLOR` variables: - `ALL_SCOPES` - `ALL_FILLS` - `FRAME_FILL` - `SHAPE_FILL` - `TEXT_FILL` - `STROKE_COLOR` - `EFFECT_COLOR`
15/// Scopes allow a variable to be shown or hidden in the variable picker for various fields. This declutters the Figma UI if you have a large number of variables. Variable scopes are currently supported on `FLOAT`, `STRING`, and `COLOR` variables.  `ALL_SCOPES` is a special scope that means that the variable will be shown in the variable picker for all variable fields. If `ALL_SCOPES` is set, no additional scopes can be set.  `ALL_FILLS` is a special scope that means that the variable will be shown in the variable picker for all fill fields. If `ALL_FILLS` is set, no additional fill scopes can be set.  Valid scopes for `FLOAT` variables: - `ALL_SCOPES` - `TEXT_CONTENT` - `WIDTH_HEIGHT` - `GAP` - `STROKE_FLOAT` - `EFFECT_FLOAT` - `OPACITY` - `FONT_WEIGHT` - `FONT_SIZE` - `LINE_HEIGHT` - `LETTER_SPACING` - `PARAGRAPH_SPACING` - `PARAGRAPH_INDENT`  Valid scopes for `STRING` variables: - `ALL_SCOPES` - `TEXT_CONTENT` - `FONT_FAMILY` - `FONT_STYLE`  Valid scopes for `COLOR` variables: - `ALL_SCOPES` - `ALL_FILLS` - `FRAME_FILL` - `SHAPE_FILL` - `TEXT_FILL` - `STROKE_COLOR` - `EFFECT_COLOR`
16#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
17pub enum VariableScope {
18    #[serde(rename = "ALL_SCOPES")]
19    AllScopes,
20    #[serde(rename = "TEXT_CONTENT")]
21    TextContent,
22    #[serde(rename = "CORNER_RADIUS")]
23    CornerRadius,
24    #[serde(rename = "WIDTH_HEIGHT")]
25    WidthHeight,
26    #[serde(rename = "GAP")]
27    Gap,
28    #[serde(rename = "ALL_FILLS")]
29    AllFills,
30    #[serde(rename = "FRAME_FILL")]
31    FrameFill,
32    #[serde(rename = "SHAPE_FILL")]
33    ShapeFill,
34    #[serde(rename = "TEXT_FILL")]
35    TextFill,
36    #[serde(rename = "STROKE_COLOR")]
37    StrokeColor,
38    #[serde(rename = "STROKE_FLOAT")]
39    StrokeFloat,
40    #[serde(rename = "EFFECT_FLOAT")]
41    EffectFloat,
42    #[serde(rename = "EFFECT_COLOR")]
43    EffectColor,
44    #[serde(rename = "OPACITY")]
45    Opacity,
46    #[serde(rename = "FONT_FAMILY")]
47    FontFamily,
48    #[serde(rename = "FONT_STYLE")]
49    FontStyle,
50    #[serde(rename = "FONT_WEIGHT")]
51    FontWeight,
52    #[serde(rename = "FONT_SIZE")]
53    FontSize,
54    #[serde(rename = "LINE_HEIGHT")]
55    LineHeight,
56    #[serde(rename = "LETTER_SPACING")]
57    LetterSpacing,
58    #[serde(rename = "PARAGRAPH_SPACING")]
59    ParagraphSpacing,
60    #[serde(rename = "PARAGRAPH_INDENT")]
61    ParagraphIndent,
62    #[serde(rename = "FONT_VARIATIONS")]
63    FontVariations,
64
65}
66
67impl std::fmt::Display for VariableScope {
68    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
69        match self {
70            Self::AllScopes => write!(f, "ALL_SCOPES"),
71            Self::TextContent => write!(f, "TEXT_CONTENT"),
72            Self::CornerRadius => write!(f, "CORNER_RADIUS"),
73            Self::WidthHeight => write!(f, "WIDTH_HEIGHT"),
74            Self::Gap => write!(f, "GAP"),
75            Self::AllFills => write!(f, "ALL_FILLS"),
76            Self::FrameFill => write!(f, "FRAME_FILL"),
77            Self::ShapeFill => write!(f, "SHAPE_FILL"),
78            Self::TextFill => write!(f, "TEXT_FILL"),
79            Self::StrokeColor => write!(f, "STROKE_COLOR"),
80            Self::StrokeFloat => write!(f, "STROKE_FLOAT"),
81            Self::EffectFloat => write!(f, "EFFECT_FLOAT"),
82            Self::EffectColor => write!(f, "EFFECT_COLOR"),
83            Self::Opacity => write!(f, "OPACITY"),
84            Self::FontFamily => write!(f, "FONT_FAMILY"),
85            Self::FontStyle => write!(f, "FONT_STYLE"),
86            Self::FontWeight => write!(f, "FONT_WEIGHT"),
87            Self::FontSize => write!(f, "FONT_SIZE"),
88            Self::LineHeight => write!(f, "LINE_HEIGHT"),
89            Self::LetterSpacing => write!(f, "LETTER_SPACING"),
90            Self::ParagraphSpacing => write!(f, "PARAGRAPH_SPACING"),
91            Self::ParagraphIndent => write!(f, "PARAGRAPH_INDENT"),
92            Self::FontVariations => write!(f, "FONT_VARIATIONS"),
93        }
94    }
95}
96
97impl Default for VariableScope {
98    fn default() -> VariableScope {
99        Self::AllScopes
100    }
101}
102