From 76e430ec9031b272bb69ad9a8900224362030f81 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 1 May 2026 20:26:41 +0530 Subject: [PATCH 1/2] chore: update Rust SDK to 0.4.0 --- CHANGELOG.md | 28 +- Cargo.toml | 8 +- README.md | 4 +- docs/examples/project/create-smtp-test.md | 20 + docs/examples/project/get-email-template.md | 23 + .../examples/project/update-email-template.md | 29 ++ .../update-membership-privacy-policy.md | 26 ++ .../update-password-dictionary-policy.md | 22 + .../project/update-password-history-policy.md | 22 + .../update-password-personal-data-policy.md | 22 + ...-protocol-status.md => update-protocol.md} | 2 +- ...te-service-status.md => update-service.md} | 2 +- .../project/update-session-alert-policy.md | 22 + .../project/update-session-duration-policy.md | 22 + .../update-session-invalidation-policy.md | 22 + .../project/update-session-limit-policy.md | 22 + docs/examples/project/update-smtp.md | 31 ++ .../project/update-user-limit-policy.md | 22 + src/client.rs | 6 +- src/enums/build_runtime.rs | 9 + src/enums/email_template_locale.rs | 413 ++++++++++++++++++ src/enums/email_template_type.rs | 41 ++ src/enums/mod.rs | 6 + src/enums/runtime.rs | 9 + src/enums/scopes.rs | 6 + src/enums/secure.rs | 26 ++ src/lib.rs | 4 +- src/models/email_template.rs | 104 +++++ src/models/membership.rs | 10 + src/models/mod.rs | 3 + src/models/project.rs | 42 +- src/services/project.rs | 330 +++++++++++++- 32 files changed, 1327 insertions(+), 31 deletions(-) create mode 100644 docs/examples/project/create-smtp-test.md create mode 100644 docs/examples/project/get-email-template.md create mode 100644 docs/examples/project/update-email-template.md create mode 100644 docs/examples/project/update-membership-privacy-policy.md create mode 100644 docs/examples/project/update-password-dictionary-policy.md create mode 100644 docs/examples/project/update-password-history-policy.md create mode 100644 docs/examples/project/update-password-personal-data-policy.md rename docs/examples/project/{update-protocol-status.md => update-protocol.md} (91%) rename docs/examples/project/{update-service-status.md => update-service.md} (91%) create mode 100644 docs/examples/project/update-session-alert-policy.md create mode 100644 docs/examples/project/update-session-duration-policy.md create mode 100644 docs/examples/project/update-session-invalidation-policy.md create mode 100644 docs/examples/project/update-session-limit-policy.md create mode 100644 docs/examples/project/update-smtp.md create mode 100644 docs/examples/project/update-user-limit-policy.md create mode 100644 src/enums/email_template_locale.rs create mode 100644 src/enums/email_template_type.rs create mode 100644 src/enums/secure.rs create mode 100644 src/models/email_template.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index fd9693a..d9205a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,11 @@ 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.3.0] - TBD +## [0.4.0] - TBD ### Added - Initial release of Appwrite Rust SDK -- Full support for Appwrite API 1.9.1 +- Full support for Appwrite API 1.9.2 - Async/await support with tokio runtime - Built-in error handling with custom error types - File upload support with automatic chunking @@ -32,7 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Health service with 24 methods - Locale service with 8 methods - Messaging service with 56 methods -- Project service with 26 methods +- Project service with 39 methods - Sites service with 25 methods - Storage service with 13 methods - TablesDB service with 69 methods @@ -453,8 +453,23 @@ The Project service allows you to manage all the projects in your Appwrite serve - `update_windows_platform()` - Update a Windows platform by its unique ID. Use this endpoint to update the platform's name or package identifier name. - `get_platform()` - Get a platform by its unique ID. This endpoint returns the platform's details, including its name, type, and key configurations. - `delete_platform()` - Delete a platform by its unique ID. This endpoint removes the platform and all its configurations from the project. -- `update_protocol_status()` - Update the status of a specific protocol. Use this endpoint to enable or disable a protocol in your project. -- `update_service_status()` - Update the status of a specific service. Use this endpoint to enable or disable a service in your project. +- `update_membership_privacy_policy()` - Updating this policy allows you to control if team members can see other members information. When enabled, all team members can see ID, name, email, phone number, and MFA status of other members.. +- `update_password_dictionary_policy()` - Updating this policy allows you to control if new passwords are checked against most common passwords dictionary. When enabled, and user changes their password, password must not be contained in the dictionary. +- `update_password_history_policy()` - Updates one of password strength policies. Based on total length configured, previous password hashes are stored, and users cannot choose a new password that is already stored in the passwird history list, when updating an user password, or setting new one through password recovery. + +Keep in mind, while password history policy is disabled, the history is not being stored. Enabling the policy will not have any history on existing users, and it will only start to collect and enforce the policy on password changes since the policy is enabled. +- `update_password_personal_data_policy()` - Updating this policy allows you to control if password strength is checked against personal data. When enabled, and user sets or changes their password, the password must not contain user ID, name, email or phone number. +- `update_session_alert_policy()` - Updating this policy allows you to control if email alert is sent upon session creation. When enabled, and user signs into their account, they will be sent an email notification. There is an exception, the first session after a new sign up does not trigger an alert, even if the policy is enabled. +- `update_session_duration_policy()` - Update maximum duration how long sessions created within a project should stay active for. +- `update_session_invalidation_policy()` - Updating this policy allows you to control if existing sessions should be invalidated when a password of a user is changed. When enabled, and user changes their password, they will be logged out of all their devices. +- `update_session_limit_policy()` - Update the maximum number of sessions allowed per user. When the limit is hit, the oldest session will be deleted to make room for new one. +- `update_user_limit_policy()` - Update the maximum number of users in the project. When the limit is hit or amount of existing users already exceeded the limit, all users remain active, but new user sign up will be prohibited. +- `update_protocol()` - Update properties of a specific protocol. Use this endpoint to enable or disable a protocol in your project. +- `update_service()` - Update properties of a specific service. Use this endpoint to enable or disable a service in your project. +- `update_smtp()` - Update the SMTP configuration for your project. Use this endpoint to configure your project's SMTP provider with your custom settings for sending transactional emails. +- `create_smtp_test()` - Send a test email to verify SMTP configuration. +- `update_email_template()` - Update a custom email template for the specified locale and type. Use this endpoint to modify the content of your email templates. +- `get_email_template()` - Get a custom email template for the specified locale and type. This endpoint returns the template content, subject, and other configuration details. - `list_variables()` - Get a list of all project environment variables. - `create_variable()` - Create a new project environment variable. These variables can be accessed by all functions and sites in the project. - `get_variable()` - Get a variable by its unique ID. @@ -854,6 +869,7 @@ If you want to generate a token for a custom authentication flow, use the [POST - `HealthTime` - Health Time - `Headers` - Headers - `Specification` - Specification +- `EmailTemplate` - EmailTemplate - `MfaChallenge` - MFA Challenge - `MfaRecoveryCodes` - MFA Recovery Codes - `MfaType` - MFAType @@ -889,4 +905,4 @@ If you want to generate a token for a custom authentication flow, use the [POST - File upload examples - Query builder documentation -[0.3.0]: https://github.com/appwrite/sdk-for-rust/releases/tag/0.3.0 +[0.4.0]: https://github.com/appwrite/sdk-for-rust/releases/tag/0.4.0 diff --git a/Cargo.toml b/Cargo.toml index 0447052..3cdec9b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "appwrite" -version = "0.3.0" +version = "0.4.0" edition = "2021" rust-version = "1.83" authors = ["appwrite"] @@ -21,8 +21,10 @@ serde = { version = "1.0.228", features = ["derive"] } serde_json = "1.0.149" reqwest = { version = "0.12.28", features = ["json", "multipart", "stream"] } tokio = { version = "1.48.0", features = ["full"] } -indexmap = ">=2, <2.12" -url = ">=2.4.1, <2.5" +indexmap = ">=2, <2.14" +url = "=2.5.4" +idna = "=1.0.3" +idna_adapter = "=1.0.0" mime = "0.3.17" fastrand = "=2.0.2" thiserror = "1.0.69" diff --git a/README.md b/README.md index d1a98ac..56fe6c0 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Appwrite Rust SDK ![License](https://img.shields.io/github/license/appwrite/sdk-for-rust.svg) -![Version](https://img.shields.io/badge/api%20version-1.9.1-blue.svg) +![Version](https://img.shields.io/badge/api%20version-1.9.2-blue.svg) [![Crates.io](https://img.shields.io/crates/v/appwrite.svg)](https://crates.io/crates/appwrite) [![Documentation](https://docs.rs/appwrite/badge.svg)](https://docs.rs/appwrite) @@ -17,7 +17,7 @@ Add this to your `Cargo.toml`: ```toml [dependencies] -appwrite = "0.3.0" +appwrite = "0.4.0" tokio = { version = "1.48", features = ["full"] } ``` diff --git a/docs/examples/project/create-smtp-test.md b/docs/examples/project/create-smtp-test.md new file mode 100644 index 0000000..cb5f2ce --- /dev/null +++ b/docs/examples/project/create-smtp-test.md @@ -0,0 +1,20 @@ +```rust +use appwrite::Client; +use appwrite::services::Project; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new(); + client.set_endpoint("https://.cloud.appwrite.io/v1"); // Your API Endpoint + client.set_project(""); // Your project ID + client.set_key(""); // Your secret API key + + let project = Project::new(&client); + + project.create_smtp_test( + vec![] + ).await?; + + Ok(()) +} +``` diff --git a/docs/examples/project/get-email-template.md b/docs/examples/project/get-email-template.md new file mode 100644 index 0000000..760fe40 --- /dev/null +++ b/docs/examples/project/get-email-template.md @@ -0,0 +1,23 @@ +```rust +use appwrite::Client; +use appwrite::services::Project; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new(); + client.set_endpoint("https://.cloud.appwrite.io/v1"); // Your API Endpoint + client.set_project(""); // Your project ID + client.set_key(""); // Your secret API key + + let project = Project::new(&client); + + let result = project.get_email_template( + appwrite::enums::EmailTemplateType::Verification, + Some(appwrite::enums::EmailTemplateLocale::Af) // optional + ).await?; + + let _ = result; + + Ok(()) +} +``` diff --git a/docs/examples/project/update-email-template.md b/docs/examples/project/update-email-template.md new file mode 100644 index 0000000..f7274ba --- /dev/null +++ b/docs/examples/project/update-email-template.md @@ -0,0 +1,29 @@ +```rust +use appwrite::Client; +use appwrite::services::Project; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new(); + client.set_endpoint("https://.cloud.appwrite.io/v1"); // Your API Endpoint + client.set_project(""); // Your project ID + client.set_key(""); // Your secret API key + + let project = Project::new(&client); + + let result = project.update_email_template( + appwrite::enums::EmailTemplateType::Verification, + Some(appwrite::enums::EmailTemplateLocale::Af), // optional + Some(""), // optional + Some(""), // optional + Some(""), // optional + Some("email@example.com"), // optional + Some("email@example.com"), // optional + Some("") // optional + ).await?; + + let _ = result; + + Ok(()) +} +``` diff --git a/docs/examples/project/update-membership-privacy-policy.md b/docs/examples/project/update-membership-privacy-policy.md new file mode 100644 index 0000000..754d8b7 --- /dev/null +++ b/docs/examples/project/update-membership-privacy-policy.md @@ -0,0 +1,26 @@ +```rust +use appwrite::Client; +use appwrite::services::Project; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new(); + client.set_endpoint("https://.cloud.appwrite.io/v1"); // Your API Endpoint + client.set_project(""); // Your project ID + client.set_key(""); // Your secret API key + + let project = Project::new(&client); + + let result = project.update_membership_privacy_policy( + Some(false), // optional + Some(false), // optional + Some(false), // optional + Some(false), // optional + Some(false) // optional + ).await?; + + let _ = result; + + Ok(()) +} +``` diff --git a/docs/examples/project/update-password-dictionary-policy.md b/docs/examples/project/update-password-dictionary-policy.md new file mode 100644 index 0000000..2c01878 --- /dev/null +++ b/docs/examples/project/update-password-dictionary-policy.md @@ -0,0 +1,22 @@ +```rust +use appwrite::Client; +use appwrite::services::Project; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new(); + client.set_endpoint("https://.cloud.appwrite.io/v1"); // Your API Endpoint + client.set_project(""); // Your project ID + client.set_key(""); // Your secret API key + + let project = Project::new(&client); + + let result = project.update_password_dictionary_policy( + false + ).await?; + + let _ = result; + + Ok(()) +} +``` diff --git a/docs/examples/project/update-password-history-policy.md b/docs/examples/project/update-password-history-policy.md new file mode 100644 index 0000000..c45e8a8 --- /dev/null +++ b/docs/examples/project/update-password-history-policy.md @@ -0,0 +1,22 @@ +```rust +use appwrite::Client; +use appwrite::services::Project; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new(); + client.set_endpoint("https://.cloud.appwrite.io/v1"); // Your API Endpoint + client.set_project(""); // Your project ID + client.set_key(""); // Your secret API key + + let project = Project::new(&client); + + let result = project.update_password_history_policy( + 1 + ).await?; + + let _ = result; + + Ok(()) +} +``` diff --git a/docs/examples/project/update-password-personal-data-policy.md b/docs/examples/project/update-password-personal-data-policy.md new file mode 100644 index 0000000..fc0cb39 --- /dev/null +++ b/docs/examples/project/update-password-personal-data-policy.md @@ -0,0 +1,22 @@ +```rust +use appwrite::Client; +use appwrite::services::Project; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new(); + client.set_endpoint("https://.cloud.appwrite.io/v1"); // Your API Endpoint + client.set_project(""); // Your project ID + client.set_key(""); // Your secret API key + + let project = Project::new(&client); + + let result = project.update_password_personal_data_policy( + false + ).await?; + + let _ = result; + + Ok(()) +} +``` diff --git a/docs/examples/project/update-protocol-status.md b/docs/examples/project/update-protocol.md similarity index 91% rename from docs/examples/project/update-protocol-status.md rename to docs/examples/project/update-protocol.md index 5ba688a..5ef23eb 100644 --- a/docs/examples/project/update-protocol-status.md +++ b/docs/examples/project/update-protocol.md @@ -11,7 +11,7 @@ async fn main() -> Result<(), Box> { let project = Project::new(&client); - let result = project.update_protocol_status( + let result = project.update_protocol( appwrite::enums::ProtocolId::Rest, false ).await?; diff --git a/docs/examples/project/update-service-status.md b/docs/examples/project/update-service.md similarity index 91% rename from docs/examples/project/update-service-status.md rename to docs/examples/project/update-service.md index 2579500..af2c29d 100644 --- a/docs/examples/project/update-service-status.md +++ b/docs/examples/project/update-service.md @@ -11,7 +11,7 @@ async fn main() -> Result<(), Box> { let project = Project::new(&client); - let result = project.update_service_status( + let result = project.update_service( appwrite::enums::ServiceId::Account, false ).await?; diff --git a/docs/examples/project/update-session-alert-policy.md b/docs/examples/project/update-session-alert-policy.md new file mode 100644 index 0000000..cd67b88 --- /dev/null +++ b/docs/examples/project/update-session-alert-policy.md @@ -0,0 +1,22 @@ +```rust +use appwrite::Client; +use appwrite::services::Project; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new(); + client.set_endpoint("https://.cloud.appwrite.io/v1"); // Your API Endpoint + client.set_project(""); // Your project ID + client.set_key(""); // Your secret API key + + let project = Project::new(&client); + + let result = project.update_session_alert_policy( + false + ).await?; + + let _ = result; + + Ok(()) +} +``` diff --git a/docs/examples/project/update-session-duration-policy.md b/docs/examples/project/update-session-duration-policy.md new file mode 100644 index 0000000..d6d7306 --- /dev/null +++ b/docs/examples/project/update-session-duration-policy.md @@ -0,0 +1,22 @@ +```rust +use appwrite::Client; +use appwrite::services::Project; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new(); + client.set_endpoint("https://.cloud.appwrite.io/v1"); // Your API Endpoint + client.set_project(""); // Your project ID + client.set_key(""); // Your secret API key + + let project = Project::new(&client); + + let result = project.update_session_duration_policy( + 5 + ).await?; + + let _ = result; + + Ok(()) +} +``` diff --git a/docs/examples/project/update-session-invalidation-policy.md b/docs/examples/project/update-session-invalidation-policy.md new file mode 100644 index 0000000..8c275b3 --- /dev/null +++ b/docs/examples/project/update-session-invalidation-policy.md @@ -0,0 +1,22 @@ +```rust +use appwrite::Client; +use appwrite::services::Project; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new(); + client.set_endpoint("https://.cloud.appwrite.io/v1"); // Your API Endpoint + client.set_project(""); // Your project ID + client.set_key(""); // Your secret API key + + let project = Project::new(&client); + + let result = project.update_session_invalidation_policy( + false + ).await?; + + let _ = result; + + Ok(()) +} +``` diff --git a/docs/examples/project/update-session-limit-policy.md b/docs/examples/project/update-session-limit-policy.md new file mode 100644 index 0000000..fd958cf --- /dev/null +++ b/docs/examples/project/update-session-limit-policy.md @@ -0,0 +1,22 @@ +```rust +use appwrite::Client; +use appwrite::services::Project; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new(); + client.set_endpoint("https://.cloud.appwrite.io/v1"); // Your API Endpoint + client.set_project(""); // Your project ID + client.set_key(""); // Your secret API key + + let project = Project::new(&client); + + let result = project.update_session_limit_policy( + 1 + ).await?; + + let _ = result; + + Ok(()) +} +``` diff --git a/docs/examples/project/update-smtp.md b/docs/examples/project/update-smtp.md new file mode 100644 index 0000000..4f9d3c2 --- /dev/null +++ b/docs/examples/project/update-smtp.md @@ -0,0 +1,31 @@ +```rust +use appwrite::Client; +use appwrite::services::Project; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new(); + client.set_endpoint("https://.cloud.appwrite.io/v1"); // Your API Endpoint + client.set_project(""); // Your project ID + client.set_key(""); // Your secret API key + + let project = Project::new(&client); + + let result = project.update_smtp( + Some(""), // optional + Some(0), // optional + Some(""), // optional + Some(""), // optional + Some("email@example.com"), // optional + Some(""), // optional + Some("email@example.com"), // optional + Some(""), // optional + Some(appwrite::enums::Secure::Tls), // optional + Some(false) // optional + ).await?; + + let _ = result; + + Ok(()) +} +``` diff --git a/docs/examples/project/update-user-limit-policy.md b/docs/examples/project/update-user-limit-policy.md new file mode 100644 index 0000000..dd679d4 --- /dev/null +++ b/docs/examples/project/update-user-limit-policy.md @@ -0,0 +1,22 @@ +```rust +use appwrite::Client; +use appwrite::services::Project; + +#[tokio::main] +async fn main() -> Result<(), Box> { + let client = Client::new(); + client.set_endpoint("https://.cloud.appwrite.io/v1"); // Your API Endpoint + client.set_project(""); // Your project ID + client.set_key(""); // Your secret API key + + let project = Project::new(&client); + + let result = project.update_user_limit_policy( + 1 + ).await?; + + let _ = result; + + Ok(()) +} +``` diff --git a/src/client.rs b/src/client.rs index 2a31e9e..bc878c7 100644 --- a/src/client.rs +++ b/src/client.rs @@ -88,12 +88,12 @@ impl Client { /// Create a new Appwrite client pub fn new() -> Self { let mut headers = HeaderMap::new(); - headers.insert("X-Appwrite-Response-Format", "1.9.1".parse().unwrap()); - headers.insert("user-agent", format!("AppwriteRustSDK/0.3.0 ({}; {})", std::env::consts::OS, std::env::consts::ARCH).parse().unwrap()); + headers.insert("X-Appwrite-Response-Format", "1.9.2".parse().unwrap()); + headers.insert("user-agent", format!("AppwriteRustSDK/0.4.0 ({}; {})", std::env::consts::OS, std::env::consts::ARCH).parse().unwrap()); 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.3.0".parse().unwrap()); + headers.insert("x-sdk-version", "0.4.0".parse().unwrap()); let config = Config { endpoint: "https://cloud.appwrite.io/v1".to_string(), diff --git a/src/enums/build_runtime.rs b/src/enums/build_runtime.rs index c79fa36..014462a 100644 --- a/src/enums/build_runtime.rs +++ b/src/enums/build_runtime.rs @@ -65,6 +65,12 @@ pub enum BuildRuntime { PythonMl312, #[serde(rename = "python-ml-3.13")] PythonMl313, + #[serde(rename = "deno-1.21")] + Deno121, + #[serde(rename = "deno-1.24")] + Deno124, + #[serde(rename = "deno-1.35")] + Deno135, #[serde(rename = "deno-1.40")] Deno140, #[serde(rename = "deno-1.46")] @@ -216,6 +222,9 @@ impl BuildRuntime { BuildRuntime::PythonMl311 => "python-ml-3.11", BuildRuntime::PythonMl312 => "python-ml-3.12", BuildRuntime::PythonMl313 => "python-ml-3.13", + BuildRuntime::Deno121 => "deno-1.21", + BuildRuntime::Deno124 => "deno-1.24", + BuildRuntime::Deno135 => "deno-1.35", BuildRuntime::Deno140 => "deno-1.40", BuildRuntime::Deno146 => "deno-1.46", BuildRuntime::Deno20 => "deno-2.0", diff --git a/src/enums/email_template_locale.rs b/src/enums/email_template_locale.rs new file mode 100644 index 0000000..ccec2b3 --- /dev/null +++ b/src/enums/email_template_locale.rs @@ -0,0 +1,413 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)] +pub enum EmailTemplateLocale { + #[serde(rename = "af")] + #[default] + Af, + #[serde(rename = "ar-ae")] + ArAe, + #[serde(rename = "ar-bh")] + ArBh, + #[serde(rename = "ar-dz")] + ArDz, + #[serde(rename = "ar-eg")] + ArEg, + #[serde(rename = "ar-iq")] + ArIq, + #[serde(rename = "ar-jo")] + ArJo, + #[serde(rename = "ar-kw")] + ArKw, + #[serde(rename = "ar-lb")] + ArLb, + #[serde(rename = "ar-ly")] + ArLy, + #[serde(rename = "ar-ma")] + ArMa, + #[serde(rename = "ar-om")] + ArOm, + #[serde(rename = "ar-qa")] + ArQa, + #[serde(rename = "ar-sa")] + ArSa, + #[serde(rename = "ar-sy")] + ArSy, + #[serde(rename = "ar-tn")] + ArTn, + #[serde(rename = "ar-ye")] + ArYe, + #[serde(rename = "as")] + As, + #[serde(rename = "az")] + Az, + #[serde(rename = "be")] + Be, + #[serde(rename = "bg")] + Bg, + #[serde(rename = "bh")] + Bh, + #[serde(rename = "bn")] + Bn, + #[serde(rename = "bs")] + Bs, + #[serde(rename = "ca")] + Ca, + #[serde(rename = "cs")] + Cs, + #[serde(rename = "cy")] + Cy, + #[serde(rename = "da")] + Da, + #[serde(rename = "de")] + De, + #[serde(rename = "de-at")] + DeAt, + #[serde(rename = "de-ch")] + DeCh, + #[serde(rename = "de-li")] + DeLi, + #[serde(rename = "de-lu")] + DeLu, + #[serde(rename = "el")] + El, + #[serde(rename = "en")] + En, + #[serde(rename = "en-au")] + EnAu, + #[serde(rename = "en-bz")] + EnBz, + #[serde(rename = "en-ca")] + EnCa, + #[serde(rename = "en-gb")] + EnGb, + #[serde(rename = "en-ie")] + EnIe, + #[serde(rename = "en-jm")] + EnJm, + #[serde(rename = "en-nz")] + EnNz, + #[serde(rename = "en-tt")] + EnTt, + #[serde(rename = "en-us")] + EnUs, + #[serde(rename = "en-za")] + EnZa, + #[serde(rename = "eo")] + Eo, + #[serde(rename = "es")] + Es, + #[serde(rename = "es-ar")] + EsAr, + #[serde(rename = "es-bo")] + EsBo, + #[serde(rename = "es-cl")] + EsCl, + #[serde(rename = "es-co")] + EsCo, + #[serde(rename = "es-cr")] + EsCr, + #[serde(rename = "es-do")] + EsDo, + #[serde(rename = "es-ec")] + EsEc, + #[serde(rename = "es-gt")] + EsGt, + #[serde(rename = "es-hn")] + EsHn, + #[serde(rename = "es-mx")] + EsMx, + #[serde(rename = "es-ni")] + EsNi, + #[serde(rename = "es-pa")] + EsPa, + #[serde(rename = "es-pe")] + EsPe, + #[serde(rename = "es-pr")] + EsPr, + #[serde(rename = "es-py")] + EsPy, + #[serde(rename = "es-sv")] + EsSv, + #[serde(rename = "es-uy")] + EsUy, + #[serde(rename = "es-ve")] + EsVe, + #[serde(rename = "et")] + Et, + #[serde(rename = "eu")] + Eu, + #[serde(rename = "fa")] + Fa, + #[serde(rename = "fi")] + Fi, + #[serde(rename = "fo")] + Fo, + #[serde(rename = "fr")] + Fr, + #[serde(rename = "fr-be")] + FrBe, + #[serde(rename = "fr-ca")] + FrCa, + #[serde(rename = "fr-ch")] + FrCh, + #[serde(rename = "fr-lu")] + FrLu, + #[serde(rename = "ga")] + Ga, + #[serde(rename = "gd")] + Gd, + #[serde(rename = "he")] + He, + #[serde(rename = "hi")] + Hi, + #[serde(rename = "hr")] + Hr, + #[serde(rename = "hu")] + Hu, + #[serde(rename = "id")] + Id, + #[serde(rename = "is")] + Is, + #[serde(rename = "it")] + It, + #[serde(rename = "it-ch")] + ItCh, + #[serde(rename = "ja")] + Ja, + #[serde(rename = "ji")] + Ji, + #[serde(rename = "ko")] + Ko, + #[serde(rename = "ku")] + Ku, + #[serde(rename = "lt")] + Lt, + #[serde(rename = "lv")] + Lv, + #[serde(rename = "mk")] + Mk, + #[serde(rename = "ml")] + Ml, + #[serde(rename = "ms")] + Ms, + #[serde(rename = "mt")] + Mt, + #[serde(rename = "nb")] + Nb, + #[serde(rename = "ne")] + Ne, + #[serde(rename = "nl")] + Nl, + #[serde(rename = "nl-be")] + NlBe, + #[serde(rename = "nn")] + Nn, + #[serde(rename = "no")] + No, + #[serde(rename = "pa")] + Pa, + #[serde(rename = "pl")] + Pl, + #[serde(rename = "pt")] + Pt, + #[serde(rename = "pt-br")] + PtBr, + #[serde(rename = "rm")] + Rm, + #[serde(rename = "ro")] + Ro, + #[serde(rename = "ro-md")] + RoMd, + #[serde(rename = "ru")] + Ru, + #[serde(rename = "ru-md")] + RuMd, + #[serde(rename = "sb")] + Sb, + #[serde(rename = "sk")] + Sk, + #[serde(rename = "sl")] + Sl, + #[serde(rename = "sq")] + Sq, + #[serde(rename = "sr")] + Sr, + #[serde(rename = "sv")] + Sv, + #[serde(rename = "sv-fi")] + SvFi, + #[serde(rename = "th")] + Th, + #[serde(rename = "tn")] + Tn, + #[serde(rename = "tr")] + Tr, + #[serde(rename = "ts")] + Ts, + #[serde(rename = "ua")] + Ua, + #[serde(rename = "ur")] + Ur, + #[serde(rename = "ve")] + Ve, + #[serde(rename = "vi")] + Vi, + #[serde(rename = "xh")] + Xh, + #[serde(rename = "zh-cn")] + ZhCn, + #[serde(rename = "zh-hk")] + ZhHk, + #[serde(rename = "zh-sg")] + ZhSg, + #[serde(rename = "zh-tw")] + ZhTw, + #[serde(rename = "zu")] + Zu, +} + +impl EmailTemplateLocale { + /// Get the string value of the enum + pub fn as_str(&self) -> &str { + match self { + EmailTemplateLocale::Af => "af", + EmailTemplateLocale::ArAe => "ar-ae", + EmailTemplateLocale::ArBh => "ar-bh", + EmailTemplateLocale::ArDz => "ar-dz", + EmailTemplateLocale::ArEg => "ar-eg", + EmailTemplateLocale::ArIq => "ar-iq", + EmailTemplateLocale::ArJo => "ar-jo", + EmailTemplateLocale::ArKw => "ar-kw", + EmailTemplateLocale::ArLb => "ar-lb", + EmailTemplateLocale::ArLy => "ar-ly", + EmailTemplateLocale::ArMa => "ar-ma", + EmailTemplateLocale::ArOm => "ar-om", + EmailTemplateLocale::ArQa => "ar-qa", + EmailTemplateLocale::ArSa => "ar-sa", + EmailTemplateLocale::ArSy => "ar-sy", + EmailTemplateLocale::ArTn => "ar-tn", + EmailTemplateLocale::ArYe => "ar-ye", + EmailTemplateLocale::As => "as", + EmailTemplateLocale::Az => "az", + EmailTemplateLocale::Be => "be", + EmailTemplateLocale::Bg => "bg", + EmailTemplateLocale::Bh => "bh", + EmailTemplateLocale::Bn => "bn", + EmailTemplateLocale::Bs => "bs", + EmailTemplateLocale::Ca => "ca", + EmailTemplateLocale::Cs => "cs", + EmailTemplateLocale::Cy => "cy", + EmailTemplateLocale::Da => "da", + EmailTemplateLocale::De => "de", + EmailTemplateLocale::DeAt => "de-at", + EmailTemplateLocale::DeCh => "de-ch", + EmailTemplateLocale::DeLi => "de-li", + EmailTemplateLocale::DeLu => "de-lu", + EmailTemplateLocale::El => "el", + EmailTemplateLocale::En => "en", + EmailTemplateLocale::EnAu => "en-au", + EmailTemplateLocale::EnBz => "en-bz", + EmailTemplateLocale::EnCa => "en-ca", + EmailTemplateLocale::EnGb => "en-gb", + EmailTemplateLocale::EnIe => "en-ie", + EmailTemplateLocale::EnJm => "en-jm", + EmailTemplateLocale::EnNz => "en-nz", + EmailTemplateLocale::EnTt => "en-tt", + EmailTemplateLocale::EnUs => "en-us", + EmailTemplateLocale::EnZa => "en-za", + EmailTemplateLocale::Eo => "eo", + EmailTemplateLocale::Es => "es", + EmailTemplateLocale::EsAr => "es-ar", + EmailTemplateLocale::EsBo => "es-bo", + EmailTemplateLocale::EsCl => "es-cl", + EmailTemplateLocale::EsCo => "es-co", + EmailTemplateLocale::EsCr => "es-cr", + EmailTemplateLocale::EsDo => "es-do", + EmailTemplateLocale::EsEc => "es-ec", + EmailTemplateLocale::EsGt => "es-gt", + EmailTemplateLocale::EsHn => "es-hn", + EmailTemplateLocale::EsMx => "es-mx", + EmailTemplateLocale::EsNi => "es-ni", + EmailTemplateLocale::EsPa => "es-pa", + EmailTemplateLocale::EsPe => "es-pe", + EmailTemplateLocale::EsPr => "es-pr", + EmailTemplateLocale::EsPy => "es-py", + EmailTemplateLocale::EsSv => "es-sv", + EmailTemplateLocale::EsUy => "es-uy", + EmailTemplateLocale::EsVe => "es-ve", + EmailTemplateLocale::Et => "et", + EmailTemplateLocale::Eu => "eu", + EmailTemplateLocale::Fa => "fa", + EmailTemplateLocale::Fi => "fi", + EmailTemplateLocale::Fo => "fo", + EmailTemplateLocale::Fr => "fr", + EmailTemplateLocale::FrBe => "fr-be", + EmailTemplateLocale::FrCa => "fr-ca", + EmailTemplateLocale::FrCh => "fr-ch", + EmailTemplateLocale::FrLu => "fr-lu", + EmailTemplateLocale::Ga => "ga", + EmailTemplateLocale::Gd => "gd", + EmailTemplateLocale::He => "he", + EmailTemplateLocale::Hi => "hi", + EmailTemplateLocale::Hr => "hr", + EmailTemplateLocale::Hu => "hu", + EmailTemplateLocale::Id => "id", + EmailTemplateLocale::Is => "is", + EmailTemplateLocale::It => "it", + EmailTemplateLocale::ItCh => "it-ch", + EmailTemplateLocale::Ja => "ja", + EmailTemplateLocale::Ji => "ji", + EmailTemplateLocale::Ko => "ko", + EmailTemplateLocale::Ku => "ku", + EmailTemplateLocale::Lt => "lt", + EmailTemplateLocale::Lv => "lv", + EmailTemplateLocale::Mk => "mk", + EmailTemplateLocale::Ml => "ml", + EmailTemplateLocale::Ms => "ms", + EmailTemplateLocale::Mt => "mt", + EmailTemplateLocale::Nb => "nb", + EmailTemplateLocale::Ne => "ne", + EmailTemplateLocale::Nl => "nl", + EmailTemplateLocale::NlBe => "nl-be", + EmailTemplateLocale::Nn => "nn", + EmailTemplateLocale::No => "no", + EmailTemplateLocale::Pa => "pa", + EmailTemplateLocale::Pl => "pl", + EmailTemplateLocale::Pt => "pt", + EmailTemplateLocale::PtBr => "pt-br", + EmailTemplateLocale::Rm => "rm", + EmailTemplateLocale::Ro => "ro", + EmailTemplateLocale::RoMd => "ro-md", + EmailTemplateLocale::Ru => "ru", + EmailTemplateLocale::RuMd => "ru-md", + EmailTemplateLocale::Sb => "sb", + EmailTemplateLocale::Sk => "sk", + EmailTemplateLocale::Sl => "sl", + EmailTemplateLocale::Sq => "sq", + EmailTemplateLocale::Sr => "sr", + EmailTemplateLocale::Sv => "sv", + EmailTemplateLocale::SvFi => "sv-fi", + EmailTemplateLocale::Th => "th", + EmailTemplateLocale::Tn => "tn", + EmailTemplateLocale::Tr => "tr", + EmailTemplateLocale::Ts => "ts", + EmailTemplateLocale::Ua => "ua", + EmailTemplateLocale::Ur => "ur", + EmailTemplateLocale::Ve => "ve", + EmailTemplateLocale::Vi => "vi", + EmailTemplateLocale::Xh => "xh", + EmailTemplateLocale::ZhCn => "zh-cn", + EmailTemplateLocale::ZhHk => "zh-hk", + EmailTemplateLocale::ZhSg => "zh-sg", + EmailTemplateLocale::ZhTw => "zh-tw", + EmailTemplateLocale::Zu => "zu", + } + } +} + +impl std::fmt::Display for EmailTemplateLocale { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.as_str()) + } +} diff --git a/src/enums/email_template_type.rs b/src/enums/email_template_type.rs new file mode 100644 index 0000000..e238933 --- /dev/null +++ b/src/enums/email_template_type.rs @@ -0,0 +1,41 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)] +pub enum EmailTemplateType { + #[serde(rename = "verification")] + #[default] + Verification, + #[serde(rename = "magicSession")] + MagicSession, + #[serde(rename = "recovery")] + Recovery, + #[serde(rename = "invitation")] + Invitation, + #[serde(rename = "mfaChallenge")] + MfaChallenge, + #[serde(rename = "sessionAlert")] + SessionAlert, + #[serde(rename = "otpSession")] + OtpSession, +} + +impl EmailTemplateType { + /// Get the string value of the enum + pub fn as_str(&self) -> &str { + match self { + EmailTemplateType::Verification => "verification", + EmailTemplateType::MagicSession => "magicSession", + EmailTemplateType::Recovery => "recovery", + EmailTemplateType::Invitation => "invitation", + EmailTemplateType::MfaChallenge => "mfaChallenge", + EmailTemplateType::SessionAlert => "sessionAlert", + EmailTemplateType::OtpSession => "otpSession", + } + } +} + +impl std::fmt::Display for EmailTemplateType { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.as_str()) + } +} diff --git a/src/enums/mod.rs b/src/enums/mod.rs index 5190602..1ba833d 100644 --- a/src/enums/mod.rs +++ b/src/enums/mod.rs @@ -52,6 +52,12 @@ pub mod protocol_id; pub use protocol_id::ProtocolId; pub mod service_id; pub use service_id::ServiceId; +pub mod secure; +pub use secure::Secure; +pub mod email_template_type; +pub use email_template_type::EmailTemplateType; +pub mod email_template_locale; +pub use email_template_locale::EmailTemplateLocale; pub mod framework; pub use framework::Framework; pub mod build_runtime; diff --git a/src/enums/runtime.rs b/src/enums/runtime.rs index 6084671..bbd5277 100644 --- a/src/enums/runtime.rs +++ b/src/enums/runtime.rs @@ -65,6 +65,12 @@ pub enum Runtime { PythonMl312, #[serde(rename = "python-ml-3.13")] PythonMl313, + #[serde(rename = "deno-1.21")] + Deno121, + #[serde(rename = "deno-1.24")] + Deno124, + #[serde(rename = "deno-1.35")] + Deno135, #[serde(rename = "deno-1.40")] Deno140, #[serde(rename = "deno-1.46")] @@ -216,6 +222,9 @@ impl Runtime { Runtime::PythonMl311 => "python-ml-3.11", Runtime::PythonMl312 => "python-ml-3.12", Runtime::PythonMl313 => "python-ml-3.13", + Runtime::Deno121 => "deno-1.21", + Runtime::Deno124 => "deno-1.24", + Runtime::Deno135 => "deno-1.35", Runtime::Deno140 => "deno-1.40", Runtime::Deno146 => "deno-1.46", Runtime::Deno20 => "deno-2.0", diff --git a/src/enums/scopes.rs b/src/enums/scopes.rs index 822e1e8..1c3a48b 100644 --- a/src/enums/scopes.rs +++ b/src/enums/scopes.rs @@ -135,6 +135,10 @@ pub enum Scopes { PlatformsWrite, #[serde(rename = "policies.write")] PoliciesWrite, + #[serde(rename = "templates.read")] + TemplatesRead, + #[serde(rename = "templates.write")] + TemplatesWrite, #[serde(rename = "policies.read")] PoliciesRead, #[serde(rename = "archives.read")] @@ -223,6 +227,8 @@ impl Scopes { Scopes::PlatformsRead => "platforms.read", Scopes::PlatformsWrite => "platforms.write", Scopes::PoliciesWrite => "policies.write", + Scopes::TemplatesRead => "templates.read", + Scopes::TemplatesWrite => "templates.write", Scopes::PoliciesRead => "policies.read", Scopes::ArchivesRead => "archives.read", Scopes::ArchivesWrite => "archives.write", diff --git a/src/enums/secure.rs b/src/enums/secure.rs new file mode 100644 index 0000000..6e60a72 --- /dev/null +++ b/src/enums/secure.rs @@ -0,0 +1,26 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default)] +pub enum Secure { + #[serde(rename = "tls")] + #[default] + Tls, + #[serde(rename = "ssl")] + Ssl, +} + +impl Secure { + /// Get the string value of the enum + pub fn as_str(&self) -> &str { + match self { + Secure::Tls => "tls", + Secure::Ssl => "ssl", + } + } +} + +impl std::fmt::Display for Secure { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.as_str()) + } +} diff --git a/src/lib.rs b/src/lib.rs index ab7eedf..6739f6c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,7 +8,7 @@ //! //! ```toml //! [dependencies] -//! appwrite = "0.3.0" +//! appwrite = "0.4.0" //! ``` //! //! ## Usage @@ -51,7 +51,7 @@ pub use input_file::InputFile; pub type Result = std::result::Result; /// SDK version -pub const VERSION: &str = "0.3.0"; +pub const VERSION: &str = "0.4.0"; /// SDK name pub const SDK_NAME: &str = "Rust"; diff --git a/src/models/email_template.rs b/src/models/email_template.rs new file mode 100644 index 0000000..551ccf8 --- /dev/null +++ b/src/models/email_template.rs @@ -0,0 +1,104 @@ +//! EmailTemplate model for Appwrite SDK + +use serde::{Deserialize, Serialize}; + +/// EmailTemplate +#[derive(Debug, Clone, Serialize, Deserialize)] +#[cfg_attr(test, derive(Default))] +pub struct EmailTemplate { + /// Template type + #[serde(rename = "templateId")] + pub template_id: String, + /// Template locale + #[serde(rename = "locale")] + pub locale: String, + /// Template message + #[serde(rename = "message")] + pub message: String, + /// Name of the sender + #[serde(rename = "senderName")] + pub sender_name: String, + /// Email of the sender + #[serde(rename = "senderEmail")] + pub sender_email: String, + /// Reply to email address + #[serde(rename = "replyToEmail")] + pub reply_to_email: String, + /// Reply to name + #[serde(rename = "replyToName")] + pub reply_to_name: String, + /// Email subject + #[serde(rename = "subject")] + pub subject: String, +} + +impl EmailTemplate { + /// Get template_id + pub fn template_id(&self) -> &String { + &self.template_id + } + + /// Get locale + pub fn locale(&self) -> &String { + &self.locale + } + + /// Get message + pub fn message(&self) -> &String { + &self.message + } + + /// Get sender_name + pub fn sender_name(&self) -> &String { + &self.sender_name + } + + /// Get sender_email + pub fn sender_email(&self) -> &String { + &self.sender_email + } + + /// Get reply_to_email + pub fn reply_to_email(&self) -> &String { + &self.reply_to_email + } + + /// Get reply_to_name + pub fn reply_to_name(&self) -> &String { + &self.reply_to_name + } + + /// Get subject + pub fn subject(&self) -> &String { + &self.subject + } + +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_email_template_creation() { + let _model = ::default(); + let _ = _model.template_id(); + let _ = _model.locale(); + let _ = _model.message(); + let _ = _model.sender_name(); + let _ = _model.sender_email(); + let _ = _model.reply_to_email(); + let _ = _model.reply_to_name(); + let _ = _model.subject(); + } + + #[test] + fn test_email_template_serialization() { + let model = ::default(); + let json = serde_json::to_string(&model); + assert!(json.is_ok()); + + let deserialized: Result = serde_json::from_str(&json.unwrap()); + assert!(deserialized.is_ok()); + } +} diff --git a/src/models/membership.rs b/src/models/membership.rs index 269abf9..c3f4ef1 100644 --- a/src/models/membership.rs +++ b/src/models/membership.rs @@ -26,6 +26,10 @@ pub struct Membership { /// the Console. #[serde(rename = "userEmail")] pub user_email: String, + /// User phone number. Hide this attribute by toggling membership privacy in + /// the Console. + #[serde(rename = "userPhone")] + pub user_phone: String, /// Team ID. #[serde(rename = "teamId")] pub team_id: String, @@ -84,6 +88,11 @@ impl Membership { &self.user_email } + /// Get user_phone + pub fn user_phone(&self) -> &String { + &self.user_phone + } + /// Get team_id pub fn team_id(&self) -> &String { &self.team_id @@ -134,6 +143,7 @@ mod tests { let _ = _model.user_id(); let _ = _model.user_name(); let _ = _model.user_email(); + let _ = _model.user_phone(); let _ = _model.team_id(); let _ = _model.team_name(); let _ = _model.invited(); diff --git a/src/models/mod.rs b/src/models/mod.rs index 8af2112..c5b5377 100644 --- a/src/models/mod.rs +++ b/src/models/mod.rs @@ -270,6 +270,8 @@ pub mod headers; pub use headers::Headers; pub mod specification; pub use specification::Specification; +pub mod email_template; +pub use email_template::EmailTemplate; pub mod mfa_challenge; pub use mfa_challenge::MfaChallenge; pub mod mfa_recovery_codes; @@ -453,6 +455,7 @@ impl Model for HealthCertificate {} impl Model for HealthTime {} impl Model for Headers {} impl Model for Specification {} +impl Model for EmailTemplate {} impl Model for MfaChallenge {} impl Model for MfaRecoveryCodes {} impl Model for MfaType {} diff --git a/src/models/project.rs b/src/models/project.rs index 6e82f2e..b3f38ed 100644 --- a/src/models/project.rs +++ b/src/models/project.rs @@ -97,6 +97,12 @@ pub struct Project { /// Whether or not to show user MFA status in the teams membership response. #[serde(rename = "authMembershipsMfa")] pub auth_memberships_mfa: bool, + /// Whether or not to show user IDs in the teams membership response. + #[serde(rename = "authMembershipsUserId")] + pub auth_memberships_user_id: bool, + /// Whether or not to show user phone numbers in the teams membership response. + #[serde(rename = "authMembershipsUserPhone")] + pub auth_memberships_user_phone: bool, /// Whether or not all existing sessions should be invalidated on password /// change #[serde(rename = "authInvalidateSessions")] @@ -125,9 +131,12 @@ pub struct Project { /// SMTP sender email #[serde(rename = "smtpSenderEmail")] pub smtp_sender_email: String, + /// SMTP reply to name + #[serde(rename = "smtpReplyToName")] + pub smtp_reply_to_name: String, /// SMTP reply to email - #[serde(rename = "smtpReplyTo")] - pub smtp_reply_to: String, + #[serde(rename = "smtpReplyToEmail")] + pub smtp_reply_to_email: String, /// SMTP server host name #[serde(rename = "smtpHost")] pub smtp_host: String, @@ -137,7 +146,8 @@ pub struct Project { /// SMTP server username #[serde(rename = "smtpUsername")] pub smtp_username: String, - /// SMTP server password + /// SMTP server password. This property is write-only and always returned + /// empty. #[serde(rename = "smtpPassword")] pub smtp_password: String, /// SMTP server secure protocol @@ -392,6 +402,16 @@ impl Project { &self.auth_memberships_mfa } + /// Get auth_memberships_user_id + pub fn auth_memberships_user_id(&self) -> &bool { + &self.auth_memberships_user_id + } + + /// Get auth_memberships_user_phone + pub fn auth_memberships_user_phone(&self) -> &bool { + &self.auth_memberships_user_phone + } + /// Get auth_invalidate_sessions pub fn auth_invalidate_sessions(&self) -> &bool { &self.auth_invalidate_sessions @@ -437,9 +457,14 @@ impl Project { &self.smtp_sender_email } - /// Get smtp_reply_to - pub fn smtp_reply_to(&self) -> &String { - &self.smtp_reply_to + /// Get smtp_reply_to_name + pub fn smtp_reply_to_name(&self) -> &String { + &self.smtp_reply_to_name + } + + /// Get smtp_reply_to_email + pub fn smtp_reply_to_email(&self) -> &String { + &self.smtp_reply_to_email } /// Get smtp_host @@ -679,6 +704,8 @@ mod tests { let _ = _model.auth_memberships_user_name(); let _ = _model.auth_memberships_user_email(); let _ = _model.auth_memberships_mfa(); + let _ = _model.auth_memberships_user_id(); + let _ = _model.auth_memberships_user_phone(); let _ = _model.auth_invalidate_sessions(); let _ = _model.o_auth_providers(); let _ = _model.platforms(); @@ -688,7 +715,8 @@ mod tests { let _ = _model.smtp_enabled(); let _ = _model.smtp_sender_name(); let _ = _model.smtp_sender_email(); - let _ = _model.smtp_reply_to(); + let _ = _model.smtp_reply_to_name(); + let _ = _model.smtp_reply_to_email(); let _ = _model.smtp_host(); let _ = _model.smtp_port(); let _ = _model.smtp_username(); diff --git a/src/services/project.rs b/src/services/project.rs index d54d88b..c40d651 100644 --- a/src/services/project.rs +++ b/src/services/project.rs @@ -379,9 +379,193 @@ impl Project { self.client.call(Method::DELETE, &path, Some(api_headers), Some(params)).await } - /// Update the status of a specific protocol. Use this endpoint to enable or + /// Updating this policy allows you to control if team members can see other + /// members information. When enabled, all team members can see ID, name, + /// email, phone number, and MFA status of other members.. + pub async fn update_membership_privacy_policy( + &self, + user_id: Option, + user_email: Option, + user_phone: Option, + user_name: Option, + user_mfa: Option, + ) -> crate::error::Result { + let mut params = HashMap::new(); + if let Some(value) = user_id { + params.insert("userId".to_string(), json!(value)); + } + if let Some(value) = user_email { + params.insert("userEmail".to_string(), json!(value)); + } + if let Some(value) = user_phone { + params.insert("userPhone".to_string(), json!(value)); + } + if let Some(value) = user_name { + params.insert("userName".to_string(), json!(value)); + } + if let Some(value) = user_mfa { + params.insert("userMFA".to_string(), json!(value)); + } + let mut api_headers = HashMap::new(); + api_headers.insert("content-type".to_string(), "application/json".to_string()); + + let path = "/project/policies/membership-privacy".to_string(); + + self.client.call(Method::PATCH, &path, Some(api_headers), Some(params)).await + } + + /// Updating this policy allows you to control if new passwords are checked + /// against most common passwords dictionary. When enabled, and user changes + /// their password, password must not be contained in the dictionary. + pub async fn update_password_dictionary_policy( + &self, + enabled: bool, + ) -> crate::error::Result { + let mut params = HashMap::new(); + params.insert("enabled".to_string(), json!(enabled)); + let mut api_headers = HashMap::new(); + api_headers.insert("content-type".to_string(), "application/json".to_string()); + + let path = "/project/policies/password-dictionary".to_string(); + + self.client.call(Method::PATCH, &path, Some(api_headers), Some(params)).await + } + + /// Updates one of password strength policies. Based on total length + /// configured, previous password hashes are stored, and users cannot choose a + /// new password that is already stored in the passwird history list, when + /// updating an user password, or setting new one through password recovery. + /// + /// Keep in mind, while password history policy is disabled, the history is not + /// being stored. Enabling the policy will not have any history on existing + /// users, and it will only start to collect and enforce the policy on password + /// changes since the policy is enabled. + pub async fn update_password_history_policy( + &self, + total: Option, + ) -> crate::error::Result { + let mut params = HashMap::new(); + if let Some(value) = total { + params.insert("total".to_string(), json!(value)); + } + let mut api_headers = HashMap::new(); + api_headers.insert("content-type".to_string(), "application/json".to_string()); + + let path = "/project/policies/password-history".to_string(); + + self.client.call(Method::PATCH, &path, Some(api_headers), Some(params)).await + } + + /// Updating this policy allows you to control if password strength is checked + /// against personal data. When enabled, and user sets or changes their + /// password, the password must not contain user ID, name, email or phone + /// number. + pub async fn update_password_personal_data_policy( + &self, + enabled: bool, + ) -> crate::error::Result { + let mut params = HashMap::new(); + params.insert("enabled".to_string(), json!(enabled)); + let mut api_headers = HashMap::new(); + api_headers.insert("content-type".to_string(), "application/json".to_string()); + + let path = "/project/policies/password-personal-data".to_string(); + + self.client.call(Method::PATCH, &path, Some(api_headers), Some(params)).await + } + + /// Updating this policy allows you to control if email alert is sent upon + /// session creation. When enabled, and user signs into their account, they + /// will be sent an email notification. There is an exception, the first + /// session after a new sign up does not trigger an alert, even if the policy + /// is enabled. + pub async fn update_session_alert_policy( + &self, + enabled: bool, + ) -> crate::error::Result { + let mut params = HashMap::new(); + params.insert("enabled".to_string(), json!(enabled)); + let mut api_headers = HashMap::new(); + api_headers.insert("content-type".to_string(), "application/json".to_string()); + + let path = "/project/policies/session-alert".to_string(); + + self.client.call(Method::PATCH, &path, Some(api_headers), Some(params)).await + } + + /// Update maximum duration how long sessions created within a project should + /// stay active for. + pub async fn update_session_duration_policy( + &self, + duration: i64, + ) -> crate::error::Result { + let mut params = HashMap::new(); + params.insert("duration".to_string(), json!(duration)); + let mut api_headers = HashMap::new(); + api_headers.insert("content-type".to_string(), "application/json".to_string()); + + let path = "/project/policies/session-duration".to_string(); + + self.client.call(Method::PATCH, &path, Some(api_headers), Some(params)).await + } + + /// Updating this policy allows you to control if existing sessions should be + /// invalidated when a password of a user is changed. When enabled, and user + /// changes their password, they will be logged out of all their devices. + pub async fn update_session_invalidation_policy( + &self, + enabled: bool, + ) -> crate::error::Result { + let mut params = HashMap::new(); + params.insert("enabled".to_string(), json!(enabled)); + let mut api_headers = HashMap::new(); + api_headers.insert("content-type".to_string(), "application/json".to_string()); + + let path = "/project/policies/session-invalidation".to_string(); + + self.client.call(Method::PATCH, &path, Some(api_headers), Some(params)).await + } + + /// Update the maximum number of sessions allowed per user. When the limit is + /// hit, the oldest session will be deleted to make room for new one. + pub async fn update_session_limit_policy( + &self, + total: Option, + ) -> crate::error::Result { + let mut params = HashMap::new(); + if let Some(value) = total { + params.insert("total".to_string(), json!(value)); + } + let mut api_headers = HashMap::new(); + api_headers.insert("content-type".to_string(), "application/json".to_string()); + + let path = "/project/policies/session-limit".to_string(); + + self.client.call(Method::PATCH, &path, Some(api_headers), Some(params)).await + } + + /// Update the maximum number of users in the project. When the limit is hit or + /// amount of existing users already exceeded the limit, all users remain + /// active, but new user sign up will be prohibited. + pub async fn update_user_limit_policy( + &self, + total: Option, + ) -> crate::error::Result { + let mut params = HashMap::new(); + if let Some(value) = total { + params.insert("total".to_string(), json!(value)); + } + let mut api_headers = HashMap::new(); + api_headers.insert("content-type".to_string(), "application/json".to_string()); + + let path = "/project/policies/user-limit".to_string(); + + self.client.call(Method::PATCH, &path, Some(api_headers), Some(params)).await + } + + /// Update properties of a specific protocol. Use this endpoint to enable or /// disable a protocol in your project. - pub async fn update_protocol_status( + pub async fn update_protocol( &self, protocol_id: crate::enums::ProtocolId, enabled: bool, @@ -391,14 +575,14 @@ impl Project { let mut api_headers = HashMap::new(); api_headers.insert("content-type".to_string(), "application/json".to_string()); - let path = "/project/protocols/{protocolId}/status".to_string().replace("{protocolId}", &protocol_id.to_string()); + let path = "/project/protocols/{protocolId}".to_string().replace("{protocolId}", &protocol_id.to_string()); self.client.call(Method::PATCH, &path, Some(api_headers), Some(params)).await } - /// Update the status of a specific service. Use this endpoint to enable or + /// Update properties of a specific service. Use this endpoint to enable or /// disable a service in your project. - pub async fn update_service_status( + pub async fn update_service( &self, service_id: crate::enums::ServiceId, enabled: bool, @@ -408,11 +592,145 @@ impl Project { let mut api_headers = HashMap::new(); api_headers.insert("content-type".to_string(), "application/json".to_string()); - let path = "/project/services/{serviceId}/status".to_string().replace("{serviceId}", &service_id.to_string()); + let path = "/project/services/{serviceId}".to_string().replace("{serviceId}", &service_id.to_string()); self.client.call(Method::PATCH, &path, Some(api_headers), Some(params)).await } + /// Update the SMTP configuration for your project. Use this endpoint to + /// configure your project's SMTP provider with your custom settings for + /// sending transactional emails. + #[allow(clippy::too_many_arguments)] + pub async fn update_smtp( + &self, + host: Option<&str>, + port: Option, + username: Option<&str>, + password: Option<&str>, + sender_email: Option<&str>, + sender_name: Option<&str>, + reply_to_email: Option<&str>, + reply_to_name: Option<&str>, + secure: Option, + enabled: Option, + ) -> crate::error::Result { + let mut params = HashMap::new(); + if let Some(value) = host { + params.insert("host".to_string(), json!(value)); + } + if let Some(value) = port { + params.insert("port".to_string(), json!(value)); + } + if let Some(value) = username { + params.insert("username".to_string(), json!(value)); + } + if let Some(value) = password { + params.insert("password".to_string(), json!(value)); + } + if let Some(value) = sender_email { + params.insert("senderEmail".to_string(), json!(value)); + } + if let Some(value) = sender_name { + params.insert("senderName".to_string(), json!(value)); + } + if let Some(value) = reply_to_email { + params.insert("replyToEmail".to_string(), json!(value)); + } + if let Some(value) = reply_to_name { + params.insert("replyToName".to_string(), json!(value)); + } + if let Some(value) = secure { + params.insert("secure".to_string(), json!(value)); + } + if let Some(value) = enabled { + params.insert("enabled".to_string(), json!(value)); + } + let mut api_headers = HashMap::new(); + api_headers.insert("content-type".to_string(), "application/json".to_string()); + + let path = "/project/smtp".to_string(); + + self.client.call(Method::PATCH, &path, Some(api_headers), Some(params)).await + } + + /// Send a test email to verify SMTP configuration. + pub async fn create_smtp_test( + &self, + emails: impl IntoIterator>, + ) -> crate::error::Result<()> { + let mut params = HashMap::new(); + params.insert("emails".to_string(), json!(emails.into_iter().map(|s| s.into()).collect::>())); + let mut api_headers = HashMap::new(); + api_headers.insert("content-type".to_string(), "application/json".to_string()); + + let path = "/project/smtp/tests".to_string(); + + self.client.call(Method::POST, &path, Some(api_headers), Some(params)).await + } + + /// Update a custom email template for the specified locale and type. Use this + /// endpoint to modify the content of your email templates. + #[allow(clippy::too_many_arguments)] + pub async fn update_email_template( + &self, + template_id: crate::enums::EmailTemplateType, + locale: Option, + subject: Option<&str>, + message: Option<&str>, + sender_name: Option<&str>, + sender_email: Option<&str>, + reply_to_email: Option<&str>, + reply_to_name: Option<&str>, + ) -> crate::error::Result { + let mut params = HashMap::new(); + params.insert("templateId".to_string(), json!(template_id)); + if let Some(value) = locale { + params.insert("locale".to_string(), json!(value)); + } + if let Some(value) = subject { + params.insert("subject".to_string(), json!(value)); + } + if let Some(value) = message { + params.insert("message".to_string(), json!(value)); + } + if let Some(value) = sender_name { + params.insert("senderName".to_string(), json!(value)); + } + if let Some(value) = sender_email { + params.insert("senderEmail".to_string(), json!(value)); + } + if let Some(value) = reply_to_email { + params.insert("replyToEmail".to_string(), json!(value)); + } + if let Some(value) = reply_to_name { + params.insert("replyToName".to_string(), json!(value)); + } + let mut api_headers = HashMap::new(); + api_headers.insert("content-type".to_string(), "application/json".to_string()); + + let path = "/project/templates/email".to_string(); + + self.client.call(Method::PATCH, &path, Some(api_headers), Some(params)).await + } + + /// Get a custom email template for the specified locale and type. This + /// endpoint returns the template content, subject, and other configuration + /// details. + pub async fn get_email_template( + &self, + template_id: crate::enums::EmailTemplateType, + locale: Option, + ) -> crate::error::Result { + let mut params = HashMap::new(); + if let Some(value) = locale { + params.insert("locale".to_string(), json!(value)); + } + + let path = "/project/templates/email/{templateId}".to_string().replace("{templateId}", &template_id.to_string()); + + self.client.call(Method::GET, &path, None, Some(params)).await + } + /// Get a list of all project environment variables. pub async fn list_variables( &self, From 400edb333ee87d204e7465bb352f08a7c9250c30 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Fri, 1 May 2026 20:46:11 +0530 Subject: [PATCH 2/2] chore: update Rust SDK to 0.4.0 --- Cargo.toml | 6 +++--- docs/examples/databases/update-boolean-attribute.md | 2 +- docs/examples/databases/update-datetime-attribute.md | 2 +- docs/examples/databases/update-email-attribute.md | 2 +- docs/examples/databases/update-enum-attribute.md | 2 +- docs/examples/databases/update-float-attribute.md | 2 +- docs/examples/databases/update-integer-attribute.md | 2 +- docs/examples/databases/update-ip-attribute.md | 2 +- docs/examples/databases/update-longtext-attribute.md | 2 +- docs/examples/databases/update-mediumtext-attribute.md | 2 +- docs/examples/databases/update-string-attribute.md | 2 +- docs/examples/databases/update-text-attribute.md | 2 +- docs/examples/databases/update-url-attribute.md | 2 +- docs/examples/databases/update-varchar-attribute.md | 2 +- docs/examples/project/update-password-history-policy.md | 2 +- docs/examples/project/update-session-limit-policy.md | 2 +- docs/examples/project/update-user-limit-policy.md | 2 +- docs/examples/tablesdb/update-boolean-column.md | 2 +- docs/examples/tablesdb/update-datetime-column.md | 2 +- docs/examples/tablesdb/update-email-column.md | 2 +- docs/examples/tablesdb/update-enum-column.md | 2 +- docs/examples/tablesdb/update-float-column.md | 2 +- docs/examples/tablesdb/update-integer-column.md | 2 +- docs/examples/tablesdb/update-ip-column.md | 2 +- docs/examples/tablesdb/update-longtext-column.md | 2 +- docs/examples/tablesdb/update-mediumtext-column.md | 2 +- docs/examples/tablesdb/update-string-column.md | 2 +- docs/examples/tablesdb/update-text-column.md | 2 +- docs/examples/tablesdb/update-url-column.md | 2 +- docs/examples/tablesdb/update-varchar-column.md | 2 +- 30 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3cdec9b..88b013a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,9 +22,9 @@ serde_json = "1.0.149" reqwest = { version = "0.12.28", features = ["json", "multipart", "stream"] } tokio = { version = "1.48.0", features = ["full"] } indexmap = ">=2, <2.14" -url = "=2.5.4" -idna = "=1.0.3" -idna_adapter = "=1.0.0" +url = ">=2.5.4, <2.6" +idna = ">=1.0.3, <1.2" +idna_adapter = ">=1.0.0, <1.1" mime = "0.3.17" fastrand = "=2.0.2" thiserror = "1.0.69" diff --git a/docs/examples/databases/update-boolean-attribute.md b/docs/examples/databases/update-boolean-attribute.md index 3b21d42..b3477b3 100644 --- a/docs/examples/databases/update-boolean-attribute.md +++ b/docs/examples/databases/update-boolean-attribute.md @@ -16,7 +16,7 @@ async fn main() -> Result<(), Box> { "", "", false, - false, + Some(false), Some("") // optional ).await?; diff --git a/docs/examples/databases/update-datetime-attribute.md b/docs/examples/databases/update-datetime-attribute.md index 66d2090..0f431d1 100644 --- a/docs/examples/databases/update-datetime-attribute.md +++ b/docs/examples/databases/update-datetime-attribute.md @@ -16,7 +16,7 @@ async fn main() -> Result<(), Box> { "", "", false, - "2020-10-15T06:38:00.000+00:00", + Some("2020-10-15T06:38:00.000+00:00"), Some("") // optional ).await?; diff --git a/docs/examples/databases/update-email-attribute.md b/docs/examples/databases/update-email-attribute.md index c4c77f2..417681b 100644 --- a/docs/examples/databases/update-email-attribute.md +++ b/docs/examples/databases/update-email-attribute.md @@ -16,7 +16,7 @@ async fn main() -> Result<(), Box> { "", "", false, - "email@example.com", + Some("email@example.com"), Some("") // optional ).await?; diff --git a/docs/examples/databases/update-enum-attribute.md b/docs/examples/databases/update-enum-attribute.md index 2567755..66d5e71 100644 --- a/docs/examples/databases/update-enum-attribute.md +++ b/docs/examples/databases/update-enum-attribute.md @@ -17,7 +17,7 @@ async fn main() -> Result<(), Box> { "", vec![], false, - "", + Some(""), Some("") // optional ).await?; diff --git a/docs/examples/databases/update-float-attribute.md b/docs/examples/databases/update-float-attribute.md index e36d6cb..e63c364 100644 --- a/docs/examples/databases/update-float-attribute.md +++ b/docs/examples/databases/update-float-attribute.md @@ -16,7 +16,7 @@ async fn main() -> Result<(), Box> { "", "", false, - 0, + Some(0), Some(0), // optional Some(0), // optional Some("") // optional diff --git a/docs/examples/databases/update-integer-attribute.md b/docs/examples/databases/update-integer-attribute.md index f1ff193..9e6d0bc 100644 --- a/docs/examples/databases/update-integer-attribute.md +++ b/docs/examples/databases/update-integer-attribute.md @@ -16,7 +16,7 @@ async fn main() -> Result<(), Box> { "", "", false, - 0, + Some(0), Some(0), // optional Some(0), // optional Some("") // optional diff --git a/docs/examples/databases/update-ip-attribute.md b/docs/examples/databases/update-ip-attribute.md index 65e2980..7f3416e 100644 --- a/docs/examples/databases/update-ip-attribute.md +++ b/docs/examples/databases/update-ip-attribute.md @@ -16,7 +16,7 @@ async fn main() -> Result<(), Box> { "", "", false, - "", + Some(""), Some("") // optional ).await?; diff --git a/docs/examples/databases/update-longtext-attribute.md b/docs/examples/databases/update-longtext-attribute.md index a5af120..3936d90 100644 --- a/docs/examples/databases/update-longtext-attribute.md +++ b/docs/examples/databases/update-longtext-attribute.md @@ -16,7 +16,7 @@ async fn main() -> Result<(), Box> { "", "", false, - "", + Some(""), Some("") // optional ).await?; diff --git a/docs/examples/databases/update-mediumtext-attribute.md b/docs/examples/databases/update-mediumtext-attribute.md index 9587103..e208ed7 100644 --- a/docs/examples/databases/update-mediumtext-attribute.md +++ b/docs/examples/databases/update-mediumtext-attribute.md @@ -16,7 +16,7 @@ async fn main() -> Result<(), Box> { "", "", false, - "", + Some(""), Some("") // optional ).await?; diff --git a/docs/examples/databases/update-string-attribute.md b/docs/examples/databases/update-string-attribute.md index 9fa09d6..d30640a 100644 --- a/docs/examples/databases/update-string-attribute.md +++ b/docs/examples/databases/update-string-attribute.md @@ -16,7 +16,7 @@ async fn main() -> Result<(), Box> { "", "", false, - "", + Some(""), Some(1), // optional Some("") // optional ).await?; diff --git a/docs/examples/databases/update-text-attribute.md b/docs/examples/databases/update-text-attribute.md index 83a11d3..eaf9a17 100644 --- a/docs/examples/databases/update-text-attribute.md +++ b/docs/examples/databases/update-text-attribute.md @@ -16,7 +16,7 @@ async fn main() -> Result<(), Box> { "", "", false, - "", + Some(""), Some("") // optional ).await?; diff --git a/docs/examples/databases/update-url-attribute.md b/docs/examples/databases/update-url-attribute.md index 04992ea..5d384f5 100644 --- a/docs/examples/databases/update-url-attribute.md +++ b/docs/examples/databases/update-url-attribute.md @@ -16,7 +16,7 @@ async fn main() -> Result<(), Box> { "", "", false, - "https://example.com", + Some("https://example.com"), Some("") // optional ).await?; diff --git a/docs/examples/databases/update-varchar-attribute.md b/docs/examples/databases/update-varchar-attribute.md index 69e9571..5ca0b24 100644 --- a/docs/examples/databases/update-varchar-attribute.md +++ b/docs/examples/databases/update-varchar-attribute.md @@ -16,7 +16,7 @@ async fn main() -> Result<(), Box> { "", "", false, - "", + Some(""), Some(1), // optional Some("") // optional ).await?; diff --git a/docs/examples/project/update-password-history-policy.md b/docs/examples/project/update-password-history-policy.md index c45e8a8..1b88480 100644 --- a/docs/examples/project/update-password-history-policy.md +++ b/docs/examples/project/update-password-history-policy.md @@ -12,7 +12,7 @@ async fn main() -> Result<(), Box> { let project = Project::new(&client); let result = project.update_password_history_policy( - 1 + Some(1) ).await?; let _ = result; diff --git a/docs/examples/project/update-session-limit-policy.md b/docs/examples/project/update-session-limit-policy.md index fd958cf..c4e9aa9 100644 --- a/docs/examples/project/update-session-limit-policy.md +++ b/docs/examples/project/update-session-limit-policy.md @@ -12,7 +12,7 @@ async fn main() -> Result<(), Box> { let project = Project::new(&client); let result = project.update_session_limit_policy( - 1 + Some(1) ).await?; let _ = result; diff --git a/docs/examples/project/update-user-limit-policy.md b/docs/examples/project/update-user-limit-policy.md index dd679d4..2b2d999 100644 --- a/docs/examples/project/update-user-limit-policy.md +++ b/docs/examples/project/update-user-limit-policy.md @@ -12,7 +12,7 @@ async fn main() -> Result<(), Box> { let project = Project::new(&client); let result = project.update_user_limit_policy( - 1 + Some(1) ).await?; let _ = result; diff --git a/docs/examples/tablesdb/update-boolean-column.md b/docs/examples/tablesdb/update-boolean-column.md index 88e6755..a7a871a 100644 --- a/docs/examples/tablesdb/update-boolean-column.md +++ b/docs/examples/tablesdb/update-boolean-column.md @@ -16,7 +16,7 @@ async fn main() -> Result<(), Box> { "", "", false, - false, + Some(false), Some("") // optional ).await?; diff --git a/docs/examples/tablesdb/update-datetime-column.md b/docs/examples/tablesdb/update-datetime-column.md index 56dbd2f..6200842 100644 --- a/docs/examples/tablesdb/update-datetime-column.md +++ b/docs/examples/tablesdb/update-datetime-column.md @@ -16,7 +16,7 @@ async fn main() -> Result<(), Box> { "", "", false, - "2020-10-15T06:38:00.000+00:00", + Some("2020-10-15T06:38:00.000+00:00"), Some("") // optional ).await?; diff --git a/docs/examples/tablesdb/update-email-column.md b/docs/examples/tablesdb/update-email-column.md index 669eae0..e19b352 100644 --- a/docs/examples/tablesdb/update-email-column.md +++ b/docs/examples/tablesdb/update-email-column.md @@ -16,7 +16,7 @@ async fn main() -> Result<(), Box> { "", "", false, - "email@example.com", + Some("email@example.com"), Some("") // optional ).await?; diff --git a/docs/examples/tablesdb/update-enum-column.md b/docs/examples/tablesdb/update-enum-column.md index 78faa5b..d0de7b0 100644 --- a/docs/examples/tablesdb/update-enum-column.md +++ b/docs/examples/tablesdb/update-enum-column.md @@ -17,7 +17,7 @@ async fn main() -> Result<(), Box> { "", vec![], false, - "", + Some(""), Some("") // optional ).await?; diff --git a/docs/examples/tablesdb/update-float-column.md b/docs/examples/tablesdb/update-float-column.md index 5bfc272..77ee532 100644 --- a/docs/examples/tablesdb/update-float-column.md +++ b/docs/examples/tablesdb/update-float-column.md @@ -16,7 +16,7 @@ async fn main() -> Result<(), Box> { "", "", false, - 0, + Some(0), Some(0), // optional Some(0), // optional Some("") // optional diff --git a/docs/examples/tablesdb/update-integer-column.md b/docs/examples/tablesdb/update-integer-column.md index 42b33f7..a290193 100644 --- a/docs/examples/tablesdb/update-integer-column.md +++ b/docs/examples/tablesdb/update-integer-column.md @@ -16,7 +16,7 @@ async fn main() -> Result<(), Box> { "", "", false, - 0, + Some(0), Some(0), // optional Some(0), // optional Some("") // optional diff --git a/docs/examples/tablesdb/update-ip-column.md b/docs/examples/tablesdb/update-ip-column.md index dc88ba6..d20dc47 100644 --- a/docs/examples/tablesdb/update-ip-column.md +++ b/docs/examples/tablesdb/update-ip-column.md @@ -16,7 +16,7 @@ async fn main() -> Result<(), Box> { "", "", false, - "", + Some(""), Some("") // optional ).await?; diff --git a/docs/examples/tablesdb/update-longtext-column.md b/docs/examples/tablesdb/update-longtext-column.md index 0bf4ba1..e7867b1 100644 --- a/docs/examples/tablesdb/update-longtext-column.md +++ b/docs/examples/tablesdb/update-longtext-column.md @@ -16,7 +16,7 @@ async fn main() -> Result<(), Box> { "", "", false, - "", + Some(""), Some("") // optional ).await?; diff --git a/docs/examples/tablesdb/update-mediumtext-column.md b/docs/examples/tablesdb/update-mediumtext-column.md index 7349864..df7813f 100644 --- a/docs/examples/tablesdb/update-mediumtext-column.md +++ b/docs/examples/tablesdb/update-mediumtext-column.md @@ -16,7 +16,7 @@ async fn main() -> Result<(), Box> { "", "", false, - "", + Some(""), Some("") // optional ).await?; diff --git a/docs/examples/tablesdb/update-string-column.md b/docs/examples/tablesdb/update-string-column.md index cdedb15..0bdf03a 100644 --- a/docs/examples/tablesdb/update-string-column.md +++ b/docs/examples/tablesdb/update-string-column.md @@ -16,7 +16,7 @@ async fn main() -> Result<(), Box> { "", "", false, - "", + Some(""), Some(1), // optional Some("") // optional ).await?; diff --git a/docs/examples/tablesdb/update-text-column.md b/docs/examples/tablesdb/update-text-column.md index fa8126a..8b29968 100644 --- a/docs/examples/tablesdb/update-text-column.md +++ b/docs/examples/tablesdb/update-text-column.md @@ -16,7 +16,7 @@ async fn main() -> Result<(), Box> { "", "", false, - "", + Some(""), Some("") // optional ).await?; diff --git a/docs/examples/tablesdb/update-url-column.md b/docs/examples/tablesdb/update-url-column.md index 0baa59c..853a5ec 100644 --- a/docs/examples/tablesdb/update-url-column.md +++ b/docs/examples/tablesdb/update-url-column.md @@ -16,7 +16,7 @@ async fn main() -> Result<(), Box> { "", "", false, - "https://example.com", + Some("https://example.com"), Some("") // optional ).await?; diff --git a/docs/examples/tablesdb/update-varchar-column.md b/docs/examples/tablesdb/update-varchar-column.md index 5213898..ff3a27f 100644 --- a/docs/examples/tablesdb/update-varchar-column.md +++ b/docs/examples/tablesdb/update-varchar-column.md @@ -16,7 +16,7 @@ async fn main() -> Result<(), Box> { "", "", false, - "", + Some(""), Some(1), // optional Some("") // optional ).await?;