box-open-sdk 0.4.1

Box API client for Rust (open source, community, punk rock) — typed models, async managers, and a reqwest runtime with retry, backoff, and token refresh.
Documentation
// Code generated by box-gantry 0.1.0 (spec 3fb3510fe12f2f80) for Box API 2024.0. DO NOT EDIT.

use crate::serde_helpers::double_option;

use super::*;

#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct CollaboratorVariable {
    pub r#type: CollaboratorVariableType,
    pub variable_type: CollaboratorVariableVariableType,
    pub variable_value: Vec<CollaboratorVariableVariableValue>,
}

#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct CompletionRuleVariable {
    pub r#type: CollaboratorVariableType,
    pub variable_type: CompletionRuleVariableVariableType,
    pub variable_value: CompletionRuleVariableVariableValue,
}

#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct Outcome {
    pub id: String,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub collaborators: Option<CollaboratorVariable>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub completion_rule: Option<CompletionRuleVariable>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub file_collaborator_role: Option<RoleVariable>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub task_collaborators: Option<CollaboratorVariable>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub role: Option<RoleVariable>,
}

#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct RoleVariable {
    pub r#type: CollaboratorVariableType,
    pub variable_type: RoleVariableVariableType,
    pub variable_value: FileFullAllowedInviteeRoles,
}

#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct Workflow {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub r#type: Option<WorkflowType>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub is_enabled: Option<bool>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub flows: Option<Vec<WorkflowFlows>>,
}

#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct Workflows {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub limit: Option<i64>,
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        deserialize_with = "double_option"
    )]
    pub next_marker: Option<Option<String>>,
    #[serde(
        default,
        skip_serializing_if = "Option::is_none",
        deserialize_with = "double_option"
    )]
    pub prev_marker: Option<Option<String>>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub entries: Option<Vec<Workflow>>,
}

#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(transparent)]
pub struct CollaboratorVariableType(pub String);

impl CollaboratorVariableType {
    pub const VARIABLE: &'static str = "variable";
}

#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(transparent)]
pub struct CollaboratorVariableVariableType(pub String);

impl CollaboratorVariableVariableType {
    pub const USER_LIST: &'static str = "user_list";
}

#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(transparent)]
pub struct CompletionRuleVariableVariableType(pub String);

impl CompletionRuleVariableVariableType {
    pub const TASK_COMPLETION_RULE: &'static str = "task_completion_rule";
}

#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(transparent)]
pub struct CompletionRuleVariableVariableValue(pub String);

impl CompletionRuleVariableVariableValue {
    pub const ALL_ASSIGNEES: &'static str = "all_assignees";
    pub const ANY_ASSIGNEES: &'static str = "any_assignees";
}

#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(transparent)]
pub struct RoleVariableVariableType(pub String);

impl RoleVariableVariableType {
    pub const COLLABORATOR_ROLE: &'static str = "collaborator_role";
}

#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(transparent)]
pub struct WorkflowType(pub String);

impl WorkflowType {
    pub const WORKFLOW: &'static str = "workflow";
}

#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(transparent)]
pub struct FlowsType(pub String);

impl FlowsType {
    pub const FLOW: &'static str = "flow";
}

#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(transparent)]
pub struct TriggerType(pub String);

impl TriggerType {
    pub const TRIGGER: &'static str = "trigger";
}

#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(transparent)]
pub struct TriggerTriggerType(pub String);

impl TriggerTriggerType {
    pub const WORKFLOW_MANUAL_START: &'static str = "WORKFLOW_MANUAL_START";
}

#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(transparent)]
pub struct ScopeType(pub String);

impl ScopeType {
    pub const TRIGGER_SCOPE: &'static str = "trigger_scope";
}

#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct TriggerScope {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub r#type: Option<ScopeType>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub r#ref: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub object: Option<MetadataCascadePolicyParent>,
}

#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct FlowsTrigger {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub r#type: Option<TriggerType>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub trigger_type: Option<TriggerTriggerType>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub scope: Option<Vec<TriggerScope>>,
}

#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(transparent)]
pub struct OutcomesType(pub String);

impl OutcomesType {
    pub const OUTCOME: &'static str = "outcome";
}

#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(transparent)]
pub struct OutcomesActionType(pub String);

impl OutcomesActionType {
    pub const ADD_METADATA: &'static str = "add_metadata";
    pub const ASSIGN_TASK: &'static str = "assign_task";
    pub const COPY_FILE: &'static str = "copy_file";
    pub const COPY_FOLDER: &'static str = "copy_folder";
    pub const CREATE_FOLDER: &'static str = "create_folder";
    pub const DELETE_FILE: &'static str = "delete_file";
    pub const DELETE_FOLDER: &'static str = "delete_folder";
    pub const LOCK_FILE: &'static str = "lock_file";
    pub const MOVE_FILE: &'static str = "move_file";
    pub const MOVE_FOLDER: &'static str = "move_folder";
    pub const REMOVE_WATERMARK_FILE: &'static str = "remove_watermark_file";
    pub const RENAME_FOLDER: &'static str = "rename_folder";
    pub const RESTORE_FOLDER: &'static str = "restore_folder";
    pub const SHARE_FILE: &'static str = "share_file";
    pub const SHARE_FOLDER: &'static str = "share_folder";
    pub const UNLOCK_FILE: &'static str = "unlock_file";
    pub const UPLOAD_FILE: &'static str = "upload_file";
    pub const WAIT_FOR_TASK: &'static str = "wait_for_task";
    pub const WATERMARK_FILE: &'static str = "watermark_file";
    pub const GO_BACK_TO_STEP: &'static str = "go_back_to_step";
    pub const APPLY_FILE_CLASSIFICATION: &'static str = "apply_file_classification";
    pub const APPLY_FOLDER_CLASSIFICATION: &'static str = "apply_folder_classification";
    pub const SEND_NOTIFICATION: &'static str = "send_notification";
}

#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct OutcomesIfRejected {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub r#type: Option<OutcomesType>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub action_type: Option<OutcomesActionType>,
}

#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct FlowsOutcomes {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub r#type: Option<OutcomesType>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub action_type: Option<OutcomesActionType>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub if_rejected: Option<Vec<OutcomesIfRejected>>,
}

#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct WorkflowFlows {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub r#type: Option<FlowsType>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub trigger: Option<FlowsTrigger>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub outcomes: Option<Vec<FlowsOutcomes>>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub created_at: Option<chrono::DateTime<chrono::Utc>>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub created_by: Option<UserBase>,
}

#[derive(Clone, Debug, Default, Eq, PartialEq, serde::Deserialize, serde::Serialize)]
#[serde(transparent)]
pub struct PostIdStartType(pub String);

impl PostIdStartType {
    pub const WORKFLOW_PARAMETERS: &'static str = "workflow_parameters";
}

#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct PostIdStartFlow {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub r#type: Option<String>,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub id: Option<String>,
}

#[derive(Clone, Debug, Default, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct StartWorkflowRequest {
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub r#type: Option<PostIdStartType>,
    pub flow: PostIdStartFlow,
    pub files: Vec<PutSkillInvocationIdFile>,
    pub folder: MetadataCascadePolicyParent,
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub outcomes: Option<Vec<Outcome>>,
}