figma_api/models/
inline_object.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 InlineObject {
16    /// The name of the file as it appears in the editor.
17    #[serde(rename = "name")]
18    pub name: String,
19    /// The role of the user making the API request in relation to the file.
20    #[serde(rename = "role")]
21    pub role: Role,
22    /// The UTC ISO 8601 time at which the file was last modified.
23    #[serde(rename = "lastModified")]
24    pub last_modified: String,
25    /// The type of editor associated with this file.
26    #[serde(rename = "editorType")]
27    pub editor_type: EditorType,
28    /// A URL to a thumbnail image of the file.
29    #[serde(rename = "thumbnailUrl", skip_serializing_if = "Option::is_none")]
30    pub thumbnail_url: Option<String>,
31    /// The version number of the file. This number is incremented when a file is modified and can be used to check if the file has changed between requests.
32    #[serde(rename = "version")]
33    pub version: String,
34    #[serde(rename = "document")]
35    pub document: Box<models::DocumentNode>,
36    /// A mapping from component IDs to component metadata.
37    #[serde(rename = "components")]
38    pub components: std::collections::HashMap<String, models::Component>,
39    /// A mapping from component set IDs to component set metadata.
40    #[serde(rename = "componentSets")]
41    pub component_sets: std::collections::HashMap<String, models::ComponentSet>,
42    /// The version of the file schema that this file uses.
43    #[serde(rename = "schemaVersion")]
44    pub schema_version: f64,
45    /// A mapping from style IDs to style metadata.
46    #[serde(rename = "styles")]
47    pub styles: std::collections::HashMap<String, models::Style>,
48    /// The share permission level of the file link.
49    #[serde(rename = "linkAccess", skip_serializing_if = "Option::is_none")]
50    pub link_access: Option<String>,
51    /// The key of the main file for this file. If present, this file is a component or component set.
52    #[serde(rename = "mainFileKey", skip_serializing_if = "Option::is_none")]
53    pub main_file_key: Option<String>,
54    /// A list of branches for this file.
55    #[serde(rename = "branches", skip_serializing_if = "Option::is_none")]
56    pub branches: Option<Vec<models::InlineObjectBranchesInner>>,
57}
58
59impl InlineObject {
60    pub fn new(name: String, role: Role, last_modified: String, editor_type: EditorType, version: String, document: models::DocumentNode, components: std::collections::HashMap<String, models::Component>, component_sets: std::collections::HashMap<String, models::ComponentSet>, schema_version: f64, styles: std::collections::HashMap<String, models::Style>) -> InlineObject {
61        InlineObject {
62            name,
63            role,
64            last_modified,
65            editor_type,
66            thumbnail_url: None,
67            version,
68            document: Box::new(document),
69            components,
70            component_sets,
71            schema_version,
72            styles,
73            link_access: None,
74            main_file_key: None,
75            branches: None,
76        }
77    }
78}
79/// The role of the user making the API request in relation to the file.
80#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
81pub enum Role {
82    #[serde(rename = "owner")]
83    Owner,
84    #[serde(rename = "editor")]
85    Editor,
86    #[serde(rename = "viewer")]
87    Viewer,
88}
89
90impl Default for Role {
91    fn default() -> Role {
92        Self::Owner
93    }
94}
95/// The type of editor associated with this file.
96#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
97pub enum EditorType {
98    #[serde(rename = "figma")]
99    Figma,
100    #[serde(rename = "figjam")]
101    Figjam,
102}
103
104impl Default for EditorType {
105    fn default() -> EditorType {
106        Self::Figma
107    }
108}
109