atomic_lti/deep_linking/
image.rs

1use super::shared::{Icon, Thumbnail};
2use serde::{Deserialize, Serialize};
3use serde_with::skip_serializing_none;
4
5#[skip_serializing_none]
6#[derive(Debug, Deserialize, Serialize, Clone)]
7pub struct Image {
8  #[serde(rename = "type")]
9  #[serde(default = "default_type")]
10  pub type_: String,
11  pub url: String,
12  pub title: Option<String>,
13  pub text: Option<String>,
14  pub icon: Option<Icon>,
15  pub thumbnail: Option<Thumbnail>,
16  pub width: Option<i32>,
17  pub height: Option<i32>,
18}
19
20impl Default for Image {
21  fn default() -> Self {
22    Self {
23      type_: "image".to_string(),
24      url: "".to_string(),
25      title: None,
26      text: None,
27      icon: None,
28      thumbnail: None,
29      width: None,
30      height: None,
31    }
32  }
33}
34
35fn default_type() -> String {
36  "image".to_string()
37}