### Setup Firestore Emulator Source: https://github.com/firebase/firebase-js-sdk/blob/main/packages/firestore/CONTRIBUTING.md Installs the Firestore emulator. This command downloads and sets up the necessary components for the emulator. ```bash firebase setup:emulators:firestore ``` -------------------------------- ### Initialize AI with Default Settings Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/ai.md Example of getting the default AI instance without specific options. ```javascript const ai = getAI(app); ``` -------------------------------- ### Install SDK Dependencies Source: https://github.com/firebase/firebase-js-sdk/blob/main/README.md Run this command in the root of the SDK directory to install all necessary development dependencies. ```bash yarn ``` -------------------------------- ### Start Firestore Emulator Source: https://github.com/firebase/firebase-js-sdk/blob/main/packages/firestore/CONTRIBUTING.md Starts the Firestore emulator. Use this command to run tests against a local Firestore instance. ```bash firebase emulators:start --only firestore ``` -------------------------------- ### Install Firebase CLI Source: https://github.com/firebase/firebase-js-sdk/blob/main/packages/firestore/CONTRIBUTING.md Installs the Firebase CLI globally. This is a prerequisite for using Firebase emulators. ```bash npm install -g firebase-tools ``` -------------------------------- ### Start Chat Session Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/ai.generativemodel.md Gets a new ChatSession instance for multi-turn conversations. Pass StartChatParams for initial configuration. ```typescript startChat(startChatParams?: StartChatParams): ChatSession; ``` -------------------------------- ### Initialize Firebase App Example (JavaScript) Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/app.md Demonstrates how to initialize the default Firebase app using provided configuration options. This example shows the structure of the options object, including essential keys like apiKey, authDomain, and databaseURL. Replace placeholder values with your actual Firebase project credentials. ```javascript // Initialize default app // Retrieve your own options values by adding a web app on // https://console.firebase.google.com initializeApp({ apiKey: "AIza....", // Auth / General Use authDomain: "YOUR_APP.firebaseapp.com", // Auth with popup/redirect databaseURL: "https://YOUR_APP.firebaseio.com", // Realtime Database storageBucket: "YOUR_APP.appspot.com", // Storage messagingSenderId: "123456789" }); ``` -------------------------------- ### Build the SDK Source: https://github.com/firebase/firebase-js-sdk/blob/main/README.md Execute this command in the root of the SDK directory after installing dependencies to build the entire SDK. ```bash yarn build ``` -------------------------------- ### onConfigUpdate Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/remote-config.md Starts listening for real-time config updates and automatically fetches updates. ```APIDOC ## onConfigUpdate(remoteConfig, observer) ### Description Starts listening for real-time config updates from the Remote Config backend and automatically fetches updates from the Remote Config backend when they are available. ### Parameters #### Path Parameters - **remoteConfig** (object) - Required - The Remote Config instance. - **observer** (object) - Required - An observer object with `onConfigUpdated` and `onError` methods. ### Returns - (function) - A function to unsubscribe from the updates. ``` -------------------------------- ### LiveGenerativeModel.connect() Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/ai.livegenerativemodel.md Starts a LiveSession for real-time interaction. ```APIDOC ## LiveGenerativeModel.connect() ### Description Starts a [LiveSession](./ai.livesession.md#livesession_class). ### Method ```typescript connect(sessionResumption?: SessionResumptionConfig): Promise; ``` ### Parameters #### Query Parameters - **sessionResumption** (SessionResumptionConfig) - Optional - Configuration for resuming a session. ### Response #### Success Response (200) - **LiveSession** - A [LiveSession](./ai.livesession.md#livesession_class) object. #### Exceptions - If the connection failed to be established with the server. ``` -------------------------------- ### Add Field Values Example Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_pipelines.md Example demonstrating how to add the values of two fields using the `add` function. ```typescript // Add the value of the 'quantity' field and the 'reserve' field. add("quantity", field("reserve")); ``` -------------------------------- ### Install and Initialize Firebase in Node.js (CommonJS) Source: https://github.com/firebase/firebase-js-sdk/blob/main/packages/firebase/README.md This snippet shows how to install the Firebase SDK using npm and initialize it in a Node.js environment using CommonJS modules. It covers installing the 'firebase' package and importing necessary functions for app initialization and Firestore. ```bash $ npm init $ npm install --save firebase ``` ```javascript const { initializeApp } = require('firebase/app'); const { getFirestore, collection, getDocs } = require('firebase/firestore'); // ... // TODO: Replace the following with your app's Firebase project configuration const firebaseConfig = { //... }; const app = initializeApp(firebaseConfig); const db = getFirestore(app); // Example usage (assuming you have a 'cities' collection) async function getCities(db) { const citiesCol = collection(db, 'cities'); const citySnapshot = await getDocs(citiesCol); const cityList = citySnapshot.docs.map(doc => doc.data()); return cityList; } getCities(db).then(cities => console.log(cities)); ``` -------------------------------- ### Execute pipeline and iterate results Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_pipelines.pipelinesnapshot.md Example showing how to execute a pipeline and iterate over the resulting documents. ```typescript const snapshot: PipelineSnapshot = await firestore .pipeline() .collection('myCollection') .where(field('value').greaterThan(10)) .execute(); snapshot.results.forEach(doc => { console.log(doc.id, '=>', doc.data()); }); ``` -------------------------------- ### Example: Filtering Books by Rating and Genre Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_pipelines.pipeline.md This example demonstrates how to use the where() method with logical operators (and) and field comparators (greaterThan, equal) to filter books by rating and genre. ```typescript firestore.pipeline().collection("books") .where( and( greaterThan(field("rating"), 4.0), // Filter for ratings greater than 4.0 field("genre").equal("Science Fiction") // Equivalent to equal("genre", "Science Fiction") ) ); ``` -------------------------------- ### startAt(snapshot) Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_lite.md Creates a QueryStartAtConstraint that modifies the result set to start at the provided document (inclusive). The starting position is relative to the order of the query. The document must contain all of the fields provided in the orderBy of this query. ```APIDOC ## startAt(snapshot) ### Description Creates a `QueryStartAtConstraint` that modifies the result set to start at the provided document (inclusive). The starting position is relative to the order of the query. The document must contain all of the fields provided in the `orderBy` of this query. ### Signature ```typescript export declare function startAt(snapshot: DocumentSnapshot): QueryStartAtConstraint; ``` ### Parameters #### Path Parameters - **snapshot** (DocumentSnapshot) - Required - The snapshot of the document to start at. ### Returns - **QueryStartAtConstraint** - A `QueryStartAtConstraint` to pass to `query()`. ``` -------------------------------- ### GenerativeModel.startChat() Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/ai.generativemodel.md Gets a new ChatSession instance for multi-turn conversations. ```APIDOC ## GenerativeModel.startChat() ### Description Gets a new [ChatSession](./ai.chatsession.md#chatsession_class) instance which can be used for multi-turn chats. ### Method Signature ```typescript startChat(startChatParams?: StartChatParams): ChatSession; ``` ### Parameters #### startChatParams - **startChatParams** ([StartChatParams](./ai.startchatparams.md#startchatparams_interface)) - Description not provided. ### Returns [ChatSession](./ai.chatsession.md#chatsession_class) ``` -------------------------------- ### linkWithPopup Usage Example Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/auth.md Demonstrates linking a Facebook provider to an existing user session via a pop-up. ```javascript // Sign in using some other provider. const result = await signInWithEmailAndPassword(auth, email, password); // Link using a popup. const provider = new FacebookAuthProvider(); await linkWithPopup(result.user, provider); ``` -------------------------------- ### Get Firebase Installation ID (TypeScript) Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/installations.md Creates a Firebase Installation if one does not exist for the app and returns the Installation ID. This asynchronous function returns a Promise that resolves with the Installation ID string. It requires an Installations instance. ```typescript import { Installations, getId } from "firebase/installations"; // Assuming 'installations' is an Installations instance getId(installations).then((installationId) => { console.log("Firebase Installation ID: ", installationId); }).catch((error) => { console.error("Error getting Firebase Installation ID: ", error); }); ``` -------------------------------- ### Firebase Installations SDK - Core Functions (TypeScript) Source: https://github.com/firebase/firebase-js-sdk/blob/main/common/api-review/installations.api.md Provides core functions for interacting with Firebase Installations, including getting and deleting installations, and retrieving installation tokens. It relies on the FirebaseApp type from '@firebase/app'. ```typescript import { FirebaseApp } from '@firebase/app'; // @public export function deleteInstallations(installations: Installations): Promise; // @public export function getId(installations: Installations): Promise; // @public export function getInstallations(app?: FirebaseApp): Installations; // @public export function getToken(installations: Installations, forceRefresh?: boolean): Promise; // @public export type IdChangeCallbackFn = (installationId: string) => void; // @public export type IdChangeUnsubscribeFn = () => void; // @public export interface Installations { app: FirebaseApp; } // @public export function onIdChange(installations: Installations, callback: IdChangeCallbackFn): IdChangeUnsubscribeFn; ``` -------------------------------- ### Install Yarn Version 1.x Source: https://github.com/firebase/firebase-js-sdk/blob/main/README.md Use this command to set your Yarn version to 1.x, which is supported by the SDK. ```bash yarn set version 1.22.11 ``` -------------------------------- ### Get Firebase Installations Instance (TypeScript) Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/installations.md Retrieves an instance of the Installations interface associated with a given FirebaseApp instance. This function is part of the Firebase Installations Web SDK and requires a FirebaseApp instance as input. ```typescript import { FirebaseApp } from "firebase/app"; import { Installations, getInstallations } from "firebase/installations"; // Assuming 'app' is an initialized FirebaseApp instance const installations: Installations = getInstallations(app); ``` -------------------------------- ### Get Firebase Installations Auth Token (TypeScript) Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/installations.md Returns a Firebase Installations auth token that identifies the current Firebase Installation. This asynchronous function can optionally force a refresh of the token. It requires an Installations instance and an optional boolean for force refresh. ```typescript import { Installations, getToken } from "firebase/installations"; // Assuming 'installations' is an Installations instance getToken(installations, true).then((token) => { console.log("Firebase Installations Auth Token: ", token); }).catch((error) => { console.error("Error getting Firebase Installations Auth Token: ", error); }); ``` -------------------------------- ### Retrieve specific fields with get() Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_lite_pipelines.pipelineresult.md Method signature and usage example for retrieving a specific field from a PipelineResult. ```typescript get(fieldPath: string | FieldPath | Field): any; ``` ```javascript let p = firestore.pipeline().collection('col'); p.execute().then(results => { let field = results[0].get('a.b'); console.log(`Retrieved field value: ${field}`); }); ``` -------------------------------- ### Build and Run Firebase Auth Demo Source: https://github.com/firebase/firebase-js-sdk/blob/main/packages/auth/demo/README.md Commands to build dependencies and launch the local development server for the authentication demo. ```bash cd auth/demo yarn yarn build:deps yarn run demo ``` -------------------------------- ### GenerativeModel.startChat Method Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/ai.generativemodel.md Gets a new ChatSession instance for multi-turn chats. Accepts start chat parameters. ```typescript startChat(startChatParams: StartChatParams): ChatSession; ``` -------------------------------- ### Run Sample Applications Source: https://github.com/firebase/firebase-js-sdk/blob/main/e2e/smoke-tests/README.md Commands to start the local development server for the modular or compat sample applications. These apps demonstrate basic SDK initialization and method calls. ```bash yarn start:modular yarn start:compat ``` -------------------------------- ### Run Firebase Auth Demo with Emulator Source: https://github.com/firebase/firebase-js-sdk/blob/main/packages/auth/demo/README.md Commands to initialize the Firebase emulator and run the demo application against local mocked authentication endpoints. ```bash cd auth/demo firebase init yarn run demo:emulator ``` -------------------------------- ### Listen for FCM Registration Events Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/messaging_sw.md Subscribe to registration events using `onRegistered` to get the Firebase Installation ID (FID). Use this FID to update your application server. The returned unsubscribe function stops the listener. ```typescript export declare function onRegistered(messaging: Messaging, nextOrObserver: NextFn | Observer): Unsubscribe; ``` -------------------------------- ### Verify Prerequisites Source: https://github.com/firebase/firebase-js-sdk/blob/main/README.md Run these commands to verify your Node.js, Yarn, and Java installations meet the SDK's requirements. ```bash node -v yarn -v java -version ``` -------------------------------- ### Get Array Element by Index with arrayGet Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_pipelines.md Creates an expression to access a specific element within an array using its index. Supports positive and negative indices for accessing from the start or end. An error occurs if the index is out of bounds. ```typescript arrayGet(field('tags'), 1); ``` -------------------------------- ### Initialize AI with Vertex AI Backend Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/ai.md Configures and retrieves an AI instance to use the Vertex AI Gemini API. ```javascript // Get an AI instance configured to use the Vertex AI Gemini API. const ai = getAI(app, { backend: new VertexAIBackend() }); ``` -------------------------------- ### Complete Phone Authentication with ConfirmationResult Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/auth.confirmationresult.md This example demonstrates how to use the ConfirmationResult object to complete a phone number sign-in, link, or reauthentication flow. It shows obtaining the confirmationResult and then using the confirm method with a verification code to get a UserCredential. ```javascript const confirmationResult = await signInWithPhoneNumber(auth, phoneNumber, applicationVerifier); // Obtain verificationCode from the user. const userCredential = await confirmationResult.confirm(verificationCode); ``` -------------------------------- ### StartTemplateChatParams Source: https://github.com/firebase/firebase-js-sdk/blob/main/common/api-review/ai.api.md Extends `StartChatParams` to support starting chat sessions based on a template. It includes template-specific configurations like ID, variables, and template tools. ```APIDOC ## StartTemplateChatParams ### Description Extends `StartChatParams` to support starting chat sessions based on a template. It includes template-specific configurations like ID, variables, and template tools. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **templateId** (string) - Required - The ID of the chat template to use. - **templateVariables** (Record) - Optional - A record of variables to be used with the template. - **tools** (TemplateTool[]) - Optional - An array of `TemplateTool` objects available for this template chat. ``` -------------------------------- ### Clone and Initialize Firebase Auth Demo Source: https://github.com/firebase/firebase-js-sdk/blob/main/packages/auth/demo/README.md Commands to clone the repository and prepare the Firebase project configuration for the demo application. ```bash git clone https://github.com/firebase/firebase-js-sdk.git cd firebase-js-sdk/packages/auth/demo firebase use --add cp src/sample-config.js src/config.js ``` -------------------------------- ### Delete Firebase Installation (TypeScript) Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/installations.md Deletes the Firebase Installation and all associated data. This asynchronous function returns a Promise that resolves when the deletion is complete. It requires an Installations instance as input. ```typescript import { Installations, deleteInstallations } from "firebase/installations"; // Assuming 'installations' is an Installations instance deleteInstallations(installations).then(() => { console.log("Firebase Installation deleted successfully."); }).catch((error) => { console.error("Error deleting Firebase Installation: ", error); }); ``` -------------------------------- ### Listen for Installation ID Changes (TypeScript) Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/installations.md Sets a callback function to be invoked when the Installation ID changes. This function returns an unsubscribe function that can be called to remove the callback. It requires an Installations instance and a callback function. ```typescript import { Installations, onIdChange } from "firebase/installations"; // Assuming 'installations' is an Installations instance const unsubscribe = onIdChange(installations, (newId) => { console.log("Installation ID changed to: ", newId); }); // To stop listening for changes: // unsubscribe(); ``` -------------------------------- ### Initialize Auth with Custom Dependencies Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/auth.md Initialize an Auth instance with specific persistence and resolver configurations for fine-grained control. ```js const auth = initializeAuth(app, { persistence: browserSessionPersistence, popupRedirectResolver: undefined, }); ``` ```typescript export declare function initializeAuth(app: FirebaseApp, deps?: Dependencies): Auth; ``` -------------------------------- ### Installations Interface (TypeScript) Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/installations.installations.md Defines the public interface for the Firebase Installations SDK. It includes properties like the associated FirebaseApp instance. ```typescript export interface Installations { app: FirebaseApp; } ``` -------------------------------- ### Instantiate ImagenModel and generate images Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/ai.imagenmodel.md Instantiate the ImagenModel with your AI instance and model parameters. Then, use the `generateImages` method with a text prompt to create images. Check the response for generated images or filtering information. ```javascript const imagen = new ImagenModel( ai, { model: 'imagen-3.0-generate-002' } ); const response = await imagen.generateImages('A photo of a cat'); if (response.images.length > 0) { console.log(response.images[0].bytesBase64Encoded); } ``` -------------------------------- ### initializeFirestore(app, settings, databaseId) Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_.md Initializes a new instance of Firestore with the provided settings. This must be called before any other function, including getFirestore(). If settings are empty, it's equivalent to calling getFirestore(). ```APIDOC ## initializeFirestore(app, settings, databaseId) ### Description Initializes a new instance of [Firestore](./firestore_.firestore.md#firestore_class) with the provided settings. Can only be called before any other function, including [getFirestore()](./firestore_.md#getfirestore). If the custom settings are empty, this function is equivalent to calling [getFirestore()](./firestore_.md#getfirestore). ### Parameters #### Path Parameters - **app** (FirebaseApp) - The Firebase app to which the Firestore instance is associated. - **settings** (object) - An object containing initialization settings. - **databaseId** (string, optional) - The ID of the Firestore database instance. ### Method N/A (SDK function) ### Endpoint N/A (SDK function) ### Request Example ```javascript const settings = { cacheSizeBytes: 1000000 }; const db = initializeFirestore(app, settings, "my-database-id"); ``` ### Response #### Success Response - **firestore** (Firestore) - The initialized Firestore instance. ``` -------------------------------- ### Collect All Tags Example Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_pipelines.md Example showing how to use `arrayAgg` to collect all tags from books into an array. ```typescript // Collect all tags from books into an array arrayAgg("tags").as("allTags"); ``` -------------------------------- ### initializeFirestore(app, settings) Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_lite.md Initializes a new Firestore instance with custom settings. This must be called before getFirestore(). ```APIDOC ## initializeFirestore(app, settings) ### Description Initializes a new instance of Cloud Firestore with the provided settings. Can only be called before any other functions, including [getFirestore()](./firestore_.md#getfirestore). If the custom settings are empty, this function is equivalent to calling [getFirestore()](./firestore_.md#getfirestore). ### Method function ### Parameters * **app** (FirebaseApp) - The Firebase app to initialize Firestore for. * **settings** (object) - An object containing the initialization settings. * **...** - Additional arguments (implementation-specific). ``` -------------------------------- ### Get All Database Documents (Default) Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_lite_pipelines.pipelinesource.md Retrieves all documents from the entire database. This is the default behavior for a database stage. ```typescript database(): PipelineType; ``` -------------------------------- ### Get Parent Document Reference Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_lite_pipelines.expression.md Use this to get the parent document reference of a given document reference. ```typescript field("__path__").parent(); ``` -------------------------------- ### Collect Distinct Tags Example Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_pipelines.md Example showing how to use `arrayAggDistinct` to collect all distinct tags from books into an array. ```typescript // Collect all distinct tags from books into an array arrayAggDistinct("tags").as("allDistinctTags"); ``` -------------------------------- ### GenerativeModel.initializeDeviceModel() Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/ai.generativemodel.md Initializes on-device models, potentially triggering a download. Must be called after user interaction. ```APIDOC ## GenerativeModel.initializeDeviceModel() ### Description Initializes on-device models. This may trigger a download on first use. Wait for this promise to complete before calling inference methods if you want to ensure the device models are ready before any calls. Calling inference methods before the device is ready will result in a cloud fallback if `inferenceMode` is set to `PREFER_ON_DEVICE`, and an error if set to `ONLY_ON_DEVICE`. IMPORTANT: This call must be made on or after a user has interacted with the page (for example, through a button click or key press). If it is called without a user interaction, and it requires a download, this will cause an error. See the [Prompt API docs](https://developer.chrome.com/docs/ai/prompt-api#use_the_prompt_api) for more details on this requirement. ### Method Signature ```typescript initializeDeviceModel(onDownloadProgress?: (progressValue: number) => void): Promise; ``` ### Parameters #### onDownloadProgress - **onDownloadProgress** ((progressValue: number) => void) - A callback called repeatedly as the download progresses that provides a `progressValue` between 0 and 1 representing how much of the download is complete. This will be ignored if `monitor` was populated in [LanguageModelCreateOptions](./ai.languagemodelcreateoptions.md#languagemodelcreateoptions_interface). ### Returns Promise ``` -------------------------------- ### Initialize AI with Google AI Backend Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/ai.md Configures and retrieves an AI instance to use the Gemini Developer API via Google AI. ```javascript // Get an AI instance configured to use the Gemini Developer API (via Google AI). const ai = getAI(app, { backend: new GoogleAIBackend() }); ``` -------------------------------- ### Automated Test Setup for Firebase Project Source: https://github.com/firebase/firebase-js-sdk/blob/main/README.md Run this command to configure your Firebase project for testing. It allows interactive selection of the project or explicit specification via projectId. ```bash # Select the Firebase project via the text-based UI. This will run tools/config.js # and deploy from config/ to your Firebase project. $ yarn test:setup # Specify the Firebase project via the command-line arguments. $ yarn test:setup --projectId= ``` -------------------------------- ### Firebase Installations SDK - Internal Functions (TypeScript) Source: https://github.com/firebase/firebase-js-sdk/blob/main/common/api-review/installations.api.md Exposes internal functionalities for Firebase Installations, such as retrieving the installation ID and token with optional force refresh. This interface is marked as @internal and should not be used in production code. ```typescript import { FirebaseApp } from '@firebase/app'; // @internal export interface _FirebaseInstallationsInternal { getId(): Promise; getToken(forceRefresh?: boolean): Promise; } ``` -------------------------------- ### initializeFirestore(app, settings) Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_lite.md Initializes a new Firestore instance with the provided settings. This must be called before any other Firestore functions. If settings are empty, it's equivalent to calling getFirestore(). ```APIDOC ## initializeFirestore(app, settings) ### Description Initializes a new instance of Cloud Firestore with the provided settings. Can only be called before any other functions, including getFirestore(). If the custom settings are empty, this function is equivalent to calling getFirestore(). ### Method initializeFirestore ### Parameters #### Path Parameters - **app** (FirebaseApp) - Required - The FirebaseApp with which the Firestore instance will be associated. - **settings** (Settings) - Required - A settings object to configure the Firestore instance. ### Returns - **Firestore** - A newly initialized `Firestore` instance. ``` -------------------------------- ### Get a DocumentReference Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_lite.md Use the `doc` function to get a reference to a specific document. Provide the Firestore instance and the document path. ```typescript export declare function doc(firestore: Firestore, path: string, ...pathSegments: string[]): DocumentReference; ``` -------------------------------- ### Get a CollectionReference Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_lite.md Use the `collection` function to get a reference to a specific collection. Provide the Firestore instance and the collection path. ```typescript export declare function collection(firestore: Firestore, path: string, ...pathSegments: string[]): CollectionReference; ``` -------------------------------- ### Send Email Sign-in Link and Handle Completion Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/auth.md Configures action settings and sends a sign-in link to the user's email, then checks for and completes the sign-in process using the email link. ```javascript const actionCodeSettings = { url: 'https://www.example.com/?email=user@example.com', iOS: { bundleId: 'com.example.ios' }, android: { packageName: 'com.example.android', installApp: true, minimumVersion: '12' }, handleCodeInApp: true }; await sendSignInLinkToEmail(auth, 'user@example.com', actionCodeSettings); // Obtain emailLink from the user. if(isSignInWithEmailLink(auth, emailLink)) { await signInWithEmailLink(auth, 'user@example.com', emailLink); } ``` -------------------------------- ### Get Remote Config Instance Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/remote-config.md Use this function to get an instance of the Remote Config client. You can optionally provide FirebaseApp and RemoteConfigOptions. ```typescript export declare function getRemoteConfig(app?: FirebaseApp, options?: RemoteConfigOptions): RemoteConfig; ``` -------------------------------- ### Get Download Stream Source: https://github.com/firebase/firebase-js-sdk/blob/main/common/api-review/storage.api.md Get a ReadableStream for downloading a file. Useful for processing file data chunk by chunk. ```APIDOC ## GET /firebase/firebase-js-sdk ### Description Retrieves a `ReadableStream` for downloading the content of a file specified by a `StorageReference`. This is particularly useful for handling large files efficiently by processing them in chunks, rather than downloading the entire file into memory at once. ### Method GET (Implicitly via function call) ### Endpoint N/A (Function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```javascript import { getStorage, ref, getStream } from "firebase/storage"; import firebaseApp from "./firebaseConfig"; const storage = getStorage(firebaseApp); const fileRef = ref(storage, "path/to/your/file.txt"); // Optional: Specify maximum download size const maxSizeBytes = 1024 * 1024; // 1MB getStream(fileRef, maxSizeBytes) .then(async (stream) => { const reader = stream.getReader(); let result = await reader.read(); while (!result.done) { const chunk = result.value; console.log("Received chunk:", chunk); // Process the chunk (e.g., write to a file, display progress) result = await reader.read(); } console.log("Download complete."); }) .catch((error) => { console.error("Error getting download stream: ", error); }); ``` ### Response #### Success Response (200) - **ReadableStream** (object) - A stream object from which file data can be read. #### Response Example ```json { "//": "This is a ReadableStream object, not a JSON response. You interact with it using its reader." } ``` ``` -------------------------------- ### getAll Source: https://github.com/firebase/firebase-js-sdk/blob/main/common/api-review/remote-config.api.md Retrieves all configuration values from the Remote Config instance. ```APIDOC ## getAll ### Description Retrieves all configuration values from the Remote Config instance. ### Method `getAll(remoteConfig: RemoteConfig): Record` ### Parameters * **remoteConfig** (RemoteConfig) - The RemoteConfig instance. ### Response * **Record** - An object containing all configuration key-value pairs. ``` -------------------------------- ### Generate Documentation via Yarn Source: https://github.com/firebase/firebase-js-sdk/blob/main/CONTRIBUTING.md Commands to install project dependencies and execute the documentation generation script. This process updates the files located in the docs-devsite/ directory. ```shell yarn yarn docgen:all ``` -------------------------------- ### PrebuiltVoiceConfig Source: https://github.com/firebase/firebase-js-sdk/blob/main/common/api-review/ai.api.md Configuration for selecting a pre-built voice. ```APIDOC ## Interface: PrebuiltVoiceConfig ### Description Configuration options for specifying a pre-defined voice to be used. ### Fields - **voiceName** (string) - Optional - The name of the pre-built voice to use. ``` -------------------------------- ### Get a subcollection reference from a CollectionReference Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_lite.md Use `collection` with a `CollectionReference` to get a reference to a subcollection. This is useful for navigating nested data structures within Firestore. ```typescript export declare function collection(reference: CollectionReference, path: string, ...pathSegments: string[]): CollectionReference; ``` -------------------------------- ### Get Firestore Instance Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_lite.md Retrieves an existing Firestore instance or initializes a new one with default settings. Use this to get a reference to your Firestore database. ```typescript export declare function getFirestore(databaseId: string): Firestore; ``` -------------------------------- ### initializeApp Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/app.md Initializes a new FirebaseApp instance with the provided configuration options. ```APIDOC ## initializeApp(options, name) ### Description Creates and initializes a FirebaseApp instance. This is the primary entry point for using Firebase services. ### Method FUNCTION ### Parameters #### Request Body - **options** (Object) - Required - Firebase configuration object containing API keys and project identifiers. - **name** (String) - Optional - A unique name for the app instance. If omitted, the default app is initialized. ### Response #### Success Response - **FirebaseApp** (Object) - The initialized Firebase application instance. ``` -------------------------------- ### Get top N elements from an array Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_lite_pipelines.md Use `arrayMaximumN` to get the top N elements from an array expression. This is useful for ranking or selecting the highest values. ```typescript // Get the top n elements from an array expression arrayMaximumN(field("scores"), field("count")); ``` -------------------------------- ### StartTemplateChatParams Interface Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/ai.starttemplatechatparams.md Defines the configuration object for initializing a chat session with a server-side template. ```APIDOC ## StartTemplateChatParams Interface ### Description Parameters for TemplateGenerativeModel.startChat(). This API is currently in public preview. ### Properties - **templateId** (string) - Required - The ID of the server-side template to execute. - **templateVariables** (Record) - Optional - A key-value map of variables to populate the template with. - **tools** (TemplateTool[]) - Optional - A list of tools available for the template chat session. ### Request Example { "templateId": "my-template-id", "templateVariables": { "user_name": "John Doe" }, "tools": [] } ``` -------------------------------- ### activate Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/remote-config.md Makes the last fetched configuration available to the getters. ```APIDOC ## activate(remoteConfig) ### Description Makes the last fetched config available to the getters. ### Parameters #### Path Parameters - **remoteConfig** (object) - Required - The Remote Config instance. ### Returns - (boolean) - True if the configuration was successfully activated, false otherwise. ``` -------------------------------- ### timestampDiff(endFieldName, startExpression, unit) Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_pipelines.md Creates an expression that calculates the difference between a timestamp field and a starting timestamp expression. This overload is useful when the start time is dynamic or derived. ```APIDOC ## timestampDiff(endFieldName, startExpression, unit) ### Description Creates an expression that calculates the difference between two timestamps. ### Parameters #### Path Parameters - **endFieldName** (string) - Required - The name of the field representing the ending timestamp. - **startExpression** ([Expression](./firestore_pipelines.expression.md#expression_class)) - Required - The starting timestamp for the difference calculation. - **unit** ([TimeUnit](./firestore_pipelines.md#timeunit) | [Expression](./firestore_pipelines.expression.md#expression_class)) - Required - The unit of time for the difference (e.g., "day", "hour"). ### Returns [FunctionExpression](./firestore_pipelines.functionexpression.md#functionexpression_class) A new `Expression` representing the difference as an integer. ### Example ```typescript // Calculate the difference in days between 'endTime' field and a starting timestamp expression. timestampDiff('endTime', field('startTime'), 'day') ``` ``` -------------------------------- ### Initialize Named Firebase App Example (JavaScript) Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/app.md Illustrates how to initialize a named Firebase application instance. This is useful when managing multiple Firebase projects within the same application. The second argument to initializeApp specifies the name for this particular app instance. ```javascript // Initialize another app const otherApp = initializeApp({ databaseURL: "https://.firebaseio.com", storageBucket: ".appspot.com" }, "otherApp"); ``` -------------------------------- ### Get First N Elements of Array (Number) Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_pipelines.expression.md Use `arrayFirstN` with a number to retrieve the first `n` elements from an array field. This is useful for getting a fixed-size prefix of an array. ```typescript field("myArray").arrayFirstN(3); ``` -------------------------------- ### Run Lite SDK Browser Tests (Emulator) Source: https://github.com/firebase/firebase-js-sdk/blob/main/packages/firestore/CONTRIBUTING.md Executes the Lite version of the Cloud Firestore SDK tests in a browser environment (Chrome Headless) against the emulator. ```bash yarn test:lite:browser ``` -------------------------------- ### Install Firebase NPM Module Source: https://github.com/firebase/firebase-js-sdk/blob/main/packages/firebase/README.md Installs the Firebase NPM module using npm. This is the first step to integrate Firebase into your web or Node.js application. ```bash $ npm init $ npm install --save firebase ``` -------------------------------- ### initializeFirestore(app, settings, databaseId) Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_lite.md Initializes a new Firestore instance with the provided settings and database ID. This must be called before any other Firestore functions. This API is in preview. ```APIDOC ## initializeFirestore(app, settings, databaseId) ### Description Initializes a new instance of Cloud Firestore with the provided settings. Can only be called before any other functions, including getFirestore(). If the custom settings are empty, this function is equivalent to calling getFirestore(). This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. ### Method initializeFirestore ### Parameters #### Path Parameters - **app** (FirebaseApp) - Required - The FirebaseApp with which the Firestore instance will be associated. - **settings** (Settings) - Required - A settings object to configure the Firestore instance. - **databaseId** (string) - Optional - The name of the database. ### Returns - **Firestore** - A newly initialized `Firestore` instance. ``` -------------------------------- ### Example: Replace Document with Map Expression Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_pipelines.pipeline.md This example shows replacing a document with a map derived from an expression. The expression constructs a map including static values and fields from the input document. ```typescript // Input. // { // 'name': 'John Doe Jr.', // 'parents': { // 'father': 'John Doe Sr.', // 'mother': 'Jane Doe' // } // } // Emit parents as document. irestore.pipeline().collection('people').replaceWith(map({ foo: 'bar', info: { name: field('name') } })); // Output // { // 'father': 'John Doe Sr.', // 'mother': 'Jane Doe' // } ``` -------------------------------- ### Connect to Realtime Database Emulator Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/database.md Configures a Database instance to communicate with a local Realtime Database emulator. This must be invoked before any other database operations are performed. ```typescript export declare function connectDatabaseEmulator(db: Database, host: string, port: number, options?: { mockUserToken?: EmulatorMockTokenOptions | string; }): void; ``` -------------------------------- ### Get a subcollection reference from a DocumentReference Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_lite.md Use `collection` with a `DocumentReference` to get a reference to a subcollection nested under a specific document. This allows for targeted access to data within a document's hierarchy. ```typescript export declare function collection(reference: DocumentReference, path: string, ...pathSegments: string[]): CollectionReference; ``` -------------------------------- ### initializeAuth(app, deps) Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/auth.md Initializes an Auth instance with fine-grained control over dependencies, allowing for custom persistence and resolver configurations. ```APIDOC ## initializeAuth(app, deps) ### Description Initializes an Auth instance with fine-grained control over Dependencies. Use this if you need control over the persistence layer or to minimize bundle size. ### Parameters #### Path Parameters - **app** (FirebaseApp) - Required - The Firebase App. - **deps** (Dependencies) - Optional - The dependencies to configure the Auth instance. ### Response - **Auth** (Auth) - The initialized Auth instance. ``` -------------------------------- ### Get Data Type of Expression Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_pipelines.expression.md Use `type()` to get the backend data type of an expression as a string. Note that custom Firestore mappings are ignored, and numeric types are reported as 'int64' or 'float64'. ```typescript // Get the data type of the value in field 'title' field('title').type() ``` -------------------------------- ### Get a document reference from another document Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_lite.md Gets a DocumentReference instance that refers to a document within another document at the specified relative path. This is useful for creating references to subcollections or nested documents. ```typescript export declare function doc(reference: DocumentReference, path: string, ...pathSegments: string[]): DocumentReference; ``` -------------------------------- ### LiveGenerationConfig.contextWindowCompression Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/ai.livegenerationconfig.md Configuration for context window compression. This API is provided as a preview and may change based on feedback. ```APIDOC ## LiveGenerationConfig.contextWindowCompression > This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment. ### Description The context window compression configuration. ### Signature ```typescript contextWindowCompression?: ContextWindowCompressionConfig; ``` ``` -------------------------------- ### startAfter Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_.md Creates a QueryStartAtConstraint that modifies the result set to start after the provided document (exclusive). The starting position is relative to the order of the query. The document must contain all of the fields provided in the orderBy of the query. ```APIDOC ## function startAfter(snapshot) ### Description Creates a `QueryStartAtConstraint` that modifies the result set to start after the provided document (exclusive). The starting position is relative to the order of the query. The document must contain all of the fields provided in the `orderBy` of the query. ### Method `startAfter` ### Parameters #### Path Parameters - **snapshot** ([DocumentSnapshot](./firestore_.documentsnapshot.md#documentsnapshot_class)) - Required - The snapshot of the document to start after. ### Returns - **QueryStartAtConstraint** - A `QueryStartAtConstraint` to pass to `query()` ``` -------------------------------- ### Run Full SDK Browser Tests (Emulator) Source: https://github.com/firebase/firebase-js-sdk/blob/main/packages/firestore/CONTRIBUTING.md Executes the full Cloud Firestore SDK tests in a browser environment (Chrome Headless) against the emulator. ```bash yarn test:browser ``` -------------------------------- ### onConfigUpdate(remoteConfig, observer) Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/remote-config.md Starts listening for real-time config updates from the Remote Config backend. It automatically fetches updates when they are available and reuses an existing connection if one is open. ```APIDOC ## onConfigUpdate(remoteConfig, observer) ### Description Starts listening for real-time config updates from the Remote Config backend and automatically fetches updates from the Remote Config backend when they are available. If a connection to the Remote Config backend is not already open, calling this method will open it. Multiple listeners can be added by calling this method again, but subsequent calls re-use the same connection to the backend. ### Signature ```typescript export declare function onConfigUpdate(remoteConfig: RemoteConfig, observer: ConfigUpdateObserver): Unsubscribe; ``` ### Parameters #### Path Parameters - **remoteConfig** (RemoteConfig) - Required - The RemoteConfig instance. - **observer** (ConfigUpdateObserver) - Required - The ConfigUpdateObserver to be notified of config updates. ### Returns Unsubscribe - An Unsubscribe function to remove the listener. ``` -------------------------------- ### startAfter(snapshot) Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_lite.md Creates a QueryStartAtConstraint that modifies the result set to start after the provided document (exclusive). The starting position is relative to the order of the query. The document must contain all of the fields provided in the orderBy of the query. ```APIDOC ## startAfter(snapshot) ### Description Creates a `QueryStartAtConstraint` that modifies the result set to start after the provided document (exclusive). The starting position is relative to the order of the query. The document must contain all of the fields provided in the `orderBy` of the query. ### Signature ```typescript export declare function startAfter(snapshot: DocumentSnapshot): QueryStartAtConstraint; ``` ### Parameters #### Path Parameters - **snapshot** (DocumentSnapshot) - Required - The snapshot of the document to start after. ### Returns - **QueryStartAtConstraint** - A `QueryStartAtConstraint` to pass to `query()` ``` -------------------------------- ### getAI Source: https://github.com/firebase/firebase-js-sdk/blob/main/common/api-review/ai.api.md Initializes and retrieves an AI instance. This is the entry point for using AI services. ```APIDOC ## getAI ### Description Initializes and retrieves an AI instance. This is the entry point for using AI services. ### Method `getAI` ### Parameters - **app** (FirebaseApp) - Optional - The Firebase app instance. - **options** (AIOptions) - Optional - Configuration options for the AI service. ### Returns - **AI** - An instance of the AI service. ``` -------------------------------- ### Start Audio Conversation Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/ai.md Starts a real-time, bidirectional audio conversation. This function must be called in response to a user gesture due to browser autoplay policies. It manages microphone access, recording, and playback. ```typescript export declare function startAudioConversation(liveSession: LiveSession, options?: StartAudioConversationOptions): Promise; ``` -------------------------------- ### Initialize Auth with React Native Persistence Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/auth.md Example showing how to initialize Firebase Auth with React Native storage persistence. ```javascript import { initializeAuth, getReactNativePersistence } from 'firebase/auth'; // For @react-native-async-storage/async-storage v3: import { createAsyncStorage } from '@react-native-async-storage/async-storage'; const appStorage = createAsyncStorage('app'); const persistence = getReactNativePersistence(appStorage); // For @react-native-async-storage/async-storage v2: // import ReactNativeAsyncStorage from '@react-native-async-storage/async-storage'; // const persistence = getReactNativePersistence(ReactNativeAsyncStorage); // Then, initialize auth: const auth = initializeAuth(app, { persistence }); ``` -------------------------------- ### initializeAppCheck Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/app-check.md Activate App Check for the given app. This function can be called only once per app. ```APIDOC ## initializeAppCheck(app, options) ### Description Activate App Check for the given app. Can be called only once per app. ### Method Not applicable (SDK function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```typescript initializeAppCheck(firebaseApp, { provider: myProvider, isTokenAutoRefreshEnabled: true }); ``` ### Response #### Success Response - **AppCheck** (object) - The Firebase App Check service interface. #### Response Example ```json { // AppCheck service object } ``` ``` -------------------------------- ### Define exclusive start point for Firebase queries Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/database.md Creates a QueryConstraint that sets a starting point for a query, excluding the specified value. It allows for filtering based on values greater than the input, with optional key-based refinement. ```typescript export declare function startAfter(value: number | string | boolean | null, key?: string): QueryConstraint; ``` -------------------------------- ### Define FID Change Unsubscribe Function (TypeScript) Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/installations.md Defines the type for a function that, when called, will stop listening for Firebase Installations FID changes. This is used to clean up event listeners. ```typescript export type IdChangeUnsubscribeFn = () => void; ``` -------------------------------- ### Run Full SDK Node Tests (Emulator) Source: https://github.com/firebase/firebase-js-sdk/blob/main/packages/firestore/CONTRIBUTING.md Executes the full Cloud Firestore SDK tests in a Node.js environment against the emulator. ```bash yarn test:node ``` -------------------------------- ### Define FID Change Callback Function (TypeScript) Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/installations.md Defines the type for a callback function that will be invoked when the Firebase Installations FID changes. This function accepts the new FID as a string argument. ```typescript export type IdChangeCallbackFn = (installationId: string) => void; ``` -------------------------------- ### Example: Replace Document with Nested Map Field Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_pipelines.pipeline.md This example demonstrates how to use replaceWith to emit a nested map as the document content. The input document's 'parents' field, containing a map, is used to replace the entire document. ```typescript // Input. // { // 'name': 'John Doe Jr.', // 'parents': { // 'father': 'John Doe Sr.', // 'mother': 'Jane Doe' // } // } // Emit parents as document. irestore.pipeline().collection('people').replaceWith('parents'); // Output // { // 'father': 'John Doe Sr.', // 'mother': 'Jane Doe' // } ``` -------------------------------- ### Initialize On-Device Model Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/ai.generativemodel.md Initializes on-device models. This may trigger a download on first use and must be called after user interaction. Use the onDownloadProgress callback to monitor download status. ```typescript initializeDeviceModel(onDownloadProgress?: (progressValue: number) => void): Promise; ``` -------------------------------- ### Get First N Elements of Array with arrayFirstN (Expression) Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_pipelines.md Use arrayFirstN with an Expression to get the first 'n' elements from an array field, where 'n' is dynamically determined by another expression. This allows for flexible selection of array subsets. ```typescript arrayFirstN("tags", field("count")); ``` -------------------------------- ### sample(options) Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/firestore_pipelines.pipeline.md Performs a pseudo-random sampling of documents from the previous stage. The 'options' parameter specifies how sampling will be performed. ```APIDOC ## sample(options) ### Description Performs a pseudo-random sampling of documents from the previous stage. ### Parameters #### Path Parameters - **options** (SampleStageOptions) - Required - Specifies how sampling will be performed. See [SampleStageOptions](./firestore_pipelines.md#samplestageoptions) for more information. ``` -------------------------------- ### getValue Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/remote-config.md Gets the Value object for the given key. ```APIDOC ## getValue(remoteConfig, key) ### Description Gets the [Value](./remote-config.value.md#value_interface) for the given key. ### Parameters #### Path Parameters - **remoteConfig** (object) - Required - The Remote Config instance. - **key** (string) - Required - The key of the configuration value. ### Returns - (object) - The Value object for the given key. ``` -------------------------------- ### Sign in with Email and Password, Link with Redirect Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/auth.md Demonstrates signing in a user with email and password, then linking their account with a Facebook provider via redirect. After the redirect, it shows how to get the redirect result. ```javascript // Sign in using some other provider. const result = await signInWithEmailAndPassword(auth, email, password); // Link using a redirect. const provider = new FacebookAuthProvider(); await linkWithRedirect(result.user, provider); // This will trigger a full page redirect away from your app // After returning from the redirect when your app initializes you can obtain the result const result = await getRedirectResult(auth); ``` -------------------------------- ### getString Source: https://github.com/firebase/firebase-js-sdk/blob/main/docs-devsite/remote-config.md Gets the value for the given key as a string. ```APIDOC ## getString(remoteConfig, key) ### Description Gets the value for the given key as a string. Convenience method for calling remoteConfig.getValue(key).asString(). ### Parameters #### Path Parameters - **remoteConfig** (object) - Required - The Remote Config instance. - **key** (string) - Required - The key of the configuration value. ### Returns - (string) - The string value for the given key. ```