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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
46 changes: 41 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.2.0] - TBD
## [0.3.0] - TBD

### Added
- Initial release of Appwrite Rust SDK
- Full support for Appwrite API 1.9.0
- Full support for Appwrite API 1.9.1
- Async/await support with tokio runtime
- Built-in error handling with custom error types
- File upload support with automatic chunking
Expand All @@ -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 5 methods
- Project service with 26 methods
- Sites service with 25 methods
- Storage service with 13 methods
- TablesDB service with 69 methods
Expand Down Expand Up @@ -332,6 +332,7 @@ The Health service allows you to both validate and monitor your Appwrite server&
- `get_db()` - Check the Appwrite database servers are up and connection is successful.
- `get_pub_sub()` - Check the Appwrite pub-sub servers are up and connection is successful.
- `get_queue_audits()` - Get the number of audit logs that are waiting to be processed in the Appwrite internal queue server.

- `get_queue_builds()` - Get the number of builds that are waiting to be processed in the Appwrite internal queue server.
- `get_queue_certificates()` - Get the number of certificates that are waiting to be issued against [Letsencrypt](https://letsencrypt.org/) in the Appwrite internal queue server.
- `get_queue_databases()` - Get the number of database changes that are waiting to be processed in the Appwrite internal queue server.
Expand Down Expand Up @@ -433,6 +434,27 @@ The Messaging service allows you to send messages to any provider type (SMTP, pu

#### Project
The Project service allows you to manage all the projects in your Appwrite server.
- `list_keys()` - Get a list of all API keys from the current project.
- `create_key()` - Create a new API key. It's recommended to have multiple API keys with strict scopes for separate functions within your project.
- `get_key()` - Get a key by its unique ID.
- `update_key()` - Update a key by its unique ID. Use this endpoint to update the name, scopes, or expiration time of an API key.
- `delete_key()` - Delete a key by its unique ID. Once deleted, the key can no longer be used to authenticate API calls.
- `update_labels()` - Update the project labels. Labels can be used to easily filter projects in an organization.
- `list_platforms()` - Get a list of all platforms in the project. This endpoint returns an array of all platforms and their configurations.
- `create_android_platform()` - Create a new Android platform for your project. Use this endpoint to register a new Android platform where your users will run your application which will interact with the Appwrite API.
- `update_android_platform()` - Update an Android platform by its unique ID. Use this endpoint to update the platform's name or application ID.
- `create_apple_platform()` - Create a new Apple platform for your project. Use this endpoint to register a new Apple platform where your users will run your application which will interact with the Appwrite API.
- `update_apple_platform()` - Update an Apple platform by its unique ID. Use this endpoint to update the platform's name or bundle identifier.
- `create_linux_platform()` - Create a new Linux platform for your project. Use this endpoint to register a new Linux platform where your users will run your application which will interact with the Appwrite API.
- `update_linux_platform()` - Update a Linux platform by its unique ID. Use this endpoint to update the platform's name or package name.
- `create_web_platform()` - Create a new web platform for your project. Use this endpoint to register a new platform where your users will run your application which will interact with the Appwrite API.
- `update_web_platform()` - Update a web platform by its unique ID. Use this endpoint to update the platform's name or hostname.
- `create_windows_platform()` - Create a new Windows platform for your project. Use this endpoint to register a new Windows platform where your users will run your application which will interact with the Appwrite API.
- `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.
- `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.
Expand Down Expand Up @@ -693,7 +715,7 @@ If you want to generate a token for a custom authentication flow, use the [POST
- `get()` - Get a webhook by its unique ID. This endpoint returns details about a specific webhook configured for a project.
- `update()` - Update a webhook by its unique ID. Use this endpoint to update the URL, events, or status of an existing webhook.
- `delete()` - Delete a webhook by its unique ID. Once deleted, the webhook will no longer receive project events.
- `update_signature()` - Update the webhook signature key. This endpoint can be used to regenerate the signature key used to sign and validate payload deliveries for a specific webhook.
- `update_secret()` - Update the webhook signing key. This endpoint can be used to regenerate the signing key used to sign and validate payload deliveries for a specific webhook.


### Models
Expand All @@ -720,6 +742,7 @@ If you want to generate a token for a custom authentication flow, use the [POST
- `DeploymentList` - Deployments List
- `ExecutionList` - Executions List
- `WebhookList` - Webhooks List
- `KeyList` - API Keys List
- `CountryList` - Countries List
- `ContinentList` - Continents List
- `LanguageList` - Languages List
Expand Down Expand Up @@ -806,7 +829,18 @@ If you want to generate a token for a custom authentication flow, use the [POST
- `FrameworkAdapter` - Framework Adapter
- `Deployment` - Deployment
- `Execution` - Execution
- `Project` - Project
- `Webhook` - Webhook
- `Key` - Key
- `DevKey` - DevKey
- `MockNumber` - Mock Number
- `AuthProvider` - AuthProvider
- `PlatformWeb` - Platform Web
- `PlatformApple` - Platform Apple
- `PlatformAndroid` - Platform Android
- `PlatformWindows` - Platform Windows
- `PlatformLinux` - Platform Linux
- `PlatformList` - Platforms List
- `Variable` - Variable
- `Country` - Country
- `Continent` - Continent
Expand All @@ -832,6 +866,8 @@ If you want to generate a token for a custom authentication flow, use the [POST
- `Target` - Target
- `ActivityEvent` - ActivityEvent
- `BackupArchive` - Archive
- `BillingLimits` - BillingLimits
- `Block` - Block
- `BackupPolicy` - backup
- `BackupRestoration` - Restoration
- `ActivityEventList` - Activity event list
Expand All @@ -853,4 +889,4 @@ If you want to generate a token for a custom authentication flow, use the [POST
- File upload examples
- Query builder documentation

[0.2.0]: https://github.com/appwrite/sdk-for-rust/releases/tag/0.2.0
[0.3.0]: https://github.com/appwrite/sdk-for-rust/releases/tag/0.3.0
22 changes: 13 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "appwrite"
version = "0.2.0"
version = "0.3.0"
edition = "2021"
rust-version = "1.83"
authors = ["appwrite"]
Expand All @@ -18,19 +18,23 @@ autobenches = false

[dependencies]
serde = { version = "1.0.228", features = ["derive"] }
serde_json = "1.0"
serde_json = "1.0.149"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Unused dependency added

indexmap is declared as a dependency but is not imported or used anywhere in the source tree (src/). This adds unnecessary compile time and bloat to the dependency graph. If it's intended for a future change, it should be added in the same PR that uses it.

Suggested change
serde_json = "1.0.149"

(Remove the indexmap = ">=2, <2.12" line entirely.)

reqwest = { version = "0.12.28", features = ["json", "multipart", "stream"] }
tokio = { version = "1.48.0", features = ["full"] }
url = "2.4"
mime = "0.3"
fastrand = "2.0"
thiserror = "1.0"
bytes = "1.0"
indexmap = ">=2, <2.12"
url = ">=2.4.1, <2.5"
mime = "0.3.17"
fastrand = "=2.0.2"
thiserror = "1.0.69"
bytes = "1.11.1"
arc-swap = "1.8.0"

[target.'cfg(any(target_os = "macos", target_os = "ios", target_os = "tvos", target_os = "watchos"))'.dependencies]
security-framework = ">=3, <3.7"

[dev-dependencies]
tokio-test = "0.4"
wiremock = "0.5"
tokio-test = "=0.4.4"
wiremock = "=0.5.22"

[lib]
name = "appwrite"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.0-blue.svg)
![Version](https://img.shields.io/badge/api%20version-1.9.1-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)

Expand All @@ -17,7 +17,7 @@ Add this to your `Cargo.toml`:

```toml
[dependencies]
appwrite = "0.2.0"
appwrite = "0.3.0"
tokio = { version = "1.48", features = ["full"] }
```

Expand Down
20 changes: 20 additions & 0 deletions docs/examples/account/create-anonymous-session.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
```rust
use appwrite::Client;
use appwrite::services::Account;

#[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_session(""); // The user session to authenticate with

let account = Account::new(&client);

let result = account.create_anonymous_session().await?;

let _ = result;

Ok(())
}
```
23 changes: 23 additions & 0 deletions docs/examples/account/create-email-password-session.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
```rust
use appwrite::Client;
use appwrite::services::Account;

#[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_session(""); // The user session to authenticate with

let account = Account::new(&client);

let result = account.create_email_password_session(
"email@example.com",
"password"
).await?;

let _ = result;

Ok(())
}
```
24 changes: 24 additions & 0 deletions docs/examples/account/create-email-token.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
```rust
use appwrite::Client;
use appwrite::services::Account;

#[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_session(""); // The user session to authenticate with

let account = Account::new(&client);

let result = account.create_email_token(
"<USER_ID>",
"email@example.com",
Some(false) // optional
).await?;

let _ = result;

Ok(())
}
```
22 changes: 22 additions & 0 deletions docs/examples/account/create-email-verification.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
```rust
use appwrite::Client;
use appwrite::services::Account;

#[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_session(""); // The user session to authenticate with

let account = Account::new(&client);

let result = account.create_email_verification(
"https://example.com"
).await?;

let _ = result;

Ok(())
}
```
22 changes: 22 additions & 0 deletions docs/examples/account/create-jwt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
```rust
use appwrite::Client;
use appwrite::services::Account;

#[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_session(""); // The user session to authenticate with

let account = Account::new(&client);

let result = account.create_jwt(
Some(0) // optional
).await?;

let _ = result;

Ok(())
}
```
25 changes: 25 additions & 0 deletions docs/examples/account/create-magic-url-token.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
```rust
use appwrite::Client;
use appwrite::services::Account;

#[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_session(""); // The user session to authenticate with

let account = Account::new(&client);

let result = account.create_magic_url_token(
"<USER_ID>",
"email@example.com",
Some("https://example.com"), // optional
Some(false) // optional
).await?;

let _ = result;

Ok(())
}
```
22 changes: 22 additions & 0 deletions docs/examples/account/create-mfa-authenticator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
```rust
use appwrite::Client;
use appwrite::services::Account;

#[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_session(""); // The user session to authenticate with

let account = Account::new(&client);

let result = account.create_mfa_authenticator(
appwrite::enums::AuthenticatorType::Totp
).await?;

let _ = result;

Ok(())
}
```
22 changes: 22 additions & 0 deletions docs/examples/account/create-mfa-challenge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
```rust
use appwrite::Client;
use appwrite::services::Account;

#[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_session(""); // The user session to authenticate with

let account = Account::new(&client);

let result = account.create_mfa_challenge(
appwrite::enums::AuthenticationFactor::Email
).await?;

let _ = result;

Ok(())
}
```
20 changes: 20 additions & 0 deletions docs/examples/account/create-mfa-recovery-codes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
```rust
use appwrite::Client;
use appwrite::services::Account;

#[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_session(""); // The user session to authenticate with

let account = Account::new(&client);

let result = account.create_mfa_recovery_codes().await?;

let _ = result;

Ok(())
}
```
Loading