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
17 changes: 12 additions & 5 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.8.0] - TBD
## [0.9.0] - TBD

### Added
- Initial release of Appwrite Rust SDK
Expand All @@ -29,12 +29,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Databases service with 71 methods
- Functions service with 26 methods
- Graphql service with 2 methods
- Health service with 24 methods
- Health service with 25 methods
- Locale service with 8 methods
- Messaging service with 56 methods
- Messaging service with 58 methods
- Organization service with 10 methods
- Presences service with 5 methods
- Project service with 98 methods
- Project service with 100 methods
- Proxy service with 8 methods
- Advisor service with 5 methods
- Sites service with 25 methods
Expand Down Expand Up @@ -334,6 +334,8 @@ The GraphQL API allows you to query and mutate your Appwrite server using GraphQ
The Health service allows you to both validate and monitor your Appwrite server's health.
- `get()` - Check the Appwrite HTTP server is up and responsive.
- `get_antivirus()` - Check the Appwrite Antivirus server is up and connection is successful.
- `get_audits_db()` - Check the database that backs the audit and activity store. When the connection is reachable the endpoint returns a passing status with its response time.

- `get_cache()` - Check the Appwrite in-memory cache servers are up and connection is successful.
- `get_certificate()` - Get the SSL certificate for a domain
- `get_console_pausing()` - Get console pausing health status. Monitors projects approaching the pause threshold to detect potential issues with console access tracking.
Expand Down Expand Up @@ -410,6 +412,8 @@ The Messaging service allows you to send messages to any provider type (SMTP, pu
- `update_resend_provider()` - Update a Resend provider by its unique ID.
- `create_sendgrid_provider()` - Create a new Sendgrid provider.
- `update_sendgrid_provider()` - Update a Sendgrid provider by its unique ID.
- `create_ses_provider()` - Create a new Amazon SES provider.
- `update_ses_provider()` - Update an Amazon SES provider by its unique ID.
- `create_smtp_provider()` - Create a new SMTP provider.
- `create_smtp_provider()` - Create a new SMTP provider.
- `update_smtp_provider()` - Update a SMTP provider by its unique ID.
Expand Down Expand Up @@ -489,6 +493,7 @@ You can also create a standard API key if you need a longer-lived key instead.
- `update_mock_phone()` - Update a mock phone by its unique number. Use this endpoint to update the mock phone's OTP.
- `delete_mock_phone()` - Delete a mock phone by its unique number. This endpoint removes the mock phone and its OTP configuration from the project.
- `list_o_auth2_providers()` - Get a list of all OAuth2 providers supported by the server, along with the project's configuration for each. Credential fields are write-only and always returned empty.
- `update_o_auth2_server()` - Update the OAuth2 server (OIDC provider) configuration.
- `update_o_auth2_amazon()` - Update the project OAuth2 Amazon configuration.
- `update_o_auth2_apple()` - Update the project OAuth2 Apple configuration.
- `update_o_auth2_auth0()` - Update the project OAuth2 Auth0 configuration.
Expand Down Expand Up @@ -555,6 +560,7 @@ You can also create a standard API key if you need a longer-lived key instead.

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_password_strength_policy()` - Update the password strength requirements for users in the project.
- `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.
Expand Down Expand Up @@ -1046,6 +1052,7 @@ If you want to generate a token for a custom authentication flow, use the [POST
- `OAuth2ProviderList` - OAuth2 Providers List
- `PolicyPasswordDictionary` - Policy Password Dictionary
- `PolicyPasswordHistory` - Policy Password History
- `PolicyPasswordStrength` - Policy Password Strength
- `PolicyPasswordPersonalData` - Policy Password Personal Data
- `PolicySessionAlert` - Policy Session Alert
- `PolicySessionDuration` - Policy Session Duration
Expand Down Expand Up @@ -1119,4 +1126,4 @@ If you want to generate a token for a custom authentication flow, use the [POST
- File upload examples
- Query builder documentation

[0.8.0]: https://github.com/appwrite/sdk-for-rust/releases/tag/0.8.0
[0.9.0]: https://github.com/appwrite/sdk-for-rust/releases/tag/0.9.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.8.0"
version = "0.9.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.8.0"
appwrite = "0.9.0"
tokio = { version = "1.48", features = ["full"] }
```

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/account/update-password.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {

let result = account.update_password(
"",
Some("password") // optional
Some("<OLD_PASSWORD>") // optional
).await?;

let _ = result;
Expand Down
20 changes: 20 additions & 0 deletions docs/examples/health/get-audits-db.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
```rust
use appwrite::Client;
use appwrite::services::Health;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
client.set_endpoint("https://<REGION>.cloud.appwrite.io/v1"); // Your API Endpoint
client.set_project("<YOUR_PROJECT_ID>"); // Your project ID
client.set_key("<YOUR_API_KEY>"); // Your secret API key

let health = Health::new(&client);

let result = health.get_audits_db().await?;

let _ = result;

Ok(())
}
```
31 changes: 31 additions & 0 deletions docs/examples/messaging/create-ses-provider.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
```rust
use appwrite::Client;
use appwrite::services::Messaging;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
client.set_endpoint("https://<REGION>.cloud.appwrite.io/v1"); // Your API Endpoint
client.set_project("<YOUR_PROJECT_ID>"); // Your project ID
client.set_key("<YOUR_API_KEY>"); // Your secret API key

let messaging = Messaging::new(&client);

let result = messaging.create_ses_provider(
"<PROVIDER_ID>",
"<NAME>",
Some("<ACCESS_KEY>"), // optional
Some("<SECRET_KEY>"), // optional
Some("<REGION>"), // optional
Some("<FROM_NAME>"), // optional
Some("email@example.com"), // optional
Some("<REPLY_TO_NAME>"), // optional
Some("email@example.com"), // optional
Some(false) // optional
).await?;

let _ = result;

Ok(())
}
```
31 changes: 31 additions & 0 deletions docs/examples/messaging/update-ses-provider.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
```rust
use appwrite::Client;
use appwrite::services::Messaging;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
client.set_endpoint("https://<REGION>.cloud.appwrite.io/v1"); // Your API Endpoint
client.set_project("<YOUR_PROJECT_ID>"); // Your project ID
client.set_key("<YOUR_API_KEY>"); // Your secret API key

let messaging = Messaging::new(&client);

let result = messaging.update_ses_provider(
"<PROVIDER_ID>",
Some("<NAME>"), // optional
Some(false), // optional
Some("<ACCESS_KEY>"), // optional
Some("<SECRET_KEY>"), // optional
Some("<REGION>"), // optional
Some("<FROM_NAME>"), // optional
Some("email@example.com"), // optional
Some("<REPLY_TO_NAME>"), // optional
Some("<REPLY_TO_EMAIL>") // optional
).await?;

let _ = result;

Ok(())
}
```
29 changes: 29 additions & 0 deletions docs/examples/project/update-o-auth-2-server.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
```rust
use appwrite::Client;
use appwrite::services::Project;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
client.set_endpoint("https://<REGION>.cloud.appwrite.io/v1"); // Your API Endpoint
client.set_project("<YOUR_PROJECT_ID>"); // Your project ID
client.set_key("<YOUR_API_KEY>"); // Your secret API key

