Module automations

Module automations 

Source
Expand description

Automation operations

Automations enable scheduled or event-driven file operations without manual intervention. Create workflows that automatically process files based on schedules, file events, or webhooks.

§Features

  • Schedule automated file operations (copy, move, delete)
  • Trigger actions on file events (upload, download, modify)
  • Configure recurring tasks (daily, weekly, monthly)
  • Set up webhook-triggered automations
  • Manage syncs with remote servers
  • Import files from external URLs

§Automation Types

  • create_folder - Create directories automatically
  • delete_file - Delete files matching patterns
  • copy_file - Copy files to destinations
  • move_file - Move files between locations
  • run_sync - Execute sync operations
  • import_file - Import from external URLs

§Example

use files_sdk::{FilesClient, AutomationHandler};

let client = FilesClient::builder()
    .api_key("your-api-key")
    .build()?;

let handler = AutomationHandler::new(client);

// Create automation to copy uploaded files to archive daily
let automation = handler.create(
    "copy_file",
    Some("/uploads/*.pdf"),
    Some("/archive/"),
    None,
    Some("day"),
    Some("/uploads"),
    Some("daily")
).await?;

println!("Created automation ID: {}", automation.id.unwrap());

// Manually trigger the automation
handler.manual_run(automation.id.unwrap()).await?;

Structs§

AutomationEntity
An Automation entity
AutomationHandler
Handler for automation operations

Enums§

AutomationTrigger
Automation trigger type
AutomationType
Automation type enum