Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "appwrite"
version = "0.15.0"
version = "0.16.0"
edition = "2021"
rust-version = "1.83"
authors = ["appwrite"]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
```

Expand Down
1 change: 1 addition & 0 deletions docs/examples/functions/create.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
Some(vec![]), // optional
Some("s-1vcpu-512mb"), // optional
Some("s-1vcpu-512mb"), // optional
Some(0), // optional
Some(0) // optional
).await?;

Expand Down
1 change: 1 addition & 0 deletions docs/examples/functions/update.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
Some(vec![]), // optional
Some("s-1vcpu-512mb"), // optional
Some("s-1vcpu-512mb"), // optional
Some(0), // optional
Some(0) // optional
).await?;

Expand Down
4 changes: 2 additions & 2 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand All @@ -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(),
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//!
//! ```toml
//! [dependencies]
//! appwrite = "0.15.0"
//! appwrite = "0.16.0"
//! ```
//!
//! ## Usage
Expand Down Expand Up @@ -51,7 +51,7 @@ pub use input_file::InputFile;
pub type Result<T> = std::result::Result<T, AppwriteError>;

/// SDK version
pub const VERSION: &str = "0.15.0";
pub const VERSION: &str = "0.16.0";

/// SDK name
pub const SDK_NAME: &str = "Rust";
Expand Down
10 changes: 10 additions & 0 deletions src/models/billing_plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down
15 changes: 15 additions & 0 deletions src/models/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<i64>,
/// Function execution timeout in seconds.
#[serde(rename = "timeout")]
pub timeout: i64,
Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions src/services/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ impl Functions {
build_specification: Option<&str>,
runtime_specification: Option<&str>,
deployment_retention: Option<i64>,
interval: Option<i64>,
) -> crate::error::Result<crate::models::Function> {
let mut params = HashMap::new();
params.insert("functionId".to_string(), json!(function_id.into()));
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -245,6 +249,7 @@ impl Functions {
build_specification: Option<&str>,
runtime_specification: Option<&str>,
deployment_retention: Option<i64>,
interval: Option<i64>,
) -> crate::error::Result<crate::models::Function> {
let mut params = HashMap::new();
params.insert("name".to_string(), json!(name.into()));
Expand Down Expand Up @@ -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());
Expand Down
Loading