Skip to content

Conversation

@abnegate
Copy link
Member

@abnegate abnegate commented Dec 17, 2025

This PR contains updates to the Dart SDK for version 20.0.0.

Summary by CodeRabbit

  • New Features

    • Set a client session during initialization to streamline session-based auth.
    • Create collections with optional attributes and indexes.
    • Create tables with optional columns and indexes.
    • OAuth2 token requests now include session information.
  • Documentation

    • Examples updated to show session configuration in client setup.
  • Chores

    • Package and SDK version bumped to 20.1.0.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 17, 2025

Walkthrough

This pull request updates many Dart example docs to initialize Client with a chained .setSession('') call. It adds session propagation to Account.createOAuth2Token, extends Databases.createCollection to accept optional attributes and indexes, and extends TablesDB.createTable to accept optional enabled, columns, and indexes. The SDK package version and telemetry headers were bumped to 20.1.0 and CHANGELOG/README/pubspec were updated accordingly. Several example files were edited to reflect the new Client chaining.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • lib/services/databases.dart: confirm new parameters (attributes, indexes) are serialized correctly and maintain backward compatibility.
  • lib/services/tables_db.dart: verify columns/indexes inclusion and behavior of new enabled parameter.
  • lib/services/account.dart: validate adding 'session': client.config['session'] to OAuth2 params handles null/empty session safely.
  • SDK client API surface: review addition/usage of Client.setSession in public examples and any corresponding client class changes.
  • lib/src/client_io.dart and lib/src/client_browser.dart: check telemetry/user-agent header updates.
  • Documentation examples and README/CHANGELOG/pubspec.yaml: confirm consistent example updates and version bump accuracy.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title claims version 20.0.0, but all changes indicate version 20.1.0 (pubspec.yaml, README.md, client files, and CHANGELOG.md all reference 20.1.0). Update the PR title to reflect the actual version: 'feat: Dart SDK update for version 20.1.0' or describe the main feature more specifically, such as 'feat: Add session configuration and collection attributes/indexes support'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6caad4c and 72ece9a.

📒 Files selected for processing (5)
  • CHANGELOG.md (1 hunks)
  • README.md (1 hunks)
  • lib/src/client_browser.dart (1 hunks)
  • lib/src/client_io.dart (1 hunks)
  • pubspec.yaml (1 hunks)
✅ Files skipped from review due to trivial changes (3)
  • pubspec.yaml
  • CHANGELOG.md
  • README.md
🔇 Additional comments (2)
lib/src/client_io.dart (1)

45-47: LGTM! Version updates are consistent with browser client.

The SDK version header and user-agent string updates are correct and mirror the changes in client_browser.dart, ensuring consistency across both client implementations.

lib/src/client_browser.dart (1)

36-36: Version 20.1.0 is consistently applied throughout the project.

The SDK version header in the code is correct and matches all other version references across the codebase: pubspec.yaml, client_io.dart, and CHANGELOG.md all use 20.1.0.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (8)
docs/examples/account/update-phone-session.md (1)

5-6: Verify empty string semantics for setSession.

This example follows the same pattern as other account examples in this PR, adding .setSession('') to the Client initialization chain. The concern about empty string semantics applies here as well.

See the verification request in docs/examples/account/create-mfa-challenge.md for details on confirming the intended usage pattern.

docs/examples/account/create-anonymous-session.md (1)

5-6: Verify empty string semantics for setSession.

This example demonstrates the same Client initialization pattern with .setSession('') that appears consistently across all account examples in this PR.

The same verification applies: confirm whether an empty string is the correct way to indicate no session, or if the call should be omitted when no session is available. See verification request in docs/examples/account/create-mfa-challenge.md.

docs/examples/account/create-email-token.md (1)

5-6: Consistent pattern across documentation examples.

This file follows the same changes as the other account examples (adding .setSession('')). The same documentation clarity recommendation applies here.

docs/examples/account/update-magic-url-session.md (1)

5-6: Consistent with other documentation updates in this PR.

This file applies the same .setSession('') pattern. The documentation clarity recommendations from earlier comments apply here as well.

docs/examples/account/create-jwt.md (1)

5-6: Consistent with other documentation updates in this PR.

This file applies the same .setSession('') pattern. The documentation clarity recommendations from earlier comments apply here as well.

docs/examples/account/create-o-auth-2-token.md (1)

5-6: Consistent with other documentation updates in this PR.

This file applies the same .setSession('') pattern. The documentation clarity recommendations from earlier comments apply here as well.

docs/examples/account/create.md (1)

5-6: Consistent with other documentation updates in this PR.

This file applies the same .setSession('') pattern. The documentation clarity recommendations from earlier comments apply here as well.

docs/examples/account/create-email-password-session.md (1)

5-6: Consistent with other documentation updates in this PR.

This file applies the same .setSession('') pattern. The documentation clarity recommendations from earlier comments apply here as well.

