Skip to main content

app_store_server_library/models/
image_size.rs

1use serde::{Deserialize, Serialize};
2
3/// The size of an image you upload for use in retention messages.
4///
5/// [imageSize](https://developer.apple.com/documentation/retentionmessaging/imagesize)
6#[derive(Debug, Clone, Deserialize, Serialize, Hash, PartialEq, Eq)]
7pub enum ImageSize {
8    /// A full-size image for use as a message's main image.
9    #[serde(rename = "FULL_SIZE")]
10    FullSize,
11
12    /// A small image for use as a bullet point.
13    #[serde(rename = "BULLET_POINT")]
14    BulletPoint,
15
16    /// A value the App Store sent that this version of the
17    /// library does not support, preserved as received.
18    #[serde(untagged)]
19    NotSupported(String),
20}
21
22impl ImageSize {
23    pub fn raw_value(&self) -> &str {
24        match self {
25            ImageSize::FullSize => "FULL_SIZE",
26            ImageSize::BulletPoint => "BULLET_POINT",
27            ImageSize::NotSupported(value) => value.as_str(),
28        }
29    }
30}