Skip to main content

wekan_cli/
command_result.rs

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