🧹 Nitpick comments (2)
docs/examples/account/create-magic-url-token.md (1)

5-6: Consider clarifying empty session usage in documentation example.

The .setSession('') pattern appears throughout official Appwrite Dart SDK documentation, but for better clarity in end-user documentation, the comment could explicitly indicate this is a placeholder:

- .setSession(''); // The user session to authenticate with
+ .setSession(''); // Replace with actual user session ID

This would help developers understand that the empty string is a template placeholder, not the intended runtime value.

docs/examples/account/create-phone-token.md (1)

5-6: Clarify the session placeholder in the example.

The .setSession('') method is shown with an empty string, which may confuse developers about the intended usage. The inline comment suggests it should contain "The user session to authenticate with", yet the example demonstrates an empty value.

Consider one of the following approaches:

  • Replace the empty string with a more realistic placeholder like '<USER_SESSION>' to make the intent clearer.
  • Add an explanatory comment explaining that this is a placeholder and developers should substitute their actual session token.

Applied change example:

 Client client = Client()
     .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint
     .setProject('<YOUR_PROJECT_ID>') // Your project ID
-    .setSession(''); // The user session to authenticate with
+    .setSession('<USER_SESSION>'); // Replace with actual user session

Alternatively, if empty session is the intended initialization pattern:

     .setSession(''); // Initialize with session support (replace '' with actual session token when available)
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c0692d2 and 6caad4c.

📒 Files selected for processing (17)
  • docs/examples/account/create-anonymous-session.md (1 hunks)
  • docs/examples/account/create-email-password-session.md (1 hunks)
  • docs/examples/account/create-email-token.md (1 hunks)
  • docs/examples/account/create-jwt.md (1 hunks)
  • docs/examples/account/create-magic-url-token.md (1 hunks)
  • docs/examples/account/create-mfa-challenge.md (1 hunks)
  • docs/examples/account/create-o-auth-2-token.md (1 hunks)
  • docs/examples/account/create-phone-token.md (1 hunks)
  • docs/examples/account/create-session.md (1 hunks)
  • docs/examples/account/create.md (1 hunks)
  • docs/examples/account/update-magic-url-session.md (1 hunks)
  • docs/examples/account/update-phone-session.md (1 hunks)
  • docs/examples/databases/create-collection.md (1 hunks)
  • docs/examples/tablesdb/create-table.md (1 hunks)
  • lib/services/account.dart (1 hunks)
  • lib/services/databases.dart (2 hunks)
  • lib/services/tables_db.dart (2 hunks)
🔇 Additional comments (9)
docs/examples/tablesdb/create-table.md (1)

19-20: LGTM! New optional parameters for table creation.

The addition of columns and indexes parameters allows defining table schema at creation time, reducing the need for subsequent API calls. The empty array defaults are appropriate for demonstration purposes.

lib/services/databases.dart (2)

262-264: LGTM! API extended to support schema definition at creation.

The method signature correctly adds attributes and indexes as optional parameters.


274-275: LGTM! Parameters conditionally included in request payload.

The implementation properly checks for null values before including attributes and indexes in the API request.

docs/examples/databases/create-collection.md (1)

19-20: LGTM! Documentation updated to reflect new API parameters.

The example correctly demonstrates the new optional attributes and indexes parameters. The empty arrays serve as placeholders; developers should populate these with actual attribute and index definitions when needed.

lib/services/tables_db.dart (2)

246-248: LGTM! Method signature extended with schema definition parameters.

The addition of enabled, columns, and indexes as optional parameters allows defining table structure at creation time, consistent with the createCollection pattern in databases.dart.


257-259: LGTM! Parameters properly conditionally included.

The implementation correctly adds the new parameters to the request payload only when they are provided.

docs/examples/account/create-mfa-challenge.md (1)

5-6: The .setSession('') pattern is correct per Appwrite SDK documentation.

The .setSession('') empty string is the standard Appwrite pattern shown in official API examples, used when initializing the client without an active session. This is intentional—the SDK's setSession method authenticates a user when a session exists, or can be initialized without one. The example code is accurate as written.

lib/services/account.dart (1)

1017-1017: Session parameter addition is safe and properly filtered.

The implementation correctly adds the session parameter to OAuth2 token requests. Null values are safely filtered from the query string before transmission (line 79), so if the session is not configured, it won't be included in the request to the backend.

docs/examples/account/create-session.md (1)

5-6: Contextually consistent, but documentation clarity recommendation applies here too.

Like the previous file, the .setSession('') usage follows the same pattern. In this specific example (creating a session), the empty string is semantically sensible—no session exists before creation. However, the documentation should still clarify this relationship.

The pattern is consistent with the rest of the PR. If the same empty-string pattern is used across all examples, ensure the documentation or inline comments make it clear to users whether they should:

  1. Use empty string when no session exists (pre-authentication flow)
  2. Pass their actual session ID when using authenticated endpoints

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