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