mangadex_api/v5/upload/
upload_session_id.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
pub mod batch;
pub mod commit;
pub mod delete;
pub mod post;
pub mod upload_session_file_id;

use crate::HttpClientRef;

use uuid::Uuid;

use batch::BatchEndpoint;
use commit::CommitEndpoint;
use delete::AbandonUploadSessionBuilder;
use post::UploadImagesBuilder;
use upload_session_file_id::UploadSessionFileEndpoint;

/// Statistics endpoint handler builder.
#[derive(Clone, Debug)]
pub struct UploadSessionIdEndpoint {
    http_client: HttpClientRef,
    upload_session_id: Uuid,
}

impl UploadSessionIdEndpoint {
    #[doc(hidden)]
    pub(crate) fn new(http_client: HttpClientRef, upload_session_id: Uuid) -> Self {
        Self {
            http_client,
            upload_session_id,
        }
    }
    pub fn batch(&self) -> BatchEndpoint {
        BatchEndpoint::new(self.http_client.clone(), self.upload_session_id)
    }
    pub fn commit(&self) -> CommitEndpoint {
        CommitEndpoint::new(self.http_client.clone(), self.upload_session_id)
    }
    pub fn delete(&self) -> AbandonUploadSessionBuilder {
        AbandonUploadSessionBuilder::default()
            .session_id(self.upload_session_id)
            .http_client(self.http_client.clone())
    }
    pub fn post(&self) -> UploadImagesBuilder {
        UploadImagesBuilder::default()
            .session_id(self.upload_session_id)
            .http_client(self.http_client.clone())
    }
    pub fn upload_session_file_id(
        &self,
        upload_session_file_id: Uuid,
    ) -> UploadSessionFileEndpoint {
        UploadSessionFileEndpoint::new(
            self.http_client.clone(),
            self.upload_session_id,
            upload_session_file_id,
        )
    }
}