tinify/convert.rs
1use serde::Deserialize;
2use serde::Serialize;
3
4/// The type `enum` defines the type of image to which it will be converted.
5#[derive(Serialize, Deserialize, Clone, Debug)]
6pub enum Type {
7 #[serde(rename = "image/png")]
8 Png,
9
10 #[serde(rename = "image/jpeg")]
11 Jpeg,
12
13 #[serde(rename = "image/webp")]
14 Webp,
15
16 #[serde(rename = "*/*")]
17 WildCard,
18}
19
20/// # Converting images
21///
22/// You can use the API to convert your images to your desired image type. Tinify currently supports converting between `WebP`, J`PEG`, and `PNG`. When you provide more than one image `type` in your convert request, the smallest version will be returned to you.
23///
24/// Image converting will count as one additional compression.
25#[derive(Serialize, Deserialize, Clone, Debug)]
26pub struct Convert {
27 /// A vector of `types`
28 pub r#type: Vec<Type>,
29}