Skip to main content

wekan_cli/command_result/
attachments.rs

1use crate::client::attachments::AttachmentMetadata;
2use serde::Serialize;
3
4#[derive(Debug, Eq, PartialEq, Serialize)]
5pub struct BoardAttachmentCollectionSuccess {
6    pub board_id: String,
7    pub count: usize,
8    pub attachments: Vec<crate::client::boards::attachments::BoardAttachment>,
9}
10
11#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize)]
12#[serde(rename_all = "snake_case")]
13pub enum AttachmentScope {
14    Board,
15    Swimlane,
16    List,
17    Card,
18}
19
20#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
21pub struct AttachmentCollectionSuccess {
22    pub board_id: String,
23    pub swimlane_id: Option<String>,
24    pub list_id: Option<String>,
25    pub card_id: Option<String>,
26    pub requested_scope: AttachmentScope,
27    pub effective_scope: AttachmentScope,
28    pub count: u32,
29    pub attachments: Vec<AttachmentMetadata>,
30}
31
32#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
33pub struct AttachmentMutationSuccess<T> {
34    #[serde(flatten)]
35    pub response: T,
36    pub mutation_confirmed: bool,
37}
38
39impl<T> AttachmentMutationSuccess<T> {
40    pub fn acknowledged(response: T) -> Self {
41        Self {
42            response,
43            mutation_confirmed: false,
44        }
45    }
46}
47
48#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
49pub struct AttachmentDownloadSuccess {
50    pub attachment_id: String,
51    pub file_name: String,
52    pub file_size: u64,
53    pub file_type: String,
54    pub storage_backend: String,
55    pub background_image_url: Option<String>,
56    pub destination: String,
57    pub bytes_written: u64,
58    pub file_saved: bool,
59    #[serde(skip)]
60    pub bytes: Option<Vec<u8>>,
61}