mangadex_api_schema_rust/v5/
upload_session_file.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//! Upload session file information from a response body.

use mangadex_api_types::{ResultType, UploadSource};
use serde::Deserialize;

use crate::{v5::error::MangaDexError_, FromResponse};

#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
#[cfg_attr(feature = "non_exhaustive", non_exhaustive)]
#[cfg_attr(feature = "specta", derive(specta::Type))]
pub struct UploadSessionFileAttributes {
    pub original_file_name: String,
    pub file_hash: String,
    pub file_size: u32,
    pub mime_type: String,
    pub source: UploadSource,
    pub version: u32,
}

#[derive(Clone, Debug, Deserialize)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize))]
#[cfg_attr(feature = "specta", derive(specta::Type))]
pub struct UploadSessionFileData<A> {
    #[serde(default)]
    pub result: ResultType,
    pub errors: Vec<MangaDexError_>,
    pub data: Vec<A>,
}

impl<A> FromResponse for UploadSessionFileData<A> {
    type Response = Self;
    fn from_response(res: Self::Response) -> Self {
        res
    }
}