figma_api/models/
node.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, Debug, PartialEq, Serialize, Deserialize)]
15#[serde(tag = "type")]
16pub enum Node {
17    #[serde(rename="BOOLEAN_OPERATION")]
18    BooleanOperation(Box<models::BooleanOperationNode>),
19    #[serde(rename="COMPONENT")]
20    Component(Box<models::ComponentNode>),
21    #[serde(rename="COMPONENT_SET")]
22    ComponentSet(Box<models::ComponentSetNode>),
23    #[serde(rename="CONNECTOR")]
24    Connector(Box<models::ConnectorNode>),
25    #[serde(rename="ELLIPSE")]
26    Ellipse(Box<models::EllipseNode>),
27    #[serde(rename="EMBED")]
28    Embed(Box<models::EmbedNode>),
29    #[serde(rename="FRAME")]
30    Frame(Box<models::FrameNode>),
31    #[serde(rename="GROUP")]
32    Group(Box<models::GroupNode>),
33    #[serde(rename="INSTANCE")]
34    Instance(Box<models::InstanceNode>),
35    #[serde(rename="LINE")]
36    Line(Box<models::LineNode>),
37    #[serde(rename="LINK_UNFURL")]
38    LinkUnfurl(Box<models::LinkUnfurlNode>),
39    #[serde(rename="RECTANGLE")]
40    Rectangle(Box<models::RectangleNode>),
41    #[serde(rename="REGULAR_POLYGON")]
42    RegularPolygon(Box<models::RegularPolygonNode>),
43    #[serde(rename="SECTION")]
44    Section(Box<models::SectionNode>),
45    #[serde(rename="SHAPE_WITH_TEXT")]
46    ShapeWithText(Box<models::ShapeWithTextNode>),
47    #[serde(rename="SLICE")]
48    Slice(Box<models::SliceNode>),
49    #[serde(rename="STAR")]
50    Star(Box<models::StarNode>),
51    #[serde(rename="STICKY")]
52    Sticky(Box<models::StickyNode>),
53    #[serde(rename="TABLE")]
54    Table(Box<models::TableNode>),
55    #[serde(rename="TABLE_CELL")]
56    TableCell(Box<models::TableCellNode>),
57    #[serde(rename="TEXT")]
58    Text(Box<models::TextNode>),
59    #[serde(rename="TEXT_PATH")]
60    TextPath(Box<models::TextPathNode>),
61    #[serde(rename="TRANSFORM_GROUP")]
62    TransformGroup(Box<models::TransformGroupNode>),
63    #[serde(rename="VECTOR")]
64    Vector(Box<models::VectorNode>),
65    #[serde(rename="WASHI_TAPE")]
66    WashiTape(Box<models::WashiTapeNode>),
67    #[serde(rename="WIDGET")]
68    Widget(Box<models::WidgetNode>),
69    #[serde(rename="DOCUMENT")]
70    Document(Box<models::DocumentNode>),
71    #[serde(rename="CANVAS")]
72    Canvas(Box<models::CanvasNode>),
73}
74
75impl Default for Node {
76    fn default() -> Self {
77        Self::BooleanOperation(Default::default())
78    }
79}
80
81/// A string enum indicating the type of boolean operation applied.
82#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
83pub enum BooleanOperation {
84    #[serde(rename = "UNION")]
85    Union,
86    #[serde(rename = "INTERSECT")]
87    Intersect,
88    #[serde(rename = "SUBTRACT")]
89    Subtract,
90    #[serde(rename = "EXCLUDE")]
91    Exclude,
92}
93
94impl Default for BooleanOperation {
95    fn default() -> BooleanOperation {
96        Self::Union
97    }
98}
99/// How layer should be treated when the frame is resized
100#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
101pub enum ScrollBehavior {
102    #[serde(rename = "SCROLLS")]
103    Scrolls,
104    #[serde(rename = "FIXED")]
105    Fixed,
106    #[serde(rename = "STICKY_SCROLLS")]
107    StickyScrolls,
108}
109
110impl Default for ScrollBehavior {
111    fn default() -> ScrollBehavior {
112        Self::Scrolls
113    }
114}
115///  Determines if the layer should stretch along the parent's counter axis. This property is only provided for direct children of auto-layout frames.  - `INHERIT` - `STRETCH`  In previous versions of auto layout, determined how the layer is aligned inside an auto-layout frame. This property is only provided for direct children of auto-layout frames.  - `MIN` - `CENTER` - `MAX` - `STRETCH`  In horizontal auto-layout frames, \"MIN\" and \"MAX\" correspond to \"TOP\" and \"BOTTOM\". In vertical auto-layout frames, \"MIN\" and \"MAX\" correspond to \"LEFT\" and \"RIGHT\".
116#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
117pub enum LayoutAlign {
118    #[serde(rename = "INHERIT")]
119    Inherit,
120    #[serde(rename = "STRETCH")]
121    Stretch,
122    #[serde(rename = "MIN")]
123    Min,
124    #[serde(rename = "CENTER")]
125    Center,
126    #[serde(rename = "MAX")]
127    Max,
128}
129
130impl Default for LayoutAlign {
131    fn default() -> LayoutAlign {
132        Self::Inherit
133    }
134}
135/// Determines whether a layer's size and position should be determined by auto-layout settings or manually adjustable.
136#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
137pub enum LayoutPositioning {
138    #[serde(rename = "AUTO")]
139    Auto,
140    #[serde(rename = "ABSOLUTE")]
141    Absolute,
142}
143
144impl Default for LayoutPositioning {
145    fn default() -> LayoutPositioning {
146        Self::Auto
147    }
148}
149/// The horizontal sizing setting on this auto-layout frame or frame child. - `FIXED` - `HUG`: only valid on auto-layout frames and text nodes - `FILL`: only valid on auto-layout frame children
150#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
151pub enum LayoutSizingHorizontal {
152    #[serde(rename = "FIXED")]
153    Fixed,
154    #[serde(rename = "HUG")]
155    Hug,
156    #[serde(rename = "FILL")]
157    Fill,
158}
159
160impl Default for LayoutSizingHorizontal {
161    fn default() -> LayoutSizingHorizontal {
162        Self::Fixed
163    }
164}
165/// The vertical sizing setting on this auto-layout frame or frame child. - `FIXED` - `HUG`: only valid on auto-layout frames and text nodes - `FILL`: only valid on auto-layout frame children
166#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
167pub enum LayoutSizingVertical {
168    #[serde(rename = "FIXED")]
169    Fixed,
170    #[serde(rename = "HUG")]
171    Hug,
172    #[serde(rename = "FILL")]
173    Fill,
174}
175
176impl Default for LayoutSizingVertical {
177    fn default() -> LayoutSizingVertical {
178        Self::Fixed
179    }
180}
181/// 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
182#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
183pub enum StrokeAlign {
184    #[serde(rename = "INSIDE")]
185    Inside,
186    #[serde(rename = "OUTSIDE")]
187    Outside,
188    #[serde(rename = "CENTER")]
189    Center,
190}
191
192impl Default for StrokeAlign {
193    fn default() -> StrokeAlign {
194        Self::Inside
195    }
196}
197/// A string enum with value of \"MITER\", \"BEVEL\", or \"ROUND\", describing how corners in vector paths are rendered.
198#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
199pub enum StrokeJoin {
200    #[serde(rename = "MITER")]
201    Miter,
202    #[serde(rename = "BEVEL")]
203    Bevel,
204    #[serde(rename = "ROUND")]
205    Round,
206}
207
208impl Default for StrokeJoin {
209    fn default() -> StrokeJoin {
210        Self::Miter
211    }
212}
213/// A string enum describing the end caps of vector paths.
214#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
215pub enum StrokeCap {
216    #[serde(rename = "NONE")]
217    None,
218    #[serde(rename = "ROUND")]
219    Round,
220    #[serde(rename = "SQUARE")]
221    Square,
222    #[serde(rename = "LINE_ARROW")]
223    LineArrow,
224    #[serde(rename = "TRIANGLE_ARROW")]
225    TriangleArrow,
226    #[serde(rename = "DIAMOND_FILLED")]
227    DiamondFilled,
228    #[serde(rename = "CIRCLE_FILLED")]
229    CircleFilled,
230    #[serde(rename = "TRIANGLE_FILLED")]
231    TriangleFilled,
232    #[serde(rename = "WASHI_TAPE_1")]
233    WashiTape1,
234    #[serde(rename = "WASHI_TAPE_2")]
235    WashiTape2,
236    #[serde(rename = "WASHI_TAPE_3")]
237    WashiTape3,
238    #[serde(rename = "WASHI_TAPE_4")]
239    WashiTape4,
240    #[serde(rename = "WASHI_TAPE_5")]
241    WashiTape5,
242    #[serde(rename = "WASHI_TAPE_6")]
243    WashiTape6,
244}
245
246impl Default for StrokeCap {
247    fn default() -> StrokeCap {
248        Self::None
249    }
250}
251/// If this layer is a mask, this property describes the operation used to mask the layer's siblings. The value may be one of the following:  - ALPHA: the mask node's alpha channel will be used to determine the opacity of each pixel in the masked result. - VECTOR: if the mask node has visible fill paints, every pixel inside the node's fill regions will be fully visible in the masked result. If the mask has visible stroke paints, every pixel inside the node's stroke regions will be fully visible in the masked result. - LUMINANCE: the luminance value of each pixel of the mask node will be used to determine the opacity of that pixel in the masked result.
252#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
253pub enum MaskType {
254    #[serde(rename = "ALPHA")]
255    Alpha,
256    #[serde(rename = "VECTOR")]
257    Vector,
258    #[serde(rename = "LUMINANCE")]
259    Luminance,
260}
261
262impl Default for MaskType {
263    fn default() -> MaskType {
264        Self::Alpha
265    }
266}
267/// Whether a node has primary axis scrolling, horizontal or vertical.
268#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
269pub enum OverflowDirection {
270    #[serde(rename = "HORIZONTAL_SCROLLING")]
271    HorizontalScrolling,
272    #[serde(rename = "VERTICAL_SCROLLING")]
273    VerticalScrolling,
274    #[serde(rename = "HORIZONTAL_AND_VERTICAL_SCROLLING")]
275    HorizontalAndVerticalScrolling,
276    #[serde(rename = "NONE")]
277    None,
278}
279
280impl Default for OverflowDirection {
281    fn default() -> OverflowDirection {
282        Self::HorizontalScrolling
283    }
284}
285/// Whether this layer uses auto-layout to position its children.
286#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
287pub enum LayoutMode {
288    #[serde(rename = "NONE")]
289    None,
290    #[serde(rename = "HORIZONTAL")]
291    Horizontal,
292    #[serde(rename = "VERTICAL")]
293    Vertical,
294}
295
296impl Default for LayoutMode {
297    fn default() -> LayoutMode {
298        Self::None
299    }
300}
301/// Whether the primary axis has a fixed length (determined by the user) or an automatic length (determined by the layout engine). This property is only applicable for auto-layout frames.
302#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
303pub enum PrimaryAxisSizingMode {
304    #[serde(rename = "FIXED")]
305    Fixed,
306    #[serde(rename = "AUTO")]
307    Auto,
308}
309
310impl Default for PrimaryAxisSizingMode {
311    fn default() -> PrimaryAxisSizingMode {
312        Self::Fixed
313    }
314}
315/// Whether the counter axis has a fixed length (determined by the user) or an automatic length (determined by the layout engine). This property is only applicable for auto-layout frames.
316#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
317pub enum CounterAxisSizingMode {
318    #[serde(rename = "FIXED")]
319    Fixed,
320    #[serde(rename = "AUTO")]
321    Auto,
322}
323
324impl Default for CounterAxisSizingMode {
325    fn default() -> CounterAxisSizingMode {
326        Self::Fixed
327    }
328}
329/// Determines how the auto-layout frame's children should be aligned in the primary axis direction. This property is only applicable for auto-layout frames.
330#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
331pub enum PrimaryAxisAlignItems {
332    #[serde(rename = "MIN")]
333    Min,
334    #[serde(rename = "CENTER")]
335    Center,
336    #[serde(rename = "MAX")]
337    Max,
338    #[serde(rename = "SPACE_BETWEEN")]
339    SpaceBetween,
340}
341
342impl Default for PrimaryAxisAlignItems {
343    fn default() -> PrimaryAxisAlignItems {
344        Self::Min
345    }
346}
347/// Determines how the auto-layout frame's children should be aligned in the counter axis direction. This property is only applicable for auto-layout frames.
348#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
349pub enum CounterAxisAlignItems {
350    #[serde(rename = "MIN")]
351    Min,
352    #[serde(rename = "CENTER")]
353    Center,
354    #[serde(rename = "MAX")]
355    Max,
356    #[serde(rename = "BASELINE")]
357    Baseline,
358}
359
360impl Default for CounterAxisAlignItems {
361    fn default() -> CounterAxisAlignItems {
362        Self::Min
363    }
364}
365/// Whether this auto-layout frame has wrapping enabled.
366#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
367pub enum LayoutWrap {
368    #[serde(rename = "NO_WRAP")]
369    NoWrap,
370    #[serde(rename = "WRAP")]
371    Wrap,
372}
373
374impl Default for LayoutWrap {
375    fn default() -> LayoutWrap {
376        Self::NoWrap
377    }
378}
379/// Determines how the auto-layout frame’s wrapped tracks should be aligned in the counter axis direction. This property is only applicable for auto-layout frames with `layoutWrap: \"WRAP\"`.
380#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
381pub enum CounterAxisAlignContent {
382    #[serde(rename = "AUTO")]
383    Auto,
384    #[serde(rename = "SPACE_BETWEEN")]
385    SpaceBetween,
386}
387
388impl Default for CounterAxisAlignContent {
389    fn default() -> CounterAxisAlignContent {
390        Self::Auto
391    }
392}
393/// A string enum describing the end cap of the start of the connector.
394#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
395pub enum ConnectorStartStrokeCap {
396    #[serde(rename = "NONE")]
397    None,
398    #[serde(rename = "LINE_ARROW")]
399    LineArrow,
400    #[serde(rename = "TRIANGLE_ARROW")]
401    TriangleArrow,
402    #[serde(rename = "DIAMOND_FILLED")]
403    DiamondFilled,
404    #[serde(rename = "CIRCLE_FILLED")]
405    CircleFilled,
406    #[serde(rename = "TRIANGLE_FILLED")]
407    TriangleFilled,
408}
409
410impl Default for ConnectorStartStrokeCap {
411    fn default() -> ConnectorStartStrokeCap {
412        Self::None
413    }
414}
415/// A string enum describing the end cap of the end of the connector.
416#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
417pub enum ConnectorEndStrokeCap {
418    #[serde(rename = "NONE")]
419    None,
420    #[serde(rename = "LINE_ARROW")]
421    LineArrow,
422    #[serde(rename = "TRIANGLE_ARROW")]
423    TriangleArrow,
424    #[serde(rename = "DIAMOND_FILLED")]
425    DiamondFilled,
426    #[serde(rename = "CIRCLE_FILLED")]
427    CircleFilled,
428    #[serde(rename = "TRIANGLE_FILLED")]
429    TriangleFilled,
430}
431
432impl Default for ConnectorEndStrokeCap {
433    fn default() -> ConnectorEndStrokeCap {
434        Self::None
435    }
436}
437/// An array with the same number of elements as lines in the text node, where lines are delimited by newline or paragraph separator characters. Each element in the array corresponds to the list type of a specific line. List types are represented as string enums with one of these possible values:  - `NONE`: Not a list item. - `ORDERED`: Text is an ordered list (numbered). - `UNORDERED`: Text is an unordered list (bulleted).
438#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
439pub enum LineTypes {
440    #[serde(rename = "NONE")]
441    None,
442    #[serde(rename = "ORDERED")]
443    Ordered,
444    #[serde(rename = "UNORDERED")]
445    Unordered,
446}
447
448impl Default for LineTypes {
449    fn default() -> LineTypes {
450        Self::None
451    }
452}
453