Skip to main content

box_open_sdk/models/schemas/
workflows.rs

1// Code generated by box-gantry 0.1.0 (spec 3fb3510fe12f2f80) for Box API 2024.0. DO NOT EDIT.
2
3use crate::serde_helpers::double_option;
4
5use super::*;
6
7#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
8pub struct CollaboratorVariable {
9    pub r#type: CollaboratorVariableType,
10    pub variable_type: CollaboratorVariableVariableType,
11    pub variable_value: Vec<CollaboratorVariableVariableValue>,
12}
13
14#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
15pub struct CompletionRuleVariable {
16    pub r#type: CollaboratorVariableType,
17    pub variable_type: CompletionRuleVariableVariableType,
18    pub variable_value: CompletionRuleVariableVariableValue,
19}
20
21#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
22pub struct Outcome {
23    pub id: String,
24    #[serde(default, skip_serializing_if = "Option::is_none")]
25    pub collaborators: Option<CollaboratorVariable>,
26    #[serde(default, skip_serializing_if = "Option::is_none")]
27    pub completion_rule: Option<CompletionRuleVariable>,
28    #[serde(default, skip_serializing_if = "Option::is_none")]
29    pub file_collaborator_role: Option<RoleVariable>,
30    #[serde(default, skip_serializing_if = "Option::is_none")]
31    pub task_collaborators: Option<CollaboratorVariable>,
32    #[serde(default, skip_serializing_if = "Option::is_none")]
33    pub role: Option<RoleVariable>,
34}
35
36#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
37pub struct RoleVariable {
38    pub r#type: CollaboratorVariableType,
39    pub variable_type: RoleVariableVariableType,
40    pub variable_value: FileFullAllowedInviteeRoles,
41}
42
43#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
44pub struct Workflow {
45    #[serde(default, skip_serializing_if = "Option::is_none")]
46    pub id: Option<String>,
47    #[serde(default, skip_serializing_if = "Option::is_none")]
48    pub r#type: Option<WorkflowType>,
49    #[serde(default, skip_serializing_if = "Option::is_none")]
50    pub name: Option<String>,
51    #[serde(default, skip_serializing_if = "Option::is_none")]
52    pub description: Option<String>,
53    #[serde(default, skip_serializing_if = "Option::is_none")]
54    pub is_enabled: Option<bool>,
55    #[serde(default, skip_serializing_if = "Option::is_none")]
56    pub flows: Option<Vec<WorkflowFlows>>,
57}
58
59#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
60pub struct Workflows {
61    #[serde(default, skip_serializing_if = "Option::is_none")]
62    pub limit: Option<i64>,
63    #[serde(
64        default,
65        skip_serializing_if = "Option::is_none",
66        deserialize_with = "double_option"
67    )]
68    pub next_marker: Option<Option<String>>,
69    #[serde(
70        default,
71        skip_serializing_if = "Option::is_none",
72        deserialize_with = "double_option"
73    )]
74    pub prev_marker: Option<Option<String>>,
75    #[serde(default, skip_serializing_if = "Option::is_none")]
76    pub entries: Option<Vec<Workflow>>,
77}
78
79#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
80#[serde(transparent)]
81pub struct CollaboratorVariableType(pub String);
82
83impl CollaboratorVariableType {
84    pub const VARIABLE: &'static str = "variable";
85}
86
87#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
88#[serde(transparent)]
89pub struct CollaboratorVariableVariableType(pub String);
90
91impl CollaboratorVariableVariableType {
92    pub const USER_LIST: &'static str = "user_list";
93}
94
95#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
96#[serde(transparent)]
97pub struct CompletionRuleVariableVariableType(pub String);
98
99impl CompletionRuleVariableVariableType {
100    pub const TASK_COMPLETION_RULE: &'static str = "task_completion_rule";
101}
102
103#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
104#[serde(transparent)]
105pub struct CompletionRuleVariableVariableValue(pub String);
106
107impl CompletionRuleVariableVariableValue {
108    pub const ALL_ASSIGNEES: &'static str = "all_assignees";
109    pub const ANY_ASSIGNEES: &'static str = "any_assignees";
110}
111
112#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
113#[serde(transparent)]
114pub struct RoleVariableVariableType(pub String);
115
116impl RoleVariableVariableType {
117    pub const COLLABORATOR_ROLE: &'static str = "collaborator_role";
118}
119
120#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
121#[serde(transparent)]
122pub struct WorkflowType(pub String);
123
124impl WorkflowType {
125    pub const WORKFLOW: &'static str = "workflow";
126}
127
128#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
129#[serde(transparent)]
130pub struct FlowsType(pub String);
131
132impl FlowsType {
133    pub const FLOW: &'static str = "flow";
134}
135
136#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
137#[serde(transparent)]
138pub struct TriggerType(pub String);
139
140impl TriggerType {
141    pub const TRIGGER: &'static str = "trigger";
142}
143
144#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
145#[serde(transparent)]
146pub struct TriggerTriggerType(pub String);
147
148impl TriggerTriggerType {
149    pub const WORKFLOW_MANUAL_START: &'static str = "WORKFLOW_MANUAL_START";
150}
151
152#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
153#[serde(transparent)]
154pub struct ScopeType(pub String);
155
156impl ScopeType {
157    pub const TRIGGER_SCOPE: &'static str = "trigger_scope";
158}
159
160#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
161pub struct TriggerScope {
162    #[serde(default, skip_serializing_if = "Option::is_none")]
163    pub r#type: Option<ScopeType>,
164    #[serde(default, skip_serializing_if = "Option::is_none")]
165    pub r#ref: Option<String>,
166    #[serde(default, skip_serializing_if = "Option::is_none")]
167    pub object: Option<MetadataCascadePolicyParent>,
168}
169
170#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
171pub struct FlowsTrigger {
172    #[serde(default, skip_serializing_if = "Option::is_none")]
173    pub r#type: Option<TriggerType>,
174    #[serde(default, skip_serializing_if = "Option::is_none")]
175    pub trigger_type: Option<TriggerTriggerType>,
176    #[serde(default, skip_serializing_if = "Option::is_none")]
177    pub scope: Option<Vec<TriggerScope>>,
178}
179
180#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
181#[serde(transparent)]
182pub struct OutcomesType(pub String);
183
184impl OutcomesType {
185    pub const OUTCOME: &'static str = "outcome";
186}
187
188#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
189#[serde(transparent)]
190pub struct OutcomesActionType(pub String);
191
192impl OutcomesActionType {
193    pub const ADD_METADATA: &'static str = "add_metadata";
194    pub const ASSIGN_TASK: &'static str = "assign_task";
195    pub const COPY_FILE: &'static str = "copy_file";
196    pub const COPY_FOLDER: &'static str = "copy_folder";
197    pub const CREATE_FOLDER: &'static str = "create_folder";
198    pub const DELETE_FILE: &'static str = "delete_file";
199    pub const DELETE_FOLDER: &'static str = "delete_folder";
200    pub const LOCK_FILE: &'static str = "lock_file";
201    pub const MOVE_FILE: &'static str = "move_file";
202    pub const MOVE_FOLDER: &'static str = "move_folder";
203    pub const REMOVE_WATERMARK_FILE: &'static str = "remove_watermark_file";
204    pub const RENAME_FOLDER: &'static str = "rename_folder";
205    pub const RESTORE_FOLDER: &'static str = "restore_folder";
206    pub const SHARE_FILE: &'static str = "share_file";
207    pub const SHARE_FOLDER: &'static str = "share_folder";
208    pub const UNLOCK_FILE: &'static str = "unlock_file";
209    pub const UPLOAD_FILE: &'static str = "upload_file";
210    pub const WAIT_FOR_TASK: &'static str = "wait_for_task";
211    pub const WATERMARK_FILE: &'static str = "watermark_file";
212    pub const GO_BACK_TO_STEP: &'static str = "go_back_to_step";
213    pub const APPLY_FILE_CLASSIFICATION: &'static str = "apply_file_classification";
214    pub const APPLY_FOLDER_CLASSIFICATION: &'static str = "apply_folder_classification";
215    pub const SEND_NOTIFICATION: &'static str = "send_notification";
216}
217
218#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
219pub struct OutcomesIfRejected {
220    #[serde(default, skip_serializing_if = "Option::is_none")]
221    pub id: Option<String>,
222    #[serde(default, skip_serializing_if = "Option::is_none")]
223    pub r#type: Option<OutcomesType>,
224    #[serde(default, skip_serializing_if = "Option::is_none")]
225    pub name: Option<String>,
226    #[serde(default, skip_serializing_if = "Option::is_none")]
227    pub action_type: Option<OutcomesActionType>,
228}
229
230#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
231pub struct FlowsOutcomes {
232    #[serde(default, skip_serializing_if = "Option::is_none")]
233    pub id: Option<String>,
234    #[serde(default, skip_serializing_if = "Option::is_none")]
235    pub r#type: Option<OutcomesType>,
236    #[serde(default, skip_serializing_if = "Option::is_none")]
237    pub name: Option<String>,
238    #[serde(default, skip_serializing_if = "Option::is_none")]
239    pub action_type: Option<OutcomesActionType>,
240    #[serde(default, skip_serializing_if = "Option::is_none")]
241    pub if_rejected: Option<Vec<OutcomesIfRejected>>,
242}
243
244#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
245pub struct WorkflowFlows {
246    #[serde(default, skip_serializing_if = "Option::is_none")]
247    pub id: Option<String>,
248    #[serde(default, skip_serializing_if = "Option::is_none")]
249    pub r#type: Option<FlowsType>,
250    #[serde(default, skip_serializing_if = "Option::is_none")]
251    pub trigger: Option<FlowsTrigger>,
252    #[serde(default, skip_serializing_if = "Option::is_none")]
253    pub outcomes: Option<Vec<FlowsOutcomes>>,
254    #[serde(default, skip_serializing_if = "Option::is_none")]
255    pub created_at: Option<chrono::DateTime<chrono::Utc>>,
256    #[serde(default, skip_serializing_if = "Option::is_none")]
257    pub created_by: Option<UserBase>,
258}
259
260#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
261#[serde(transparent)]
262pub struct PostIdStartType(pub String);
263
264impl PostIdStartType {
265    pub const WORKFLOW_PARAMETERS: &'static str = "workflow_parameters";
266}
267
268#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
269pub struct PostIdStartFlow {
270    #[serde(default, skip_serializing_if = "Option::is_none")]
271    pub r#type: Option<String>,
272    #[serde(default, skip_serializing_if = "Option::is_none")]
273    pub id: Option<String>,
274}
275
276#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
277pub struct StartWorkflowRequest {
278    #[serde(default, skip_serializing_if = "Option::is_none")]
279    pub r#type: Option<PostIdStartType>,
280    pub flow: PostIdStartFlow,
281    pub files: Vec<PutSkillInvocationIdFile>,
282    pub folder: MetadataCascadePolicyParent,
283    #[serde(default, skip_serializing_if = "Option::is_none")]
284    pub outcomes: Option<Vec<Outcome>>,
285}