Ir a la consola

HttpsCallableReference

public class HttpsCallableReference extends Object

A reference to a particular Callable HTTPS trigger in Cloud Functions.

Public Method Summary

Task<HttpsCallableResult>
call()
Executes this HTTPS endpoint asynchronously without arguments.
Task<HttpsCallableResult>
call(Object data)
Executes this Callable HTTPS trigger asynchronously.
long
getTimeout()
Returns the timeout for calls from this instance of Functions.
void
setTimeout(long timeout, TimeUnit units)
Changes the timeout for calls from this instance of Functions.
HttpsCallableReference
withTimeout(long timeout, TimeUnit units)
Creates a new reference with the given timeout for calls.

Inherited Method Summary

Public Methods

public Task<HttpsCallableResult> call ()

Executes this HTTPS endpoint asynchronously without arguments.

The request to the Cloud Functions backend made by this method automatically includes a Firebase Instance ID token to identify the app instance. If a user is logged in with Firebase Auth, an auth token for the user will also be automatically included.

Firebase Instance ID sends data to the Firebase backend periodically to collect information regarding the app instance. To stop this, see deleteInstanceId(). It will resume with a new Instance ID the next time you call this method.

Returns
  • A Task that will be completed when the HTTPS request has completed.

public Task<HttpsCallableResult> call (Object data)

Executes this Callable HTTPS trigger asynchronously.

The data passed into the trigger can be any of the following types:

  • Any primitive type, including null, int, long, float, and boolean.
  • String
  • List<?>, where the contained objects are also one of these types.
  • Map<String, ?>, where the values are also one of these types.
  • JSONArray
  • JSONObject
  • JSONObject.NULL

If the returned task fails, the Exception will be one of the following types:

  • IOException - if the HTTPS request failed to connect.
  • FirebaseFunctionsException - if the request connected, but the function returned an error.

The request to the Cloud Functions backend made by this method automatically includes a Firebase Instance ID token to identify the app instance. If a user is logged in with Firebase Auth, an auth token for the user will also be automatically included.

Firebase Instance ID sends data to the Firebase backend periodically to collect information regarding the app instance. To stop this, see deleteInstanceId(). It will resume with a new Instance ID the next time you call this method.

Parameters
data Parameters to pass to the trigger.
Returns
  • A Task that will be completed when the HTTPS request has completed.

public long getTimeout ()

Returns the timeout for calls from this instance of Functions.

Returns
  • The timeout, in milliseconds.

public void setTimeout (long timeout, TimeUnit units)

Changes the timeout for calls from this instance of Functions. The default is 60 seconds.

Parameters
timeout The length of the timeout, in the given units.
units The units for the specified timeout.

public HttpsCallableReference withTimeout (long timeout, TimeUnit units)

Creates a new reference with the given timeout for calls. The default is 60 seconds.

Parameters
timeout The length of the timeout, in the given units.
units The units for the specified timeout.