figma_api/models/
inline_object_4.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 InlineObject4 {
16    /// The name of the file.
17    #[serde(rename = "name")]
18    pub name: String,
19    /// The name of the project containing the file.
20    #[serde(rename = "folder_name", skip_serializing_if = "Option::is_none")]
21    pub folder_name: Option<String>,
22    /// The UTC ISO 8601 time at which the file content was last modified.
23    #[serde(rename = "last_touched_at")]
24    pub last_touched_at: String,
25    /// The user who created the file.
26    #[serde(rename = "creator")]
27    pub creator: Box<models::User>,
28    /// The user who last modified the file contents.
29    #[serde(rename = "last_touched_by", skip_serializing_if = "Option::is_none")]
30    pub last_touched_by: Option<Box<models::User>>,
31    /// A URL to a thumbnail image of the file.
32    #[serde(rename = "thumbnail_url", skip_serializing_if = "Option::is_none")]
33    pub thumbnail_url: Option<String>,
34    /// The type of editor associated with this file.
35    #[serde(rename = "editorType")]
36    pub editor_type: EditorType,
37    /// The role of the user making the API request in relation to the file.
38    #[serde(rename = "role", skip_serializing_if = "Option::is_none")]
39    pub role: Option<Role>,
40    /// Access policy for users who have the link to the file.
41    #[serde(rename = "link_access", skip_serializing_if = "Option::is_none")]
42    pub link_access: Option<LinkAccess>,
43    /// The URL of the file.
44    #[serde(rename = "url", skip_serializing_if = "Option::is_none")]
45    pub url: Option<String>,
46    /// 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.
47    #[serde(rename = "version", skip_serializing_if = "Option::is_none")]
48    pub version: Option<String>,
49}
50
51impl InlineObject4 {
52    pub fn new(name: String, last_touched_at: String, creator: models::User, editor_type: EditorType) -> InlineObject4 {
53        InlineObject4 {
54            name,
55            folder_name: None,
56            last_touched_at,
57            creator: Box::new(creator),
58            last_touched_by: None,
59            thumbnail_url: None,
60            editor_type,
61            role: None,
62            link_access: None,
63            url: None,
64            version: None,
65        }
66    }
67}
68/// The type of editor associated with this file.
69#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
70pub enum EditorType {
71    #[serde(rename = "figma")]
72    Figma,
73    #[serde(rename = "figjam")]
74    Figjam,
75    #[serde(rename = "slides")]
76    Slides,
77}
78
79impl Default for EditorType {
80    fn default() -> EditorType {
81        Self::Figma
82    }
83}
84/// The role of the user making the API request in relation to the file.
85#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
86pub enum Role {
87    #[serde(rename = "owner")]
88    Owner,
89    #[serde(rename = "editor")]
90    Editor,
91    #[serde(rename = "viewer")]
92    Viewer,
93}
94
95impl Default for Role {
96    fn default() -> Role {
97        Self::Owner
98    }
99}
100/// Access policy for users who have the link to the file.
101#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
102pub enum LinkAccess {
103    #[serde(rename = "view")]
104    View,
105    #[serde(rename = "edit")]
106    Edit,
107    #[serde(rename = "org_view")]
108    OrgView,
109    #[serde(rename = "org_edit")]
110    OrgEdit,
111    #[serde(rename = "inherit")]
112    Inherit,
113}
114
115impl Default for LinkAccess {
116    fn default() -> LinkAccess {
117        Self::View
118    }
119}
120