Skip to content

feat: SDK update for version 0.10.0#23

Merged
ChiragAgg5k merged 1 commit into
mainfrom
dev
Jun 30, 2026
Merged

feat: SDK update for version 0.10.0#23
ChiragAgg5k merged 1 commit into
mainfrom
dev

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Jun 30, 2026

Copy link
Copy Markdown
Member

This PR contains updates to the SDK for version 0.10.0.

What's Changed

  • Breaking: Reworked listEvents and listGauges in usage with a required metrics param and new interval, dimensions, date-range, and ordering options
  • Breaking: Replaced UsageEvent and UsageGauge models with UsageDataPoint and UsageMetric
  • Added: Notifications service with Notification and NotificationList models
  • Added: getQueueNotifications health check to health
  • Added: updateDenyCorporateEmailPolicy and PolicyDenyCorporateEmail to project
  • Updated: All requests now send an Accept: application/json header

@ChiragAgg5k ChiragAgg5k changed the title feat: Rust SDK update for version 0.10.0 feat: SDK update for version 0.10.0 Jun 30, 2026
@greptile-apps

greptile-apps Bot commented Jun 30, 2026

Copy link
Copy Markdown

Greptile Summary

This PR updates the Appwrite Rust SDK from 0.9.0 to 0.10.0, adding new API surface (Notifications service, corporate-email policy, device-flow OAuth2 params, userAccessedAt on memberships) and reworking the usage metrics API from raw event/gauge rows to an aggregated metrics[]/points[] shape.

  • New models and service: Notification, NotificationList, UsageDataPoint, UsageMetric, PolicyDenyCorporateEmail, and a Notifications service with list/update endpoints are introduced; UsageEvent and UsageGauge are removed and replaced.
  • Pervasive accept: application/json header addition: Every GET (and most PATCH/POST) method across all services now explicitly sets this header, making content-negotiation consistent.
  • Membership.user_accessed_at is added as a non-optional String, but the field is conditionally returned by the API (only when the membership-privacy toggle enables it), which will cause deserialization failures in projects where the toggle is off.

Confidence Score: 3/5

The PR is mostly mechanical and correct, but the non-optional user_accessed_at field on Membership will silently break deserialization for any caller retrieving memberships when the Appwrite membership-privacy toggle is not configured to expose that field.

Every other privacy-gated field on Membership uses 'Hide this attribute' wording and is always present in responses. The new user_accessed_at uses 'Show this attribute', meaning the field is absent by default. A required non-optional serde field that is sometimes missing from responses will cause a runtime deserialization error for any SDK consumer that lists or fetches team memberships without the toggle enabled.

src/models/membership.rs needs the user_accessed_at field changed to Option<String>. The zeroize version range in Cargo.toml and the interval sentinel in src/models/usage_event_list.rs and src/models/usage_gauge_list.rs are also worth a second look.

Important Files Changed

Filename Overview
src/models/membership.rs Adds user_accessed_at: String (non-optional), but this field is conditionally returned by the API only when the membership privacy toggle is enabled, so deserialization will fail when the field is absent.
Cargo.toml Bumps version to 0.10.0 and adds zeroize dependency with an overly narrow version range (>=1.8, <1.9) that will block any 1.9.x release.
src/models/usage_event_list.rs Refactored from {total, events[]} to {interval: String, metrics[]} to match the new aggregation API shape; interval uses an empty-string sentinel instead of Option<String>.
src/models/usage_gauge_list.rs Parallel refactor to UsageEventList — same interval: String sentinel concern applies.
src/services/notifications.rs New service with list and update endpoints; path templating, headers, and param handling are consistent with the rest of the SDK.
src/services/usage.rs Both list_events and list_gauges signatures were reworked to accept metrics, interval, dimensions, and paging params; #[allow(clippy::too_many_arguments)] was added appropriately.
src/services/project.rs Adds update_deny_corporate_email_policy, device-flow OAuth2 params, user_accessed_at to membership-privacy update, and consistently adds accept: application/json headers across all methods.
src/models/project.rs OAuth2 server fields changed from required to Option<T>, new device-flow fields added, and onboarding: serde_json::Value added as a required field.
src/models/notification.rs New Notification model with optional fields for message_id, project_id, read, first_seen, and last_seen; serialization round-trip tested.
src/models/usage_data_point.rs New UsageDataPoint model replaces UsageEvent/UsageGauge; all dimension-breakdown fields are correctly optional.
src/models/mod.rs Cleans up the duplicate impl Model for UsageEventList/UsageGaugeList that existed in the previous version, and registers all new models correctly.

Reviews (1): Last reviewed commit: "chore: update Rust SDK to 0.10.0" | Re-trigger Greptile

Comment thread src/models/membership.rs
Comment on lines +55 to +58
/// Most recent access date in ISO 8601 format. Show this attribute by toggling
/// membership privacy in the Console.
#[serde(rename = "userAccessedAt")]
pub user_accessed_at: String,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 user_accessed_at should be Option<String>

Every other privacy-gated field in this struct uses "Hide this attribute by toggling membership privacy" (meaning it is present by default). The new field uses the opposite wording — "Show this attribute by toggling membership privacy" — meaning it is absent from API responses until the toggle is enabled. A non-optional String field will cause a serde deserialization error whenever the Appwrite API omits userAccessedAt, breaking any call that retrieves memberships when the privacy toggle is off.

Comment thread Cargo.toml
thiserror = "1.0.69"
bytes = "1.11.1"
arc-swap = "1.8.0"
zeroize = ">=1.8, <1.9"

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 The upper bound <1.9 restricts the dependency to only 1.8.x patch releases. When zeroize publishes 1.9.0 (a semver-compatible minor bump), Cargo will refuse to resolve it, potentially causing unnecessary conflicts with other crates that depend on a newer 1.x. The conventional Cargo range for "1.8 or later within the same major" is >=1.8, <2.0 (or simply "1.8" which expands to that by Cargo convention).

Suggested change
zeroize = ">=1.8, <1.9"
zeroize = ">=1.8, <2.0"

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment on lines +12 to +14
pub interval: String,
/// One entry per requested metric, each carrying its own points[] time series
/// (sums per bucket / dimension over time).

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 interval should be Option<String>

The field doc states "Empty when the request omits interval". Using a non-optional String with an empty-string sentinel means callers cannot distinguish "no interval was requested" from "the API returned an empty string for some other reason", and it forces callers to check interval.is_empty() rather than the idiomatic interval.is_none(). The same pattern applies to UsageGaugeList::interval. An Option<String>None when absent, Some("1h") when present — would be semantically correct.

@ChiragAgg5k ChiragAgg5k merged commit b222fd1 into main Jun 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants