figma_api/models/
hyperlink.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/// Hyperlink : A link to either a URL or another frame (node) in the document.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Hyperlink {
17    /// The type of hyperlink. Can be either `URL` or `NODE`.
18    #[serde(rename = "type")]
19    pub r#type: Type,
20    /// The URL that the hyperlink points to, if `type` is `URL`.
21    #[serde(rename = "url", skip_serializing_if = "Option::is_none")]
22    pub url: Option<String>,
23    /// The ID of the node that the hyperlink points to, if `type` is `NODE`.
24    #[serde(rename = "nodeID", skip_serializing_if = "Option::is_none")]
25    pub node_id: Option<String>,
26}
27
28impl Hyperlink {
29    /// A link to either a URL or another frame (node) in the document.
30    pub fn new(r#type: Type) -> Hyperlink {
31        Hyperlink {
32            r#type,
33            url: None,
34            node_id: None,
35        }
36    }
37}
38/// The type of hyperlink. Can be either `URL` or `NODE`.
39#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
40pub enum Type {
41    #[serde(rename = "URL")]
42    Url,
43    #[serde(rename = "NODE")]
44    Node,
45}
46
47impl Default for Type {
48    fn default() -> Type {
49        Self::Url
50    }
51}
52