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
1 change: 1 addition & 0 deletions .github/workflows/autoclose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:

jobs:
auto_close:
if: github.head_ref != 'dev'
uses: appwrite/.github/.github/workflows/autoclose.yml@main
secrets:
GH_AUTO_CLOSE_PR_TOKEN: ${{ secrets.GH_AUTO_CLOSE_PR_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish to Crates.io

on:
release:
types: [published]
workflow_dispatch:

jobs:
publish:
name: Build and publish to crates.io
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Rust
uses: dtolnay/rust-toolchain@1.83.0

- name: Run tests
run: cargo test --all-features

- name: Publish to crates.io
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
9 changes: 9 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Mark stale issues

on:
schedule:
- cron: "0 0 * * *" # Midnight Runtime

jobs:
stale:
uses: appwrite/.github/.github/workflows/stale.yml@main
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Rust build artifacts
/target

# Cargo.lock is included for applications, excluded for libraries
# Since this is a library SDK, we exclude it
Cargo.lock

# Backup files from rustfmt
**/*.rs.bk

# IDE files
.idea/
.vscode/
*.swp
*.swo
*~

# OS files
.DS_Store
Thumbs.db

# Test coverage
*.profraw
*.profdata
852 changes: 852 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[package]
name = "appwrite"
version = "0.1.0"
edition = "2021"
rust-version = "1.83"
authors = ["appwrite"]
description = "Appwrite SDK for Rust"
documentation = "https://docs.rs/appwrite"
repository = "https://github.com/appwrite/sdk-for-rust"
license = "BSD-3-Clause"
keywords = ["appwrite", "sdk", "api", "backend", "baas"]
categories = ["api-bindings", "web-programming"]
readme = "README.md"
autobins = false
autoexamples = false
autotests = false
autobenches = false

[dependencies]
serde = { version = "1.0.228", features = ["derive"] }
serde_json = "1.0"
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"
arc-swap = "1.8.0"

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

[lib]
name = "appwrite"
path = "src/lib.rs"

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
29 changes: 6 additions & 23 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,29 +1,12 @@
BSD 3-Clause License

Copyright (c) 2021, Appwrite
Copyright (c) 2026 Appwrite (https://appwrite.io) and individual contributors.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
109 changes: 107 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,107 @@
# sdk-for-rust
[READ-ONLY] Official Appwrite Rust SDK ⚙️
# 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)
[![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)

**This SDK is compatible with Appwrite server version 1.8.x. For older versions, please check [previous releases](https://github.com/appwrite/sdk-for-rust/releases).**

Appwrite is an open-source backend as a service server that abstracts and simplifies complex and repetitive development tasks behind a very simple to use REST API. Appwrite aims to help you develop your apps faster and in a more secure way. Use the Rust SDK to integrate your app with the Appwrite server to easily start interacting with all of Appwrite backend APIs and tools. For full API documentation and tutorials go to [https://appwrite.io/docs](https://appwrite.io/docs)

![Appwrite](https://github.com/appwrite/appwrite/raw/main/public/images/github.png)

## Installation

Add this to your `Cargo.toml`:

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

Or using `cargo add`:

```bash
cargo add appwrite
```


## Getting Started

### Init your SDK
Initialize your SDK with your Appwrite server API endpoint and project ID which can be found on your project settings page and your new API secret Key from project's API keys section.

```rust
use appwrite::client::Client;

let client = Client::new()
.set_endpoint("https://[HOSTNAME_OR_IP]/v1") // Your API Endpoint
.set_project("5df5acd0d48c2") // Your project ID
.set_key("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
.set_self_signed(true); // Use only on dev mode with a self-signed SSL cert
```

### Make Your First Request
Once your SDK object is set, create any of the Appwrite service objects and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the [API References](https://appwrite.io/docs) section.

```rust
use appwrite::client::Client;
use appwrite::services::users::Users;
use appwrite::id::ID;

let client = Client::new()
.set_endpoint("https://[HOSTNAME_OR_IP]/v1")
.set_project("5df5acd0d48c2")
.set_key("919c2d18fb5d4...a2ae413da83346ad2")
.set_self_signed(true);

let users = Users::new(&client);

let user = users.create(
ID::unique(),
Some("email@example.com"),
Some("+123456789"),
Some("password"),
Some("Walter O'Brien"),
).await?;

println!("{}", user.name);
println!("{}", user.email);
```

### Error Handling
The Appwrite Rust SDK returns `Result` types. You can handle errors using standard Rust error handling patterns. Below is an example.

```rust
use appwrite::error::AppwriteError;

match users.create(
ID::unique(),
Some("email@example.com"),
Some("+123456789"),
Some("password"),
Some("Walter O'Brien"),
).await {
Ok(user) => println!("{}", user.name),
Err(AppwriteError { message, code, .. }) => {
eprintln!("Error {}: {}", code, message);
}
}
```

### Learn more
You can use the following resources to learn more and get help
- 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)
- 📜 [Appwrite Docs](https://appwrite.io/docs)
- 💬 [Discord Community](https://appwrite.io/discord)


## Contribution

This library is auto-generated by Appwrite custom [SDK Generator](https://github.com/appwrite/sdk-generator). To learn more about how you can help us improve this SDK, please check the [contribution guide](https://github.com/appwrite/sdk-generator/blob/master/CONTRIBUTING.md) before sending a pull-request.

## License

Please see the [BSD-3-Clause license](https://raw.githubusercontent.com/appwrite/appwrite/master/LICENSE) file for more information.
Loading