pub struct AutomationHandler { /* private fields */ }
Expand description
Handler for automation operations
Implementations§
Source§impl AutomationHandler
impl AutomationHandler
Sourcepub fn new(client: FilesClient) -> Self
pub fn new(client: FilesClient) -> Self
Create a new automation handler
Sourcepub async fn list(
&self,
cursor: Option<&str>,
per_page: Option<i64>,
automation: Option<&str>,
) -> Result<(Vec<AutomationEntity>, PaginationInfo)>
pub async fn list( &self, cursor: Option<&str>, per_page: Option<i64>, automation: Option<&str>, ) -> Result<(Vec<AutomationEntity>, PaginationInfo)>
List automations
§Arguments
cursor
- Pagination cursorper_page
- Results per pageautomation
- Filter by automation type
§Returns
Tuple of (automations, pagination_info)
§Example
use files_sdk::{FilesClient, AutomationHandler};
let client = FilesClient::builder().api_key("key").build()?;
let handler = AutomationHandler::new(client);
let (automations, _) = handler.list(None, None, None).await?;
Sourcepub async fn get(&self, id: i64) -> Result<AutomationEntity>
pub async fn get(&self, id: i64) -> Result<AutomationEntity>
Sourcepub async fn create(
&self,
automation: &str,
source: Option<&str>,
destination: Option<&str>,
destinations: Option<Vec<String>>,
interval: Option<&str>,
path: Option<&str>,
trigger: Option<&str>,
) -> Result<AutomationEntity>
pub async fn create( &self, automation: &str, source: Option<&str>, destination: Option<&str>, destinations: Option<Vec<String>>, interval: Option<&str>, path: Option<&str>, trigger: Option<&str>, ) -> Result<AutomationEntity>
Create a new automation
§Arguments
automation
- Automation type (required)source
- Source path/globdestination
- Destination pathdestinations
- Destination paths (array)interval
- Schedule intervalpath
- Path on which automation runstrigger
- Trigger type
§Returns
The created automation
§Example
use files_sdk::{FilesClient, AutomationHandler};
let client = FilesClient::builder().api_key("key").build()?;
let handler = AutomationHandler::new(client);
let automation = handler.create(
"copy_file",
Some("/source/*.txt"),
Some("/destination/"),
None,
None,
Some("/source"),
Some("action")
).await?;
Sourcepub async fn update(
&self,
id: i64,
source: Option<&str>,
destination: Option<&str>,
interval: Option<&str>,
disabled: Option<bool>,
) -> Result<AutomationEntity>
pub async fn update( &self, id: i64, source: Option<&str>, destination: Option<&str>, interval: Option<&str>, disabled: Option<bool>, ) -> Result<AutomationEntity>
Auto Trait Implementations§
impl Freeze for AutomationHandler
impl !RefUnwindSafe for AutomationHandler
impl Send for AutomationHandler
impl Sync for AutomationHandler
impl Unpin for AutomationHandler
impl !UnwindSafe for AutomationHandler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more