figma_api/models/interaction.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/// Interaction : An interaction in the Figma viewer, containing a trigger and one or more actions.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Interaction {
17 #[serde(rename = "trigger", deserialize_with = "Option::deserialize")]
18 pub trigger: Option<Box<models::Trigger>>,
19 /// The actions that are performed when the trigger is activated.
20 #[serde(rename = "actions", skip_serializing_if = "Option::is_none")]
21 pub actions: Option<Vec<models::Action>>,
22}
23
24impl Interaction {
25 /// An interaction in the Figma viewer, containing a trigger and one or more actions.
26 pub fn new(trigger: Option<models::Trigger>) -> Interaction {
27 Interaction {
28 trigger: if let Some(x) = trigger {Some(Box::new(x))} else {None},
29 actions: None,
30 }
31 }
32}
33