figma_api/models/
get_file.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 GetFile {
16    /// The name of the file as it appears in the editor.
17    #[serde(rename = "name")]
18    pub name: String,
19    #[serde(rename = "role")]
20    pub role: models::Role,
21    /// The UTC ISO 8601 time at which the file was last modified.
22    #[serde(rename = "lastModified")]
23    pub last_modified: String,
24    #[serde(rename = "editorType")]
25    pub editor_type: models::EditorType,
26    /// A URL to a thumbnail image of the file.
27    #[serde(rename = "thumbnailUrl", skip_serializing_if = "Option::is_none")]
28    pub thumbnail_url: Option<String>,
29    /// 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.
30    #[serde(rename = "version")]
31    pub version: String,
32    #[serde(rename = "document")]
33    pub document: Box<models::DocumentNode>,
34    /// A mapping from component IDs to component metadata.
35    #[serde(rename = "components")]
36    pub components: std::collections::HashMap<String, models::Component>,
37    /// A mapping from component set IDs to component set metadata.
38    #[serde(rename = "componentSets")]
39    pub component_sets: std::collections::HashMap<String, models::ComponentSet>,
40    /// The version of the file schema that this file uses.
41    #[serde(rename = "schemaVersion")]
42    pub schema_version: f64,
43    /// A mapping from style IDs to style metadata.
44    #[serde(rename = "styles")]
45    pub styles: std::collections::HashMap<String, models::Style>,
46    /// The share permission level of the file link.
47    #[serde(rename = "linkAccess", skip_serializing_if = "Option::is_none")]
48    pub link_access: Option<String>,
49    /// The key of the main file for this file. If present, this file is a component or component set.
50    #[serde(rename = "mainFileKey", skip_serializing_if = "Option::is_none")]
51    pub main_file_key: Option<String>,
52    /// A list of branches for this file.
53    #[serde(rename = "branches", skip_serializing_if = "Option::is_none")]
54    pub branches: Option<Vec<models::GetFileBranchesItem>>,
55}
56
57impl GetFile {
58    pub fn new(name: String, role: models::Role, last_modified: String, editor_type: models::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>) -> GetFile {
59        GetFile {
60            name,
61            role,
62            last_modified,
63            editor_type,
64            thumbnail_url: None,
65            version,
66            document: Box::new(document),
67            components,
68            component_sets,
69            schema_version,
70            styles,
71            link_access: None,
72            main_file_key: None,
73            branches: None,
74        }
75    }
76}
77