Skip to main content

wekan_cli/
command_result.rs

1mod api;
2mod auth;
3mod boards;
4mod bulk_cards;
5mod cards;
6mod checklist_items;
7mod checklists;
8mod comments;
9mod custom_field_items;
10mod custom_fields;
11mod dependencies;
12mod lists;
13mod profiles;
14mod swimlanes;
15mod users;
16
17pub use api::{
18    ApiResponseSuccess, RawApiResponseData, RawResponseBody, RawResponseHeader, RawValueEncoding,
19};
20pub use auth::{
21    AuthStatusEmail, AuthStatusSuccess, AuthStatusUser, AuthSuccess, LogoutScope, LogoutSuccess,
22};
23pub use boards::{
24    BoardCountSuccess, BoardCreateSuccess, BoardDeleteSuccess, BoardDetail, BoardDetailDomain,
25    BoardDetailLabel, BoardDetailMember, BoardDetailOrganization, BoardDetailTeam,
26    BoardDetailWatcher, BoardListScope, BoardListSuccess, BoardRenameSuccess, BoardSummary,
27    UserBoardSummary,
28};
29pub use boards::{
30    BoardMemberCollectionSuccess, BoardMemberMutationSuccess, BoardMemberSubmittedField,
31    BoardMemberUpdateSuccess,
32};
33pub use cards::{
34    CardArchiveSuccess, CardCollectionSuccess, CardCreateSuccess, CardDeleteMode,
35    CardDeleteSuccess, CardDetail, CardDetailCustomField, CardDetailCustomFieldValue,
36    CardDetailDependency, CardDetailLocation, CardDetailPoker, CardDetailSticker,
37    CardDetailStickerHighlight, CardDetailVote, CardRestoreSuccess, CardSubmittedField,
38    CardSummary, CardUpdateSuccess,
39};
40pub use cards::{
41    CardAssigneeCollectionSuccess, CardMemberCollectionSuccess, CardMembershipKind,
42    CardMembershipMutationSuccess,
43};
44pub use cards::{CardCustomFieldQuerySuccess, CardCustomFieldSetSuccess};
45pub use checklist_items::{
46    ChecklistItemCreateSuccess, ChecklistItemDeleteMode, ChecklistItemDeleteSuccess,
47    ChecklistItemDetail, ChecklistItemSubmittedField, ChecklistItemUpdateSuccess,
48};
49pub use checklists::{
50    ChecklistCollectionSuccess, ChecklistCreateSuccess, ChecklistDeleteMode,
51    ChecklistDeleteSuccess, ChecklistDetail, ChecklistItemSummary, ChecklistSummary,
52};
53pub use comments::{
54    CommentCollectionSuccess, CommentCreateSuccess, CommentDeleteMode, CommentDeleteSuccess,
55    CommentDetail, CommentSummary,
56};
57pub use custom_field_items::{
58    CustomFieldItemCreateSuccess, CustomFieldItemDeleteMode, CustomFieldItemDeleteSuccess,
59    CustomFieldItemSubmittedField, CustomFieldItemUpdateSuccess,
60};
61pub use custom_fields::{
62    CustomFieldCollectionSuccess, CustomFieldCreateSuccess, CustomFieldDeleteMode,
63    CustomFieldDeleteSuccess, CustomFieldDetail, CustomFieldDropdownItem, CustomFieldSettings,
64    CustomFieldSubmittedField, CustomFieldSummary, CustomFieldUpdateSuccess,
65};
66pub use dependencies::{
67    BoardDependencyCollectionSuccess, CardDependencyCollectionSuccess, DependencyCreateSuccess,
68    DependencyDeleteSuccess, DependencyLine, DependencySubmittedField, DependencySummary,
69    DependencyUpdateSuccess,
70};
71pub use lists::{
72    ListCollectionSuccess, ListCreateSuccess, ListDeleteMode, ListDeleteSuccess, ListDetail,
73    ListSummary, ListUpdateSuccess, ListUpdatedField, ListWipLimitDetail,
74};
75pub use profiles::{ProfileItem, ProfileListSuccess, ProfileRemoveSuccess};
76pub use swimlanes::{
77    SwimlaneCollectionSuccess, SwimlaneCreateSuccess, SwimlaneDeleteMode, SwimlaneDeleteSuccess,
78    SwimlaneDetail, SwimlaneSummary, SwimlaneUpdateSuccess, SwimlaneUpdatedField,
79};
80pub use users::{
81    UserBoardMembership, UserBoardsSuccess, UserCard, UserCardsSuccess, UserCreateSuccess,
82    UserCreateWarning, UserDeleteSuccess, UserDetail, UserEmail, UserListSuccess, UserLoginAction,
83    UserLoginChangeSuccess, UserOrganization, UserOwnershipSuccess, UserProfileDetail,
84    UserProfileNotificationDetail, UserProfileStarredPageDetail, UserSessionData, UserSummary,
85    UserTeam, UserWorkspaceNodeDetail,
86};
87
88use serde::Serialize;
89
90pub use bulk_cards::*;
91
92pub use boards::{BoardLabelAdded, BoardLabelCollection};
93pub use cards::CardLabelCollection;
94
95pub mod attachments;
96pub use attachments::*;
97
98#[derive(Debug, Eq, PartialEq)]
99pub enum CommandSuccess {
100    CardBatch(CardBatchResult),
101    BoardLabels(BoardLabelCollection),
102    BoardLabelAdded(BoardLabelAdded),
103    CardLabels(CardLabelCollection),
104    BoardMembers(BoardMemberCollectionSuccess),
105    BoardMemberChanged(BoardMemberMutationSuccess),
106    BoardMemberUpdated(BoardMemberUpdateSuccess),
107    CardMembers(CardMemberCollectionSuccess),
108    CardAssignees(CardAssigneeCollectionSuccess),
109    CardMembershipChanged(CardMembershipMutationSuccess),
110    BoardDependencies(BoardDependencyCollectionSuccess),
111    CardDependencies(CardDependencyCollectionSuccess),
112    DependencyCreated(DependencyCreateSuccess),
113    DependencyUpdated(DependencyUpdateSuccess),
114    DependencyDeleted(DependencyDeleteSuccess),
115    AttachmentList(AttachmentCollectionSuccess),
116    AttachmentShown(crate::client::attachments::AttachmentInfo),
117    AttachmentUploaded(
118        AttachmentMutationSuccess<crate::client::attachments::AttachmentUploadResponse>,
119    ),
120    BackgroundUploaded(
121        AttachmentMutationSuccess<crate::client::attachments::BackgroundUploadResponse>,
122    ),
123    AttachmentCopied(AttachmentMutationSuccess<crate::client::attachments::AttachmentCopyResponse>),
124    AttachmentMoved(AttachmentMutationSuccess<crate::client::attachments::AttachmentMoveResponse>),
125    AttachmentDeleted(
126        AttachmentMutationSuccess<crate::client::attachments::AttachmentDeleteResponse>,
127    ),
128    AttachmentDownloaded(AttachmentDownloadSuccess),
129    ApiResponse(ApiResponseSuccess),
130    Cancelled(CancellationSuccess),
131    Registration(AuthSuccess),
132    Login(AuthSuccess),
133    Logout(LogoutSuccess),
134    AuthStatus(AuthStatusSuccess),
135    UserCurrent(UserDetail),
136    UserList(UserListSuccess),
137    UserShown(UserDetail),
138    UserUpdated(UserDetail),
139    UserCards(UserCardsSuccess),
140    UserCreated(UserCreateSuccess),
141    UserBoards(UserBoardsSuccess),
142    UserOwnershipTaken(UserOwnershipSuccess),
143    UserLoginChanged(UserLoginChangeSuccess),
144    UserDeleted(UserDeleteSuccess),
145    BoardList(BoardListSuccess),
146    BoardCount(BoardCountSuccess),
147    BoardShown(Box<BoardDetail>),
148    BoardCreated(BoardCreateSuccess),
149    BoardRenamed(BoardRenameSuccess),
150    BoardDeleted(BoardDeleteSuccess),
151    ListCollection(ListCollectionSuccess),
152    ListShown(ListDetail),
153    ListCreated(ListCreateSuccess),
154    ListUpdated(ListUpdateSuccess),
155    ListDeleted(ListDeleteSuccess),
156    CardCollection(CardCollectionSuccess),
157    CardShown(Box<CardDetail>),
158    CardCreated(CardCreateSuccess),
159    CardUpdated(CardUpdateSuccess),
160    CardArchived(CardArchiveSuccess),
161    CardRestored(CardRestoreSuccess),
162    CardDeleted(CardDeleteSuccess),
163    ChecklistCollection(ChecklistCollectionSuccess),
164    ChecklistShown(ChecklistDetail),
165    ChecklistCreated(ChecklistCreateSuccess),
166    ChecklistDeleted(ChecklistDeleteSuccess),
167    ChecklistItemShown(ChecklistItemDetail),
168    ChecklistItemCreated(ChecklistItemCreateSuccess),
169    ChecklistItemUpdated(ChecklistItemUpdateSuccess),
170    ChecklistItemDeleted(ChecklistItemDeleteSuccess),
171    CustomFieldCollection(CustomFieldCollectionSuccess),
172    CustomFieldShown(CustomFieldDetail),
173    CustomFieldCreated(CustomFieldCreateSuccess),
174    CustomFieldUpdated(CustomFieldUpdateSuccess),
175    CustomFieldDeleted(CustomFieldDeleteSuccess),
176    CustomFieldItemsCreated(CustomFieldItemCreateSuccess),
177    CustomFieldItemUpdated(CustomFieldItemUpdateSuccess),
178    CustomFieldItemDeleted(CustomFieldItemDeleteSuccess),
179    CardCustomFieldSet(CardCustomFieldSetSuccess),
180    CardCustomFieldQuery(CardCustomFieldQuerySuccess),
181    CommentCollection(CommentCollectionSuccess),
182    CommentShown(CommentDetail),
183    CommentCreated(CommentCreateSuccess),
184    CommentDeleted(CommentDeleteSuccess),
185    SwimlaneCollection(SwimlaneCollectionSuccess),
186    SwimlaneShown(SwimlaneDetail),
187    SwimlaneCreated(SwimlaneCreateSuccess),
188    SwimlaneUpdated(SwimlaneUpdateSuccess),
189    SwimlaneDeleted(SwimlaneDeleteSuccess),
190    ProfileAdded(ProfileItem),
191    ProfileList(ProfileListSuccess),
192    ProfileShown(ProfileItem),
193    ProfileUsed(ProfileItem),
194    ProfileUpdated(ProfileItem),
195    ProfileRemoved(ProfileRemoveSuccess),
196}
197
198#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize)]
199#[serde(rename_all = "snake_case")]
200pub enum MembershipAction {
201    Add,
202    Remove,
203}
204
205#[derive(Clone, Copy, Debug, Eq, PartialEq, Serialize)]
206#[serde(rename_all = "snake_case")]
207pub enum DestructiveOperation {
208    CardBulkDelete,
209    DependencyDelete,
210    AttachmentDelete,
211    ApiRequest,
212    AuthLogout,
213    ProfileRemove,
214    UserTakeOwnership,
215    UserDisableLogin,
216    UserDelete,
217    BoardDelete,
218    ListDelete,
219    CardDelete,
220    ChecklistDelete,
221    ChecklistItemDelete,
222    CustomFieldDelete,
223    CustomFieldItemDelete,
224    CommentDelete,
225    SwimlaneDelete,
226}
227
228impl DestructiveOperation {
229    pub const fn as_command(self) -> &'static str {
230        match self {
231            Self::CardBulkDelete => "card bulk delete",
232            Self::DependencyDelete => "dependency delete",
233            Self::AttachmentDelete => "attachment delete",
234            Self::ApiRequest => "api request",
235            Self::AuthLogout => "auth logout",
236            Self::ProfileRemove => "profile remove",
237            Self::UserTakeOwnership => "user take-ownership",
238            Self::UserDisableLogin => "user disable-login",
239            Self::UserDelete => "user delete",
240            Self::BoardDelete => "board delete",
241            Self::ListDelete => "list delete",
242            Self::CardDelete => "card delete",
243            Self::ChecklistDelete => "checklist delete",
244            Self::ChecklistItemDelete => "checklist-item delete",
245            Self::CustomFieldDelete => "custom-field delete",
246            Self::CustomFieldItemDelete => "custom-field-item delete",
247            Self::CommentDelete => "comment delete",
248            Self::SwimlaneDelete => "swimlane delete",
249        }
250    }
251}
252
253#[derive(Debug, Eq, PartialEq, Serialize)]
254pub struct CancellationSuccess {
255    pub cancelled: bool,
256    pub operation: DestructiveOperation,
257}
258
259impl CancellationSuccess {
260    pub const fn new(operation: DestructiveOperation) -> Self {
261        Self {
262            cancelled: true,
263            operation,
264        }
265    }
266}