Skip to content

chore: update Examples#196

Merged
demolaf merged 9 commits intomainfrom
examples
Mar 24, 2026
Merged

chore: update Examples#196
demolaf merged 9 commits intomainfrom
examples

Conversation

@demolaf
Copy link
Copy Markdown
Member

@demolaf demolaf commented Mar 23, 2026

This PR expands and improves the runnable examples across auth, firestore, functions, and messaging packages.

Changes

Auth (auth_example.dart)

  • Added userManagementExample — creates a real temporary user at the start so getUser, updateUser, getUsers, and deleteUser all operate on a guaranteed-existing user, then cleans up on completion
  • Added emailLinksExample covering generatePasswordResetLink, generateEmailVerificationLink, generateVerifyAndChangeEmailLink, and generateSignInWithEmailLink
  • Added tokenExample covering setCustomUserClaims, createCustomToken, verifyIdToken, and revokeRefreshTokens; includes comments explaining how to obtain a real ID token from each client platform
  • Added sessionCookieExample covering createSessionCookie and verifySessionCookie; includes a comment on the typical server-side session cookie exchange flow
  • Added providerConfigExample covering full CRUD for OIDC and SAML provider configs

Firestore (firestore_example.dart)

  • Added batchExample using a realistic order-placement scenario (create order, update user count, decrement stock
    atomically)
  • Added transactionExample demonstrating an atomic counter increment with read-modify-write
  • Added collectionGroupExample with finally-block cleanup to prevent data accumulation
  • Added getAllExample, listCollectionsExample, and recursiveDeleteExample
  • Registered all new examples in the firestoreExample entry point

Functions (functions_example.dart)

  • Added functions.app.name access example
  • Added example for TaskOptionsExperimental URI override

Messaging (messaging_example.dart)

  • Added ConditionMessage example demonstrating topic-condition-based sends

@demolaf demolaf marked this pull request as draft March 23, 2026 15:22
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the example application and adds integration tests to improve the functionality and reliability of the Firebase Admin SDK for Dart. The changes cover several key areas, including authentication, Firestore, Cloud Functions, and Cloud Messaging, providing developers with comprehensive examples and tests for these services.

Highlights

  • Auth Examples: Added examples for user management, email links, token handling, session cookies, and provider configuration.
  • Firestore Examples: Included examples for batch writes, transactions, collection groups, document retrieval, collection listing, and recursive deletion.
  • Functions Examples: Demonstrated accessing the Firebase app and enqueuing tasks with custom handler URIs.
  • Messaging Examples: Added example for sending messages with conditions.
  • App Check Tests: Introduced integration tests for App Check token creation and verification.
  • Auth Provider Config Tests: Added integration tests for retrieving, updating, listing, and paginating Auth provider configurations.
  • Auth User and Token Tests: Added integration tests for retrieving user records and verifying ID tokens, including revocation checks.
  • Functions Task Queue Tests: Added integration tests for enqueuing tasks with experimental URI.
  • Messaging Condition Tests: Added integration tests for sending messages with conditions.
  • Firestore Terminate: Added terminate() to Firestore to close the HTTP client.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 23, 2026

Coverage Report

✅ Coverage 74.58% meets 40% threshold

Total Coverage: 74.58%
Lines Covered: 5018/6728

Package Breakdown

Package Coverage
dart_firebase_admin 72.44%
google_cloud_firestore 77.01%

Minimum threshold: 40%

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request introduces new examples for Firebase Authentication, Firestore, Functions, and Messaging, along with corresponding integration tests. The new examples demonstrate user management, email action links, custom tokens, session cookies, and provider configurations for Auth; batch writes, transactions, collection group queries, getAll, listCollections, and recursive deletes for Firestore; and experimental URI overrides for Functions tasks, and condition messages for Messaging. Integration tests have been added and existing unit tests refactored to cover these new functionalities and ensure correctness. Overall, the changes enhance the example suite and test coverage significantly.

@demolaf demolaf changed the title Examples chore: update Examples Mar 23, 2026
@demolaf demolaf changed the base branch from main to missing-tests March 24, 2026 09:43
@demolaf demolaf marked this pull request as ready for review March 24, 2026 09:54
Base automatically changed from missing-tests to main March 24, 2026 10:55
@demolaf demolaf merged commit 6c09bea into main Mar 24, 2026
11 checks passed
@demolaf demolaf deleted the examples branch March 24, 2026 11:57
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.

1 participant