imgurs/src/imgur/image_type.rs

49 lines
1.3 KiB
Rust
Raw Normal View History

use serde::{Deserialize, Serialize};
2022-01-23 12:05:32 +00:00
2022-06-12 15:28:25 +00:00
/// Image Info Response
2022-06-17 21:00:45 +00:00
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)]
2022-01-23 12:05:32 +00:00
pub struct ImageInfo {
2022-06-17 21:00:45 +00:00
/// Image Data
2022-01-23 12:05:32 +00:00
pub data: ImageInfoData,
2022-06-17 21:00:45 +00:00
/// Request processed success or not.
2022-01-24 22:15:55 +00:00
pub success: bool,
2022-06-17 21:00:45 +00:00
/// HTTP status code from API request.
2022-01-24 22:15:55 +00:00
pub status: i32,
2022-01-23 12:05:32 +00:00
}
2022-06-12 15:28:25 +00:00
/// Image Info Reponse (`data` json)
2022-06-17 21:00:45 +00:00
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)]
2022-01-23 12:05:32 +00:00
pub struct ImageInfoData {
2022-06-17 21:00:45 +00:00
/// Image ID
/// e.g. `iDYNKJq`
2022-01-23 12:05:32 +00:00
pub id: String,
2022-06-17 21:00:45 +00:00
/// Image title
2022-01-23 12:05:32 +00:00
pub title: Option<String>,
2022-06-17 21:00:45 +00:00
/// Description of this image
2022-01-23 12:05:32 +00:00
pub description: Option<String>,
2022-06-17 21:00:45 +00:00
/// Image uploaded time
2022-01-23 12:05:32 +00:00
pub datetime: i32,
2022-06-17 21:00:45 +00:00
/// Image type
/// e.g. `image/png`
2022-01-23 12:05:32 +00:00
#[serde(rename = "type")]
pub img_type: String,
2022-06-17 21:00:45 +00:00
/// If image if animated (gif, etc)
2022-01-23 12:05:32 +00:00
pub animated: bool,
2022-06-17 21:00:45 +00:00
/// Width of this image
2022-01-23 12:05:32 +00:00
pub width: i32,
2022-06-17 21:00:45 +00:00
/// Height of this image
2022-01-23 12:05:32 +00:00
pub height: i32,
2022-06-17 21:00:45 +00:00
/// Image size in bytes
2022-01-23 12:05:32 +00:00
pub size: i32,
2022-06-17 21:00:45 +00:00
/// Unique image views
2022-01-23 12:05:32 +00:00
pub views: i32,
2022-06-17 21:00:45 +00:00
/// Bandwidth used by this image
2022-01-23 12:05:32 +00:00
pub bandwidth: i64,
2022-06-17 21:00:45 +00:00
/// If image is added to favorite
2022-01-23 12:05:32 +00:00
pub favorite: bool,
2022-06-17 21:00:45 +00:00
/// Delete hash (only show after image upload)
2022-01-23 12:05:32 +00:00
pub deletehash: Option<String>,
2022-06-17 21:00:45 +00:00
/// Link of this image
2022-01-23 12:05:32 +00:00
pub link: String,
}