FirebaseFunctions

class FirebaseFunctions


FirebaseFunctions lets you call Cloud Functions for Firebase.

Summary

Public companion functions

FirebaseFunctions

Creates a Cloud Functions client with the default app.

FirebaseFunctions

Creates a Cloud Functions client with the given app.

FirebaseFunctions
getInstance(regionOrCustomDomain: String)

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

FirebaseFunctions
getInstance(app: FirebaseApp, regionOrCustomDomain: String)

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

Public functions

HttpsCallableReference

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

HttpsCallableReference

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

HttpsCallableReference

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

HttpsCallableReference

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

Unit
useEmulator(host: String, port: Int)

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

Unit

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

Extension functions

HttpsCallableReference

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

HttpsCallableReference

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

HttpsCallableReference

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

HttpsCallableReference

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

Public companion functions

getInstance

fun getInstance(): FirebaseFunctions

Creates a Cloud Functions client with the default app.

getInstance

fun getInstance(app: FirebaseApp): FirebaseFunctions

Creates a Cloud Functions client with the given app.

Parameters
app: FirebaseApp

The app for the Firebase project.

getInstance

fun getInstance(regionOrCustomDomain: String): FirebaseFunctions

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

Parameters
regionOrCustomDomain: String

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

getInstance

fun getInstance(app: FirebaseApp, regionOrCustomDomain: String): FirebaseFunctions

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

Parameters
app: FirebaseApp

The app for the Firebase project.

regionOrCustomDomain: String

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

Public functions

getHttpsCallable

fun getHttpsCallable(name: String): HttpsCallableReference

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

getHttpsCallable

fun getHttpsCallable(name: String, options: HttpsCallableOptions): HttpsCallableReference

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

getHttpsCallableFromUrl

fun getHttpsCallableFromUrl(url: URL): HttpsCallableReference

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

getHttpsCallableFromUrl

fun getHttpsCallableFromUrl(url: URL, options: HttpsCallableOptions): HttpsCallableReference

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

useEmulator

fun useEmulator(host: String, port: Int): Unit

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
host: String

the emulator host (for example, 10.0.2.2)

port: Int

the emulator port (for example, 5001)

useFunctionsEmulator

fun useFunctionsEmulator(origin: String): Unit

Extension functions

getHttpsCallable

fun FirebaseFunctions.getHttpsCallable(name: String, init: HttpsCallableOptions.Builder.() -> Unit): HttpsCallableReference

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

getHttpsCallable

fun FirebaseFunctions.getHttpsCallable(name: String, init: HttpsCallableOptions.Builder.() -> Unit): HttpsCallableReference

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.

getHttpsCallableFromUrl

fun FirebaseFunctions.getHttpsCallableFromUrl(url: URL, init: HttpsCallableOptions.Builder.() -> Unit): HttpsCallableReference

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

getHttpsCallableFromUrl

fun FirebaseFunctions.getHttpsCallableFromUrl(url: URL, init: HttpsCallableOptions.Builder.() -> Unit): HttpsCallableReference

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.