imgchest/
model.rs

1mod list_posts;
2mod post;
3mod scraped_post;
4mod scraped_user;
5mod user;
6
7pub use self::list_posts::ListPostsPost;
8pub use self::post::File as PostFile;
9pub use self::post::Post;
10pub use self::post::Privacy as PostPrivacy;
11pub use self::scraped_post::File as ScrapedPostFile;
12pub use self::scraped_post::FromHtmlError as InvalidScrapedPostError;
13pub use self::scraped_post::ScrapedPost;
14pub use self::scraped_user::FromHtmlError as InvalidScrapedUserError;
15pub use self::scraped_user::ScrapedUser;
16pub use self::user::User;
17
18/// A request for updating files in bulk.
19#[derive(Debug, serde::Serialize, serde::Deserialize)]
20pub(crate) struct ApiUpdateFilesBulkRequest {
21    /// The payload
22    pub data: Vec<FileUpdate>,
23}
24
25/// A file update as part of a bulk file update.
26#[derive(Debug, serde::Serialize, serde::Deserialize)]
27pub struct FileUpdate {
28    /// The file id
29    pub id: String,
30
31    /// The file description.
32    ///
33    /// Though the API docs seem to say that this field is nullable,
34    /// it is not.
35    pub description: String,
36}
37
38/// The response to an api request
39#[derive(Debug, serde::Serialize, serde::Deserialize)]
40pub(crate) struct ApiResponse<T> {
41    /// The data payload
42    pub data: T,
43}
44
45/// The response for when the api completed something
46#[derive(Debug, serde::Serialize, serde::Deserialize)]
47pub(crate) struct ApiCompletedResponse {
48    /// Whether the operation was successful.
49    #[serde(with = "crate::serde::from_str_to_str")]
50    pub success: bool,
51
52    /// The operation message response.
53    pub message: Option<Box<str>>,
54}