wekan_cli/command_result/
attachments.rs1use crate::client::attachments::{AttachmentMetadata, AttachmentUploadResponse};
2use serde::Serialize;
3
4#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
5pub struct AttachmentUploadSuccess {
6 pub attachment_id: String,
7 pub file_name: String,
8 pub file_size: u64,
9 pub storage_backend: String,
10 pub server_message: String,
11 pub request_accepted: bool,
12 pub upload_confirmed: bool,
13}
14
15impl From<AttachmentUploadResponse> for AttachmentUploadSuccess {
16 fn from(response: AttachmentUploadResponse) -> Self {
17 Self {
18 attachment_id: response.attachment_id,
19 file_name: response.file_name,
20 file_size: response.file_size,
21 storage_backend: response.storage_backend,
22 server_message: response.message,
23 request_accepted: true,
24 upload_confirmed: false,
26 }
27 }
28}
29
30#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
31pub struct DeletedAttachmentCollectionSuccess {
32 pub board_id: String,
33 pub count: usize,
34 pub attachments: Vec<crate::client::attachments::recovery::DeletedAttachment>,
35}
36#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
37pub struct AttachmentRestoreSuccess {
38 pub board_id: String,
39 pub attachment_id: String,
40 pub restored: bool,
41}
42#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
43pub struct AttachmentSoftDeleteSuccess {
44 pub board_id: String,
45 pub attachment_id: String,
46 pub deleted: bool,
47 pub batch_id: Option<String>,
48}
49
50#[derive(Debug, Eq, PartialEq, Serialize)]
51pub struct BoardAttachmentCollectionSuccess {
52 pub board_id: String,
53 pub count: usize,
54 pub attachments: Vec<crate::client::boards::attachments::BoardAttachment>,
55}
56
57#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize)]
58#[serde(rename_all = "snake_case")]
59pub enum AttachmentScope {
60 Board,
61 Swimlane,
62 List,
63 Card,
64}
65
66#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
67pub struct AttachmentCollectionSuccess {
68 pub board_id: String,
69 pub swimlane_id: Option<String>,
70 pub list_id: Option<String>,
71 pub card_id: Option<String>,
72 pub requested_scope: AttachmentScope,
73 pub effective_scope: AttachmentScope,
74 pub count: u32,
75 pub attachments: Vec<AttachmentMetadata>,
76}
77
78#[derive(Clone, Debug, Eq, PartialEq, Serialize)]
79pub struct AttachmentDownloadSuccess {
80 pub attachment_id: String,
81 pub file_name: String,
82 pub file_size: u64,
83 pub file_type: String,
84 pub storage_backend: String,
85 pub background_image_url: Option<String>,
86 pub destination: String,
87 pub bytes_written: u64,
88 pub file_saved: bool,
89 #[serde(skip)]
90 pub bytes: Option<Vec<u8>>,
91}