FirebaseFunctions

public final class FirebaseFunctions


FirebaseFunctions lets you call Cloud Functions for Firebase.

Summary

Nested types

public static class FirebaseFunctions.Companion

Public methods

final @NonNull HttpsCallableReference

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

final @NonNull HttpsCallableReference
getHttpsCallable(
    @NonNull String name,
    @NonNull HttpsCallableOptions options
)

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

final @NonNull HttpsCallableReference

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

final @NonNull HttpsCallableReference

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

static final @NonNull FirebaseFunctions

Creates a Cloud Functions client with the default app.

static final @NonNull FirebaseFunctions

Creates a Cloud Functions client with the given app.

static final @NonNull FirebaseFunctions
getInstance(@NonNull String regionOrCustomDomain)

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

static final @NonNull FirebaseFunctions
getInstance(@NonNull FirebaseApp app, @NonNull String regionOrCustomDomain)

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

final void
useEmulator(@NonNull String 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 @NonNull HttpsCallableReference

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

final @NonNull HttpsCallableReference

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

final @NonNull HttpsCallableReference

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

final @NonNull HttpsCallableReference

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 @NonNull HttpsCallableReference getHttpsCallable(@NonNull String name)

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

getHttpsCallable

public final @NonNull HttpsCallableReference getHttpsCallable(
    @NonNull String name,
    @NonNull HttpsCallableOptions options
)

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

getHttpsCallableFromUrl

public final @NonNull HttpsCallableReference getHttpsCallableFromUrl(@NonNull URL url)

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

getHttpsCallableFromUrl

public final @NonNull HttpsCallableReference getHttpsCallableFromUrl(
    @NonNull URL url,
    @NonNull HttpsCallableOptions options
)

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

getInstance

public static final @NonNull FirebaseFunctions getInstance()

Creates a Cloud Functions client with the default app.

getInstance

public static final @NonNull FirebaseFunctions getInstance(@NonNull FirebaseApp app)

Creates a Cloud Functions client with the given app.

Parameters
@NonNull FirebaseApp app

The app for the Firebase project.

getInstance

public static final @NonNull FirebaseFunctions getInstance(@NonNull String regionOrCustomDomain)

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

Parameters
@NonNull String regionOrCustomDomain

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

getInstance

public static final @NonNull FirebaseFunctions getInstance(@NonNull FirebaseApp app, @NonNull String regionOrCustomDomain)

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

Parameters
@NonNull FirebaseApp app

The app for the Firebase project.

@NonNull String regionOrCustomDomain

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

useEmulator

public final void useEmulator(@NonNull String 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
@NonNull String host

the emulator host (for example, 10.0.2.2)

int port

the emulator port (for example, 5001)

useFunctionsEmulator

public final void useFunctionsEmulator(@NonNull String origin)

Extension functions

FunctionsKt.getHttpsCallable

public final @NonNull HttpsCallableReference FunctionsKt.getHttpsCallable(
    @NonNull FirebaseFunctions receiver,
    @NonNull String name,
    @ExtensionFunctionType @NonNull Function1<@NonNull HttpsCallableOptions.BuilderUnit> init
)

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

FunctionsKt.getHttpsCallable

public final @NonNull HttpsCallableReference FunctionsKt.getHttpsCallable(
    @NonNull FirebaseFunctions receiver,
    @NonNull String name,
    @ExtensionFunctionType @NonNull Function1<@NonNull HttpsCallableOptions.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 @NonNull HttpsCallableReference FunctionsKt.getHttpsCallableFromUrl(
    @NonNull FirebaseFunctions receiver,
    @NonNull URL url,
    @ExtensionFunctionType @NonNull Function1<@NonNull HttpsCallableOptions.BuilderUnit> init
)

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

FunctionsKt.getHttpsCallableFromUrl

public final @NonNull HttpsCallableReference FunctionsKt.getHttpsCallableFromUrl(
    @NonNull FirebaseFunctions receiver,
    @NonNull URL url,
    @ExtensionFunctionType @NonNull Function1<@NonNull HttpsCallableOptions.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.