figma_api/models/variable_value.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/// VariableValue : The value for the variable. The value must match the variable's type. If setting to a variable alias, the alias must resolve to this type.
15/// The value for the variable. The value must match the variable's type. If setting to a variable alias, the alias must resolve to this type.
16#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
17#[serde(untagged)]
18pub enum VariableValue {
19 Boolean(bool),
20 Number(f64),
21 String(String),
22 Rgb(Box<models::Rgb>),
23 Rgba(Box<models::Rgba>),
24 VariableAlias(Box<models::VariableAlias>),
25}
26
27impl Default for VariableValue {
28 fn default() -> Self {
29 Self::Boolean(Default::default())
30 }
31}
32///
33#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
34pub enum Type {
35 #[serde(rename = "VARIABLE_ALIAS")]
36 VariableAlias,
37}
38
39impl Default for Type {
40 fn default() -> Type {
41 Self::VariableAlias
42 }
43}
44