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
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.17.0"
version = "0.18.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.17.0"
appwrite = "0.18.0"
tokio = { version = "1.48", features = ["full"] }
```

Expand Down
4 changes: 2 additions & 2 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl Client {
headers.insert(
"user-agent",
format!(
"AppwriteRustSDK/0.17.0 ({}; {})",
"AppwriteRustSDK/0.18.0 ({}; {})",
std::env::consts::OS,
std::env::consts::ARCH
)
Expand All @@ -105,7 +105,7 @@ impl Client {
headers.insert("x-sdk-name", "Rust".parse().unwrap());
headers.insert("x-sdk-platform", "server".parse().unwrap());
headers.insert("x-sdk-language", "rust".parse().unwrap());
headers.insert("x-sdk-version", "0.17.0".parse().unwrap());
headers.insert("x-sdk-version", "0.18.0".parse().unwrap());

let config = Config {
endpoint: "https://cloud.appwrite.io/v1".to_string(),
Expand Down
3 changes: 3 additions & 0 deletions src/enums/project_auth_method_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ pub enum ProjectAuthMethodId {
Jwt,
#[serde(rename = "phone")]
Phone,
#[serde(rename = "passkey")]
Passkey,
}

impl ProjectAuthMethodId {
Expand All @@ -30,6 +32,7 @@ impl ProjectAuthMethodId {
ProjectAuthMethodId::Invites => "invites",
ProjectAuthMethodId::Jwt => "jwt",
ProjectAuthMethodId::Phone => "phone",
ProjectAuthMethodId::Passkey => "passkey",
}
}
}
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 @@ -33,6 +33,8 @@ pub enum ProjectPolicyId {
DenyFreeEmail,
#[serde(rename = "deny-corporate-email")]
DenyCorporateEmail,
#[serde(rename = "passkey")]
Passkey,
}

impl ProjectPolicyId {
Expand All @@ -54,6 +56,7 @@ impl ProjectPolicyId {
ProjectPolicyId::DenyDisposableEmail => "deny-disposable-email",
ProjectPolicyId::DenyFreeEmail => "deny-free-email",
ProjectPolicyId::DenyCorporateEmail => "deny-corporate-email",
ProjectPolicyId::Passkey => "passkey",
}
}
}
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.17.0"
//! appwrite = "0.18.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.17.0";
pub const VERSION: &str = "0.18.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 @@ -382,6 +382,8 @@ pub mod policy_membership_privacy;
pub use policy_membership_privacy::PolicyMembershipPrivacy;
pub mod policy_mfa_factors;
pub use policy_mfa_factors::PolicyMfaFactors;
pub mod policy_passkey;
pub use policy_passkey::PolicyPasskey;
pub mod platform_web;
pub use platform_web::PlatformWeb;
pub mod platform_apple;
Expand Down Expand Up @@ -807,6 +809,7 @@ impl Model for PolicySessionLimit {}
impl Model for PolicyUserLimit {}
impl Model for PolicyMembershipPrivacy {}
impl Model for PolicyMfaFactors {}
impl Model for PolicyPasskey {}
impl Model for PlatformWeb {}
impl Model for PlatformApple {}
impl Model for PlatformAndroid {}
Expand Down
59 changes: 59 additions & 0 deletions src/models/policy_passkey.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
//! PolicyPasskey model for Appwrite SDK

use serde::{Deserialize, Serialize};

/// Policy Passkey
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(test, derive(Default))]
pub struct PolicyPasskey {
/// Policy ID.
#[serde(rename = "$id")]
pub id: String,
/// Relying party ID passkeys are bound to. Empty until configured.
#[serde(rename = "rpId")]
pub rp_id: String,
/// Web origins passkeys work on, from the project's platforms on the relying
/// party ID and a localhost web platform. Read-only.
#[serde(rename = "origins")]
pub origins: Vec<String>,
}

impl PolicyPasskey {
/// Get id
pub fn id(&self) -> &String {
&self.id
}

/// Get rp_id
pub fn rp_id(&self) -> &String {
&self.rp_id
}

/// Get origins
pub fn origins(&self) -> &Vec<String> {
&self.origins
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn test_policy_passkey_creation() {
let _model = <PolicyPasskey as Default>::default();
let _ = _model.id();
let _ = _model.rp_id();
let _ = _model.origins();
}

#[test]
fn test_policy_passkey_serialization() {
let model = <PolicyPasskey as Default>::default();
let json = serde_json::to_string(&model);
assert!(json.is_ok());

let deserialized: Result<PolicyPasskey, _> = serde_json::from_str(&json.unwrap());
assert!(deserialized.is_ok());
Comment thread
hansi-codes[bot] marked this conversation as resolved.
}
}