FirebaseFunctions

public final class FirebaseFunctions


FirebaseFunctions lets you call Cloud Functions for Firebase.

Summary

Nested types

public static class FirebaseFunctions.Companion

Public methods

final @NonNullHttpsCallableReference

Returns a reference to the callable HTTPS trigger with the given name.

final @NonNullHttpsCallableReference

Returns a reference to the callable HTTPS trigger with the given name and call options.

final @NonNullHttpsCallableReference

Returns a reference to the callable HTTPS trigger with the provided URL.

final @NonNullHttpsCallableReference

Returns a reference to the callable HTTPS trigger with the provided URL and call options.

static final @NonNullFirebaseFunctions

Creates a Cloud Functions client with the default app.

static final @NonNullFirebaseFunctions

Creates a Cloud Functions client with the given app.

static final @NonNullFirebaseFunctions
getInstance(@NonNullString regionOrCustomDomain)

Creates a Cloud Functions client with the default app and given region or custom domain.

static final @NonNullFirebaseFunctions
getInstance(@NonNullFirebaseApp app, @NonNullString regionOrCustomDomain)

Creates a Cloud Functions client with the given app and region or custom domain.

final void
useEmulator(@NonNullString host, int port)

Modifies this FirebaseFunctions instance to communicate with the Cloud Functions emulator.

final void

This method is deprecated. Use useEmulator to connect to the emulator.

Extension functions

final @NonNullHttpsCallableReference

Returns a reference to the Callable HTTPS trigger with the given name and call options.

final @NonNullHttpsCallableReference

This method is deprecated. Migrate to use the KTX API from the main module: https://firebase.google.com/docs/android/kotlin-migration.

final @NonNullHttpsCallableReference

Returns a reference to the Callable HTTPS trigger with the given URL and call options.

final @NonNullHttpsCallableReference

This method is deprecated. Migrate to use the KTX API from the main module: https://firebase.google.com/docs/android/kotlin-migration.

Public methods

getHttpsCallable

public final @NonNullHttpsCallableReference getHttpsCallable(@NonNullString name)

Returns a reference to the callable HTTPS trigger with the given name.

getHttpsCallable

public final @NonNullHttpsCallableReference getHttpsCallable(
    @NonNullString name,
    @NonNullHttpsCallableOptions options
)

Returns a reference to the callable HTTPS trigger with the given name and call options.

getHttpsCallableFromUrl

public final @NonNullHttpsCallableReference getHttpsCallableFromUrl(@NonNullURL url)

Returns a reference to the callable HTTPS trigger with the provided URL.

getHttpsCallableFromUrl

public final @NonNullHttpsCallableReference getHttpsCallableFromUrl(
    @NonNullURL url,
    @NonNullHttpsCallableOptions options
)

Returns a reference to the callable HTTPS trigger with the provided URL and call options.

getInstance

public static final @NonNullFirebaseFunctions getInstance()

Creates a Cloud Functions client with the default app.

getInstance

public static final @NonNullFirebaseFunctions getInstance(@NonNullFirebaseApp app)

Creates a Cloud Functions client with the given app.

Parameters
@NonNullFirebaseApp app

The app for the Firebase project.

getInstance

public static final @NonNullFirebaseFunctions getInstance(@NonNullString regionOrCustomDomain)

Creates a Cloud Functions client with the default app and given region or custom domain.

Parameters
@NonNullString regionOrCustomDomain

The region or custom domain for the HTTPS trigger, such as "us-central1" or "https://mydomain.com".

getInstance

public static final @NonNullFirebaseFunctions getInstance(@NonNullFirebaseApp app, @NonNullString regionOrCustomDomain)

Creates a Cloud Functions client with the given app and region or custom domain.

Parameters
@NonNullFirebaseApp app

The app for the Firebase project.

@NonNullString regionOrCustomDomain

The region or custom domain for the HTTPS trigger, such as "us-central1" or "https://mydomain.com".

useEmulator

public final void useEmulator(@NonNullString host, int port)

Modifies this FirebaseFunctions instance to communicate with the Cloud Functions emulator.

Note: Call this method before using the instance to do any functions operations.

Parameters
@NonNullString host

the emulator host (for example, 10.0.2.2)

int port

the emulator port (for example, 5001)

useFunctionsEmulator

public final void useFunctionsEmulator(@NonNullString origin)

Extension functions

FunctionsKt.getHttpsCallable

public final @NonNullHttpsCallableReference FunctionsKt.getHttpsCallable(
    @NonNullFirebaseFunctions receiver,
    @NonNullString name,
    @ExtensionFunctionType @NonNull Function1<@NonNullHttpsCallableOptions.BuilderUnit> init
)

Returns a reference to the Callable HTTPS trigger with the given name and call options.

FunctionsKt.getHttpsCallable

public final @NonNullHttpsCallableReference FunctionsKt.getHttpsCallable(
    @NonNullFirebaseFunctions receiver,
    @NonNullString name,
    @ExtensionFunctionType @NonNull Function1<@NonNullHttpsCallableOptions.BuilderUnit> init
)

Returns a reference to the Callable HTTPS trigger with the given name and call options.

Deprecation Notice: The Kotlin extensions (KTX) APIs have been added to their respective main modules, and the Kotlin extension (KTX) APIs in com.google.firebase.firebase-functions-ktx are now deprecated. As early as April 2024, we'll no longer release KTX modules. For details, see the FAQ about this initiative.

FunctionsKt.getHttpsCallableFromUrl

public final @NonNullHttpsCallableReference FunctionsKt.getHttpsCallableFromUrl(
    @NonNullFirebaseFunctions receiver,
    @NonNullURL url,
    @ExtensionFunctionType @NonNull Function1<@NonNullHttpsCallableOptions.BuilderUnit> init
)

Returns a reference to the Callable HTTPS trigger with the given URL and call options.

FunctionsKt.getHttpsCallableFromUrl

public final @NonNullHttpsCallableReference FunctionsKt.getHttpsCallableFromUrl(
    @NonNullFirebaseFunctions receiver,
    @NonNullURL url,
    @ExtensionFunctionType @NonNull Function1<@NonNullHttpsCallableOptions.BuilderUnit> init
)

Returns a reference to the Callable HTTPS trigger with the given URL and call options.

Deprecation Notice: The Kotlin extensions (KTX) APIs have been added to their respective main modules, and the Kotlin extension (KTX) APIs in com.google.firebase.firebase-functions-ktx are now deprecated. As early as April 2024, we'll no longer release KTX modules. For details, see the FAQ about this initiative.