From d46e7029f6000ce5a783a5a3b66622d329fea6d5 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 9 Oct 2026 14:25:50 +0100 Subject: [PATCH] feat: SDK update for version 0.16.0 --- CHANGELOG.md | 4 ++-- Cargo.toml | 2 +- README.md | 2 +- docs/examples/functions/create.md | 1 + docs/examples/functions/update.md | 1 + src/client.rs | 4 ++-- src/lib.rs | 4 ++-- src/models/billing_plan.rs | 10 ++++++++++ src/models/function.rs | 15 +++++++++++++++ src/services/functions.rs | 8 ++++++++ 10 files changed, 43 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72e891a..ed2831c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [0.15.0] - TBD +## [0.16.0] - TBD ### Added - Initial release of Appwrite Rust SDK @@ -1453,4 +1453,4 @@ The Webhooks service allows you to manage your project webhooks. - File upload examples - Query builder documentation -[0.15.0]: https://github.com/appwrite/sdk-for-rust/releases/tag/0.15.0 +[0.16.0]: https://github.com/appwrite/sdk-for-rust/releases/tag/0.16.0 diff --git a/Cargo.toml b/Cargo.toml index dfbe221..b6ca383 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "appwrite" -version = "0.15.0" +version = "0.16.0" edition = "2021" rust-version = "1.83" authors = ["appwrite"] diff --git a/README.md b/README.md index 515ce02..8c04e98 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Add this to your `Cargo.toml`: ```toml [dependencies] -appwrite = "0.15.0" +appwrite = "0.16.0" tokio = { version = "1.48", features = ["full"] } ``` diff --git a/docs/examples/functions/create.md b/docs/examples/functions/create.md index 46b7a20..a779361 100644 --- a/docs/examples/functions/create.md +++ b/docs/examples/functions/create.md @@ -33,6 +33,7 @@ async fn main() -> Result<(), Box> { Some(vec![]), // optional Some("s-1vcpu-512mb"), // optional Some("s-1vcpu-512mb"), // optional + Some(0), // optional Some(0) // optional ).await?; diff --git a/docs/examples/functions/update.md b/docs/examples/functions/update.md index 16e4ea5..0ef1cfa 100644 --- a/docs/examples/functions/update.md +++ b/docs/examples/functions/update.md @@ -33,6 +33,7 @@ async fn main() -> Result<(), Box> { Some(vec![]), // optional Some("s-1vcpu-512mb"), // optional Some("s-1vcpu-512mb"), // optional + Some(0), // optional Some(0) // optional ).await?; diff --git a/src/client.rs b/src/client.rs index 72dce7f..ed7d143 100644 --- a/src/client.rs +++ b/src/client.rs @@ -95,7 +95,7 @@ impl Client { headers.insert( "user-agent", format!( - "AppwriteRustSDK/0.15.0 ({}; {})", + "AppwriteRustSDK/0.16.0 ({}; {})", std::env::consts::OS, std::env::consts::ARCH ) @@ -105,7 +105,7 @@ impl Client { headers.insert("x-sdk-name", "Rust".parse().unwrap()); headers.insert("x-sdk-platform", "server".parse().unwrap()); headers.insert("x-sdk-language", "rust".parse().unwrap()); - headers.insert("x-sdk-version", "0.15.0".parse().unwrap()); + headers.insert("x-sdk-version", "0.16.0".parse().unwrap()); let config = Config { endpoint: "https://cloud.appwrite.io/v1".to_string(), diff --git a/src/lib.rs b/src/lib.rs index f046fc6..4c60469 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,7 +8,7 @@ //! //! ```toml //! [dependencies] -//! appwrite = "0.15.0" +//! appwrite = "0.16.0" //! ``` //! //! ## Usage @@ -51,7 +51,7 @@ pub use input_file::InputFile; pub type Result = std::result::Result; /// SDK version -pub const VERSION: &str = "0.15.0"; +pub const VERSION: &str = "0.16.0"; /// SDK name pub const SDK_NAME: &str = "Rust"; diff --git a/src/models/billing_plan.rs b/src/models/billing_plan.rs index 98892fe..a7d82b7 100644 --- a/src/models/billing_plan.rs +++ b/src/models/billing_plan.rs @@ -213,6 +213,10 @@ pub struct BillingPlan { /// Maximum function and site deployment size in MB #[serde(rename = "buildSize")] pub build_size: i64, + /// Shortest function schedule interval allowed, in minutes. 0 allows every + /// interval. + #[serde(rename = "functionsIntervalMinimum")] + pub functions_interval_minimum: i64, /// Does the plan support encrypted string attributes or not. #[serde(rename = "databasesAllowEncrypt")] pub databases_allow_encrypt: bool, @@ -607,6 +611,11 @@ impl BillingPlan { &self.build_size } + /// Get functions_interval_minimum + pub fn functions_interval_minimum(&self) -> &i64 { + &self.functions_interval_minimum + } + /// Get databases_allow_encrypt pub fn databases_allow_encrypt(&self) -> &bool { &self.databases_allow_encrypt @@ -728,6 +737,7 @@ mod tests { let _ = _model.supported_addons(); let _ = _model.deployment_size(); let _ = _model.build_size(); + let _ = _model.functions_interval_minimum(); let _ = _model.databases_allow_encrypt(); let _ = _model.group(); let _ = _model.database_compute_credit(); diff --git a/src/models/function.rs b/src/models/function.rs index 1865238..06374cd 100644 --- a/src/models/function.rs +++ b/src/models/function.rs @@ -69,6 +69,10 @@ pub struct Function { /// Function execution schedule in CRON format. #[serde(rename = "schedule")] pub schedule: String, + /// Minutes between scheduled executions. 0 when the function has no interval. + #[serde(rename = "interval")] + #[serde(skip_serializing_if = "Option::is_none")] + pub interval: Option, /// Function execution timeout in seconds. #[serde(rename = "timeout")] pub timeout: i64, @@ -210,6 +214,17 @@ impl Function { &self.schedule } + /// Set interval + pub fn set_interval(mut self, interval: i64) -> Self { + self.interval = Some(interval); + self + } + + /// Get interval + pub fn interval(&self) -> Option<&i64> { + self.interval.as_ref() + } + /// Get timeout pub fn timeout(&self) -> &i64 { &self.timeout diff --git a/src/services/functions.rs b/src/services/functions.rs index 049c4ca..a05706a 100644 --- a/src/services/functions.rs +++ b/src/services/functions.rs @@ -84,6 +84,7 @@ impl Functions { build_specification: Option<&str>, runtime_specification: Option<&str>, deployment_retention: Option, + interval: Option, ) -> crate::error::Result { let mut params = HashMap::new(); params.insert("functionId".to_string(), json!(function_id.into())); @@ -158,6 +159,9 @@ impl Functions { if let Some(value) = deployment_retention { params.insert("deploymentRetention".to_string(), json!(value)); } + if let Some(value) = interval { + params.insert("interval".to_string(), json!(value)); + } let mut api_headers = HashMap::new(); api_headers.insert("content-type".to_string(), "application/json".to_string()); api_headers.insert("accept".to_string(), "application/json".to_string()); @@ -245,6 +249,7 @@ impl Functions { build_specification: Option<&str>, runtime_specification: Option<&str>, deployment_retention: Option, + interval: Option, ) -> crate::error::Result { let mut params = HashMap::new(); params.insert("name".to_string(), json!(name.into())); @@ -320,6 +325,9 @@ impl Functions { if let Some(value) = deployment_retention { params.insert("deploymentRetention".to_string(), json!(value)); } + if let Some(value) = interval { + params.insert("interval".to_string(), json!(value)); + } let mut api_headers = HashMap::new(); api_headers.insert("content-type".to_string(), "application/json".to_string()); api_headers.insert("accept".to_string(), "application/json".to_string());