figma_api/models/
has_geometry_trait.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#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct HasGeometryTrait {
16    /// An array of fill paints applied to the node.
17    #[serde(rename = "fills")]
18    pub fills: Vec<models::Paint>,
19    /// A mapping of a StyleType to style ID (see Style) of styles present on this node. The style ID can be used to look up more information about the style in the top-level styles field.
20    #[serde(rename = "styles", skip_serializing_if = "Option::is_none")]
21    pub styles: Option<std::collections::HashMap<String, String>>,
22    /// An array of stroke paints applied to the node.
23    #[serde(rename = "strokes", skip_serializing_if = "Option::is_none")]
24    pub strokes: Option<Vec<models::Paint>>,
25    /// The weight of strokes on the node.
26    #[serde(rename = "strokeWeight", skip_serializing_if = "Option::is_none")]
27    pub stroke_weight: Option<f64>,
28    /// Position of stroke relative to vector outline, as a string enum  - `INSIDE`: stroke drawn inside the shape boundary - `OUTSIDE`: stroke drawn outside the shape boundary - `CENTER`: stroke drawn centered along the shape boundary
29    #[serde(rename = "strokeAlign", skip_serializing_if = "Option::is_none")]
30    pub stroke_align: Option<StrokeAlign>,
31    /// A string enum with value of \"MITER\", \"BEVEL\", or \"ROUND\", describing how corners in vector paths are rendered.
32    #[serde(rename = "strokeJoin", skip_serializing_if = "Option::is_none")]
33    pub stroke_join: Option<StrokeJoin>,
34    /// An array of floating point numbers describing the pattern of dash length and gap lengths that the vector stroke will use when drawn.  For example a value of [1, 2] indicates that the stroke will be drawn with a dash of length 1 followed by a gap of length 2, repeated.
35    #[serde(rename = "strokeDashes", skip_serializing_if = "Option::is_none")]
36    pub stroke_dashes: Option<Vec<f64>>,
37    /// Only specified if parameter `geometry=paths` is used. An array of paths representing the object fill.
38    #[serde(rename = "fillGeometry", skip_serializing_if = "Option::is_none")]
39    pub fill_geometry: Option<Vec<models::Path>>,
40    /// Only specified if parameter `geometry=paths` is used. An array of paths representing the object stroke.
41    #[serde(rename = "strokeGeometry", skip_serializing_if = "Option::is_none")]
42    pub stroke_geometry: Option<Vec<models::Path>>,
43    /// A string enum describing the end caps of vector paths.
44    #[serde(rename = "strokeCap", skip_serializing_if = "Option::is_none")]
45    pub stroke_cap: Option<StrokeCap>,
46    /// Only valid if `strokeJoin` is \"MITER\". The corner angle, in degrees, below which `strokeJoin` will be set to \"BEVEL\" to avoid super sharp corners. By default this is 28.96 degrees.
47    #[serde(rename = "strokeMiterAngle", skip_serializing_if = "Option::is_none")]
48    pub stroke_miter_angle: Option<f64>,
49}
50
51impl HasGeometryTrait {
52    pub fn new(fills: Vec<models::Paint>) -> HasGeometryTrait {
53        HasGeometryTrait {
54            fills,
55            styles: None,
56            strokes: None,
57            stroke_weight: None,
58            stroke_align: None,
59            stroke_join: None,
60            stroke_dashes: None,
61            fill_geometry: None,
62            stroke_geometry: None,
63            stroke_cap: None,
64            stroke_miter_angle: None,
65        }
66    }
67}
68/// Position of stroke relative to vector outline, as a string enum  - `INSIDE`: stroke drawn inside the shape boundary - `OUTSIDE`: stroke drawn outside the shape boundary - `CENTER`: stroke drawn centered along the shape boundary
69#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
70pub enum StrokeAlign {
71    #[serde(rename = "INSIDE")]
72    Inside,
73    #[serde(rename = "OUTSIDE")]
74    Outside,
75    #[serde(rename = "CENTER")]
76    Center,
77}
78
79impl Default for StrokeAlign {
80    fn default() -> StrokeAlign {
81        Self::Inside
82    }
83}
84/// A string enum with value of \"MITER\", \"BEVEL\", or \"ROUND\", describing how corners in vector paths are rendered.
85#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
86pub enum StrokeJoin {
87    #[serde(rename = "MITER")]
88    Miter,
89    #[serde(rename = "BEVEL")]
90    Bevel,
91    #[serde(rename = "ROUND")]
92    Round,
93}
94
95impl Default for StrokeJoin {
96    fn default() -> StrokeJoin {
97        Self::Miter
98    }
99}
100/// A string enum describing the end caps of vector paths.
101#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
102pub enum StrokeCap {
103    #[serde(rename = "NONE")]
104    None,
105    #[serde(rename = "ROUND")]
106    Round,
107    #[serde(rename = "SQUARE")]
108    Square,
109    #[serde(rename = "LINE_ARROW")]
110    LineArrow,
111    #[serde(rename = "TRIANGLE_ARROW")]
112    TriangleArrow,
113    #[serde(rename = "DIAMOND_FILLED")]
114    DiamondFilled,
115    #[serde(rename = "CIRCLE_FILLED")]
116    CircleFilled,
117    #[serde(rename = "TRIANGLE_FILLED")]
118    TriangleFilled,
119    #[serde(rename = "WASHI_TAPE_1")]
120    WashiTape1,
121    #[serde(rename = "WASHI_TAPE_2")]
122    WashiTape2,
123    #[serde(rename = "WASHI_TAPE_3")]
124    WashiTape3,
125    #[serde(rename = "WASHI_TAPE_4")]
126    WashiTape4,
127    #[serde(rename = "WASHI_TAPE_5")]
128    WashiTape5,
129    #[serde(rename = "WASHI_TAPE_6")]
130    WashiTape6,
131}
132
133impl Default for StrokeCap {
134    fn default() -> StrokeCap {
135        Self::None
136    }
137}
138