figma_api/models/
comment.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/// Comment : A comment or reply left by a user.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Comment {
17    /// Unique identifier for comment.
18    #[serde(rename = "id")]
19    pub id: String,
20    #[serde(rename = "client_meta")]
21    pub client_meta: Box<models::CommentClientMeta>,
22    /// The file in which the comment lives
23    #[serde(rename = "file_key")]
24    pub file_key: String,
25    /// If present, the id of the comment to which this is the reply
26    #[serde(rename = "parent_id", skip_serializing_if = "Option::is_none")]
27    pub parent_id: Option<String>,
28    /// The user who left the comment
29    #[serde(rename = "user")]
30    pub user: Box<models::User>,
31    /// The UTC ISO 8601 time at which the comment was left
32    #[serde(rename = "created_at")]
33    pub created_at: String,
34    /// If set, the UTC ISO 8601 time the comment was resolved
35    #[serde(rename = "resolved_at", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
36    pub resolved_at: Option<Option<String>>,
37    /// The content of the comment
38    #[serde(rename = "message")]
39    pub message: String,
40    /// Only set for top level comments. The number displayed with the comment in the UI
41    #[serde(rename = "order_id", deserialize_with = "Option::deserialize")]
42    pub order_id: Option<String>,
43    /// An array of reactions to the comment
44    #[serde(rename = "reactions")]
45    pub reactions: Vec<models::Reaction>,
46}
47
48impl Comment {
49    /// A comment or reply left by a user.
50    pub fn new(id: String, client_meta: models::CommentClientMeta, file_key: String, user: models::User, created_at: String, message: String, order_id: Option<String>, reactions: Vec<models::Reaction>) -> Comment {
51        Comment {
52            id,
53            client_meta: Box::new(client_meta),
54            file_key,
55            parent_id: None,
56            user: Box::new(user),
57            created_at,
58            resolved_at: None,
59            message,
60            order_id,
61            reactions,
62        }
63    }
64}
65