Firebase Extensions service.

## Functions

| Function | Description |
|---|---|
| [getExtensions(app)](https://firebase.google.com/docs/reference/admin/node/firebase-admin.extensions#getextensions_8a40afc) | Gets the [Extensions](https://firebase.google.com/docs/reference/admin/node/firebase-admin.extensions.extensions#extensions_class) service for the default app or a given app.`getExtensions()` can be called with no arguments to access the default app's `Extensions` service or as `getExtensions(app)` to access the `Extensions` service associated with a specific app. |

## Classes

| Class | Description |
|---|---|
| [Extensions](https://firebase.google.com/docs/reference/admin/node/firebase-admin.extensions.extensions#extensions_class) | The Firebase `Extensions` service interface. |
| [FirebaseExtensionsError](https://firebase.google.com/docs/reference/admin/node/firebase-admin.extensions.firebaseextensionserror#firebaseextensionserror_class) | Firebase Extensions error code structure. This extends `FirebaseError`. |
| [Runtime](https://firebase.google.com/docs/reference/admin/node/firebase-admin.extensions.runtime#runtime_class) | Runtime provides methods to modify an extension instance's runtime data. |

## Variables

| Variable | Description |
|---|---|
| [ExtensionsErrorCode](https://firebase.google.com/docs/reference/admin/node/firebase-admin.extensions#extensionserrorcode) | The constant mapping for valid Extensions client error codes. |

## Type Aliases

| Type Alias | Description |
|---|---|
| [ExtensionsErrorCode](https://firebase.google.com/docs/reference/admin/node/firebase-admin.extensions#extensionserrorcode) | The type definition for valid Extensions client error codes. |
| [SettableProcessingState](https://firebase.google.com/docs/reference/admin/node/firebase-admin.extensions#settableprocessingstate) | `SettableProcessingState` represents all the processing states that can be set on an Extension instance's runtime data. |

## getExtensions(app)

Gets the [Extensions](https://firebase.google.com/docs/reference/admin/node/firebase-admin.extensions.extensions#extensions_class) service for the default app or a given app.

`getExtensions()` can be called with no arguments to access the default app's `Extensions` service or as `getExtensions(app)` to access the `Extensions` service associated with a specific app.

**Signature:**

    export declare function getExtensions(app?: App): Extensions;

### Parameters

| Parameter | Type | Description |
|---|---|---|
| app | App | Optional app for which to return the `Extensions` service. If not provided, the default `Extensions` service is returned. |

**Returns:**

[Extensions](https://firebase.google.com/docs/reference/admin/node/firebase-admin.extensions.extensions#extensions_class)

The default `Extensions` service if no app is provided, or the `Extensions` service associated with the provided app.

### Example 1

    // Get the `Extensions` service for the default app
    const defaultExtensions = getExtensions();

### Example 2

    // Get the `Extensions` service for a given app
    const otherExtensions = getExtensions(otherApp);

## ExtensionsErrorCode

The constant mapping for valid Extensions client error codes.

**Signature:**

    ExtensionsErrorCode: {
        readonly INVALID_ARGUMENT: "invalid-argument";
        readonly NOT_FOUND: "not-found";
        readonly FORBIDDEN: "forbidden";
        readonly INTERNAL_ERROR: "internal-error";
        readonly UNKNOWN_ERROR: "unknown-error";
    }

## ExtensionsErrorCode

The type definition for valid Extensions client error codes.

**Signature:**

    export type ExtensionsErrorCode = typeof ExtensionsErrorCode[keyof typeof ExtensionsErrorCode];

## SettableProcessingState

`SettableProcessingState` represents all the processing states that can be set on an Extension instance's runtime data.

You can set the following states:

- `NONE`: No relevant lifecycle event work has been done. Set this to clear out old statuses.

- `PROCESSING_COMPLETE`: Lifecycle event work completed with no errors.

- `PROCESSING_WARNING`: Lifecycle event work succeeded partially, or something happened that the user should be warned about.

- `PROCESSING_FAILED`: Lifecycle event work failed completely, but the instance will still work correctly going forward.

If the extension instance is in a broken state due to errors, instead call [Runtime.setFatalError()](https://firebase.google.com/docs/reference/admin/node/firebase-admin.extensions.runtime#runtimesetfatalerror).

The "processing" state gets set automatically when a lifecycle event handler starts; you can't set it explicitly. To report the ongoing status of an extension's function, use `console.log` or the Cloud Functions logger SDK.

**Signature:**

    export type SettableProcessingState = 'NONE' | 'PROCESSING_COMPLETE' | 'PROCESSING_WARNING' | 'PROCESSING_FAILED';