Google's Firebase Arduino Client Library for ESP8266 and ESP32
The default filessystem used in the library is flash and SD.
The file systems for flash and sd memory can be changed in FirebaseFS.h.
The global functions are the functions that called directly from the Firebase object e.g. Firebase.<function name>
param config
The pointer to FirebaseConfig data.
param auth
The pointer to FirebaseAuth data.
note: For FirebaseConfig and FirebaseAuth data usage, see the examples.
void begin(FirebaseConfig *config, FirebaseAuth *auth);
param config
The pointer to FirebaseConfig data.
param idToken
The ID Token.
param expire
The expired interval in seeconds (max.3600 sec).
param refreshToken
The refresh token for token refreshment.
note For FirebaseConfig and FirebaseAuth data usage, see the examples.
void setIdToken(FirebaseConfig *config, <string> idToken, size_t expire = 3600, <string> refreshToken = "");
param config
The pointer to FirebaseConfig data.
param accessToken
The access Token.
param expire
The expired interval in seeconds (max.3600 sec).
param refreshToken
The refresh token for token refreshment.
param clientId
The The client identifier issued to the client during the registration process.
param clientSecret
The client secret.
note For FirebaseConfig and FirebaseAuth data usage, see the examples.
void setAccessToken(FirebaseConfig *config, <string> accessToken, size_t expire = 3600, <string> refreshToken = "", <string> clientId = "", <string> clientSecret = "");
param config
The pointer to FirebaseConfig data.
param customToken
The Identity Platform custom token.
If the refresh token from Custom token verification or sign in, was assigned here instead of custom token (signed JWT token), the token refresh process will be performed immediately.
Any token that is not in the form header.payload.signature i.e., xxxxx.yyyyy.zzzzz will be treated as refresh token.
note For FirebaseConfig and FirebaseAuth data usage, see the examples.
void setCustomToken(FirebaseConfig *config, <string> customToken);
return bool
of expiry status.
bool isTokenExpired();
param config
The pointer to FirebaseConfig data.
void refreshToken(FirebaseConfig *config);
param config
The pointer to FirebaseConfig data.
void reset(FirebaseConfig *config);
return token_info_t
The token_info_t structured data that indicates the status.
note: Use type property to get the type enum value.
token_type_undefined or 0,
token_type_legacy_token or 1,
token_type_id_token or 2,
token_type_custom_token or 3,
token_type_oauth2_access_token or 4
Use status property to get the status enum value.
token_status_uninitialized or 0,
token_status_on_signing or 1,
token_status_on_request or 2,
token_status_on_refresh or 3,
token_status_ready or 4
In case of token generation and refreshment errors, use error.code property to get the error code number.
Use error.message property to get the error message string.
struct token_info_t authTokenInfo();
return Boolean
type status indicates the token generation is completed.
This function should be called repeatedly to handle authentication tasks.
bool ready();
return Boolean
type status indicates the device can access to the services.
This returns false if ready() returns false (token generation is not ready).
bool authenticated();
param config
The pointer to FirebaseConfig data.
param auth
The pointer to FirebaseAuth data.
param email
The user Email.
param password
The user password.
return Boolean
value, indicates the success of the operation.
note: By calling Firebase.begin with config and auth after sign up will be signed in.
This required Email/Password provider to be enabled,
From Firebase console, select Authentication, select Sign-in method tab, under the Sign-in providers list, enable Email/Password provider.
If the assigned email and passowrd are empty, the anonymous user will be created if Anonymous provider is enabled.
To enable Anonymous provider, from Firebase console, select Authentication, select Sign-in method tab, under the Sign-in providers list, enable Anonymous provider.
bool signUp(FirebaseConfig *config, FirebaseAuth *auth, <string> email, <string> password);
param config
The pointer to FirebaseConfig data.
param auth
The pointer to FirebaseAuth data.
param idToken
(optional) The id token of user, leave blank to delete the current sign in user.
return Boolean
type status indicates the success of the operation.
bool deleteUser(FirebaseConfig *config, FirebaseAuth *auth, const char* idToken = "");
param config
The pointer to FirebaseConfig data.
param idToken
The id token of user that was already signed in with Email and password (optional).
return Boolean
value, indicates the success of the operation.
note: The id token can be obtained from Firebase.getToken() after begin with config and auth data.
If the idToken is not assigned, the internal id_token will be used.
See the Templates of Email address verification in the Firebase console, Authentication.
bool sendEmailVerification(FirebaseConfig *config, <string> idToken);
param config
The pointer to FirebaseConfig data.
param email
The user Email to send the password resset link.
return Boolean
value, indicates the success of the operation.
bool sendResetPassword(FirebaseConfig *config, <string> email);
param reconnect
The boolean to set/unset WiFi AP reconnection.
void reconnectWiFi(bool reconnect);
param client
The pointer to UDP client based on the network type.
param gmtOffset
The GMT time offset.
void setUDPClient(UDP *client, float gmtOffset = 0);
param constant char*
of currently used auth token.
const char *getToken();
return constant char*
of refresh token.
const char *getRefreshToken();
return int *
of free Heap memory size.
int getFreeHeap();
return time_t *
of current timestamp.
time_t getCurrentTime();
param digits
The decimal places.
void setFloatDigits(uint8_t digits);
param digits
The decimal places.
void setDoubleDigits(uint8_t digits);
param ss
The SPI Chip/Slave Select pin.
param sck
The SPI Clock pin.
param miso
The SPI MISO pin.
param mosi
The SPI MOSI pin.
aram frequency
The SPI frequency.
return boolean
The boolean value indicates the success of operation.
bool sdBegin(int8_t ss = -1, int8_t sck = -1, int8_t miso = -1, int8_t mosi = -1, uint32_t frequency = 4000000);
param ss
SPI Chip/Slave Select pin.
param sdFSConfig
The pointer to SDFSConfig object (ESP8266 only).
return boolean
type status indicates the success of the operation.
bool sdBegin(SDFSConfig *sdFSConfig);
param ss
The SPI Chip/Slave Select pin.
param spiConfig
The pointer to SPIClass object for SPI configuartion.
param frequency
The SPI frequency.
return boolean
The boolean value indicates the success of operation.
bool sdBegin(int8_t ss, SPIClass *spiConfig = nullptr, uint32_t frequency = 4000000);
param sdFatSPIConfig
The pointer to SdSpiConfig object for SdFat SPI configuration.
param ss
The SPI Chip/Slave Select pin.
param sck
The SPI Clock pin.
param miso
The SPI MISO pin.
param mosi
The SPI MOSI pin.
return boolean
The boolean value indicates the success of operation.
bool sdBegin(SdSpiConfig *sdFatSPIConfig, int8_t ss = -1, int8_t sck = -1, int8_t miso = -1, int8_t mosi = -1);
param sdFatSDIOConfig
The pointer to SdioConfig object for SdFat SDIO configuration.
return boolean
The boolean value indicates the success of operation.
bool sdBegin(SdioConfig *sdFatSDIOConfig);
param mountpoint
The mounting point.
param mode1bit
Allow 1 bit data line (SPI mode).
param format_if_mount_failed
Format SD_MMC card if mount failed.
return Boolean
type status indicates the success of the operation.
bool sdMMCBegin(const char *mountpoint = "/sdcard", bool mode1bit = false, bool format_if_mount_failed = false);
param ts
timestamp in seconds from midnight Jan 1, 1970.
return Boolean
type status indicates the success of the operation.
This function allows the internal time setting by timestamp i.e. timestamp from external RTC.
bool setSystemTime(time_t ts);
param httpCode
The http code.
param buff
The String buffer out.
void errorToString(int httpCode, String &buff)
These functions can be called directly from RTDB object in the Firebase object e.g. Firebase.RTDB.<function name>
param fbdo
The pointer to Firebase Data Object.
void end(FirebaseData *fbdo);
param enable
The boolean value to enable/disable.
note: The multiple HTTP requessts at a time is disable by default to prevent the large memory used in multiple requests.
void allowMultipleRequests(bool enable);
param fbdo
The pointer to Firebase Data Object.
param millisec
The milliseconds to limit the request (0 - 900,000 ms or 15 min).
void setReadTimeout(FirebaseData *fbdo, int millisec);
param fbdo
The pointer to Firebase Data Object.
param size
The size identified string e.g. tiny, small, medium, large and unlimited.
Size string and its write timeout in seconds e.g. tiny (1s), small (10s), medium (30s) and large (60s).
void setwriteSizeLimit(FirebaseData *fbdo, <string> size);
param fbdo
The pointer to Firebase Data Object.
return Boolean
value, indicates the success of the operation.
bool getRules(FirebaseData *fbdo);
param fbdo
The pointer to Firebase Data Object.
param storageType
The enum of memory storage type e.g. mem_storage_type_flash and mem_storage_type_sd. The file systems can be changed in FirebaseFS.h.
param filename
Filename to save rules.
param callback
Optional. The callback function that accept RTDB_DownloadStatusInfo data.
return Boolean
type status indicates the success of the operation.
getRules(FirebaseData *fbdo, fb_esp_mem_storage_type storageType, <string> filename, RTDB_DownloadProgressCallback callback = NULL)
param fbdo
The pointer to Firebase Data Object.
param rules
Database rules in jSON String format.
return Boolean
value, indicates the success of the operation.
bool setRules(FirebaseData *fbdo, <string> rules);
param fbdo
The pointer to Firebase Data Object.
param storageType
The enum of memory storage type e.g. mem_storage_type_flash and mem_storage_type_sd. The file systems can be changed in FirebaseFS.h.
param filename
Filename to read the rules from.
param callback
Optional. The callback function that accept RTDB_UploadStatusInfo data.
return Boolean
type status indicates the success of the operation.
setRules(FirebaseData *fbdo, fb_esp_mem_storage_type storageType, <string> filename, RTDB_UploadProgressCallback callback = NULL)
param fbdo
The pointer to Firebase Data Object.
param path
The parent path of child's node that the .read and .write rules are being set.
param var
The child node key that the .read and .write rules are being set.
param readVal
The child node key .read value.
param writeVal
The child node key .write value.
param databaseSecret
The database secret.
return Boolean
value, indicates the success of the operation.
note: The databaseSecret can be empty if the auth type is OAuth2.0 or legacy and required if auth type is Email/Password sign-in.
bool setReadWriteRules(FirebaseData *fbdo, <string> path, <string> var, <string> readVal, <string> writeVal, <string> databaseSecret);
param fbdo
The pointer to Firebase Data Object.
param path
The parent path of child's node that is being queried.
param node
The child node key that is being queried.
param databaseSecret
The database secret.
return Boolean
value, indicates the success of the operation.
note: The databaseSecret can be empty if the auth type is OAuth2.0 or legacy and required if auth type is Email/Password sign-in.
bool setQueryIndex(FirebaseData *fbdo, <string> path, <string> node, <string> databaseSecret);
param fbdo
The pointer to Firebase Data Object.
param path
The parent path of child's node that the index is being removed.
param databaseSecret
The database secret.
return Boolean
value, indicates the success of the operation.
note: The databaseSecret can be empty if the auth type is OAuth2.0 or legacy and required if auth type is Email/Password sign-in.
bool removeQueryIndex(FirebaseData *fbdo, <string> path, <string> databaseSecret);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node.
return Boolean
value, true if the defined node was found.
bool pathExisted(FirebaseData *fbdo, <string> path);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node.
return String
of unique identifier.
String getETag(FirebaseData *fbdo, <string> path);
param fbdo
The pointer to Firebase Data Object.
param path
node that is being read the data.
return Boolean
value, indicates the success of the operation.
bool getShallowData(FirebaseData *fbdo, <string> path);
param fbdo
The pointer to Firebase Data Object.
param enable
Boolean value, true to enable, false to disable.
This option used to escape the Firewall restriction (if the device is connected through Firewall) that allows only HTTP GET and POST
HTTP PATCH request was sent as PATCH which not affected by this option.
void enableClassicRequest(FirebaseData *fbdo, bool enable);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node.
param priority
The priority value.
return Boolean
value, indicates the success of the operation.
This allows us to set priority to any node other than a priority that set through setJSON, pushJSON, updateNode, and updateNodeSilent functions.
bool setPriority(FirebaseData *fbdo, <string> path, float priority);
bool setPriorityAsync(FirebaseData *fbdo, <string> path, float priority);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node.
return Boolean
value, indicates the success of the operation.
bool getPriority(FirebaseData *fbdo, <string> path);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node.
param value
The appended value of any type e.g. bool, int, float, double, String, FirebaseJson object and array.
param blob
Byte array of data (blob).
param size
Size of the byte array (blob).
param storageType
The enum of memory storage type e.g. mem_storage_type_flash and mem_storage_type_sd.
The file systems can be changed in FirebaseFS.h.
param fileName
The file path includes its name.
return Boolean
value, indicates the success of the operation.
The key or name of new created node will be stored in Firebase Data object,
call <FirebaseData>.pushName()
to get the key.
bool push(FirebaseData *fbdo, <string> path, <type> value);
bool pushAsync(FirebaseData *fbdo, <string> path, <type> value);
bool push(FirebaseData *fbdo, <string> path, uint8_t *blob, size_t size);
bool pushAsync(FirebaseData *fbdo, <string> path, uint8_t *blob, size_t size);
bool push(FirebaseData *fbdo, fb_esp_mem_storage_type storageType, <string> path, <string> fileName);
bool pushAsync(FirebaseData *fbdo, fb_esp_mem_storage_type storageType, <string> path, <string> fileName);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node.
param value
The appended value of any type e.g. bool, int, float, double, String, FirebaseJson object and array.
param priority
The priority value.
return Boolean
value, indicates the success of the operation.
The key or name of new created node will be stored in Firebase Data object,
call <FirebaseData>.pushName()
to get the key.
bool push(FirebaseData *fbdo, <string> path, <type> value, float priority);
bool pushAsync(FirebaseData *fbdo, <string> path, <type> value, float priority);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node.
param value
The appended value.
return Boolean
value, indicates the success of the operation.
The key or name of new created node will be stored in Firebase Data object,
call <FirebaseData>.pushName()
to get the key.
bool pushInt(FirebaseData *fbdo, <string> path, int value);
bool pushIntAsync(FirebaseData *fbdo, <string> path, int value);
bool pushInt(FirebaseData *fbdo, <string> path, int value, float priority);
bool pushIntAsync(FirebaseData *fbdo, <string> path, int value, float priority);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node in which float value will be appended.
param value
The appended value.
return Boolean
value, indicates the success of the operation.
The key or name of new created node will be stored in Firebase Data object,
call <FirebaseData>.pushName()
to get the key.
bool pushFloat(FirebaseData *fbdo, <string> path, float value);
bool pushFloatAsync(FirebaseData *fbdo, <string> path, float value);
bool pushFloat(FirebaseData *fbdo, <string> path, float value, float priority);
bool pushFloatAsync(FirebaseData *fbdo, <string> path, float value, float priority);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node in which float value will be appended.
param value
The appended value.
return Boolean
value, indicates the success of the operation.
The key or name of new created node will be stored in Firebase Data object,
call <FirebaseData>.pushName()
to get the key.
bool pushDouble(FirebaseData *fbdo, <string> path, double value);
bool pushDoubleAsync(FirebaseData *fbdo, <string> path, double value);
bool pushDouble(FirebaseData *fbdo, <string> path, double value, float priority);
bool pushDoubleAsync(FirebaseData *fbdo, <string> path, double value, float priority);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node in which Boolean value will be appended.
param value
The appended value.
return Boolean
value, indicates the success of the operation.
The key or name of new created node will be stored in Firebase Data object,
call <FirebaseData>.pushName()
to get the key.
bool pushBool(FirebaseData *fbdo, <string> path, bool value);
bool pushBoolAsync(FirebaseData *fbdo, <string> path, bool value);
bool pushBool(FirebaseData *fbdo, <string> path, bool value, float priority);
bool pushBoolAsync(FirebaseData *fbdo, <string> path, bool value, float priority);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node in which string will be appended.
param value
The appended value.
return Boolean
value, indicates the success of the operation.
The key or name of new created node will be stored in Firebase Data object,
call <FirebaseData>.pushName()
to get the key.
bool pushString(FirebaseData *fbdo, <string> path, <string> value);
bool pushStringAsync(FirebaseData *fbdo, <string> path, <string> value);
bool pushString(FirebaseData *fbdo, <string> path, <string> value, float priority);
bool pushStringAsync(FirebaseData *fbdo, <string> path, <string> value, float priority);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node in which child (s) will be appended.
param json
The pointer to the FirebaseJson object which contains the child (s) nodes.
return Boolean
value, indicates the success of the operation.
The key or name of new created node will be stored in Firebase Data object,
call <FirebaseData>.pushName()
to get the key.
bool pushJSON(FirebaseData *fbdo, <string> path, FirebaseJson *json);
bool pushJSONAsync(FirebaseData *fbdo, <string> path, FirebaseJson *json);
bool pushJSON(FirebaseData *fbdo, <string> path, FirebaseJson *json, float priority);
bool pushJSONAsync(FirebaseData *fbdo, <string> path, FirebaseJson *json, float priority);
The old content in defined node will be replaced.
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node in which the array will be appended.
param arr
The pointer to the FirebaseJsonArray object.
return Boolean
value, indicates the success of the operation.
The key or name of new created node will be stored in Firebase Data object,
call <FirebaseData>.pushName()
to get the key.
bool pushArray(FirebaseData *fbdo, <string> path, FirebaseJsonArray *arr);
bool pushArrayAsync(FirebaseData *fbdo, <string> path, FirebaseJsonArray *arr);
bool pushArray(FirebaseData *fbdo, <string> path, FirebaseJsonArray *arr, float priority);
bool pushArrayAsync(FirebaseData *fbdo, <string> path, FirebaseJsonArray *arr, float priority);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node in which binary data will be appended.
param blob
Byte array of data.
param size
Size of the byte array.
return Boolean
value, indicates the success of the operation.
The key or name of new created node will be stored in Firebase Data object,
call <FirebaseData>.pushName()
to get the key.
bool pushBlob(FirebaseData *fbdo, <string> path, uint8_t *blob, size_t size);
bool pushAsync(FirebaseData *fbdo, <string> path, uint8_t *blob, size_t size);
param fbdo
The pointer to Firebase Data Object.
param storageType
The enum of memory storage type e.g. mem_storage_type_flash and mem_storage_type_sd.
The file systems can be changed in FirebaseFS.h.
param path
The path to the node in which binary data will be appended.
param fileName
The file path includes its name.
param callback
Optional. The callback function that accept RTDB_UploadStatusInfo data.
return Boolean
value, indicates the success of the operation.
The key or name of new created node will be stored in Firebase Data object,
call <FirebaseData>.pushName()
to get the key.
bool pushFile(FirebaseData *fbdo, fb_esp_mem_storage_type storageType, <string> path, <string> fileName, RTDB_UploadProgressCallback callback = NULL);
bool pushFileAsync(FirebaseData *fbdo, fb_esp_mem_storage_type storageType, <string> path, <string> fileName, RTDB_UploadProgressCallback callback = NULL);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node in which timestamp will be appended.
return Boolean
value, indicates the success of the operation.
The key or name of new created node will be stored in Firebase Data object,
call <FirebaseData>.pushName()
to get the key.
bool pushTimestamp(FirebaseData *fbdo, <string> path);
bool pushTimestampAsync(FirebaseData *fbdo, <string> path);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node which integer value will be set.
param value
the value to set of any type e.g. bool, int, float, double, String, FirebaseJson object and array.
param blob
Byte array of data (blob).
param size
Size of the byte array (blob).
param fileName
The file path includes its name.
return Boolean
value, indicates the success of the operation.
Call <FirebaseData>.dataType
or <FirebaseData>.dataTypeNum
to get the type of data that successfully stored in the database.
Call <FirebaseData>.to<type>()
to get value (cast) that stored on the defined node e.g. <FirebaseData>.to<String>()
to get the String value.
bool set(FirebaseData *fbdo, <string> path, <type> value);
bool setAsync(FirebaseData *fbdo, <string> path, <type> value);
bool set(FirebaseData *fbdo, <string> path, uint8_t *blob, size_t size);
bool setAsync(FirebaseData *fbdo, <string> path, uint8_t *blob, size_t size);
bool set(FirebaseData *fbdo, fb_esp_mem_storage_type storageType, <string> path, <string> fileName);
bool setAsync(FirebaseData *fbdo, fb_esp_mem_storage_type storageType, <string> path, <string> fileName);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node which integer value will be set.
param value
the value to set of any type e.g. bool, int, float, double, String, FirebaseJson object and array.
param priority
The priority value.
return Boolean
value, indicates the success of the operation.
Call <FirebaseData>.dataType
or <FirebaseData>.dataTypeNum
to get the type of data that successfully stored in the database.
Call <FirebaseData>.to<type>()
to get value (cast) that stored on the defined node e.g. <FirebaseData>.to<String>()
to get the String value.
bool set(FirebaseData *fbdo, <string> path, <type> value, float priority);
bool setAsync(FirebaseData *fbdo, <string> path, <type> value, float priority);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node which integer value will be set.
param value
the value to set of any type e.g. bool, int, float, double, String, FirebaseJson object and array.
param blob
Byte array of data (blob).
param size
Size of the byte array (blob).
param fileName
The file path includes its name.
param ETag
Known unique identifier string (ETag) of defined node.
return Boolean
value, indicates the success of the operation.
If ETag at the defined node does not match the provided ETag parameter, the operation will be failed with the http return code 412, Precondition Failed (ETag is not matched).
If the operation failed due to ETag is not match, call <FirebaseData>.ETag()
to get the current ETag value.
Also call <FirebaseData>.dataType
or <FirebaseData>.dataTypeNum
to get the type of data that successfully stored in the database.
And <FirebaseData>.to<type>()
to get value (cast) that stored on the defined node e.g. <FirebaseData>.to<String>()
to get the String value.
bool set(FirebaseData *fbdo, <string> path, <type> value, <string> ETag);
bool setAsync(FirebaseData *fbdo, <string> path, <type> value, <string> ETag);
bool set(FirebaseData *fbdo, <string> path, uint8_t *blob, size_t size, <string> ETag);
bool setAsync(FirebaseData *fbdo, <string> path, uint8_t *blob, size_t size, <string> ETag);
bool set(FirebaseData *fbdo, fb_esp_mem_storage_type storageType, <string> path, <string> fileName, <string> ETag);
bool setAsync(FirebaseData *fbdo, fb_esp_mem_storage_type storageType, <string> path, <string> fileName, <string> ETag);
Set the generic value and the virtual child ".priority" if defined ETag matches at the defined node.
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node which integer value will be set.
param value
the value to set of any type e.g. bool, int, float, double, String, FirebaseJson object and array.
param priority
The priority value.
param ETag
Known unique identifier string (ETag) of defined node.
return Boolean
value, indicates the success of the operation.
If ETag at the defined node does not match the provided ETag parameter, the operation will be failed with the http return code 412, Precondition Failed (ETag is not matched).
If the operation failed due to ETag is not match, call <FirebaseData>.ETag()
to get the current ETag value.
Also call <FirebaseData>.dataType
or <FirebaseData>.dataTypeNum
to get the type of data that successfully stored in the database.
And <FirebaseData>.to<type>()
to get value (cast) that stored on the defined node e.g. <FirebaseData>.to<String>()
to get the String value.
bool set(FirebaseData *fbdo, <string> path, <type> value, float priority, <string> ETag);
bool setAsync(FirebaseData *fbdo, <string> path, <type> value, float priority, <string> ETag);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node which integer value will be set.
param value
Integer value to set.
return Boolean
value, indicates the success of the operation.
Call <FirebaseData>.dataType
or <FirebaseData>.dataTypeNum
to get the type of data that successfully stored in the database.
Call <FirebaseData>.to<int>()
to get the integer value that stored on the defined node.
bool setInt(FirebaseData *fbdo, <string> path, int value);
bool setIntAsync(FirebaseData *fbdo, <string> path, int value);
bool setInt(FirebaseData *fbdo, <string> path, int value, float priority);
bool setIntAsync(FirebaseData *fbdo, <string> path, int value, float priority);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node in which integer value will be set.
param value
Integer value to set.
param ETag
Known unique identifier string (ETag) of the defined node.
return Boolean
value, indicates the success of the operation.
If ETag at the defined node does not match the provided ETag parameter, the operation will be failed with the http return code 412, Precondition Failed (ETag is not matched).
If the operation failed due to ETag is not match, call <FirebaseData>.ETag()
to get the current ETag value.
Also call <FirebaseData>.dataType
or <FirebaseData>.dataTypeNum
to get the type of data that successfully stored in the database.
And <FirebaseData>.to<int>()
to get the integer value that stored on the defined node.
bool setInt(FirebaseData *fbdo, <string> path, int value, <string> ETag);
bool setIntAsync(FirebaseData *fbdo, <string> path, int value, <string> ETag);
bool setInt(FirebaseData *fbdo, <string> path, int value, float priority, <string> ETag);
bool setIntAsync(FirebaseData *fbdo, <string> path, int value, float priority, <string> ETag);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node in which float value will be set.
param value
Float value to set.
return Boolean
value, indicates the success of the operation.
Call <FirebaseData>.dataType
or <FirebaseData>.dataTypeNum
to get the type of data that successfully stored in the database.
Call <FirebaseData>.to<float>()
to get the float value that stored on the defined node.
bool setFloat(FirebaseData *fbdo, <string> path, float value);
bool setFloatAsync(FirebaseData *fbdo, <string> path, float value);
bool setFloat(FirebaseData *fbdo, <string> path, float value, float priority);
bool setFloatAsync(FirebaseData *fbdo, <string> path, float value, float priority);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node in which float data will be set.
param value
Float value to set.
param ETag
Known unique identifier string (ETag) of defined node.
return Boolean
value, indicates the success of the operation.
If ETag at the defined node does not match the provided ETag parameter, the operation will be failed with the http return code 412, Precondition Failed (ETag is not matched).
If the operation failed due to ETag is not match, call <FirebaseData>.ETag()
to get the current ETag value.
Also call <FirebaseData>.dataType
or <FirebaseData>.dataTypeNum
to get the type of data that successfully stored in the database.
Call <FirebaseData>.to<float>()
to get the float value that stored on the defined node.
bool setFloat(FirebaseData *fbdo, <string> path, float value, <string> ETag);
bool setFloatAsync(FirebaseData *fbdo, <string> path, float value, <string> ETag);
bool setFloat(FirebaseData *fbdo, <string> path, float value, float priority, <string> ETag);
bool setFloatAsync(FirebaseData *fbdo, <string> path, float value, float priority, <string> ETag);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node in which float data will be set.
param value
Double value to set.
return Boolean
value, indicates the success of the operation.
Call <FirebaseData>.dataType
or <FirebaseData>.dataTypeNum
to get the type of data that successfully stored in the database.
Call <FirebaseData>.to<double>()
to get the double value that stored on the defined node.
Due to bugs in Serial.print in Arduino, to print large double value with zero decimal place,
use Serial.printf("%.9lf\n", firebaseData.to<double>());
for print the returned double value up to 9 decimal places.
bool setDouble(FirebaseData *fbdo, <string> path, double value);
bool setDoubleAsync(FirebaseData *fbdo, <string> path, double value);
bool setDouble(FirebaseData *fbdo, <string> path, double value, float priority);
bool setDoubleAsync(FirebaseData *fbdo, <string> path, double value, float priority);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node in which float data will be set.
param value
Double value to set.
param ETag
Known unique identifier string (ETag) of defined node.
return Boolean
value, indicates the success of the operation.
If ETag at the defined node does not match the provided ETag parameter, the operation will be failed with the http return code 412, Precondition Failed (ETag is not matched).
If the operation failed due to ETag is not match, call <FirebaseData>.ETag()
to get the current ETag value.
Also call <FirebaseData>.dataType
or <FirebaseData>.dataTypeNum
to get the type of data that successfully stored in the database.
And <FirebaseData>.to<double>()
to get the double value that stored on the defined node.
bool setDouble(FirebaseData *fbdo, <string> path, double value, <string> ETag);
bool setDoubleAsync(FirebaseData *fbdo, <string> path, double value, <string> ETag);
bool setDouble(FirebaseData *fbdo, <string> path, double value, float priority, <string> ETag);
bool setDoubleAsync(FirebaseData *fbdo, <string> path, double value, float priority, <string> ETag);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node in which Boolean data will be set.
param value
Boolean value to set.
return Boolean
value, indicates the success of the operation.
Call <FirebaseData>.dataType
or <FirebaseData>.dataTypeNum
to get the type of data that successfully stored in the database.
Call <FirebaseData>.to<bool>()
to get the boolean value that stored on the defined node.
bool setBool(FirebaseData *fbdo, <string> path, bool value);
bool setBoolAsync(FirebaseData *fbdo, <string> path, bool value);
bool setBool(FirebaseData *fbdo, <string> path, bool value, float priority);
bool setBoolAsync(FirebaseData *fbdo, <string> path, bool value, float priority);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node in which Boolean data will be set.
param value
Boolean value to set.
param ETag
Known unique identifier string (ETag) of defined node.
return Boolean
value, indicates the success of the operation.
If ETag at the defined node does not match the provided ETag parameter, the operation will be failed with the http return code 412, Precondition Failed (ETag is not matched).
If the operation failed due to ETag is not match, call <FirebaseData>.ETag()
to get the current ETag value.
Also call <FirebaseData>.dataType
or <FirebaseData>.dataTypeNum
to get the type of data that successfully stored in the database.
Call <FirebaseData>.to<bool>()
to get the boolean value that stored on the defined node.
bool setBool(FirebaseData *fbdo, <string> path, bool value, <string> ETag);
bool setBoolAsync(FirebaseData *fbdo, <string> path, bool value, <string> ETag);
bool setBool(FirebaseData *fbdo, <string> path, bool value, float priority, <string> ETag);
bool setBoolAsync(FirebaseData *fbdo, <string> path, bool value, float priority, <string> ETag);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node in which string data will be set.
param value
String or text to set.
return Boolean
value, indicates the success of the operation.
Call <FirebaseData>.dataType
or <FirebaseData>.dataTypeNum
to get the type of data that successfully stored in the database.
Call <FirebaseData>.to<String>()
to get the String value that stored on the defined node.
bool setString(FirebaseData *fbdo, <string> path, <string> value);
bool setStringAsync(FirebaseData *fbdo, <string> path, <string> value);
bool setString(FirebaseData *fbdo, <string> path, <string> value, float priority);
bool setStringAsync(FirebaseData *fbdo, <string> path, <string> value, float priority);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node in which string data will be set.
param value
String or text to set.
param ETag
Known unique identifier string (ETag) of defined node.
return Boolean
value, indicates the success of the operation.
If ETag at the defined node does not match the provided ETag parameter, the operation will be failed with the http return code 412, Precondition Failed (ETag is not matched).
If the operation failed due to ETag is not match, call <FirebaseData>.ETag()
to get the current ETag value.
Also, call <FirebaseData>.dataType
or <FirebaseData>.dataTypeNum
to get the type of data that successfully stored in the database.
Call <FirebaseData>.to<String>()
to get the String value that stored on the defined node.
bool setString(FirebaseData *fbdo, <string> path, <string> value, <string> ETag);
bool setStringAsync(FirebaseData *fbdo, <string> path, <string> value, <string> ETag);
bool setString(FirebaseData *fbdo, <string> path, <string> value, float priority, <string> ETag);
bool setStringAsync(FirebaseData *fbdo, <string> path, <string> value, float priority, <string> ETag);
The old content in defined node will be replaced.
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node in which child (s) nodes will be replaced or set.
param json
The pointer to FirebaseJson object.
return Boolean
value, indicates the success of the operation.
Call <FirebaseData>.dataType
or <FirebaseData>.dataTypeNum
to get the type of data that successfully stored in the database.
Call <FirebaseData>.to<FirebaseJson>()
and <FirebaseData>.to<FirebaseJson *>()
will return reference to object and pointer to FirebaseJson object from payload.
bool setJSON(FirebaseData *fbdo, <string> path, FirebaseJson *json);
bool setJSONAsync(FirebaseData *fbdo, <string> path, FirebaseJson *json);
bool setJSON(FirebaseData *fbdo, <string> path, FirebaseJson *json, float priority);
bool setJSONAsync(FirebaseData *fbdo, <string> path, FirebaseJson *json, float priority);
The old content in defined node will be replaced.
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node in which child(s) nodes will be replaced or set.
param json
The pointer to FirebaseJson object.
param ETag
KKnown unique identifier string (ETag) of defined node.
return Boolean
value, indicates the success of the operation.
If ETag at the defined node does not match the provided ETag parameter, the operation will be failed with the http return code 412, Precondition Failed (ETag is not matched).
If the operation failed due to ETag is not match, call <FirebaseData>.ETag()
to get the current ETag value.
Also call <FirebaseData>.dataType
or <FirebaseData>.dataTypeNum
to get the type of data that successfully stored in the database.
Call <FirebaseData>.to<FirebaseJson>()
and <FirebaseData>.to<FirebaseJson *>()
will return reference to object and pointer to FirebaseJson object from payload.
bool setJSON(FirebaseData *fbdo, <string> path, FirebaseJson *json, <string> ETag);
bool setJSONAsync(FirebaseData *fbdo, <string> path, FirebaseJson *json, <string> ETag);
Set the child (s) nodes and the virtual child ".priority" if defined ETag matches at the defined node.
bool setJSON(FirebaseData *fbdo, <string> path, FirebaseJson *json, float priority, <string> ETag);
bool setJSONAsync(FirebaseData *fbdo, <string> path, FirebaseJson *json, float priority, <string> ETag);
The old content in defined node will be replaced.
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node in which array will be replaced or set.
param arr
The pointer to FirebaseJsonArray object.
return Boolean
value, indicates the success of the operation.
Call <FirebaseData>.dataType
or <FirebaseData>.dataTypeNum
to get the type of data that successfully stored in the database.
Call <FirebaseData>.to<FirebaseJsonArray>()
and <FirebaseData>.to<FirebaseJsonArray *>()
will return reference to object and pointer to FirebaseJsonArray object that contains the array from payload.
bool setArray(FirebaseData *fbdo, <string> path, FirebaseJsonArray *arr);
bool setArrayAsync(FirebaseData *fbdo, <string> path, FirebaseJsonArray *arr);
bool setArray(FirebaseData *fbdo, <string> path, FirebaseJsonArray *arr, float priority);
bool setArrayAsync(FirebaseData *fbdo, <string> path, FirebaseJsonArray *arr, float priority);
The old content in defined node will be replaced.
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node in which array will be replaced or set.
param arr
The pointer to FirebaseJsonArray object.
param ETag
Known unique identifier string (ETag) of defined node.
return Boolean
value, indicates the success of the operation.
If ETag at the defined node does not match the provided ETag parameter, the operation will be failed with the http return code 412, Precondition Failed (ETag is not matched).
If the operation failed due to ETag is not match, call <FirebaseData>.ETag()
to get the current ETag value.
Also call <FirebaseData>.dataType
or <FirebaseData>.dataTypeNum
to get the type of data that successfully stored in the database.
And <FirebaseData>.to<FirebaseJsonArray>()
to get the FirebaseJsonArray value that stored on the defined node.
bool setArray(FirebaseData *fbdo, <string> path, FirebaseJsonArray *arr, <string> ETag);
bool setArrayAsync(FirebaseData *fbdo, <string> path, FirebaseJsonArray *arr, <string> ETag);
bool setArray(FirebaseData *fbdo, <string> path, FirebaseJsonArray *arr, float priority, <string> ETag);
bool setArrayAsync(FirebaseData *fbdo, <string> path, FirebaseJsonArray *arr, float priority, <string> ETag);
The old content in defined node will be replaced.
param fbdo
The pointer to Firebase Data Object.
param path
The path to node in which binary data will be set.
param blob
Byte array of data.
param size
Size of the byte array.
return Boolean
value, indicates the success of the operation.
No payload returned from the server.
bool setBlob(FirebaseData *fbdo, <string> path, uint8_t *blob, size_t size);
bool setBlobAsync(FirebaseData *fbdo, <string> path, uint8_t *blob, size_t size);
The old content in defined node will be replaced.
param fbdo
The pointer to Firebase Data Object.
param path
he path to the node in which binary data will be set.
param blob
Byte array of data.
param size
Size of the byte array.
param ETag
Known unique identifier string (ETag) of defined node.
return Boolean
value, indicates the success of the operation.
No payload returned from the server.
If ETag at the defined node does not match the provided ETag parameter, the operation will be failed with the http return code 412, Precondition Failed (ETag is not matched).
bool setBlob(FirebaseData *fbdo, <string> path, uint8_t *blob, size_t size, <string> ETag);
bool setBlobAsync(FirebaseData *fbdo, <string> path, uint8_t *blob, size_t size, <string> ETag);
param fbdo
The pointer to Firebase Data Object.
param storageType
The enum of memory storage type e.g. mem_storage_type_flash and mem_storage_type_sd.
The file systems can be changed in FirebaseFS.h.
param path
The path to the node in which binary data will be set.
param fileName
The file path includes its name.
param callback
Optional. The callback function that accept RTDB_DownloadStatusInfo data.
return Boolean
value, indicates the success of the operation.
No payload returned from the server.
bool setFile(FirebaseData *fbdo, fb_esp_mem_storage_type storageType, <string> path, <string> fileName, RTDB_DownloadProgressCallback callback = NULL);
bool setFileAsync(FirebaseData *fbdo, fb_esp_mem_storage_type storageType, <string> path, <string> fileName, RTDB_DownloadProgressCallback callback = NULL);
param fbdo
The pointer to Firebase Data Object.
param storageType
The enum of memory storage type e.g. mem_storage_type_flash and mem_storage_type_sd.
The file systems can be changed in FirebaseFS.h.
param path
The path to the node in which binary data from the file will be set.
param fileName
The file path includes its name.
param ETag
Known unique identifier string (ETag) of defined node.
param callback
Optional. The callback function that accept RTDB_DownloadStatusInfo data.
return Boolean
value, indicates the success of the operation.
No payload returned from the server.
If ETag at the defined node does not match the provided ETag parameter, the operation will be failed with the http return code 412, Precondition Failed (ETag is not matched).
bool setFile(FirebaseData *fbdo, fb_esp_mem_storage_type storageType, <string> path, <string> fileName, <string> ETag, RTDB_DownloadProgressCallback callback = NULL);
bool setFileAsync(FirebaseData *fbdo, fb_esp_mem_storage_type storageType, <string> path, <string> fileName, <string> ETag, RTDB_DownloadProgressCallback callback = NULL);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node in which timestamp will be set.
return Boolean
value, indicates the success of the operation.
Call <FirebaseData>.to<int>()
will return the integer value of timestamp in seconds
or <FirebaseData>.to<double>()
to get millisecond timestamp.
Due to bugs in Serial.print in Arduino, to print large double value with zero decimal place,
use Serial.printf("%.0lf\n", firebaseData.to<double>());
.
bool setTimestamp(FirebaseData *fbdo, <string> path);
bool setTimestampAsync(FirebaseData *fbdo, <string> path);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node in which child (s) nodes will be updated.
param json
The pointer to FirebaseJson object used for the update.
bool updateNode(FirebaseData *fbdo, <string> path, FirebaseJson *json);
bool updateNodeAsync(FirebaseData *fbdo, <string> path, FirebaseJson *json);
bool updateNode(FirebaseData *fbdo, <string> path, FirebaseJson *json, float priority);
bool updateNodeAsync(FirebaseData *fbdo, <string> path, FirebaseJson *json, float priority);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node in which child (s) nodes will be updated.
param json
The pointer to FirebaseJson object used for the update.
return Boolean
value, indicates the success of the operation.
Owing to the objective of this function to reduce network data usage, no payload will be returned from the server.
bool updateNodeSilent(FirebaseData *fbdo, <string> path, FirebaseJson *json);
bool updateNodeSilentAsync(FirebaseData *fbdo, <string> path, FirebaseJson *json);
bool updateNodeSilent(FirebaseData *fbdo, <string> path, FirebaseJson *json, float priority);
bool updateNodeSilentAsync(FirebaseData *fbdo, <string> path, FirebaseJson *json, float priority);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node.
return Boolean
value, indicates the success of the operation.
Call <FirebaseData>.dataType
or <FirebaseData>.dataTypeNum
to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<int>()
, <FirebaseData>.to<float>
, <FirebaseData>.to<double>
,
<FirebaseData>.to<bool>
, <FirebaseData>.to<String>
, <FirebaseData>.to<FirebaseJson>()
,
<FirebaseData>.to<FirebaseJson *>()
, <FirebaseData>.to<FirebaseJsonArray>()
,
<FirebaseData>.to<FirebaseJsonArray *>()
, <FirebaseData>.to<std::vector<uint8_t> *>
and <FirebaseData>.to<File>()
corresponded to its type that get from <FirebaseData>.dataType
.
bool get(FirebaseData *fbdo, <string> path);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node.
return Boolean
value, indicates the success of the operation.
Call <FirebaseData>.dataType
or <FirebaseData>.dataTypeNum
to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<int>()
will return the integer value of payload returned from server.
If the type of payload returned from server is not integer, float and double,
the function <FirebaseData>.to<int>()
will return zero (0).
bool getInt(FirebaseData *fbdo, <string> path);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node.
param target
The pointer to int type variable to store the value.
return Boolean
value, indicates the success of the operation.
If the type of payload returned from the server is not an integer, float and double, the target variable's value will be zero (0).
bool getInt(FirebaseData *fbdo, <string> path, int *target);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node.
return Boolean
value, indicates the success of the operation.
Call <FirebaseData>.dataType
or <FirebaseData>.dataTypeNum
to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<float>()
will return the float value of payload returned from server.
If the payload returned from server is not integer, float and double,
the function <FirebaseData>.to<float>()
will return zero (0).
bool getFloat(FirebaseData *fbdo, <string> path);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node.
param target
The pointer to float type variable to store the value.
return Boolean
value, indicates the success of the operation.
If the type of payload returned from the server is not an integer, float and double, the target variable's value will be zero (0).
bool getFloat(FirebaseData *fbdo, <string> path, float *target);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node.
return Boolean
value, indicates the success of the operation.
Call <FirebaseData>.dataType
or <FirebaseData>.dataTypeNum
to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<double>()
will return the double value of payload returned from server.
If the payload returned from server is not integer, float and double,
the function <FirebaseData>.to<double>()
will return zero (0).
Due to bugs in Serial.print in Arduino, to print large double value with zero decimal place,
use Serial.printf("%.9lf\n", firebaseData.to<double>());
for print value up to 9 decimal places.
bool getDouble(FirebaseData *fbdo, <string> path);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node.
param target
The pointer to double type variable to store the value.
return Boolean
value, indicates the success of the operation.
If the type of payload returned from the server is not an integer, float and double, the target variable's value will be zero (0).
bool getDouble(FirebaseData *fbdo, <string> path, double *target);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node.
return Boolean
value, indicates the success of the operation.
Call <FirebaseData>.dataType
or <FirebaseData>.dataTypeNum
to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<bool>()
will return the boolean value of payload returned from server.
If the type of payload returned from the server is not Boolean,
the function <FirebaseData>.to<bool>()
will return false.
bool getBool(FirebaseData *fbdo, <string> path);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node.
param target
The pointer to boolean type variable to store the value.
return Boolean
value, indicates the success of the operation.
If the type of payload returned from the server is not Boolean, the target variable's value will be false.
bool getBool(FirebaseData *fbdo, <string> path, bool *target);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node.
return Boolean
value, indicates the success of the operation.
Call <FirebaseData>.dataType
or <FirebaseData>.dataTypeNum
to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<String>()
will return the String value of payload returned from server.
If the type of payload returned from the server is not a string,
the function <FirebaseData>.to<String>()
will return empty string.
bool getString(FirebaseData *fbdo, <string> path);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node.
param target
String, std::string or chars array variable to store the value.
return Boolean
value, indicates the success of the operation.
If the target is chars array, the size of chars array should be greater than the size of payload string to prevent error.
bool getString(FirebaseData *fbdo, <string> path, <string_or_chars_array> *target);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node.
return Boolean
value, indicates the success of the operation.
Call <FirebaseData>.dataType
or <FirebaseData>.dataTypeNum
to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<FirebaseJson>()
and <FirebaseData>.to<FirebaseJson *>()
will return reference to object and pointer to FirebaseJson object from payload.
If the type of payload returned from server is not json,
the function <FirebaseData>.to<FirebaseJson>()
will contain empty object.
bool getJSON(FirebaseData *fbdo, <string> path);
The returned the pointer to FirebaseJson that contains JSON payload represents the child nodes and their value.
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node.
param target
The pointer to FirebaseJson object variable to store the value.
return Boolean
value, indicates the success of the operation.
If the type of payload returned from the server is not JSON, the target FirebaseJson object will contain an empty object.
bool getJSON(FirebaseData *fbdo, <string> path, FirebaseJson *target);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node.
param query
QueryFilter class to set query parameters to filter data.
return Boolean
value, indicates the success of the operation.
The Available query parameters for filtering the data are the following.
QueryFilter.orderBy
Required parameter to specify which data used for data filtering included child key, key, and value.
Use "$key" for filtering data by keys of all nodes at the defined node.
Use "$value" for filtering data by value of all nodes at the defined node.
Use "$priority" for filtering data by "virtual child" named .priority of all nodes.
Use any child key to filter by that key.
QueryFilter.limitToFirst
The total children (number) to filter from the first child.
QueryFilter.limitToLast
The total last children (number) to filter.
QueryFilter.startAt
Starting value of range (number or string) of query upon orderBy param.
QueryFilter.endAt
Ending value of range (number or string) of query upon orderBy param.
QueryFilter.equalTo
Value (number or string) matches the orderBy param
Call <FirebaseData>.dataType
or <FirebaseData>.dataTypeNum
to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<FirebaseJson>()
and <FirebaseData>.to<FirebaseJson *>()
will return reference to object and pointer to FirebaseJson object from payload.
If the type of payload returned from server is not JSON,
the function <FirebaseData>.to<FirebaseJson>()
will contain empty object.
bool getJSON(FirebaseData *fbdo, <string> path, QueryFilter *query);
The returned payload JSON string represents the child nodes and their value.
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node.
param target
The pointer to FirebaseJson object variable to store the value.
return Boolean
value, indicates the success of the operation.
If the type of payload returned from the server is not JSON, the target FirebaseJson object will contain an empty object.
bool getJSON(FirebaseData *fbdo, <string> path, QueryFilter *query, FirebaseJson *target);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node.
return Boolean
value, indicates the success of the operation.
Call <FirebaseData>.dataType
or <FirebaseData>.dataTypeNum
to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<FirebaseJsonArray>()
and <FirebaseData>.to<FirebaseJsonArray *>()
will return reference to object and pointer to FirebaseJsonArray object that contains the array from payload.
If the type of payload returned from the server is not an array,
the array element in <FirebaseData>.to<FirebaseJsonArray>()
will be empty.
bool getArray(FirebaseData *fbdo, <string> path);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node.
param target
The pointer to FirebaseJsonArray object variable to store the value.
return Boolean
value, indicates the success of the operation.
If the type of payload returned from the server is not an array, the target FirebaseJsonArray object will contain an empty array.
bool getArray(FirebaseData *fbdo, <string> path, FirebaseJsonArray *target);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node.
param query
QueryFilter class to set query parameters to filter data.
return Boolean
value, indicates the success of the operation.
The Available query parameters for filtering the data are the following.
QueryFilter.orderBy - Required parameter to specify which data used for data filtering included child key, key, and value. Use "$key" for filtering data by keys of all nodes at the defined node. Use "$value" for filtering data by value of all nodes at the defined node. Use "$priority" for filtering data by "virtual child" named .priority of all nodes. Use any child key to filter by that key.
QueryFilter.limitToFirst - The total children (number) to filter from the first child.
QueryFilter.limitToLast - The total last children (number) to filter.
QueryFilter.startAt - Starting value of range (number or string) of query upon orderBy param.
QueryFilter.endAt - Ending value of range (number or string) of query upon orderBy param.
QueryFilter.equalTo - Value (number or string) matches the orderBy param
Call <FirebaseData>.dataType
or <FirebaseData>.dataTypeNum
to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<FirebaseJsonArray>()
and <FirebaseData>.to<FirebaseJsonArray *>()
will return reference to object and pointer to FirebaseJsonArray object that contains the array from payload.
If the type of payload returned from the server is not an array,
the function <FirebaseData>.to<FirebaseJsonArray>()
will contain empty array.
bool getArray(FirebaseData *fbdo, <string> path, QueryFilter *query);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node.
param target
The pointer to FirebaseJsonArray object variable to store the value.
return Boolean
value, indicates the success of the operation.
If the type of payload returned from the server is not an array, the target FirebaseJsonArray object will contain an empty array.
bool getArray(FirebaseData *fbdo, <string> path, QueryFilter *query, FirebaseJsonArray *target);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node.
return Boolean
value, indicates the success of the operation.
Call <FirebaseData>.dataType
or <FirebaseData>.dataTypeNum
to determine what type of data successfully stores in the database.
Call <FirebaseData>.to<std::vector<uint8_t> *>
will return the pointer to uint8_t dynamic array data of payload returned from server.
If the type of payload returned from the server is not a blob,
the function <FirebaseData>.to<std::vector<uint8_t> *>
will return empty array.
bool getBlob(FirebaseData *fbdo, <string> path);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node
param target
The pointer to uint8_t vector variable to store the value.
return Boolean
value, indicates the success of the operation.
If the type of payload returned from the server is not a blob, the target variable value will be an empty array.
bool getBlob(FirebaseData *fbdo, <string> path, std::vector<uint8_t> *target);
The downloaded data will be decoded to binary and save to SD card/Flash memory, then please make sure that data at the defined node is the file type.
param fbdo
The pointer to Firebase Data Object.
param storageType
The enum of memory storage type e.g. mem_storage_type_flash and mem_storage_type_sd.
The file systems can be changed in FirebaseFS.h.
param nodePath
The path to the node that file data will be downloaded.
param fileName
The file path includes its name.
param callback
Optional. The callback function that accept RTDB_DownloadStatusInfo data.
return Boolean
value, indicates the success of the operation.
bool getFile(FirebaseData *fbdo, fb_esp_mem_storage_type storageType, <string> nodePath, <string> fileName, RTDB_DownloadProgressCallback callback = NULL);
param fbdo
The pointer to Firebase Data Object.
param fwPath
The firmware data path.
param callback
Optional. The callback function that accept RTDB_DownloadStatusInfo data.
return Boolean
value, indicates the success of the operation.
Note: In ESP8266, this function will allocate 16k+ memory for internal SSL client.
Firmware data is the bin file that stored on datanbase using pushFile or setFile function.
bool downloadOTA(FirebaseData *fbdo, <string> fwPath, RTDB_DownloadProgressCallback callback = NULL);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node to be deleted.
return Boolean
value, indicates the success of the operation.*
bool deleteNode(FirebaseData *fbdo, <string> path);
param fbdo
The pointer to Firebase Data Object.
param path
nThe path to the node to be deleted.
param ETag
Known unique identifier string (ETag) of defined node.
return Boolean
value, indicates the success of the operation.*
If ETag at the defined node does not match the provided ETag parameter, the operation will be failed with the http return code 412, Precondition Failed (ETag is not matched).
bool deleteNode(FirebaseData *fbdo, <string> path, <string> ETag);
param fbdo
The pointer to Firebase Data Object.
param path
The parent path of children nodes that is being deleted.
param timestampNode
The sub-child node that keep the timestamp.
param limit
The maximum number of children nodes to delete at once, 30 is maximum.
param dataRetentionPeriod
The period in seconds of data in the past which will be retained.
return Boolean
value, indicates the success of the operation.*
note: The databaseSecret can be empty if the auth type is OAuth2.0 or legacy and required if auth type is Email/Password sign-in.
bool deleteNodesByTimestamp(FirebaseData *fbdo, <string> path, <string> timestampNode, size_t limit, unsigned long dataRetentionPeriod);
param fbdo
The pointer to Firebase Data Object.
param path
The path to the node to subscribe.
return Boolean
value, indicates the success of the operation.*
bool beginStream(FirebaseData *fbdo, <string> path);
param fbdo
The pointer to Firebase Data Object.
param parentPath
The path to the parent node to subscribe.
return Boolean
value, indicates the success of the operation.*
bool beginMultiPathStream(FirebaseData *fbdo, <string> parentPath);
Once beginStream was called e.g. in setup(), the readStream function should call inside the continuous loop block.
param fbdo
The pointer to Firebase Data Object.
return Boolean
value, indicates the success of the operation.
Using the shared Firebase Data object for stream read/monitoring associated with normal Firebase call e.g. read, set, push, update and delete will break or interrupt the current stream connection.
The stream will be resumed or reconnected automatically when calling the function readStream.
bool readStream(FirebaseData *fbdo);
It can be restart again by calling the function beginStream.
param fbdo
The pointer to Firebase Data Object.
return Boolean
value, indicates the success of the operation.
bool endStream(FirebaseData *fbdo);
param fbdo
The pointer to Firebase Data Object.
param dataAvailablecallback
The Callback function that accepts FirebaseStream parameter.
param timeoutCallback
The Callback function will be called when the stream connection was timed out (optional).
ESP32 only parameter
param streamTaskStackSize
The stream task (RTOS task) reserved stack memory in byte (optional) (8192 is default).
The dataAvailableCallback will be called When data in the defined path changed or the stream path changed or stream connection was resumed from getXXX, setXXX, pushXXX, updateNode, deleteNode.
The payload returned from the server will be one of these integer, float, string, JSON and blob types.
Call [FirebaseStream object].dataType to determine what type of data successfully stores in the database.
Call [FirebaseStream object].xxxData will return the appropriate data type of the payload returned from the server.
void setStreamCallback(FirebaseData *fbdo, FirebaseData::StreamEventCallback dataAvailableCallback, FirebaseData::StreamTimeoutCallback timeoutCallback, size_t streamTaskStackSize = 8192);
void setStreamCallback(FirebaseData *fbdo, FirebaseData::StreamEventCallback dataAvailableCallback, FirebaseData::StreamTimeoutCallback timeoutCallback);
setMultiPathStreamCallback should be called before Firebase.beginMultiPathStream.
param fbdo
The pointer to Firebase Data Object.
param multiPathDataCallback
The Callback function that accepts MultiPathStream parameter.
param timeoutCallback
The Callback function will be called when the stream connection was timed out (optional).
ESP32 only parameter
param streamTaskStackSize
The stream task (RTOS task) reserved stack memory in byte (optional) (8192 is default).
The multiPathDataCallback will be called When children value of the defined node changed or the stream path changed or stream connection was resumed from normal Firebase calls.
The payload returned from the server will be one of these types e.g. boolean, integer, float, string, JSON, array, blob and file.
Call [MultiPathStream object].get to get the child node value, type and its data path.
The properties [MultiPathStream object].value, [MultiPathStream object].dataPath, and [MultiPathStream object].type will return the value, path of data, and type of data respectively.
These properties will store the result from calling the function [MultiPathStream object].get.
void setMultiPathStreamCallback(FirebaseData *fbdo, FirebaseData::MultiPathStreamEventCallback multiPathDataCallback, FirebaseData::StreamTimeoutCallback timeoutCallback = NULL, size_t streamTaskStackSize = 8192);
void setMultiPathStreamCallback(FirebaseData *fbdo, FirebaseData::MultiPathStreamEventCallback multiPathDataCallback, FirebaseData::StreamTimeoutCallback timeoutCallback = NULL);
param fbdo
The pointer to Firebase Data Object.
void removeStreamCallback(FirebaseData *fbdo);
param fbdo
The pointer to Firebase Data Object.
void removeMultiPathStreamCallback(FirebaseData *fbdo);
To manually triggering the stream callback function, this should call repeatedly in loop().
void runStream();
param fbdo
The pointer to Firebase Data Object.
param storageType
The enum of memory storage type e.g. mem_storage_type_flash and mem_storage_type_sd.
The file systems can be changed in FirebaseFS.h.
param nodePath
The path to the node to be backuped.
param fileName
File name to save.
param callback
Optional. The callback function that accept RTDB_DownloadStatusInfo data.
return Boolean
value, indicates the success of the operation.
bool backup(FirebaseData *fbdo, fb_esp_mem_storage_type storageType, <string> nodePath, <string> fileName, RTDB_DownloadProgressCallback callback = NULL);
param fbdo
The pointer to Firebase Data Object.
param storageType
The enum of memory storage type e.g. mem_storage_type_flash and mem_storage_type_sd.
The file systems can be changed in FirebaseFS.h.
param nodePath
The path to the node to be restored the data.
param fileName
File name to read.
param callback
Optional. The callback function that accept RTDB_UploadStatusInfo data.
return Boolean
value, indicates the success of the operation.
bool restore(FirebaseData *fbdo, fb_esp_mem_storage_type storageType, <string> nodePath, <string> fileName, RTDB_UploadProgressCallback callback = NULL);
Set maximum Firebase read/store retry operation (0 - 255) in case of network problems and buffer overflow.
param fbdo
The pointer to Firebase Data Object.
param num
The maximum retry.
void setMaxRetry(FirebaseData *fbdo, uint8_t num);
Firebase read/store operation causes by network problems and buffer overflow will be added to Firebase Error Queues collection.
param fbdo
The pointer to Firebase Data Object.
param num
The maximum Firebase Error Queues.
void setMaxErrorQueue(FirebaseData *fbdo, uint8_t num);
The Firebase read (get) operation will not save.
param fbdo
The pointer to Firebase Data Object.
param filename
Filename to be saved.
param storageType
The enum of memory storage type e.g. mem_storage_type_flash and mem_storage_type_sd.
The file systems can be changed in FirebaseFS.h.
bool saveErrorQueue(FirebaseData *fbdo, <string> filename, fb_esp_mem_storage_type storageType);
param filename
File name to delete.
param storageType
The enum of memory storage type e.g. mem_storage_type_flash and mem_storage_type_sd.
The file systems can be changed in FirebaseFS.h.
bool deleteStorageFile(<string> filename, fb_esp_mem_storage_type storageType);
param fbdo
The pointer to Firebase Data Object.
param filename
Filename to be read and restore queues.
param storageType
The enum of memory storage type e.g. mem_storage_type_flash and mem_storage_type_sd.
The file systems can be changed in FirebaseFS.h.
bool restoreErrorQueue(FirebaseData *fbdo, <string> filename, fb_esp_mem_storage_type storageType);
param fbdo
The pointer to Firebase Data Object.
param filename
Filename to be read and count for queues.
param storageType
The enum of memory storage type e.g. mem_storage_type_flash and mem_storage_type_sd.
The file systems can be changed in FirebaseFS.h.
return Number
(0-255) of queues store in defined queue file.
uint8_t errorQueueCount(FirebaseData *fbdo, <string> filename, fb_esp_mem_storage_type storageType);
param fbdo
The pointer to Firebase Data Object.
return Number
(0-255) of queues in Firebase Data object queue collection.
uint8_t errorQueueCount(FirebaseData *fbdo);
param fbdo
The pointer to Firebase Data Object.
return Boolean
value, indicates the full of queue.
bool isErrorQueueFull(FirebaseData *fbdo);
param fbdo
The pointer to Firebase Data Object.
param callback
Callback function that accepts QueueInfo parameter.
void processErrorQueue(FirebaseData *fbdo, QueueInfoCallback callback = NULL);
Return 0 if there is no Firebase Error from last operation.
param fbdo
The pointer to Firebase Data Object.
return Number
of Queue ID.
uint32_t getErrorQueueID(FirebaseData *fbdo);
param fbdo
The pointer to Firebase Data Object.
param errorQueueID
The Firebase Error Queue ID get from getErrorQueueID.
return Boolean
typestatus indicates the queue existence.
bool isErrorQueueExisted(FirebaseData *fbdo, uint32_t errorQueueID);
param fbdo
The pointer to Firebase Data Object.
param callback
The Callback function that accepts QueueInfo Object as a parameter, optional.
ESP32 only parameter
param queueTaskStackSize
The stream task (RTOS task) reserved stack memory in byte (optional) (8192 is default).
The following functions are available from QueueInfo Object accepted by the callback.
queueInfo.totalQueues(), get the total Error Queues in Error Queue Collection.
queueInfo.currentQueueID(), get current Error Queue ID that is being processed.
queueInfo.isQueueFull(), determine whether Error Queue Collection is full or not.
queueInfo.dataType(), get a string of the Firebase call data type that is being processed of current Error Queue.
queueInfo.method(), get a string of the Firebase call method that is being processrd of current Error Queue.
queueInfo.path(), get a string of the Firebase call path that is being processed of current Error Queue.
void beginAutoRunErrorQueue(FirebaseData *fbdo, FirebaseData::QueueInfoCallback callback = NULL, size_t queueTaskStackSize = 8192);
void beginAutoRunErrorQueue(FirebaseData *fbdo, FirebaseData::QueueInfoCallback callback = NULL);
param fbdo
The pointer to Firebase Data Object.
void endAutoRunErrorQueue(FirebaseData *fbdo);
param fbdo
The pointer to Firebase Data Object.
void clearErrorQueue(FirebaseData *fbdo);
These functions can be called directly from Firestore object in the Firebase object e.g. Firebase.Firestore.<function name>
param fbdo
The pointer to Firebase Data Object.
param projectId
The Firebase project id (only the name without the firebaseio.com).
param databaseId
The Firebase Cloud Firestore database id which is (default) or empty "".
param bucketID
The Firebase storage bucket ID in the project.
param storagePath
The path in the Firebase Storage data bucket to store the exported database.
param collectionIds
Which collection ids to export. Unspecified means all collections.
Use comma (,) to separate between the collection ids.
return Boolean
value, indicates the success of the operation.
Use FirebaseData.payload() to get the returned payload.
This function requires OAuth2.0 authentication.
bool exportDocuments(FirebaseData *fbdo, <string> projectId, <string> databaseId, <string> bucketID, <string> storagePath, <string> collectionIds = "");
param fbdo
The pointer to Firebase Data Object.
param projectId
The Firebase project id (only the name without the firebaseio.com).
param databaseId
The Firebase Cloud Firestore database id which is (default) or empty "".
param bucketID
The Firebase storage bucket ID in the project.
param storagePath
The path in the Firebase Storage data bucket that stores the exported database.
param collectionIds
Which collection ids to import. Unspecified means all collections included in the import.
Use comma (,) to separate between the collection ids.
return Boolean
value, indicates the success of the operation.
Use FirebaseData.payload() to get the returned payload.
This function requires OAuth2.0 authentication.
bool importDocuments(FirebaseData *fbdo, <string> projectId, <string> databaseId, <string> bucketID, <string> storagePath, <string> collectionIds = "");
param fbdo
The pointer to Firebase Data Object.
param projectId
The Firebase project id (only the name without the firebaseio.com).
param databaseId
The Firebase Cloud Firestore database id which is (default) or empty "".
param documentPath
The relative path of document to create in the collection.
param content
A Firestore document.
See https://firebase.google.com/docs/firestore/reference/rest/v1/projects.databases.documents#Document
param mask
The fields to return. If not set, returns all fields.
Use comma (,) to separate between the field names.
return Boolean
value, indicates the success of the operation.
Use FirebaseData.payload() to get the returned payload.
This function requires Email/password, Custom token or OAuth2.0 authentication.
bool createDocument(FirebaseData *fbdo, <string> projectId, <string> databaseId, <string> documentPath, <string> content, <string> mask = "");
param fbdo
The pointer to Firebase Data Object.
param projectId
The Firebase project id (only the name without the firebaseio.com).
param databaseId
The Firebase Cloud Firestore database id which is (default) or empty "".
param collectionId
The relative path of document collection id to create the document.
param documentId
The document id of document to be created.
param content
A Firestore document.
See https://firebase.google.com/docs/firestore/reference/rest/v1/projects.databases.documents#Document
param mask
The fields to return. If not set, returns all fields.
Use comma (,) to separate between the field names.
return Boolean
value, indicates the success of the operation.
Use FirebaseData.payload() to get the returned payload.
This function requires Email/password, Custom token or OAuth2.0 authentication.
bool createDocument(FirebaseData *fbdo, <string> projectId, <string> databaseId, <string> collectionId, <string> documentId, <string> content, <string> mask = "");
param fbdo
The pointer to Firebase Data Object.
param projectId
The Firebase project id (only the name without the firebaseio.com).
param databaseId
The Firebase Cloud Firestore database id which is (default) or empty "".
param documentPath
The relative path of document to patch with the input document.
param content
A Firestore document.
See https://firebase.google.com/docs/firestore/reference/rest/v1/projects.databases.documents#Document
param updateMask
The fields to update. If the document exists on the server and has fields not referenced in the mask, they are left unchanged.
Fields referenced in the mask, but not present in the input document (content), are deleted from the document on the server.
Use comma (,) to separate between the field names.
param mask
The fields to return. If not set, returns all fields.
If the document has a field that is not present in this mask, that field will not be returned in the response.
Use comma (,) to separate between the field names.
param exists
When set to true, the target document must exist. When set to false, the target document must not exist.
param updateTime
When set, the target document must exist and have been last updated at that time.
A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits.
Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
return Boolean
value, indicates the success of the operation.
Use FirebaseData.payload() to get the returned payload.
This function requires Email/password, Custom token or OAuth2.0 authentication.
bool patchDocument(FirebaseData *fbdo, <string> projectId, <string> databaseId, <string> documentPath, <string> content, <string> updateMask, <string> mask = "", <string> exists = "", <string> updateTime = "");
param fbdo
The pointer to Firebase Data Object.
param projectId
The Firebase project id (only the name without the firebaseio.com).
param databaseId
The Firebase Cloud Firestore database id which is (default) or empty "".
param writes
The dyamic array of write object fb_esp_firestore_document_write_t.
For the write object, see https://firebase.google.com/docs/firestore/reference/rest/v1/Write
param transaction
A base64-encoded string. If set, applies all writes in this transaction, and commits it.
return Boolean
value, indicates the success of the operation.
Use FirebaseData.payload() to get the returned payload.
This function requires Email/password, Custom token or OAuth2.0 authentication.
bool commitDocument(FirebaseData *fbdo, <string> projectId, <string> databaseId,
std::vector<struct fb_esp_firestore_document_write_t> writes, <string> transaction = "");
bool commitDocumentAsync(FirebaseData *fbdo, <string> projectId, <string> databaseId,
std::vector<struct fb_esp_firestore_document_write_t> writes, <string> transaction = "");
param fbdo
The pointer to Firebase Data Object.
param projectId
The Firebase project id (only the name without the firebaseio.com).
param databaseId
The Firebase Cloud Firestore database id which is (default) or empty "".
param writes
The dyamic array of write object fb_esp_firestore_document_write_t.
Method does not apply writes atomically and does not guarantee ordering.
Each write succeeds or fails independently.
You cannot write to the same document more than once per request.
For the write object, see https://firebase.google.com/docs/firestore/reference/rest/v1/Write
param labels
The FirebaseJson pointer that represents the Labels (map) associated with this batch write.
return Boolean
value, indicates the success of the operation.
Use FirebaseData.payload() to get the returned payload.
This function requires Email/password, Custom token or OAuth2.0 authentication.
For more description, see https://cloud.google.com/firestore/docs/reference/rest/v1/projects.databases.documents/batchWrite
bool batchWriteDocuments(FirebaseData *fbdo, <string> projectId, <string> databaseId,
std::vector<struct fb_esp_firestore_document_write_t> writes, FirebaseJson *labels = nullptr);
param fbdo
The pointer to Firebase Data Object.
param projectId
The Firebase project id (only the name without the firebaseio.com).
param databaseId
The Firebase Cloud Firestore database id which is (default) or empty "".
param documentPath
The relative path of document to get.
param mask
The fields to return. If not set, returns all fields.
If the document has a field that is not present in this mask, that field will not be returned in the response.
Use comma (,) to separate between the field names.
param transaction
Reads the document in a transaction. A base64-encoded string.
param readTime
Reads the version of the document at the given time. This may not be older than 270 seconds.
A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits.
Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
return Boolean
value, indicates the success of the operation.
Use FirebaseData.payload() to get the returned payload.
This function requires Email/password, Custom token or OAuth2.0 authentication.
bool getDocument(FirebaseData *fbdo, <string> projectId, <string> databaseId, <string> documentPath, <string> mask = "", <string> transaction = "", <string> readTime = "");
param fbdo
The pointer to Firebase Data Object.
param projectId
The Firebase project id (only the name without the firebaseio.com).
param databaseId
The Firebase Cloud Firestore database id which is (default) or empty "".
param documentPaths
The list of relative path of documents to get. Use comma (,) to separate between the field names.
param mask
The fields to return. If not set, returns all fields.
If the document has a field that is not present in this mask, that field will not be returned in the response.
Use comma (,) to separate between the field names.
param batchOperationCallback
The callback fuction that accepts const char* as argument.
Union field consistency_selector can be only one of the following.
param transaction
Reads the document in a transaction. A base64-encoded string.
param newTransaction
FirebaseJson pointer that represents TransactionOptions object.
Starts a new transaction and reads the documents.
Defaults to a read-only transaction.
The new transaction ID will be returned as the first response in the stream.
param readTime
Reads the version of the document at the given time. This may not be older than 270 seconds.
A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits.
Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
return Boolean
value, indicates the success of the operation.
Use FirebaseData.payload() to get the returned payload.
This function requires Email/password, Custom token or OAuth2.0 authentication.
bool batchGetDocuments(FirebaseData *fbdo, <string> projectId, <string> databaseId, <string> documentPaths, <string> mask, FirebaseData::FirestoreBatchOperationsCallback batchOperationCallback, <string> transaction,
FirebaseJson *newTransaction, <string> readTime);
param fbdo
The pointer to Firebase Data Object.
param projectId
The Firebase project id (only the name without the firebaseio.com).
param databaseId
The Firebase Cloud Firestore database id which is (default) or empty "".
param transactionOptions
Optional. The TransactionOptions type data that represents the options for creating a new transaction.
return Boolean
value, indicates the success of the operation.
Use FirebaseData.payload() to get the returned payload.
This function requires OAuth2.0 authentication.
The TransactionOptions struct contains two properties i.e. readOnly and readWrite.
Use readOnly for options for a transaction that can only be used to read documents.
Use readWrite for options for a transaction that can be used to read and write documents.
The readOnly property contains one property, readTime.
The readTime is for reading the documents at the given time. This may not be older than 60 seconds.
A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits.
Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
The readWrite property contains one property, retryTransaction.
The retryTransaction is a base64-encoded string represents a transaction that can be used to read and write documents.
See https://cloud.google.com/firestore/docs/reference/rest/v1/TransactionOptions for transaction options.
bool beginTransaction(FirebaseData *fbdo, <string> projectId, <string> databaseId, TransactionOptions *transactionOptions = nullptr);
param fbdo
The pointer to Firebase Data Object.
param projectId
The Firebase project id (only the name without the firebaseio.com).
param databaseId
The Firebase Cloud Firestore database id which is (default) or empty "".
param transaction
Required. A base64-encoded string of the transaction to roll back.
return Boolean
value, indicates the success of the operation.
Use FirebaseData.payload() to get the returned payload.
This function requires OAuth2.0 authentication.
bool rollback(FirebaseData *fbdo, <string> projectId, <string> databaseId, <string> transaction);
param fbdo
The pointer to Firebase Data Object.
param projectId
The Firebase project id (only the name without the firebaseio.com).
param databaseId
The Firebase Cloud Firestore database id which is (default) or empty "".
param documentPath
The relative path of document to get.
param structuredQuery
The pointer to FirebaseJson object that contains the Firestore query. For the description of structuredQuery, see https://cloud.google.com/firestore/docs/reference/rest/v1/StructuredQuery
param consistencyMode
Optional. The consistency mode for this transaction
e.g. fb_esp_firestore_consistency_mode_transaction,
fb_esp_firestore_consistency_mode_newTransaction
and fb_esp_firestore_consistency_mode_readTime
param consistency
Optional. The value based on consistency mode e.g. transaction string, TransactionOptions (JSON) and date time string.
For more description, see https://cloud.google.com/firestore/docs/reference/rest/v1/projects.databases.documents/runQuery#body.request_body.FIELDS
return Boolean
value, indicates the success of the operation.
Use FirebaseData.payload() to get the returned payload.
This function requires Email/password, Custom token or OAuth2.0 authentication.
bool runQuery(FirebaseData *fbdo, <string> projectId, <string> databaseId, <string> documentPath, <string> structuredQuery, fb_esp_firestore_consistency_mode consistencyMode, <string> consistency);
param fbdo
The pointer to Firebase Data Object.
param projectId
The Firebase project id (only the name without the firebaseio.com).
param databaseId
The Firebase Cloud Firestore database id which is (default) or empty "".
param documentPath
The relative path of document to delete.
param exists
When set to true, the target document must exist. When set to false, the target document must not exist.
param updateTime
When set, the target document must exist and have been last updated at that time.
A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits.
Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
return Boolean
value, indicates the success of the operation.
This function requires Email/password, Custom token or OAuth2.0 authentication.
bool deleteDocument(FirebaseData *fbdo, <string> projectId, <string> databaseId, <string> documentPath, <string> exists = "", <string> updateTime = "");
param fbdo
The pointer to Firebase Data Object.
param projectId
The Firebase project id (only the name without the firebaseio.com).
param databaseId
The Firebase Cloud Firestore database id which is (default) or empty "".
param collectionId
The relative path of document colection.
param pageSize
The maximum number of documents to return.
param pageToken
The nextPageToken value returned from a previous List request, if any.
param orderBy
The order to sort results by. For example: priority desc, name.
param mask
The fields to return. If not set, returns all fields.
If a document has a field that is not present in this mask, that field will not be returned in the response.
param showMissing
If the list should show missing documents.
A missing document is a document that does not exist but has sub-documents.
return Boolean
value, indicates the success of the operation.
Use FirebaseData.payload() to get the returned payload.
This function requires Email/password, Custom token or OAuth2.0 authentication (when showMissing is true).
bool listDocuments(FirebaseData *fbdo, <string> projectId, <string> databaseId, <string> collectionId, int pageSize, <string> pageToken, <string> orderBy, <string> mask, bool showMissing);
param fbdo
The pointer to Firebase Data Object.
param projectId
The Firebase project id (only the name without the firebaseio.com).
param databaseId
The Firebase Cloud Firestore database id which is (default) or empty "".
param documentPath
The relative path of document to get its collections' id.
param pageSize
The maximum number of results to return.
param pageToken
The nextPageToken value returned from a previous List request, if any.
return Boolean
value, indicates the success of the operation.
Use FirebaseData.payload() to get the returned payload.
This function requires Email/password, Custom token or OAuth2.0 authentication (when showMissing is true).
bool listCollectionIds(FirebaseData *fbdo, <string> projectId, <string> databaseId, <string> documentPath, int pageSize, <string> pageToken);
param fbdo
The pointer to Firebase Data Object.
param projectId
The Firebase project id (only the name without the firebaseio.com).
param databaseId
The Firebase Cloud Firestore database id which is (default) or empty "".
param collectionId
The relative path of document colection.
param apiScope
The API scope enum e.g., ANY_API and DATASTORE_MODE_API
param queryScope
The QueryScope enum string e.g., QUERY_SCOPE_UNSPECIFIED, COLLECTION, and COLLECTION_GROUP
See https://cloud.google.com/firestore/docs/reference/rest/Shared.Types/QueryScope
param fields
The FirebaseJsonArray that represents array of fields (IndexField JSON object) of indexes.
A IndexField object contains the keys "fieldPath" and the uinion field "value_mode" of "order" and "arrayConfig"
Where the fieldPath value is the field path string of index.
Where order is the enum string of ORDER_UNSPECIFIED, ASCENDING, and DESCENDING.
And arrayConfig is the ArrayConfig enum string of ARRAY_CONFIG_UNSPECIFIED and CONTAINS
return Boolean
value, indicates the success of the operation.
Note Use FirebaseData.payload() to get the returned payload.
This function requires OAuth2.0 authentication.
For more description, see https://cloud.google.com/firestore/docs/reference/rest/v1/projects.databases.collectionGroups.indexes/create
bool createIndex(FirebaseData *fbdo, <string> projectId, <string> databaseId, <string> collectionId,
<string> apiScope, <string> queryScope, FirebaseJsonArray *fields);
param fbdo
The pointer to Firebase Data Object.
param projectId
The Firebase project id (only the name without the firebaseio.com).
param databaseId
The Firebase Cloud Firestore database id which is (default) or empty "".
param collectionId
The relative path of document colection.
param indexId
The index to delete.
Note Use FirebaseData.payload() to get the returned payload.
This function requires OAuth2.0 authentication.
For more description, see https://cloud.google.com/firestore/docs/reference/rest/v1/projects.databases.collectionGroups.indexes/delete
bool deleteIndex(FirebaseData *fbdo, <string> projectId, <string> databaseId, <string> collectionId, <string> indexId);
param fbdo
The pointer to Firebase Data Object.
param projectId
The Firebase project id (only the name without the firebaseio.com).
param databaseId
The Firebase Cloud Firestore database id which is (default) or empty "".
param collectionId
The relative path of document colection.
param filter
The filter to apply to list results.
param pageSize
The number of results to return.
param pageToken
A page token, returned from a previous call to FirestoreAdmin.ListIndexes, that may be used to get the next page of results.
Note Use FirebaseData.payload() to get the returned payload.
This function requires OAuth2.0 authentication.
For more description, see https://cloud.google.com/firestore/docs/reference/rest/v1/projects.databases.collectionGroups.indexes/list
bool listIndex(FirebaseData *fbdo, <string> projectId, <string> databaseId, <string> collectionId, <string> filter,
int pageSize, <string> pageToken);
param fbdo
The pointer to Firebase Data Object.
param projectId
The Firebase project id (only the name without the firebaseio.com).
param databaseId
The Firebase Cloud Firestore database id which is (default) or empty "".
param collectionId
The relative path of document colection.
param indexId
The index to get.
Note Use FirebaseData.payload() to get the returned payload.
This function requires OAuth2.0 authentication.
For more description, see https://cloud.google.com/firestore/docs/reference/rest/v1/projects.databases.collectionGroups.indexes/get
bool getIndex(FirebaseData *fbdo, <string> projectId, <string> databaseId, <string> collectionId, <string> indexId);
These functions can be called directly from FCM object in the Firebase object e.g. Firebase.FCM.<function name>
param fbdo
The pointer to Firebase Data Object.
void clearErrorQueue(FirebaseData *fbdo);
param serverKey
Server key found on Console: Project settings > Cloud Messaging
param spi_ethernet_module
SPI_ETH_Module struct data, optional for ESP8266 use with Ethernet module.
note: This server key required for sending message via legacy HTTP API.
SPI_ETH_Module struct data is for ESP8266 Ethernet supported module lwip interface.
The usage example for Ethernet.
#include <ENC28J60lwIP.h>
#define ETH_CS_PIN 16 //GPIO 16 connected to Ethernet module (ENC28J60) CS pin
ENC28J60lwIP eth(ETH_CS_PIN);
FirebaseData fbdo;
SPI_ETH_Module spi_ethernet_module;
//in setup()
spi_ethernet_module.enc28j60 = ð
Firebase.FCM.setServerKey(FIREBASE_FCM_SERVER_KEY, &spi_ethernet_module);
The API key created in the Google Cloud console, cannot be used for authorizing FCM requests.
void setServerKey(<string> serverKey, SPI_ETH_Module *spi_ethernet_module = NUL);
param fbdo
The pointer to Firebase Data Object.
param msg
The pointer to the message to send which is the FCM_Legacy_JSON_Message type data.
return Boolean
value, indicates the success of the operation.
The FCM_Legacy_JSON_Message properties are
targets - The targets of messages e.g. to, registration_ids, condition.
options - The options of message contained the sub-properties e.g, collapse_key, priority, content_available, mutable_content,time_to_live, restricted_package_name, and dry_run.
The sub-properties value of the options should be assigned in string.
payloads - The two payloads i.e. notification and data.
The payloads.notification properties are available e.g.
Name | Type | Platform |
---|---|---|
title | string | all |
body | string | all |
icon | string | Andoid, web |
click_action | string | all |
sound | string | iOS, Android |
badge | number | iOS |
subtitle | string | iOS |
body_loc_key | string | iOS, Android |
body_loc_args | JSON array of string | iOS, Android |
title_loc_key | string iOS, Android | |
title_loc_args | JSON array of string | iOS, Android |
android_channel_id | string | Android |
tag | string | Android |
color | string | Android |
The payloads.data is the JSON object.
Read more details about legacy HTTP API here https://firebase.google.com/docs/cloud-messaging/http-server-ref
bool send(FirebaseData *fbdo, FCM_Legacy_HTTP_Message *msg);
param fbdo
The pointer to Firebase Data Object.
param msg
The pointer to the message to send which is the FCM_HTTPv1_JSON_Message type data.
return Boolean
value, indicates the success of the operation.
Read more details about HTTP v1 API here https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages
bool send(FirebaseData *fbdo, FCM_HTTPv1_JSON_Message *msg);
param fbdo
The pointer to Firebase Data Object.
param topic
The topic to subscribe.
param IID
The instance ID tokens or registration tokens array.
param numToken
The size of instance ID tokens array.
return Boolean
value, indicates the success of the operation.
bool subscribeTopic(FirebaseData *fbdo, <string> topic, <string> IID[], size_t numToken);
param fbdo
The pointer to Firebase Data Object.
param topic
The topic to romove the subscription.
param IID
The instance ID tokens or registration tokens array.
param numToken
The size of instance ID tokens array.
return Boolean
value, indicates the success of the operation.
bool unsubscribeTopic(FirebaseData *fbdo, <string> topic, <string> IID[], size_t numToken);
param fbdo
The pointer to Firebase Data Object.
param IID
The instance ID token of device.
return Boolean
value, indicates the success of the operation.
bool appInstanceInfo(FirebaseData *fbdo, <string> IID);
param fbdo
The pointer to Firebase Data Object.
param application
The Bundle id of the app.
param sandbox
The Boolean to indicate sandbox environment (TRUE) or production (FALSE).
param APNs
The iOS APNs tokens array.
param numToken
The size of instance ID tokens array.
return Boolean
value, indicates the success of the operation.
bool regisAPNsTokens(FirebaseData *fbdo, <string> application, bool sandbox, <string> APNs[], size_t numToken);
param fbdo
The pointer to Firebase Data Object.
return String
of payload returned from the server.
String payload(FirebaseData *fbdo);
These functions can be called directly from Storage object in the Firebase object e.g. Firebase.Storage.<function name>
param fbdo
The pointer to Firebase Data Object.
param bucketID
The Firebase storage bucket ID in the project.
param localFileName
The file path includes its name to upload.
param storageType
The enum of memory storage type e.g. mem_storage_type_flash and mem_storage_type_sd.
The file systems can be changed in FirebaseFS.h.
param remotetFileName
The file path includes its name of uploaded file in data bucket.
param mime
The file MIME type
param callback
Optional. The callback function that accept FCS_UploadStatusInfo data.
return Boolean
value, indicates the success of the operation.
Use FirebaseData.downloadURL() to get the download link.
bool upload(FirebaseData *fbdo, <string> bucketID, <string> localFileName, fb_esp_mem_storage_type storageType, <string> remotetFileName, <string> mime, FCS_UploadProgressCallback callback = NULL);
param fbdo
The pointer to Firebase Data Object.
param bucketID
The Firebase storage bucket ID in the project.
param data
The byte array of data.
param len
The size of byte array data in bytes.
param remotetFileName
The file path includes its name of uploaded file in data bucket.
param mime
The file MIME type
param callback
Optional. The callback function that accept FCS_UploadStatusInfo data.
return Boolean
value, indicates the success of the operation.
Use FirebaseData.downloadURL() to get the download link.
bool upload(FirebaseData *fbdo, <string> bucketID, uint8_t *data, size_t len, <string> remoteFileName, <string> mime, FCS_UploadProgressCallback callback = NULL);
param fbdo
The pointer to Firebase Data Object.
param bucketID
The Firebase storage bucket ID in the project.
param remotetFileName
The file path includes its name of file in the data bucket to download.
param localFileName
The file path includes its name to save.
param storageType
The enum of memory storage type e.g. mem_storage_type_flash and mem_storage_type_sd.
The file systems can be changed in FirebaseFS.h.
param callback
Optional. The callback function that accept FCS_DownloadStatusInfo data.
return Boolean
value, indicates the success of the operation.
bool download(FirebaseData *fbdo, <string> bucketID, <string> remoteFileName, <string> localFileName, fb_esp_mem_storage_type storageType, FCS_DownloadProgressCallback callback = NULL);
param fbdo
The pointer to Firebase Data Object.
param bucketID
The Firebase storage bucket ID in the project.
param remotetFileName
The firmware file path includes its name of file in the data bucket to download.
param callback
Optional. The callback function that accept FCS_DownloadStatusInfo data.
return Boolean
value, indicates the success of the operation.
Note: In ESP8266, this function will allocate 16k+ memory for internal SSL client.
bool downloadOTA(FirebaseData *fbdo, <string> bucketID, <string> remoteFileName, FCS_DownloadProgressCallback callback = NULL);
param fbdo
The pointer to Firebase Data Object.
param bucketID
The Firebase storage bucket ID in the project.
param remotetFileName
The file path includes its name of file in the data bucket.
return Boolean
value, indicates the success of the operation.
Use the FileMetaInfo type data to get name, bucket, contentType, size, generation, etag, crc32, downloadTokens properties from file.
bool getMetadata(FirebaseData *fbdo, <string> bucketID, <string> remoteFileName);
param fbdo
The pointer to Firebase Data Object.
param bucketID
The Firebase storage bucket ID in the project.
param remotetFileName
The file path includes its name of file in the data bucket.
return Boolean
value, indicates the success of the operation.
bool deleteFile(FirebaseData *fbdo, <string> bucketID, <string> fileName);
param fbdo
The pointer to Firebase Data Object.
param bucketID
The Firebase storage bucket ID in the project.
return Boolean
value, indicates the success of the operation.
Use the FileList type data to get name and bucket properties for each item.
bool listFiles(FirebaseData *fbdo, <string> bucketID);
These functions can be called directly from GCStorage object in the Firebase object e.g. Firebase.GCStorage.<function name>
param fbdo
The pointer to Firebase Data Object.
param bucketID
The Firebase or Google Cloud Storage bucket ID.
param localFileName
The file path includes its name to upload.
param storageType
The enum of memory storage type e.g. mem_storage_type_flash and mem_storage_type_sd.
The file systems can be changed in FirebaseFS.h.
param uploadType
The enum of type of upload methods e.g. gcs_upload_type_simple, gcs_upload_type_multipart, gcs_upload_type_resumable
param remotetFileName
The file path includes its name of uploaded file in data bucket.
param mime
The file MIME type.
param uploadOptions
Optional. The UploadOptions data contains the query parameters options.
For query parameters options, see https://cloud.google.com/storage/docs/json_api/v1/objects/insert#optional-parameters
param requestProps
Optional. The RequestProperties data contains the request payload properties.
For request payload properties, see https://cloud.google.com/storage/docs/json_api/v1/objects/insert#optional-properties
param status
Optional. The UploadStatusInfo data to get the upload status.
param callback
Optional. The callback function that accept UploadStatusInfo data.
return Boolean
value, indicates the success of the operation.
This function requires OAuth2.0 authentication.
The upload types of methods can be selectable.
The gcs_upload_type_simple upload type is used for small file upload in a single request without metadata.
gcs_upload_type_multipart upload type is for small file upload in a single reques with metadata.
gcs_upload_type_resumable upload type is for medium or large file (larger than or equal to 256 256 KiB) upload with metadata and can be resumable.
The upload with metadata supports allows the library to add the metadata internally for Firebase to request the download access token in Firebase Storage bucket.
User also can add custom metadata for the uploading file (object).
bool upload(FirebaseData *fbdo, <string> bucketID, <string> localFileName, fb_esp_mem_storage_type storageType, fb_esp_gcs_upload_type uploadType, <string> remoteFileName, <string> mime, UploadOptions *uploadOptions = nullptr, RequestProperties *requestProps = nullptr, UploadStatusInfo *status = nullptr, ProgressCallback callback = NULL);
param fbdo
The pointer to Firebase Data Object.
param bucketID
The Firebase or Google Cloud Storage bucket ID.
param remotetFileName
The file path includes its name of file in the data bucket to download.
param localFileName
The file path includes its name to save.
param storageType
The enum of memory storage type e.g. mem_storage_type_flash and mem_storage_type_sd.
The file systems can be changed in FirebaseFS.h.
param option
Optional. The pointer to StorageGetOptions data that contains the get query parameters.
For the query parameters options, see https://cloud.google.com/storage/docs/json_api/v1/objects/get#optional-parameters
param callback
Optional. The callback function that accept GCS_DownloadStatusInfo data.
return Boolean
value, indicates the success of the operation.
This function requires OAuth2.0 authentication.
bool download(FirebaseData *fbdo, <string> bucketID, <string> remoteFileName, <string> localFileName, fb_esp_mem_storage_type storageType, StorageGetOptions *options = nullptr, GCS_DownloadProgressCallback callback = NULL);
param fbdo
The pointer to Firebase Data Object.
param bucketID
The Firebase or Google Cloud Storage bucket ID.
param remotetFileName
The firmware file path includes its name of file in the data bucket to download.
param callback
Optional. The callback function that accept GCS_DownloadStatusInfo data.
return Boolean
value, indicates the success of the operation.
Note: In ESP8266, this function will allocate 16k+ memory for internal SSL client.
bool downloadOTA(FirebaseData *fbdo, <string> bucketID, <string> remoteFileName, GCS_DownloadProgressCallback callback = NULL);
param fbdo
The pointer to Firebase Data Object.
param bucketID
The Firebase or Google Cloud Storage bucket ID.
param remotetFileName
The file path includes its name of file in the data bucket.
param options
Optional. The pointer to StorageGetOptions data that contains the get query parameters.
For the query parameters options, see https://cloud.google.com/storage/docs/json_api/v1/objects/get#optional-parameters
return Boolean
value, indicates the success of the operation.
Use the FileMetaInfo type data to get name, bucket, contentType, size, generation, metageneration, etag, crc32, downloadTokens properties from file.
bool getMetadata(FirebaseData *fbdo, <string> bucketID, <string> remoteFileName);
param fbdo
The pointer to Firebase Data Object.
param bucketID
The Firebase or Google Cloud Storage bucket ID.
param remotetFileName
The file path includes its name of file in the data bucket.
param options
Optional. The pointer to DeleteOptions data contains the query parameters.
For query parameters options, see https://cloud.google.com/storage/docs/json_api/v1/objects/delete#optional-parameters
return Boolean
value, indicates the success of the operation.
bool deleteFile(FirebaseData *fbdo, <string> bucketID, <string> fileName, DeleteOptions *options = nullptr);
param fbdo
The pointer to Firebase Data Object.
param bucketID
The Firebase or Google Cloud Storage bucket ID.
param options
Optional. The pointer to ListOptions data that contains the query parameters
Fore query parameters description, see https://cloud.google.com/storage/docs/json_api/v1/objects/list#optional-parameters
return Boolean
value, indicates the success of the operation.
Use the FileList type data to get name and bucket properties for each item.
bool listFiles(FirebaseData *fbdo, <string> bucketID, ListOptions *options = nullptr);
These functions can be called directly from Functions object in the Firebase object e.g. Firebase.Functions.<function name>
To be used for testing purposes as very limited traffic is allowed.
For more information on the actual limits, refer to Rate Limits. https://cloud.google.com/functions/quotas#rate_limits
param fbdo
The pointer to Firebase Data Object.
param projectId
The Firebase project id (only the name without the firebaseio.com).
param locationId
The project location.
param functionId
The name of function.
param data
The Input to be passed to the function (JSON serialized string).
return Boolean
value, indicates the success of the operation.
Use FirebaseData.payload() to get the returned payload.
Ex. if data is {"info":{"name":"Paul","age":30}}
The values can be obtained from http trigger function request e.g. req as following.
req.body.info.name
req.body.info.age
This function requires OAuth2.0 authentication.
bool callFunction(FirebaseData *fbdo, <string> projectId, <string> locationId, <string> functionId, <string> data);
If a function with the given name already exists in the specified project, the long running operation will return ALREADY_EXISTS error.
param fbdo
The pointer to Firebase Data Object.
param config
The pointer to FunctionsConfig object that encapsulates the function and triggers configurationston.
param callback
The callback function to get the Cloud Function creation status.
return Boolean
value, indicates the success of the operation.
Use FirebaseData.payload() to get the returned payload.
This function requires OAuth2.0 authentication.
bool createFunction(FirebaseData *fbdo, FunctionsConfig *config, FunctionsOperationCallback callback = NULL);
If a function with the given name already exists in the specified project, the long running operation will return ALREADY_EXISTS error.
param fbdo
The pointer to Firebase Data Object.
param config
The pointer to FunctionsConfig object that encapsulates the function and triggers configurationston.
param statusInfo
The pointer to FunctionsOperationStatusInfo data to get the Cloud Function creation status later.
return Boolean
value, indicates the success of the operation.
Use FirebaseData.payload() to get the returned payload.
This function requires OAuth2.0 authentication.
bool createFunction(FirebaseData *fbdo, FunctionsConfig *config, FunctionsOperationStatusInfo *statusInfo);
param fbdo
The pointer to Firebase Data Object.
param functionId
The name of function.
param patchData
The pointer to FunctionsConfig object that encapsulates the function and triggers configurationston.
return Boolean
value, indicates the success of the operation.
Use FirebaseData.payload() to get the returned payload.
This function requires OAuth2.0 authentication.
bool patchFunction(FirebaseData *fbdo, <string> functionId, FunctionsConfig *patchData);
To manually triggering the deploy task callback function, this should call repeatedly in loop().
void runDeployTasks();
param fbdo
The pointer to Firebase Data Object.
param projectId
The Firebase project id (only the name without the firebaseio.com).
param locationId
The project location.
param functionId
The name of function.
param policy
The pointer to PolicyBuilder data concapsulates the policy configuration.
The complete policy to be applied to the resource.
param updateMask
A FieldMask specifying which fields of the policy to modify.
Only the fields in the mask will be modified. If no mask is provided, the following default mask is used:
paths: "bindings, etag"
A comma-separated list of fully qualified names of fields. Example: "user.displayName,photo"
return Boolean
value, indicates the success of the operation.
Use FirebaseData.payload() to get the returned payload.
This function requires OAuth2.0 authentication.
bool setIamPolicy(FirebaseData *fbdo, <string> projectId, <string> locationId, <string> functionId, PolicyBuilder *policy, <string> updateMask = "");
Returns an empty policy if the function exists and does not have a policy set.
param fbdo
The pointer to Firebase Data Object.
param projectId
The Firebase project id (only the name without the firebaseio.com).
param locationId
The project location.
param functionId
The name of function.
param version
Optional. The policy format version to be returned.
Valid values are 0, 1, and 3. Requests specifying an invalid value will be rejected.
return Boolean
value, indicates the success of the operation.
Use FirebaseData.payload() to get the returned payload.
This function requires OAuth2.0 authentication.
bool getIamPolicy(FirebaseData *fbdo, <string> projectId, <string> locationId, <string> functionId, <string> version = "");
Returns an empty policy if the function exists and does not have a policy set.
param fbdo
The pointer to Firebase Data Object.
param projectId
The Firebase project id (only the name without the firebaseio.com).
param locationId
The project location.
param functionId
The name of function.
return Boolean
value, indicates the success of the operation.
Use FirebaseData.payload() to get the returned payload.
This function requires OAuth2.0 authentication.
bool getFunction(FirebaseData *fbdo, <string> projectId, <string> locationId, <string> functionId);
If the given function is used by some trigger, the trigger will be updated to remove this function.
param fbdo
The pointer to Firebase Data Object.
param projectId
The Firebase project id (only the name without the firebaseio.com).
param locationId
The project location.
param functionId
The name of function.
return Boolean
value, indicates the success of the operation.
Use FirebaseData.payload() to get the returned payload.
This function requires OAuth2.0 authentication.
bool deleteFunction(FirebaseData *fbdo, <string> projectId, <string> locationId, <string> functionId);
The URL is only valid for a limited period and should be used within minutes after generation.
param fbdo
The pointer to Firebase Data Object.
param projectId
The Firebase project id (only the name without the firebaseio.com).
param locationId
The project location.
param functionId
The name of function.
param versionId
The optional version of function. If not set, default, current version is used.
return Boolean
value, indicates the success of the operation.
Use FirebaseData.payload() to get the returned payload.
This function requires OAuth2.0 authentication.
bool generateDownloadUrl(FirebaseData *fbdo, <string> projectId, <string> locationId, <string> functionId, <string> versionId = "");
param fbdo
The pointer to Firebase Data Object.
param projectId
The Firebase project id (only the name without the firebaseio.com).
param locationId
The project location.
return Boolean
value, indicates the success of the operation.
Use FirebaseData.payload() to get the returned payload.
This function requires OAuth2.0 authentication.
bool generateUploadUrl(FirebaseData *fbdo, <string> projectId, <string> locationId);
param fbdo
The pointer to Firebase Data Object.
param projectId
The Firebase project id (only the name without the firebaseio.com).
param locationId
The project location.
param pageSize
Maximum number of functions to return per call.
param pageToken
The value returned by the last ListFunctionsResponse; indicates that this is a continuation of a prior functions.list call, and that the system should return the next page of data.
return Boolean
value, indicates the success of the operation.
Use FirebaseData.payload() to get the returned payload.
This function requires OAuth2.0 authentication.
bool listFunctions(FirebaseData *fbdo, <string> projectId, <string> locationId, size_t pageSize, <string> pageToken = "");
param fbdo
The pointer to Firebase Data Object.
param filter
filter The Firebase project id (only the name without the firebaseio.com).
A filter for matching the requested operations.
The supported formats of filter are:
To query for a specific function:
project:,location:,function:*
To query for all of the latest operations for a project:
project:*,latest:true
param pageSize
he maximum number of records that should be returned.
Requested page size cannot exceed 100. If not set, the default page size is 100
param pageToken
Token identifying which result to start with, which is returned by a previous list call.
return Boolean
value, indicates the success of the operation.
Use FirebaseData.payload() to get the returned payload.
This function requires OAuth2.0 authentication.
bool listOperations(FirebaseData *fbdo, <string> filter, int pageSize, <string> pageToken);
The description of PolicyBuilder and FunctionsConfig classes and their functions are available in the header files /src/functions/PolicyBuilder.h and /src/functions/FunctionsConfig.h.
param client
The pointer to Arduino Client derived class e.g. WiFiClient, WiFiClientSecure, EthernetClient or GSMClient.
void setExternalClient(Client *client);
param tcpConnectionCB
The function that handles the server connection.
param networkConnectionCB
The function that handles the network connection.
param networkStatusCB
The function that handle the network connection status acknowledgement.
void setExternalClientCallbacks(FB_TCPConnectionRequestCallback tcpConnectionCB, FB_NetworkConnectionRequestCallback networkConnectionCB, FB_NetworkStatusRequestCallback networkStatusCB);
param status
The network status.
void setNetworkStatus(bool status);
param rx
The number of bytes for receive buffer memory for secured mode BearSSL (512 is minimum, 16384 is maximum).
param tx
The number of bytes for transmit buffer memory for secured mode BearSSL (512 is minimum, 16384 is maximum).
Set this option to false to support get large Blob and File operations.
void void setBSSLBufferSize(uint16_t rx, uint16_t tx);
param len
The server response buffer size limit.
void setResponseSize(uint16_t len);
return WiFi client instance
.
WiFiClientSecure *getWiFiClient();
note: This will release the memory used by internal SSL client.
void stopWiFiClient();
void closeFile();
param ca
PEM format certificate string.
void setCert(const char* ca);
param pause
True for pause and False for unpause.
return Boolean
value, indicates the success of the operation.
bool pauseFirebase(bool pause);
return The one of these data type e.g. integer, float, string, JSON and blob.
String dataType();
return The enumeration value of fb_esp_rtdb_data_type.
fb_esp_rtdb_data_type_null or 1,
fb_esp_rtdb_data_type_integer or 2,
fb_esp_rtdb_data_type_float or 3,
fb_esp_rtdb_data_type_double or 4,
fb_esp_rtdb_data_type_boolean or 5,
fb_esp_rtdb_data_type_string or 6,
fb_esp_rtdb_data_type_json or 7,
fb_esp_rtdb_data_type_array or 8,
fb_esp_rtdb_data_type_blob or 9,
fb_esp_rtdb_data_type_file or 10
uint8_t dataTypeEnum();
return The one of these event type String e.g. put, patch, cancel, and auth_revoked.
The event type "put" indicated that data at the event path relative to the stream path was completely changed. The event path can be determined by dataPath().
The event type "patch" indicated that data at the event path relative to stream path was updated. The event path can be determined by dataPath().
The event type "cancel" indicated something wrong and cancel by the server.
The event type "auth_revoked" indicated the provided Firebase Authentication Data (Database secret) is no longer valid.
String eventType();
return String.
of unique identifier.
String ETag();
return The database streaming path.
String streamPath();
return The node which belongs to server' s returned payload.
The node returned from this function in case of stream, also changed upon the child or parent's stream value changes.
String dataPath();
return The error description string (String object).
String errorReason();
return The error code (int).
See src/FB_Error.h
String errorCode();
return Integer value.
int intData();
return Float value.
float floatData();
return Double value.
float doubleData();
return Boolean value.
float boolData();
return String (String object).
String stringData();
return String (String object).
String jsonString();
return FirebaseJson object.
FirebaseJson &jsonObject();
return **FirebaseJson object
**pointer.
FirebaseJson *jsonObjectPtr();
return FirebaseJsonArray object
.
FirebaseJsonArray &jsonArray();
return FirebaseJsonArray object pointer
.
FirebaseJsonArray *jsonArrayPtr();
return FirebaseJsonData object
.
FirebaseJsonData &jsonData();
return FirebaseJsonData object pointer
.
FirebaseJsonData *jsonDataPtr();
return Dynamic array
of 8-bit unsigned integer i.e. std::vector<uint8_t>
.
std::vector<uint8_t> blobData();
return String
(String object).
String pushName();
return Boolean
type status indicates whether the Firebase Data object is working with the stream or not.
bool isStream();
return Boolean
type status indicates whether the Firebase Data object is connected to the server or not.
bool httpConnected();
Nothing to do when stream connection timeout, the stream connection will be automatically resumed.
return Boolean
type status indicates whether the stream was time out or not.
bool streamTimeout();
return Boolean
type status indicates whether the server returns the new payload or not.
bool dataAvailable();
return Boolean
type status indicates whether the server returns the stream event-data
payload or not.
bool streamAvailable();
Get the matching between data type that intend to get from/store to database and the server's return payload data type
return Boolean
type status indicates whether the type of data that is being get from or stored to database
and the server's returned payload is matched or not.
bool mismatchDataType();
return Integer
number of HTTP status.
int httpCode();
return Boolean
of the overflow status.
Total default HTTP response buffer size is 400 bytes which can be set through Firebase.setResponseSize.
bool bufferOverflow();
return String
(String object) of a file name that stores on SD card/flash memory after backup operation.
String getBackupFilename();
return Number of byte
of backup file in byte after backup operation.
size_t getBackupFileSize();
void clear();
return Error description string* (String object).
String fileTransferError();
return Payload string* (String object).
String payload();
param data
The JSON object literal string to set or deserialize.
return bool
value represents the successful operation.
Call FirebaseJson.errorPosition to get the error.
bool setJsonData(<string> data);
return instance of an object.
FirebaseJson &clear();
param client
The pointer to or instance of Client object.
return instance of an object.
bool readFrom(Client *client);
bool readFrom(Client &client);
param client
The pointer to or instance of WiFiClient object.
return instance of an object.
bool readFrom(WiFiClient *client);
bool readFrom(WiFiClient &client);
param client
The pointer to or instance of WiFiClientSecure object.
return instance of an object.
bool readFrom(WiFiClientSecure *client);
bool readFrom(WiFiClientSecure &client);
param ser
The HW or SW Serial object.
param timeoutMS
The timeout in millisecond to wait for Serial data to be completed.
return instance of an object.
bool readFrom(HardwareSerial &ser, uint32_t timeoutMS = 5000);
bool readFrom(SoftwareSerial &ser, uint32_t timeoutMS = 5000);
param file
The File object.
return instance of an object.
bool readFrom(fs::File &file);
param key
The new key string that null to be added.
return instance of an object.
FirebaseJson &add(<string> key);
param key
The new key string that string value to be added.
param value
The value for the new specified key.
return instance of an object.
The value that can be added is the following supported types e.g. flash string (PROGMEM and FPSTR), String, C/C++ std::string, const char*, char array, string literal, all integer and floating point numbers, boolean, FirebaseJson object and array.
FirebaseJson &add(<string> key, <type> value);
param out
The writable object e.g. String, std::string, char array, Stream e.g ile, WiFi/Ethernet Client and LWMQTT, that accepts the returning string.
param topic
The MQTT topic (LWMQTT).
param prettify
Boolean flag for return the pretty format string i.e. with text indentation and newline.
void toString(<type> out, bool prettify = false);
void toString(<type> out, <string> topic, bool prettify = false);
param result
The reference of FirebaseJsonData that holds the result.
param path
Relative path to the specific node in FirebaseJson object.
param prettify
The text indentation and new line serialization option.
return boolean status of the operation.
The FirebaseJsonData object holds the returned data which can be read from the following properties.
jsonData.value - contains the returned string.
jsonData.value - contains the returned integer value.
jsonData.value - contains the returned float value.
jsonData.value - contains the returned double value.
jsonData.value - contains the returned boolean value.
jsonData.success - used to determine the result of the get operation.
jsonData.type - used to determine the type of returned value in string represents the types of value e.g. string, int, double, boolean, array, object, null and undefined.
jsonData.typeNum used to determine the type of returned value is an integer as represented by the following value.
FirebaseJson::UNDEFINED = 0
FirebaseJson::OBJECT = 1
FirebaseJson::ARRAY = 2
FirebaseJson::STRING = 3
FirebaseJson::INT = 4
FirebaseJson::FLOAT = 5
FirebaseJson::DOUBLE = 6
FirebaseJson::BOOL = 7 and
FirebaseJson::NULL = 8
bool get(FirebaseJsonData &result, <string> path, bool prettify = false);
param result
The reference of FirebaseJsonData that holds the result.
param criteria
The FirebaseJson::SearchCriteria data.
param prettify
The text indentation and new line serialization option.
return number
of elements found from search.
The SearchCriteria data has the properties e.g.
path
- The key of path to search.
Path can be wildcard with * in search path and * should use as key in part and do not mix with any character.
value
- The value string to search.
depth
- The begin depth (int) of element to search, default is 0.
endDepth
- The end depth (int) of element to search, default is -1.
searchAll
- The boolean option to search all occurrences of elements.
size_t search(SearchCriteria &criteria);
size_t search(FirebaseJsonData &result, SearchCriteria &criteria, bool prettify = false);
param path
The key or path to search in to.
param searchAll
Search all occurrences.
return full path string
in case of found.
String getPath(<string> path, bool searchAll = false);
param path
The key or path of child element check.
return boolean
status indicated the existence of element.
bool isMember(<string> path);
return number
of child/array elements in FirebaseJson object.
size_t iteratorBegin();
param index
The element index to get.
param type
The integer which holds the type of data i.e. FirebaseJson::OBJECT and FirebaseJson::ARRAY
param key
The string which holds the key/name of the object, can return empty String if the data type is an array.
param value
The string which holds the value for the element key or array.
void iteratorGet(size_t index, int &type, String &key, String &value);
param index
The element index to get.
return IteratorValue struct
This should call after iteratorBegin.
The IteratorValue struct contains the following members: int type String key String value
IteratorValue valueAt(size_t index);
void iteratorEnd();
param path
The relative path that null to be set.
The relative path can be mixed with array index (number placed inside square brackets) and node names e.g. /myRoot/[2]/Sensor1/myData/[3].
void set(<string> path);
param path
The relative path that string value to be set.
param value
The value to set.
The relative path can be mixed with array index (number placed inside square brackets) and node names e.g. /myRoot/[2]/Sensor1/myData/[3].
The value that can be added is the following supported types e.g. flash string (PROGMEM and FPSTR), String, C/C++ std::string, const char*, char array, string literal, all integer and floating point numbers, boolean, FirebaseJson object and array.
void set(<string> path, <type> value);
param path
The relative path to remove its contents/children.
return bool
value represents the successful operation.
bool remove(<string> path);
return raw JSON string
<string> raw();
return the position of error in JSON object literal
Return -1 when for no parsing error.
int errorPosition();
param prettify
The text indentation and new line serialization option.
return size in byte of buffer
size_t serializedBufferLength(bool prettify = false);
param digits
The number of decimal places.
void setFloatDigits(uint8_t digits);
param digits
The number of decimal places.
void setDoubleDigits(uint8_t digits);
return the response code
of reading JSON data from WiFi/Ethernet Client
int responseCode();
param data
The JSON array literal string to set or deserialize.
return bool
value represents the successful operation.
Call FirebaseJsonArray.errorPosition to get the error.
bool setJsonArrayData(<string> data);
return instance of an object.
FirebaseJsonArray &add();
param value
The value to add.
return instance of an object.
The value that can be added is the following supported types e.g. flash string (PROGMEM and FPSTR), String, C/C++ std::string, const char*, char array, string literal, all integer and floating point numbers, boolean, FirebaseJson object and array.
FirebaseJsonArray &add(<type> value);
param v
The value of any type to add.
param n
The consecutive values of any type to add.
return instance of an object.
e.g. add("a","b",1,2)
FirebaseJsonArray &add(First v, Next... n);
param client
The pointer to or instance of Client object.
return instance of an object.
bool readFrom(Client *client);
bool readFrom(Client &client);
param client
The pointer to or instance of WiFiClient object.
return instance of an object.
bool readFrom(WiFiClient *client);
bool readFrom(WiFiClient &client);
param client
The pointer to or instance of WiFiClientSecure object.
return instance of an object.
bool readFrom(WiFiClientSecure *client);
bool readFrom(WiFiClientSecure &client);
param ser
The HW or SW Serial object.
param timeoutMS
The timeout in millisecond to wait for Serial data to be completed.
return instance of an object.
bool readFrom(HardwareSerial &ser, uint32_t timeoutMS = 5000);
bool readFrom(SoftwareSerial &ser, uint32_t timeoutMS = 5000);
param file
The File object.
return instance of an object.
bool readFrom(fs::File &file);
param result
The reference of FirebaseJsonData object that holds data at the specified index.
param index_or_path
Index of data or relative path to data in FirebaseJsonArray object.
return boolean
status of the operation.
The relative path must begin with array index (number placed inside square brackets) followed by other array indexes or node names e.g. /[2]/myData would get the data from myData key inside the array indexes 2
bool get(FirebaseJsonData &result, <int or string> index_or_path);
param result
The reference of FirebaseJsonData that holds the result.
param criteria
The FirebaseJson::SearchCriteria data.
param prettify
The text indentation and new line serialization option.
return number
of elements found from search.
The SearchCriteria data has the properties e.g.
path
- The key of path to search.
Path can be wildcard with * in search path and * should use as key in part and do not mix with any character.
value
- The value string to search.
depth
- The begin depth (int) of element to search, default is 0.
endDepth
- The end depth (int) of element to search, default is -1.
searchAll
- The boolean option to search all occurrences of elements.
size_t search(SearchCriteria &criteria);
size_t search(FirebaseJsonData &result, SearchCriteria &criteria, bool prettify = false);
param path
The key or path to search in to.
param searchAll
Search all occurrences.
return full path string
in case of found.
String getPath(<string> path, bool searchAll = false);
param path
The key or path of child element check.
return boolean
status indicated the existence of element.
bool isMember(<string> path);
return number
of child/array elements in FirebaseJsonArray object.
size_t iteratorBegin();
param index
The element index to get.
param type
The integer which holds the type of data i.e. FirebaseJson::OBJECT and FirebaseJson::ARRAY
param key
The string which holds the key/name of the object, can return empty String if the data type is an array.
param value
The string which holds the value for the element key or array.
void iteratorGet(size_t index, int &type, String &key, String &value);
param index
The element index to get.
return IteratorValue struct
This should call after iteratorBegin.
The IteratorValue struct contains the following members: int type String key String value
IteratorValue valueAt(size_t index);
void iteratorEnd();
return length of the array.
size_t size();
param out
The writable object e.g. String, std::string, char array, Stream e.g ile, WiFi/Ethernet Client and LWMQTT, that accepts the returning string.
param prettify
Boolean flag for return the pretty format string i.e. with text indentation and newline.
void toString(<type> out, bool prettify = false);
return raw JSON Array string
<string> raw();
param prettify
The text indentation and new line serialization option.
return size in byte of buffer
size_t serializedBufferLength(bool prettify = false);
return instance of an object.
FirebaseJsonArray &clear();
param index_or_path
The array index or path that null to be set.
void set(<int or string> index_or_path);
param index_or_path
The array index or path that value to be set.
param value
The value to set.
void set(<int or string> index_or_path, <type> value);
param index_or_path
The array index or relative path to array to be removed.
return bool
value represents the successful operation.
bool remove(<int or string> index_or_path);
return the position of error in JSON array literal
Return -1 when for no parsing error.
int errorPosition();
param digits
The number of decimal places.
void setFloatDigits(uint8_t digits);
param digits
The number of decimal places.
void setDoubleDigits(uint8_t digits);
param jsonArray
The returning FirebaseJsonArray object.
return bool
status for successful operation.
This should call after pares or get functions.
bool getArray(FirebaseJsonArray &jsonArray);
param source
The JSON array string.
param jsonArray
The returning FirebaseJsonArray object.
return bool
status for successful operation.
This should call after pares or get functions.
bool getArray(<string> source, FirebaseJsonArray &jsonArray);
param jsonArray
The returning FirebaseJson object.
return bool
status for successful operation.
This should call after pares or get functions.
bool getJSON(FirebaseJson &json);
param source
The JSON string.
param json
The returning FirebaseJsonArray object.
return bool
status for successful operation.
This should call after pares or get functions.
bool getJSON(<string> source, FirebaseJson &json);
return the The object or primitive type variable
.
to<type>();
e.g. to<String>(), to<int>(), to<bool>()
value
The String value of parses data.
value
The int value of parses data.
value
The double value of parses data.
value
The float value of parses data.
boolVlue
The bool value of parses data.
success
used to determine the result of the deserialize operation.
type
The type String of parses data e.g. string, int, double, boolean, array, object, null and undefined.
typeNum
The type (number) of parses data in form of the following jsonDataType
value.
FirebaseJson::UNDEFINED = 0
FirebaseJson::OBJECT = 1
FirebaseJson::ARRAY = 2
FirebaseJson::STRING = 3
FirebaseJson::INT = 4
FirebaseJson::FLOAT = 5
FirebaseJson::DOUBLE = 6
FirebaseJson::BOOL = 7 and
FirebaseJson::NULL = 8
The MIT License (MIT)
Copyright (c) 2023 K. Suwatchai (Mobizt)
Permission is hereby granted, free of charge, to any person returning a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.