figma_api/models/
node_action.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/// NodeAction : An action that navigates to a specific node in the Figma viewer.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct NodeAction {
17    #[serde(rename = "type")]
18    pub r#type: Type,
19    #[serde(rename = "destinationId", deserialize_with = "Option::deserialize")]
20    pub destination_id: Option<String>,
21    #[serde(rename = "navigation")]
22    pub navigation: models::Navigation,
23    #[serde(rename = "transition", deserialize_with = "Option::deserialize")]
24    pub transition: Option<Box<models::Transition>>,
25    /// Whether the scroll offsets of any scrollable elements in the current screen or overlay are preserved when navigating to the destination. This is applicable only if the layout of both the current frame and its destination are the same.
26    #[serde(rename = "preserveScrollPosition", skip_serializing_if = "Option::is_none")]
27    pub preserve_scroll_position: Option<bool>,
28    /// Applicable only when `navigation` is `\"OVERLAY\"` and the destination is a frame with `overlayPosition` equal to `\"MANUAL\"`. This value represents the offset by which the overlay is opened relative to this node.
29    #[serde(rename = "overlayRelativePosition", skip_serializing_if = "Option::is_none")]
30    pub overlay_relative_position: Option<Box<models::Vector>>,
31    /// When true, all videos within the destination frame will reset their memorized playback position to 00:00 before starting to play.
32    #[serde(rename = "resetVideoPosition", skip_serializing_if = "Option::is_none")]
33    pub reset_video_position: Option<bool>,
34    /// Whether the scroll offsets of any scrollable elements in the current screen or overlay reset when navigating to the destination. This is applicable only if the layout of both the current frame and its destination are the same.
35    #[serde(rename = "resetScrollPosition", skip_serializing_if = "Option::is_none")]
36    pub reset_scroll_position: Option<bool>,
37    /// Whether the state of any interactive components in the current screen or overlay reset when navigating to the destination. This is applicable if there are interactive components in the destination frame.
38    #[serde(rename = "resetInteractiveComponents", skip_serializing_if = "Option::is_none")]
39    pub reset_interactive_components: Option<bool>,
40}
41
42impl NodeAction {
43    /// An action that navigates to a specific node in the Figma viewer.
44    pub fn new(r#type: Type, destination_id: Option<String>, navigation: models::Navigation, transition: Option<models::Transition>) -> NodeAction {
45        NodeAction {
46            r#type,
47            destination_id,
48            navigation,
49            transition: if let Some(x) = transition {Some(Box::new(x))} else {None},
50            preserve_scroll_position: None,
51            overlay_relative_position: None,
52            reset_video_position: None,
53            reset_scroll_position: None,
54            reset_interactive_components: None,
55        }
56    }
57}
58/// 
59#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
60pub enum Type {
61    #[serde(rename = "NODE")]
62    Node,
63}
64
65impl Default for Type {
66    fn default() -> Type {
67        Self::Node
68    }
69}
70