figma_api/models/
component.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/// Component : A description of a main component. Helps you identify which component instances are attached to.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Component {
17    /// The key of the component
18    #[serde(rename = "key")]
19    pub key: String,
20    /// Name of the component
21    #[serde(rename = "name")]
22    pub name: String,
23    /// The description of the component as entered in the editor
24    #[serde(rename = "description")]
25    pub description: String,
26    /// The ID of the component set if the component belongs to one
27    #[serde(rename = "componentSetId", skip_serializing_if = "Option::is_none")]
28    pub component_set_id: Option<String>,
29    /// An array of documentation links attached to this component
30    #[serde(rename = "documentationLinks")]
31    pub documentation_links: Vec<models::DocumentationLink>,
32    /// Whether this component is a remote component that doesn't live in this file
33    #[serde(rename = "remote")]
34    pub remote: bool,
35}
36
37impl Component {
38    /// A description of a main component. Helps you identify which component instances are attached to.
39    pub fn new(key: String, name: String, description: String, documentation_links: Vec<models::DocumentationLink>, remote: bool) -> Component {
40        Component {
41            key,
42            name,
43            description,
44            component_set_id: None,
45            documentation_links,
46            remote,
47        }
48    }
49}
50