figma-api 0.31.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).
Documentation
/*
 * Figma API
 *
 * 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).
 *
 * The version of the OpenAPI document: 0.31.0
 * Contact: support@figma.com
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct TypeStyle {
    /// Font family of text (standard name).
    #[serde(rename = "fontFamily", skip_serializing_if = "Option::is_none")]
    pub font_family: Option<String>,
    /// PostScript font name.
    #[serde(rename = "fontPostScriptName", skip_serializing_if = "Option::is_none")]
    pub font_post_script_name: Option<String>,
    /// Describes visual weight or emphasis, such as Bold or Italic.
    #[serde(rename = "fontStyle", skip_serializing_if = "Option::is_none")]
    pub font_style: Option<String>,
    /// Whether or not text is italicized.
    #[serde(rename = "italic", skip_serializing_if = "Option::is_none")]
    pub italic: Option<bool>,
    /// Numeric font weight.
    #[serde(rename = "fontWeight", skip_serializing_if = "Option::is_none")]
    pub font_weight: Option<f64>,
    /// Font size in px.
    #[serde(rename = "fontSize", skip_serializing_if = "Option::is_none")]
    pub font_size: Option<f64>,
    /// Text casing applied to the node, default is the original casing.
    #[serde(rename = "textCase", skip_serializing_if = "Option::is_none")]
    pub text_case: Option<TextCase>,
    /// Horizontal text alignment as string enum.
    #[serde(rename = "textAlignHorizontal", skip_serializing_if = "Option::is_none")]
    pub text_align_horizontal: Option<TextAlignHorizontal>,
    /// Vertical text alignment as string enum.
    #[serde(rename = "textAlignVertical", skip_serializing_if = "Option::is_none")]
    pub text_align_vertical: Option<TextAlignVertical>,
    /// Space between characters in px.
    #[serde(rename = "letterSpacing", skip_serializing_if = "Option::is_none")]
    pub letter_spacing: Option<f64>,
    /// An array of fill paints applied to the characters.
    #[serde(rename = "fills", skip_serializing_if = "Option::is_none")]
    pub fills: Option<Vec<models::Paint>>,
    /// Link to a URL or frame.
    #[serde(rename = "hyperlink", skip_serializing_if = "Option::is_none")]
    pub hyperlink: Option<Box<models::Hyperlink>>,
    /// A map of OpenType feature flags to 1 or 0, 1 if it is enabled and 0 if it is disabled. Note that some flags aren't reflected here. For example, SMCP (small caps) is still represented by the `textCase` field.
    #[serde(rename = "opentypeFlags", skip_serializing_if = "Option::is_none")]
    pub opentype_flags: Option<std::collections::HashMap<String, f64>>,
    /// Indicates how the font weight was overridden when there is a text style override.
    #[serde(rename = "semanticWeight", skip_serializing_if = "Option::is_none")]
    pub semantic_weight: Option<SemanticWeight>,
    /// Indicates how the font style was overridden when there is a text style override.
    #[serde(rename = "semanticItalic", skip_serializing_if = "Option::is_none")]
    pub semantic_italic: Option<SemanticItalic>,
    /// Space between paragraphs in px, 0 if not present.
    #[serde(rename = "paragraphSpacing", skip_serializing_if = "Option::is_none")]
    pub paragraph_spacing: Option<f64>,
    /// Paragraph indentation in px, 0 if not present.
    #[serde(rename = "paragraphIndent", skip_serializing_if = "Option::is_none")]
    pub paragraph_indent: Option<f64>,
    /// Space between list items in px, 0 if not present.
    #[serde(rename = "listSpacing", skip_serializing_if = "Option::is_none")]
    pub list_spacing: Option<f64>,
    /// Text decoration applied to the node, default is none.
    #[serde(rename = "textDecoration", skip_serializing_if = "Option::is_none")]
    pub text_decoration: Option<TextDecoration>,
    /// Dimensions along which text will auto resize, default is that the text does not auto-resize. TRUNCATE means that the text will be shortened and trailing text will be replaced with \"…\" if the text contents is larger than the bounds. `TRUNCATE` as a return value is deprecated and will be removed in a future version. Read from `textTruncation` instead.
    #[serde(rename = "textAutoResize", skip_serializing_if = "Option::is_none")]
    pub text_auto_resize: Option<TextAutoResize>,
    /// Whether this text node will truncate with an ellipsis when the text contents is larger than the text node.
    #[serde(rename = "textTruncation", skip_serializing_if = "Option::is_none")]
    pub text_truncation: Option<TextTruncation>,
    /// When `textTruncation: \"ENDING\"` is set, `maxLines` determines how many lines a text node can grow to before it truncates.
    #[serde(rename = "maxLines", skip_serializing_if = "Option::is_none")]
    pub max_lines: Option<f64>,
    /// Line height in px.
    #[serde(rename = "lineHeightPx", skip_serializing_if = "Option::is_none")]
    pub line_height_px: Option<f64>,
    /// Line height as a percentage of normal line height. This is deprecated; in a future version of the API only lineHeightPx and lineHeightPercentFontSize will be returned.
    #[serde(rename = "lineHeightPercent", skip_serializing_if = "Option::is_none")]
    pub line_height_percent: Option<f64>,
    /// Line height as a percentage of the font size. Only returned when `lineHeightPercent` (deprecated) is not 100.
    #[serde(rename = "lineHeightPercentFontSize", skip_serializing_if = "Option::is_none")]
    pub line_height_percent_font_size: Option<f64>,
    /// The unit of the line height value specified by the user.
    #[serde(rename = "lineHeightUnit", skip_serializing_if = "Option::is_none")]
    pub line_height_unit: Option<LineHeightUnit>,
    /// Whether or not this style has overrides over a text style. The possible fields to override are semanticWeight, semanticItalic, hyperlink, and textDecoration. If this is true, then those fields are overrides if present.
    #[serde(rename = "isOverrideOverTextStyle", skip_serializing_if = "Option::is_none")]
    pub is_override_over_text_style: Option<bool>,
    #[serde(rename = "boundVariables", skip_serializing_if = "Option::is_none")]
    pub bound_variables: Option<Box<models::TypeStyleAllOfBoundVariables>>,
}

impl TypeStyle {
    pub fn new() -> TypeStyle {
        TypeStyle {
            font_family: None,
            font_post_script_name: None,
            font_style: None,
            italic: None,
            font_weight: None,
            font_size: None,
            text_case: None,
            text_align_horizontal: None,
            text_align_vertical: None,
            letter_spacing: None,
            fills: None,
            hyperlink: None,
            opentype_flags: None,
            semantic_weight: None,
            semantic_italic: None,
            paragraph_spacing: None,
            paragraph_indent: None,
            list_spacing: None,
            text_decoration: None,
            text_auto_resize: None,
            text_truncation: None,
            max_lines: None,
            line_height_px: None,
            line_height_percent: None,
            line_height_percent_font_size: None,
            line_height_unit: None,
            is_override_over_text_style: None,
            bound_variables: None,
        }
    }
}
/// Text casing applied to the node, default is the original casing.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum TextCase {
    #[serde(rename = "UPPER")]
    Upper,
    #[serde(rename = "LOWER")]
    Lower,
    #[serde(rename = "TITLE")]
    Title,
    #[serde(rename = "SMALL_CAPS")]
    SmallCaps,
    #[serde(rename = "SMALL_CAPS_FORCED")]
    SmallCapsForced,
}

impl Default for TextCase {
    fn default() -> TextCase {
        Self::Upper
    }
}
/// Horizontal text alignment as string enum.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum TextAlignHorizontal {
    #[serde(rename = "LEFT")]
    Left,
    #[serde(rename = "RIGHT")]
    Right,
    #[serde(rename = "CENTER")]
    Center,
    #[serde(rename = "JUSTIFIED")]
    Justified,
}

impl Default for TextAlignHorizontal {
    fn default() -> TextAlignHorizontal {
        Self::Left
    }
}
/// Vertical text alignment as string enum.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum TextAlignVertical {
    #[serde(rename = "TOP")]
    Top,
    #[serde(rename = "CENTER")]
    Center,
    #[serde(rename = "BOTTOM")]
    Bottom,
}

impl Default for TextAlignVertical {
    fn default() -> TextAlignVertical {
        Self::Top
    }
}
/// Indicates how the font weight was overridden when there is a text style override.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum SemanticWeight {
    #[serde(rename = "BOLD")]
    Bold,
    #[serde(rename = "NORMAL")]
    Normal,
}

impl Default for SemanticWeight {
    fn default() -> SemanticWeight {
        Self::Bold
    }
}
/// Indicates how the font style was overridden when there is a text style override.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum SemanticItalic {
    #[serde(rename = "ITALIC")]
    Italic,
    #[serde(rename = "NORMAL")]
    Normal,
}

impl Default for SemanticItalic {
    fn default() -> SemanticItalic {
        Self::Italic
    }
}
/// Text decoration applied to the node, default is none.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum TextDecoration {
    #[serde(rename = "NONE")]
    None,
    #[serde(rename = "STRIKETHROUGH")]
    Strikethrough,
    #[serde(rename = "UNDERLINE")]
    Underline,
}

impl Default for TextDecoration {
    fn default() -> TextDecoration {
        Self::None
    }
}
/// Dimensions along which text will auto resize, default is that the text does not auto-resize. TRUNCATE means that the text will be shortened and trailing text will be replaced with \"…\" if the text contents is larger than the bounds. `TRUNCATE` as a return value is deprecated and will be removed in a future version. Read from `textTruncation` instead.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum TextAutoResize {
    #[serde(rename = "NONE")]
    None,
    #[serde(rename = "WIDTH_AND_HEIGHT")]
    WidthAndHeight,
    #[serde(rename = "HEIGHT")]
    Height,
    #[serde(rename = "TRUNCATE")]
    Truncate,
}

impl Default for TextAutoResize {
    fn default() -> TextAutoResize {
        Self::None
    }
}
/// Whether this text node will truncate with an ellipsis when the text contents is larger than the text node.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum TextTruncation {
    #[serde(rename = "DISABLED")]
    Disabled,
    #[serde(rename = "ENDING")]
    Ending,
}

impl Default for TextTruncation {
    fn default() -> TextTruncation {
        Self::Disabled
    }
}
/// The unit of the line height value specified by the user.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum LineHeightUnit {
    #[serde(rename = "PIXELS")]
    Pixels,
    #[serde(rename = "FONT_SIZE_%")]
    FontSizePercent,
    #[serde(rename = "INTRINSIC_%")]
    IntrinsicPercent,
}

impl Default for LineHeightUnit {
    fn default() -> LineHeightUnit {
        Self::Pixels
    }
}