let project = Project::new(&client);

let result = project.update_o_auth2_server(
false,
"https://example.com",
Some(vec![]), // optional
Some(60), // optional
Some(60), // optional
Some(60), // optional
Some(60), // optional
Some(false) // optional
).await?;

let _ = result;

Ok(())
}
```
26 changes: 26 additions & 0 deletions docs/examples/project/update-password-strength-policy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
```rust
use appwrite::Client;
use appwrite::services::Project;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
client.set_endpoint("https://<REGION>.cloud.appwrite.io/v1"); // Your API Endpoint
client.set_project("<YOUR_PROJECT_ID>"); // Your project ID
client.set_key("<YOUR_API_KEY>"); // Your secret API key

let project = Project::new(&client);

let result = project.update_password_strength_policy(
Some(8), // optional
Some(false), // optional
Some(false), // optional
Some(false), // optional
Some(false) // optional
).await?;

let _ = result;

Ok(())
}
```
4 changes: 2 additions & 2 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ impl Client {
pub fn new() -> Self {
let mut headers = HeaderMap::new();
headers.insert("X-Appwrite-Response-Format", "1.9.5".parse().unwrap());
headers.insert("user-agent", format!("AppwriteRustSDK/0.8.0 ({}; {})", std::env::consts::OS, std::env::consts::ARCH).parse().unwrap());
headers.insert("user-agent", format!("AppwriteRustSDK/0.9.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.8.0".parse().unwrap());
headers.insert("x-sdk-version", "0.9.0".parse().unwrap());

let config = Config {
endpoint: "https://cloud.appwrite.io/v1".to_string(),
Expand Down
6 changes: 6 additions & 0 deletions src/enums/project_key_scopes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ pub enum ProjectKeyScopes {
DomainsWrite,
#[serde(rename = "events.read")]
EventsRead,
#[serde(rename = "apps.read")]
AppsRead,
#[serde(rename = "apps.write")]
AppsWrite,
#[serde(rename = "usage.read")]
UsageRead,
}
Expand Down Expand Up @@ -290,6 +294,8 @@ impl ProjectKeyScopes {
ProjectKeyScopes::DomainsRead => "domains.read",
ProjectKeyScopes::DomainsWrite => "domains.write",
ProjectKeyScopes::EventsRead => "events.read",
ProjectKeyScopes::AppsRead => "apps.read",
ProjectKeyScopes::AppsWrite => "apps.write",
ProjectKeyScopes::UsageRead => "usage.read",
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/enums/project_policy_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ pub enum ProjectPolicyId {
PasswordDictionary,
#[serde(rename = "password-history")]
PasswordHistory,
#[serde(rename = "password-strength")]
PasswordStrength,
#[serde(rename = "password-personal-data")]
PasswordPersonalData,
#[serde(rename = "session-alert")]
Expand Down Expand Up @@ -35,6 +37,7 @@ impl ProjectPolicyId {
match self {
ProjectPolicyId::PasswordDictionary => "password-dictionary",
ProjectPolicyId::PasswordHistory => "password-history",
ProjectPolicyId::PasswordStrength => "password-strength",
ProjectPolicyId::PasswordPersonalData => "password-personal-data",
ProjectPolicyId::SessionAlert => "session-alert",
ProjectPolicyId::SessionDuration => "session-duration",
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.8.0"
//! appwrite = "0.9.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.8.0";
pub const VERSION: &str = "0.9.0";

/// SDK name
pub const SDK_NAME: &str = "Rust";
Expand Down
3 changes: 3 additions & 0 deletions src/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,8 @@ pub mod policy_password_dictionary;
pub use policy_password_dictionary::PolicyPasswordDictionary;
pub mod policy_password_history;
pub use policy_password_history::PolicyPasswordHistory;
pub mod policy_password_strength;
pub use policy_password_strength::PolicyPasswordStrength;
pub mod policy_password_personal_data;
pub use policy_password_personal_data::PolicyPasswordPersonalData;
pub mod policy_session_alert;
Expand Down Expand Up @@ -643,6 +645,7 @@ impl Model for OAuth2Microsoft {}
impl Model for OAuth2ProviderList {}
impl Model for PolicyPasswordDictionary {}
impl Model for PolicyPasswordHistory {}
impl Model for PolicyPasswordStrength {}
impl Model for PolicyPasswordPersonalData {}
impl Model for PolicySessionAlert {}
impl Model for PolicySessionDuration {}
Expand Down
Loading