Packagecom.myflashlab.air.extensions.firebase.functions
Classpublic class Functions
InheritanceFunctions Inheritance Object

The entry point of the Firebase Functions SDK.



Public Methods
 MethodDefined By
  
callFunction($name:String, $params:Object, $callback:Function = null):void
[static] Call a 'callable' function on server.
Functions
  
getTimeout($name:String):int
[static] Returns the timeout for calls from this instance of Functions.
Functions
  
init($region:String = null):void
[static] Init the Functions ANE and optionally pass in a region.
Functions
  
setTimeout($name:String, $timeout:int):void
[static] Changes the timeout for calls from the instance of Functions.
Functions
Public Constants
 ConstantDefined By
  EXTENSION_ID : String = com.myflashlab.air.extensions.firebase.functions
[static]
Functions
  VERSION : String = 9.9.0
[static]
Functions
Method Detail
callFunction()method
public static function callFunction($name:String, $params:Object, $callback:Function = null):void

Call a 'callable' function on server. Notice that server functions should be of type functions.https.onCall so they can be called from Android or iOS apps.

Parameters

$name:String
 
$params:Object
 
$callback:Function (default = null)


Example
Below is an example of a server function in JS:
         exports.helloWorld = functions.https.onCall((data, context) => {
         // Message text passed from the client.
         const text = data.text;
          
         // returning result.
         return {
           var1: 'value from server!',
           var2: 'value from AIR: ' + text
         };
         
Below shows what parameters the callback function must have
         function($data:String, $error:Error):void
         {
             // $data: is a String is JSON format. Could be an Array or an Object depending on what format the server side returns.
             // $error: If an error occurred, this error object describes the error. If the operation was completed successfully, the value is null.
         }
         
getTimeout()method 
public static function getTimeout($name:String):int

Returns the timeout for calls from this instance of Functions. It's just for Android.

Parameters

$name:String — The name of the endpoint this reference refers to.

Returns
int — The timeout, in milliseconds.
init()method 
public static function init($region:String = null):void

Init the Functions ANE and optionally pass in a region. To understand Firebase Functions locations, read here: https://firebase.google.com/docs/functions/locations

Parameters

$region:String (default = null)

setTimeout()method 
public static function setTimeout($name:String, $timeout:int):void

Changes the timeout for calls from the instance of Functions. The default is 60 seconds. It's just for Android.

Parameters

$name:String — The name of the endpoint this reference refers to.
 
$timeout:int — The length of the timeout, in the given units.

Constant Detail
EXTENSION_IDConstant
public static const EXTENSION_ID:String = com.myflashlab.air.extensions.firebase.functions

VERSIONConstant 
public static const VERSION:String = 9.9.0