figma_api/models/region.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/// Region : Position of a region comment on the canvas.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct Region {
17 /// X coordinate of the position.
18 #[serde(rename = "x")]
19 pub x: f64,
20 /// Y coordinate of the position.
21 #[serde(rename = "y")]
22 pub y: f64,
23 /// The height of the comment region. Must be greater than 0.
24 #[serde(rename = "region_height")]
25 pub region_height: f64,
26 /// The width of the comment region. Must be greater than 0.
27 #[serde(rename = "region_width")]
28 pub region_width: f64,
29 /// The corner of the comment region to pin to the node's corner as a string enum.
30 #[serde(rename = "comment_pin_corner", skip_serializing_if = "Option::is_none")]
31 pub comment_pin_corner: Option<CommentPinCorner>,
32}
33
34impl Region {
35 /// Position of a region comment on the canvas.
36 pub fn new(x: f64, y: f64, region_height: f64, region_width: f64) -> Region {
37 Region {
38 x,
39 y,
40 region_height,
41 region_width,
42 comment_pin_corner: None,
43 }
44 }
45}
46/// The corner of the comment region to pin to the node's corner as a string enum.
47#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
48pub enum CommentPinCorner {
49 #[serde(rename = "top-left")]
50 TopLeft,
51 #[serde(rename = "top-right")]
52 TopRight,
53 #[serde(rename = "bottom-left")]
54 BottomLeft,
55 #[serde(rename = "bottom-right")]
56 BottomRight,
57}
58
59impl Default for CommentPinCorner {
60 fn default() -> CommentPinCorner {
61 Self::TopLeft
62 }
63}
64