### AsyncClientClass Setup and Control Source: https://context7.com/mobizt/firebaseclient/llms.txt Illustrates the setup and configuration of the AsyncClientClass for managing asynchronous Firebase operations. It covers basic construction, independent queues, SSL client options, and timeout settings. ```cpp #include #include WiFiClientSecure ssl1, ssl2; using AsyncClient = AsyncClientClass; // Basic constructor — uses WiFi reconnection by default AsyncClient aClient(ssl1); // Two clients for independent stream and request queues AsyncClient aClientStream(ssl1), aClientReq(ssl2); // Configure SSL client options ssl1.setInsecure(); ssl1.setConnectionTimeout(1000); // ms (ESP32 SDK v3+) ssl1.setHandshakeTimeout(5); // seconds (ESP32 SDK v3+) // ssl1.setBufferSizes(4096, 1024); // ESP8266 only // Set timeouts on the async client aClient.setSyncSendTimeout(10); // seconds aClient.setSyncReadTimeout(10); aClient.setSessionTimeout(300); // Check last error after a sync (await) call if (aClient.lastError().code() != 0) { Firebase.printf("Error: %s, code: %d\n", aClient.lastError().message().c_str(), aClient.lastError().code()); } // Stop a specific running task by UID aClient.stopAsync("myTaskUID"); // Stop all tasks in queue aClient.stopAsync(true); // Get pending task count size_t pending = aClient.taskCount(); ``` -------------------------------- ### Install FirebaseClient with PlatformIO Source: https://github.com/mobizt/firebaseclient/blob/main/README.md Use this command to install the FirebaseClient library in PlatformIO IDE. Ensure your platform-espressif32 core is up-to-date or use the pioarduino platform for ESP32. ```bash pio lib install "FirebaseClient" ``` -------------------------------- ### get (String) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/messaging_instance.md Retrieves information about app instances. ```APIDOC ## get (String) ### Description Get information about app instances. ### Method String ### Signature `String get(AsyncClientClass &aClient, const String &IID)` ### Parameters #### Path Parameters - `aClient` (AsyncClientClass&) - The async client. - `IID` (const String&) - The instance ID token. ### Returns - `String` - The response payload. ``` -------------------------------- ### Begin Transaction Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/firestore_database.md Starts a new transaction. The Firebase project ID should be the name without 'firebaseio.com'. ```cpp String beginTransaction(AsyncClientClass &aClient, const Firestore::Parent &parent, const TransactionOptions &transOptions) ``` -------------------------------- ### AsyncClientClass Setup and Control Source: https://context7.com/mobizt/firebaseclient/llms.txt Details on setting up and managing the `AsyncClientClass` for asynchronous operations, including constructor options, SSL client configuration, and task management. ```APIDOC ## `AsyncClientClass` — Async Client Setup and Control `AsyncClientClass` wraps an SSL client and manages the async task queue for all Firebase service operations. One client can serve multiple services when auth is handled by the same `FirebaseApp`. ```cpp #include #include WiFiClientSecure ssl1, ssl2; using AsyncClient = AsyncClientClass; // Basic constructor — uses WiFi reconnection by default AsyncClient aClient(ssl1); // Two clients for independent stream and request queues AsyncClient aClientStream(ssl1), aClientReq(ssl2); // Configure SSL client options ssl1.setInsecure(); ssl1.setConnectionTimeout(1000); // ms (ESP32 SDK v3+) ssl1.setHandshakeTimeout(5); // seconds (ESP32 SDK v3+) // ssl1.setBufferSizes(4096, 1024); // ESP8266 only // Set timeouts on the async client aClient.setSyncSendTimeout(10); // seconds aClient.setSyncReadTimeout(10); aClient.setSessionTimeout(300); // Check last error after a sync (await) call if (aClient.lastError().code() != 0) { Firebase.printf("Error: %s, code: %d\n", aClient.lastError().message().c_str(), aClient.lastError().code()); } // Stop a specific running task by UID aClient.stopAsync("myTaskUID"); // Stop all tasks in queue aClient.stopAsync(true); // Get pending task count size_t pending = aClient.taskCount(); ``` ``` -------------------------------- ### get(AsyncClientClass &aClient, const String &projectId, const String &rulesetId, AsyncResultCallback cb, const String &uid = "") Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/rules.md Get a Ruleset by name including the full Source contents. ```APIDOC ## void get(AsyncClientClass &aClient, const String &projectId, const String &rulesetId, AsyncResultCallback cb, const String &uid = "") ### Description Get a Ruleset by name including the full Source contents. ### Signature ```cpp void get(AsyncClientClass &aClient, const String &projectId, const String &rulesetId, AsyncResultCallback cb, const String &uid = "") ``` ### Parameters #### Path Parameters - `aClient` (AsyncClientClass&) - The async client. - `projectId` (const String&) - The project ID. - `rulesetId` (const String&) - The ruleset ID. - `cb` (AsyncResultCallback) - The async result callback. - `uid` (const String&) - The user specified UID of async result (optional). ``` -------------------------------- ### Declare RealtimeDatabase Class Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/realtime_database.md Declares the RealtimeDatabase class. No setup required. ```cpp class RealtimeDatabase ``` -------------------------------- ### Get App Instance Information (AsyncResult) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/messaging_instance.md Retrieve information about a specific app instance using its instance ID token and store the result in an AsyncResult object. This is a synchronous way to get instance details. ```cpp void get(AsyncClientClass &aClient, const String &IID, AsyncResult &aResult) ``` -------------------------------- ### String get(AsyncClientClass &aClient, const String &projectId, const String &releaseId) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/rules.md Retrieves a specific Release by its name and returns its details as a String. ```APIDOC ## Function: get ### Description Get a Release by name. ### Signature ```cpp String get(AsyncClientClass &aClient, const String &projectId, const String &releaseId) ``` ### Parameters #### Path Parameters - `aClient` (AsyncClientClass&) - The async client. - `projectId` (const String&) - The project ID. - `releaseId` (const String&) - The release ID. ### Returns - `String` - The response payload. ``` -------------------------------- ### get (AsyncResult) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/messaging_instance.md Retrieves information about app instances asynchronously. ```APIDOC ## get (AsyncResult) ### Description Get information about app instances. ### Method void ### Signature `void get(AsyncClientClass &aClient, const String &IID, AsyncResult &aResult)` ### Parameters #### Path Parameters - `aClient` (AsyncClientClass&) - The async client. - `IID` (const String&) - The instance ID token. - `aResult` (AsyncResult&) - The async result. ``` -------------------------------- ### get (AsyncResultCallback) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/messaging_instance.md Retrieves information about app instances asynchronously with a callback. ```APIDOC ## get (AsyncResultCallback) ### Description Get information about app instances. ### Method void ### Signature `void get(AsyncClientClass &aClient, const String &IID, AsyncResultCallback cb, const String &uid = "")` ### Parameters #### Path Parameters - `aClient` (AsyncClientClass&) - The async client. - `IID` (const String&) - The instance ID token. - `cb` (AsyncResultCallback) - The async result callback. - `uid` (const String&) - The user specified UID of async result (optional). ``` -------------------------------- ### Default Constructor for AsyncClientClass Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/async_client.md Initializes an AsyncClientClass with default settings. No specific setup is required. ```cpp AsyncClientClass() ``` -------------------------------- ### Get App Instance Information (String) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/messaging_instance.md Retrieve information about a specific app instance using its instance ID token. This function returns the response payload as a String. ```cpp String get(AsyncClientClass &aClient, const String &IID) ``` -------------------------------- ### Get DOM Element by ID Source: https://github.com/mobizt/firebaseclient/blob/main/examples/RealtimeDatabase/StreamPerformanceTest/index.html A utility function to get a DOM element by its ID. It's a shorthand for document.getElementById. ```javascript function getEl(e){return document.getElementById(e)} ``` -------------------------------- ### Get Data with Options Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/realtime_database.md Retrieves data with advanced options like read timeout, write size limits, shallowing, and complex filtering (orderBy, startAt, etc.). ```cpp DatabaseOptions options; options.readTimeout = 5000; Database.get(aClient, "/path/to/data", options); ``` ```cpp T get(AsyncClientClass &aClient, const String &path, DatabaseOptions &options) ``` -------------------------------- ### Get Download Information Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/async_result.md Retrieves detailed information about a file or BLOB download. Use this to get download status and details. ```cpp download_data_t downloadInfo() const ``` -------------------------------- ### Get Upload Information Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/async_result.md Retrieves detailed information about a file or BLOB upload. Use this to get upload status and details. ```cpp upload_data_t uploadInfo() const ``` -------------------------------- ### Initialize App and Event Listeners Source: https://github.com/mobizt/firebaseclient/blob/main/examples/RealtimeDatabase/StreamPerformanceTest/index.html Sets up the application by initializing Firebase, loading the initial tab, and attaching event listeners to various UI elements for user interaction and configuration changes. ```javascript function docReady(e){"complete"===document.readyState||"interactive"===document.readyState?setTimeout(e,1):document.addEventListener("DOMContentLoaded",e),addEvent("homeTabLink","click",openTab,"homeTab"),addEvent("setupTabLink","click",openTab,"setupTab"),addEvent("testTabLink","click",openTab,"testTab")} function saveInterval(){saveConfig("interval"),saveConfig("timeBase"),intvInstant&&authenticated&&(clearIterationLoop(!1),startIterationLoop())} function saveLedGPIO(){parseInt(getEl("ledGPIO").value)<0&&(getEl("ledGPIO").value="0"),saveChange("ledGPIO")} function saveDelay(){parseInt(getEl("delayMs").value)<0&&(getEl("delayMs").value="0"),saveChange("delayMs")} function startIterationLoop(){interval=1e3*parseInt(getEl("interval").value)*("Min"==getEl("timeBase").value?60:1),intvInstant=setInterval((function(){setData(!0)})),interval)} docReady((function(){addEvent("apiKey","change",saveChange,"apiKey"),addEvent("dbUrl","change",saveChange,"dbUrl"),addEvent("userEmail","change",saveChange,"userEmail"),addEvent("userPsw","change",saveChange,"userPsw"),addEvent("homeTabBtn","click",openTab,"homeTab"),addEvent("setupTabBtn","click",openTab,"setupTab"),addEvent("testTabBtn","click",openTab,"testTab"),addEvent("signInBtn","click",initApp),addEvent("signOutBtn","click",signOutUser),addEvent("mode","click",changeAppendMode),addEvent("path","change",saveChange,"path"),addEvent("valueType","change",saveChange,"valueType"),addEvent("amount","change",saveChange,"amount"),addEvent("interval","change",saveInterval),addEvent("timeBase","change",saveInterval),addEvent("iteration","change",saveChange,"iteration"),addEvent("deviceJob","change",saveDeviceJobs),addEvent("ledGPIO","change",saveLedGPIO),addEvent("delayMs","change",saveDelay),addEvent("enListenerChk","click",addRemoveListener),addEvent("setBtn","click",setDataEvt),addEvent("delBtn","click",delDataEvt),setForm(),loadTab(),initApp()})),document.addEventListener("DOMContentLoaded",(function(){const e=document.querySelectorAll(".navbar-nav .nav-link"),t=document.querySelector(".navbar-collapse");e.forEach((e=>{e.addEventListener("click",(function(){if(document.querySelectorAll(".navbar-nav .nav-link").forEach((e=>{e.classList.remove("text-success-emphasis")})),e.classList.add("text-success-emphasis"),getEl("page").innerHTML=e.innerHTML,t.classList.contains("show")){new bootstrap.Collapse(t,{toggle:!1}).hide()}}))}))})); ``` -------------------------------- ### Get Cloud Function Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/cloud_functions.md Retrieves a specific Cloud Function. This function requires OAuth2.0 authentication. Use FirebaseData.payload() to get the returned payload. ```APIDOC ## void get(AsyncClientClass &aClient, const GoogleCloudFunctions::Parent &parent, const String &functionId, AsyncResultCallback cb, const String &uid = "") ### Description Retrieves a specific Cloud Function. ### Method void ### Parameters #### Path Parameters - `aClient` (AsyncClientClass&) - The async client. - `parent` (GoogleCloudFunctions::Parent) - The GoogleCloudFunctions::Parent object included project Id and location name in its constructor. - `functionId` (String) - The name of function. - `cb` (AsyncResultCallback) - The async result callback. - `uid` (String) - The user specified UID of async result (optional). ``` -------------------------------- ### signup (with callback and uid) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/firebase_client.md Signs up a new user with a callback and an optional user ID. ```APIDOC ## signup ### Description Signup a new user with callback. ### Signature `static void signup(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, AsyncResultCallback cb, const String &uid = "")` ### Parameters - `aClient` (AsyncClientClass &aClient) - The async client to work for authentication/authorization task. - `app` (FirebaseApp &app) - The FirebaseApp class object to handle authentication/authorization task. - `auth` (user_auth_data &auth) - The user auth data (`user_auth_data`) which holds the user credentials from `USerAccount` class. - `cb` (AsyncResultCallback cb) - The async result callback (AsyncResultCallback). - `uid` (const String &uid = "") - The user specified UID of async result (optional). ``` -------------------------------- ### Get ETag from Database Get Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/realtime_database_result.md Retrieves the ETag associated with a data retrieval operation from the Realtime Database. ETags are used for conditional requests and caching. ```cpp String ETag() const ``` -------------------------------- ### Signup User (with callback) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/firebase_client.md Signs up a new user with Firebase using a callback function to handle the result. Requires an async client, app object, user auth data, and a callback. ```cpp static void signup(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, AsyncResultCallback cb, const String &uid = "") ``` -------------------------------- ### get(AsyncClientClass &aClient, const Firestore::Parent &parent, AsyncResultCallback cb, const String &uid = "") Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/firestore_database.md Gets information about a database asynchronously using a callback. ```APIDOC ## get(AsyncClientClass &aClient, const Firestore::Parent &parent, AsyncResultCallback cb, const String &uid = "") ### Description Gets information about a database. The Firebase project Id should be only the name without the firebaseio.com. The Firestore database Id is the Id of database to get the infomation. This function requires ServiceAuth or AccessToken authentication. ### Parameters #### Path Parameters - `aClient` (AsyncClientClass&) - The async client. - `parent` (Firestore::Parent) - The Firestore::Parent object included project Id and database Id in its constructor. - `cb` (AsyncResultCallback) - The async result callback (AsyncResultCallback). - `uid` (String) - The user specified UID of async result (optional). ``` -------------------------------- ### Get Release Executable as String Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/rules.md Retrieve the Release executable for enforcing rules and return it directly as a String. Supports specifying the project, release, and executable version. ```cpp String getExecutable(AsyncClientClass &aClient, const String &projectId, const String &releaseId, Rules::ReleaseExecutableVersion executableVersion) ``` -------------------------------- ### Download Configuration Source: https://github.com/mobizt/firebaseclient/blob/main/examples/Messaging/WebClient/index.html Creates a downloadable text file with the provided content. Useful for saving configuration settings. ```javascript function download(e,t){var a=document.createElement("a");a.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(t)),a.setAttribute("download",e),a.style.display="none",document.body.appendChild(a),a.click(),document.body.removeChild(a)} ``` -------------------------------- ### Get IAM Policy for a Function (Async) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/cloud_functions.md Retrieves the IAM policy for a specified Cloud Function asynchronously. Requires OAuth2.0 authentication. Use FirebaseData.payload() to get the returned payload. ```cpp void getIamPolicy(AsyncClientClass &aClient, const GoogleCloudFunctions::Parent &parent, const String &functionId, GoogleCloudFunctions::GetPolicyOptions options, AsyncResult &aResult) ``` -------------------------------- ### AsyncClientClass Constructor with Client and Network Config Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/async_client.md Initializes an AsyncClientClass with an SSL client and specific network configuration data. The network_config_data can be obtained using static functions from networking classes. ```cpp AsyncClientClass(Client &client, network_config_data &net) ``` -------------------------------- ### Initialize CustomToken from File Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/auth_class.md Constructs a CustomToken object by loading credentials from a file configuration. The file_config_data object should contain previously saved CustomToken credentials. ```cpp explicit CustomToken(const file_config_data &tokenFile) ``` -------------------------------- ### Get Firestore Database Information with Callback (Async) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/firestore_database.md Gets information about a database using an asynchronous callback. The Firebase project ID should not include 'firebaseio.com'. This function requires ServiceAuth or AccessToken authentication. ```cpp void get(AsyncClientClass &aClient, const Firestore::Parent &parent, AsyncResultCallback cb, const String &uid = "") ``` -------------------------------- ### Get IAM Policy for a Function (Async with Callback) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/cloud_functions.md Retrieves the IAM policy for a specified Cloud Function asynchronously using a callback. Requires OAuth2.0 authentication. Use FirebaseData.payload() to get the returned payload. ```cpp void getIamPolicy(AsyncClientClass &aClient, const GoogleCloudFunctions::Parent &parent, const String &functionId, GoogleCloudFunctions::GetPolicyOptions options, AsyncResultCallback cb, const String &uid = "") ``` -------------------------------- ### signup (no callback) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/firebase_client.md Signs up a new user without a callback, using an AsyncResult object. ```APIDOC ## signup ### Description Signup a new user without callback. ### Signature `static void signup(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, AsyncResult &aResult)` ### Parameters - `aClient` (AsyncClientClass &aClient) - The async client to work for authentication/authorization task. - `app` (FirebaseApp &app) - The FirebaseApp class object to handle authentication/authorization task. - `auth` (user_auth_data &auth) - The user auth data (`user_auth_data`) which holds the user credentials from `USerAccount` class. - `aResult` (AsyncResult &aResult) - The async result (AsyncResult). ``` -------------------------------- ### Signup User (with async result) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/firebase_client.md Signs up a new user with Firebase, returning the result via an AsyncResult object. Requires an async client, app object, and user auth data. ```cpp static void signup(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, AsyncResult &aResult) ``` -------------------------------- ### Get Object Metadata (Synchronous) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/cloud_storage.md Retrieves metadata for a specific object in a Google Cloud Storage bucket. Requires an async client, parent object with bucket ID and object name, and optional get options. ```cpp String getMetadata(AsyncClientClass &aClient, const GoogleCloudStorage::Parent &parent, GoogleCloudStorage::GetOptions &options) ``` -------------------------------- ### void create(AsyncClientClass &aClient, const String &projectId, const Release &release, AsyncResultCallback cb, const String &uid = "") Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/rules.md Creates a Ruleset from source. The Ruleset is given a unique generated name. Handles syntactic or semantic errors by indicating the first error encountered. ```APIDOC ## Function: create ### Description Create a Ruleset from Source. The Ruleset is given a unique generated name which is returned to the caller. Source containing syntactic or semantics errors will result in an error response indicating the first error encountered. ### Signature ```cpp void create(AsyncClientClass &aClient, const String &projectId, const Release &release, AsyncResultCallback cb, const String &uid = "") ``` ### Parameters #### Path Parameters - `aClient` (AsyncClientClass&) - The async client. - `projectId` (const String&) - The project ID. - `release` (const Release&) - The Release object. - `cb` (AsyncResultCallback) - The async result callback. - `uid` (const String&) - The user specified UID of async result (optional). ``` -------------------------------- ### Get a Cloud Function (Asynchronous) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/cloud_functions.md Initiates an asynchronous request to get details for a specific Cloud Function. The Firebase project ID should not include 'firebaseio.com'. This function requires OAuth2.0 authentication and stores the result in an AsyncResult object. ```cpp void get(AsyncClientClass &aClient, const GoogleCloudFunctions::Parent &parent, const String &functionId, AsyncResult &aResult) ``` -------------------------------- ### Initialize Firebase App (with callback) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/firebase_client.md Initializes the FirebaseApp with an async client, app object, user auth data, and a callback function. An optional user ID can be provided. ```cpp static void initializeApp(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, AsyncResultCallback cb, const String &uid = "") ``` -------------------------------- ### Signup User (basic) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/firebase_client.md Signs up a new user with Firebase using an async client, app object, and user auth data. This version does not use a callback. ```cpp static void signup(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth) ``` -------------------------------- ### length() Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/async_result.md Gets the length of the response payload string. ```APIDOC ## length() ### Description Get the length of response payload string. ### Method `size_t length() const` ### Returns - `size_t` - The payload string length. ``` -------------------------------- ### Batch Import APNs Tokens (Sync) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/messaging_instance.md Creates registration tokens for APNs tokens. Specify the application bundle ID, sandbox status, and APNs tokens. Returns the response payload. ```cpp String batchImport(AsyncClientClass &aClient, const String &application, bool sandbox, const object_t &APNs) ``` -------------------------------- ### get() Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/auth_class.md Retrieves a reference to the internal user authentication data. ```APIDOC ## get() ### Description Returns the internal user_auth_data reference. ### Returns - `user_auth_data` - Return internal user_auth_data reference. ``` -------------------------------- ### Create RealtimeDatabase Instance Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/realtime_database.md Creates a new RealtimeDatabase instance with a defined URL. Provide your Firebase database URL. ```cpp RealtimeDatabase Database("xxxxxxxxx.firebasedatabase.app"); ``` -------------------------------- ### beginTransaction Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/firestore_database.md Starts a new transaction. Requires ServiceAuth authentication. ```APIDOC ## beginTransaction ### Description Starts a new transaction. Requires ServiceAuth authentication. ### Method Signature ```cpp String beginTransaction(AsyncClientClass &aClient, const Firestore::Parent &parent, const TransactionOptions &transOptions) ``` ### Parameters - `aClient` - The async client. - `parent` - The Firestore::Parent object included project Id and database Id in its constructor. - `transOptions` - The transaction options. ``` -------------------------------- ### ListOptions Configuration Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/rules.md Configure options for listing ruleset or release instances, including page size, page token, and filtering. ```APIDOC ## ListOptions ### Description Configuration options for listing ruleset or release instances. ### Methods #### `pageSize(int value)` Sets the page size for loading data. The maximum allowed value is 100. Defaults to 10. This is a hint, and the service may return fewer items. - **Params:** - `value` (int) - Optional. The desired page size. #### `pageToken(const String &value)` Specifies the next page token for retrieving subsequent batches of Ruleset instances. - **Params:** - `value` (String) - The page token for the next page. #### `filter(const String value)` Applies filters to the list method for Ruleset or Release instances. - **Ruleset Filters:** Supports restrictions on `Ruleset.name`. For time-based filtering, use the `date` function with RFC 3339 compliant strings (e.g., `create_time > date("2017-01-01T00:00:00Z")`). Can be combined with `name` filters (e.g., `name=UUID-*`). - **Release Filters:** Supports restrictions on `Release.name` and `Release.ruleset_name`. Examples include filtering by a name prefix (e.g., `name=prod*`) or combining name and ruleset name filters (e.g., `name=prod* rulesetName=uuid1234`). Filters are relative to the project, but fully qualified names can also be used. - **Params:** - `value` (String) - Optional. The filter string. ``` -------------------------------- ### Get Object Metadata (Asynchronous with Result) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/cloud_storage.md Asynchronously retrieves metadata for a specific object in a Google Cloud Storage bucket and stores the result in an AsyncResult object. Requires an async client, parent object with bucket ID and object name, and optional get options. ```cpp void getMetadata(AsyncClientClass &aClient, const GoogleCloudStorage::Parent &parent, GoogleCloudStorage::GetOptions &options, AsyncResult &aResult) ``` -------------------------------- ### LegacyToken Constructor (file_config_data) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/auth_class.md Initializes LegacyToken using filesystem data for custom token credentials. ```APIDOC ## LegacyToken(const file_config_data &tokenFile) ### Description A LegacyToken constructor. ### Parameters #### Path Parameters - **tokenFile** (file_config_data) - Required - The filesystem data (`file_config_data`) obtained from `FileConfig` class object of file that the `CustomToken` credentials will be saved to or read from. ``` -------------------------------- ### RealtimeDatabase Constructor Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/realtime_database.md Creates a new RealtimeDatabase instance with a defined URL. ```APIDOC ## RealtimeDatabase(const String &url = "") ### Description Create new RealtimeDatabase instance with defined url. ### Example ```cpp RealtimeDatabase Database("xxxxxxxxx.firebasedatabase.app"); ``` ### Signature ```cpp RealtimeDatabase(const String &url = "") ``` ### Parameters * `url` (String) - The database url ``` -------------------------------- ### Get Object Metadata (Asynchronous with Callback) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/cloud_storage.md Asynchronously retrieves metadata for a specific object in a Google Cloud Storage bucket using a callback function. Requires an async client, parent object with bucket ID and object name, optional get options, and a callback function. ```cpp void getMetadata(AsyncClientClass &aClient, const GoogleCloudStorage::Parent &parent, GoogleCloudStorage::GetOptions &options, AsyncResultCallback cb, const String &uid = "") ``` -------------------------------- ### Download Object with Options Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/cloud_storage.md Downloads an object from a Google Cloud Storage bucket. The `options` parameter allows for customization of the download process via API parameters. ```cpp bool download(AsyncClientClass &aClient, const GoogleCloudStorage::Parent &parent, file_config_data &file, GoogleCloudStorage::GetOptions &options) ``` -------------------------------- ### Get C-String Pointer Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/placeholders.md Returns a pointer to the internal string buffer. ```APIDOC ## c_str() ### Description Return the pointer to internal string buffer. ### Method c_str ### Returns - `const char *` - The pointer to internal string buffer. ``` -------------------------------- ### Perform OTA Update with Callback Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/realtime_database.md Initiates an OTA update using a firmware file from the database. The firmware data should be a base64 encoded string. This version uses a callback for asynchronous results. ```cpp Database.ota(aClient, "/path/to/data", cb, U_FLASH); ``` -------------------------------- ### Initialize CustomAuth with Service Account Details Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/auth_class.md Use this constructor when you have the service account credentials (API key, client email, project ID, private key) and user ID readily available. It also supports optional custom claims and an expiration time for the token. ```cpp explicit CustomAuth(TimeStatusCallback timeCb, const String &apiKey, const String &clientEmail, const String &projectId, const String &privateKey, const String &uid, const String &claims = "", size_t expire = FIREBASE_DEFAULT_TOKEN_TTL) ``` -------------------------------- ### ttl Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/firebase_app.md Gets the remaining time in seconds until the current token expires. ```APIDOC ## ttl() ### Description Get the remaining time to live of token until expired. ### Returns - `unsigned long` - The integer value of ttl. ``` -------------------------------- ### Initialize IDToken from File Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/auth_class.md Constructs an IDToken object by loading credentials from a file configuration. The file_config_data object should contain previously saved IDToken credentials. ```cpp explicit IDToken(const file_config_data &tokenFile) ``` -------------------------------- ### RealtimeDatabase Destructor Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/realtime_database.md Destructor for the RealtimeDatabase class. No parameters or setup required. ```cpp ~RealtimeDatabase() ``` -------------------------------- ### String create(AsyncClientClass &aClient, const String &projectId, const Release &release) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/rules.md Creates a Ruleset from source and returns the generated name as a String. Handles syntactic or semantic errors by indicating the first error encountered. ```APIDOC ## Function: create ### Description Create a Ruleset from Source. The Ruleset is given a unique generated name which is returned to the caller. Source containing syntactic or semantics errors will result in an error response indicating the first error encountered. ### Signature ```cpp String create(AsyncClientClass &aClient, const String &projectId, const Release &release) ``` ### Parameters #### Path Parameters - `aClient` (AsyncClientClass&) - The async client. - `projectId` (const String&) - The project ID. - `release` (const Release&) - The Release object. ### Returns - `String` - The response payload. ``` -------------------------------- ### Get Request Path Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/async_result.md Retrieves the path of the resource that was requested. This can be helpful for logging or routing. ```cpp String path() const ``` -------------------------------- ### void get(AsyncClientClass &aClient, const String &path, file_config_data &file, AsyncResult &aResult) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/realtime_database.md Retrieves data from a specified node path in the Realtime Database. It utilizes file system configurations for handling data operations. ```APIDOC ## void get(AsyncClientClass &aClient, const String &path, file_config_data &file, AsyncResult &aResult) ### Description Get value at the node path. The FileConfig object constructor should be included filename and FileConfigCallback. The FileConfigCallback function contains the parameters i.e., File reference returned from file operation, filename for file operation and file_operating_mode. ### Parameters - `aClient` - The async client. - `path` - The node path to get value. - `file` - The filesystem data (file_config_data) obtained from FileConfig class object. - `aResult` - The async result (AsyncResult) ``` -------------------------------- ### Begin Transaction (AsyncResultCallback) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/firestore_database.md Starts a new transaction asynchronously, with results delivered to a callback function. Requires ServiceAuth authentication. The Firebase project ID should be the name without 'firebaseio.com'. Transaction options can be configured for read-only or read-write modes. ```cpp void beginTransaction(AsyncClientClass &aClient, const Firestore::Parent &parent, const TransactionOptions &transOptions, AsyncResultCallback cb, const String &uid = "") ``` -------------------------------- ### void create(AsyncClientClass &aClient, const String &projectId, const Release &release, AsyncResult &aResult) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/rules.md Creates a Ruleset from source, storing the result in an AsyncResult object. Handles syntactic or semantic errors by indicating the first error encountered. ```APIDOC ## Function: create ### Description Create a Ruleset from Source. The Ruleset is given a unique generated name which is returned to the caller. Source containing syntactic or semantics errors will result in an error response indicating the first error encountered. ### Signature ```cpp void create(AsyncClientClass &aClient, const String &projectId, const Release &release, AsyncResult &aResult) ``` ### Parameters #### Path Parameters - `aClient` (AsyncClientClass&) - The async client. - `projectId` (const String&) - The project ID. - `release` (const Release&) - The Release object. - `aResult` (AsyncResult&) - The async result. ``` -------------------------------- ### get (String) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/firestore_database.md Retrieves a composite index and returns it as a string. This function requires ServiceAuth authentication. ```APIDOC ## get (String) ### Description Gets a composite index. ### Parameters - `aClient` (AsyncClientClass &) - The async client. - `parent` (const Firestore::Parent &) - The Firestore::Parent object included project Id and database Id in its constructor. - `collectionId` (const String &) - The collection Id. - `indexId` (const String &) - The index to get. ### Returns - `String` - The response payload. ``` -------------------------------- ### void get(AsyncClientClass &aClient, const String &path, file_config_data &file, AsyncResultCallback cb, const String &uid = "") Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/realtime_database.md Retrieves data from a specified node path in the Realtime Database, with a callback for asynchronous result handling. It also supports an optional user-defined ID for the result. ```APIDOC ## void get(AsyncClientClass &aClient, const String &path, file_config_data &file, AsyncResultCallback cb, const String &uid = "") ### Description Get value at the node path. The FileConfig object constructor should be included filename and FileConfigCallback. The FileConfigCallback function contains the parameters i.e., File reference returned from file operation, filename for file operation and file_operating_mode. ### Parameters - `aClient` - The async client. - `path` - The node path to get value. - `file` - The filesystem data (file_config_data) obtained from FileConfig class object. - `cb` - The async result callback (AsyncResultCallback). - `uid` - The user specified UID of async result (optional). ``` -------------------------------- ### get (String) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/firestore_database.md Retrieves an index and returns the response payload as a String. Requires ServiceAuth authentication. ```APIDOC ## get (String) ### Description Gets an index and returns the response payload. ### Method ```cpp String get(AsyncClientClass &aClient, const Firestore::Parent &parent, const String &indexId) ``` ### Parameters - `aClient` - The async client. - `parent` - The Firestore::Parent object included project Id and database Id in its constructor. - `indexId` - The index to get. ### Returns - `String` - The response payload. ``` -------------------------------- ### Get App Instance Information (Callback) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/messaging_instance.md Retrieve information about a specific app instance using its instance ID token and a callback function. An optional user-specified UID can be provided for the async result. ```cpp void get(AsyncClientClass &aClient, const String &IID, AsyncResultCallback cb, const String &uid = "") ``` -------------------------------- ### Get Release with Callback Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/rules.md Retrieves a Release by its name using an asynchronous client and a callback for results. ```cpp void get(AsyncClientClass &aClient, const String &projectId, const String &releaseId, AsyncResultCallback cb, const String &uid = "") ``` -------------------------------- ### Get User Authentication Data Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/auth_class.md Retrieves a reference to the internal user authentication data structure. ```cpp user_auth_data &get() ``` -------------------------------- ### Initialize FirebaseApp with User Authentication Source: https://context7.com/mobizt/firebaseclient/llms.txt Use this snippet for user authentication with email and password. Ensure required build options are enabled and call `app.loop()` in your main loop to maintain authentication. ```cpp #define ENABLE_USER_AUTH #define ENABLE_DATABASE #include #include #include // User authentication with email/password UserAuth user_auth("WEB_API_KEY", "user@example.com", "password123", 3300); FirebaseApp app; WiFiClientSecure ssl_client; using AsyncClient = AsyncClientClass; AsyncClient aClient(ssl_client); RealtimeDatabase Database; void authCallback(AsyncResult &aResult) { if (aResult.isDebug()) Firebase.printf("Auth debug: %s\n", aResult.debug().c_str()); if (aResult.isError()) Firebase.printf("Auth error: %s, code: %d\n", aResult.error().message().c_str(), aResult.error().code()); } void setup() { WiFi.begin("SSID", "PASSWORD"); while (WiFi.status() != WL_CONNECTED) delay(300); ssl_client.setInsecure(); // or set CA cert for production // Async auth init with callback initializeApp(aClient, app, getAuth(user_auth), authCallback, "authTask"); // Bind the authenticated app to the service class app.getApp(Database); Database.url("PROJECT-ID-default-rtdb.firebaseio.com"); } void loop() { app.loop(); // Maintains auth tokens and async task queue // ... } ``` -------------------------------- ### AsyncClientClass(Client &client, network_config_data &net) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/async_client.md Constructor that takes a reference to a Client object and network configuration data. ```APIDOC ## AsyncClientClass(Client &client, network_config_data &net) ### Description Initializes the AsyncClientClass with a given SSL client and specific network configuration data. ### Method Constructor ### Parameters #### Path Parameters - **client** (Client&) - The SSL client that working with the network interface. - **net** (network_config_data&) - The network config data can be obtained from the networking classes via the static function called `getNetwork`. ### Code ```cpp AsyncClientClass(Client &client, network_config_data &net) ``` ``` -------------------------------- ### Get Task Count Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/async_client.md Retrieve the number of asynchronous and synchronous tasks currently stored in the queue. ```cpp size_t taskCount() const ``` -------------------------------- ### Get Debug Information Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/async_result.md Retrieves detailed debug information about the asynchronous operation. Use this for troubleshooting. ```cpp String debug() ``` -------------------------------- ### Initialize Placeholder as JSON Array (C++) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/placeholders.md Initializes the placeholder to represent a JSON array. ```cpp void initArray() ``` -------------------------------- ### create(AsyncClientClass &aClient, const String &projectId, const Ruleset &ruleSet, AsyncResultCallback cb, const String &uid = "") Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/rules.md Create a Ruleset from Source. The Ruleset is given a unique generated name which is returned to the caller. Source containing syntactic or semantics errors will result in an error response indicating the first error encountered. ```APIDOC ## void create(AsyncClientClass &aClient, const String &projectId, const Ruleset &ruleSet, AsyncResultCallback cb, const String &uid = "") ### Description Create a Ruleset from Source. The Ruleset is given a unique generated name which is returned to the caller. Source containing syntactic or semantics errors will result in an error response indicating the first error encountered. ### Signature ```cpp void create(AsyncClientClass &aClient, const String &projectId, const Ruleset &ruleSet, AsyncResultCallback cb, const String &uid = "") ``` ### Parameters #### Path Parameters - `aClient` (AsyncClientClass&) - The async client. - `projectId` (const String&) - The project ID. - `ruleSet` (const Ruleset&) - The ruleset object. - `cb` (AsyncResultCallback) - The async result callback. - `uid` (const String&) - The user specified UID of async result (optional). ``` -------------------------------- ### get (AsyncResult) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/firestore_database.md Retrieves an index asynchronously and stores the result in an AsyncResult object. Requires ServiceAuth authentication. ```APIDOC ## get (AsyncResult) ### Description Gets an index asynchronously. ### Method ```cpp void get(AsyncClientClass &aClient, const Firestore::Parent &parent, const String &indexId, AsyncResult &aResult) ``` ### Parameters - `aClient` - The async client. - `parent` - The Firestore::Parent object included project Id and database Id in its constructor. - `indexId` - The index to get. - `aResult` - The async result (AsyncResult). ``` -------------------------------- ### Get Metadata (AsyncResult) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/storage.md Retrieves the metadata for a specified object in Firebase Storage and stores it in an AsyncResult object. ```APIDOC ## getMetadata (AsyncResult) ### Description Retrieves the metadata for a specified object in Firebase Storage, storing the result in an AsyncResult object. ### Signature ```cpp void getMetadata(AsyncClientClass &aClient, const FirebaseStorage::Parent &parent, AsyncResult &aResult) ``` ### Parameters - `aClient` (AsyncClientClass&) - The async client. - `parent` (FirebaseStorage::Parent&) - The FirebaseStorage::Parent object included Storage bucket Id and object in its constructor. - `aResult` (AsyncResult&) - The async result object to store the metadata. ``` -------------------------------- ### Static FileConfig::getBlob Method Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/file_config.md A static utility function to get the reference of file_config_data from a BlobConfig object. ```cpp static file_config_data &getBlob(BlobConfig &blob) ``` -------------------------------- ### FirebaseClient Library Build Options Source: https://github.com/mobizt/firebaseclient/blob/main/README.md List of available preprocessor macros to enable specific features of the FirebaseClient library. Define these before including the library header or as compiler build flags. ```cpp ENABLE_DATABASE // For RTDB compilation ENABLE_FIRESTORE // For Firestore compilation ENABLE_FIRESTORE_QUERY // For Firestore Query feature compilation ENABLE_MESSAGING // For Firebase Cloud Messaging compilation ENABLE_STORAGE // For Firebase Storage compilation ENABLE_CLOUD_STORAGE // For Google Cloud Storage compilation ENABLE_FUNCTIONS // For Google Cloud Functions compilation ENABLE_RULESETS // For RuleSets compilation ENABLE_PSRAM // For enabling PSRAM support ENABLE_OTA // For enabling OTA updates support ENABLE_FS // For enabling Flash filesystem support FIREBASE_ASYNC_QUEUE_LIMIT // For maximum async queue limit (number). FIREBASE_PRINTF_PORT // For Firebase.printf debug port class object. FIREBASE_PRINTF_BUFFER // Firebase.printf buffer size. // For enabling authentication and token ENABLE_SERVICE_AUTH ENABLE_CUSTOM_AUTH ENABLE_USER_AUTH ENABLE_ACCESS_TOKEN ENABLE_CUSTOM_TOKEN ENABLE_ID_TOKEN ENABLE_LEGACY_TOKEN ``` -------------------------------- ### Initialize as JSON Array Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/placeholders.md Initiates the placeholder to represent a JSON array. ```APIDOC ## initArray() ### Description Initiates the placeholder as JSON Array object representation. ### Method initArray ### Returns - `void` ``` -------------------------------- ### Static FileConfig::getFile Method Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/file_config.md A static utility function to get the reference of file_config_data from a FileConfig object. ```cpp static file_config_data &getFile(FileConfig &file) ``` -------------------------------- ### Initialize Firebase App (with timeout) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/firebase_client.md Initializes the FirebaseApp with an async client, app object, and user auth data. Supports an optional timeout and callback. ```cpp static void initializeApp(AsyncClientClass &aClient, FirebaseApp &app, user_auth_data &auth, unsigned long timeoutMs = 0, AsyncResultCallback cb = NULL) ``` -------------------------------- ### Get ETag Header Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/async_result.md Retrieves the ETag from the server response headers. This is often used for caching validation. ```cpp String etag() const ``` -------------------------------- ### get (void, AsyncResultCallback) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/firestore_database.md Retrieves a composite index using an asynchronous callback. This function requires ServiceAuth authentication. ```APIDOC ## get (void, AsyncResultCallback) ### Description Gets a composite index. ### Parameters - `aClient` (AsyncClientClass &) - The async client. - `parent` (const Firestore::Parent &) - The Firestore::Parent object included project Id and database Id in its constructor. - `collectionId` (const String &) - The collection Id. - `indexId` (const String &) - The index to get. - `cb` (AsyncResultCallback) - The async result callback (AsyncResultCallback). - `uid` (const String &) - The user specified UID of async result (optional). ``` -------------------------------- ### Initialize Placeholder as JSON Object (C++) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/placeholders.md Initializes the placeholder to represent a JSON object. ```cpp void initObject() ``` -------------------------------- ### get (Callback) Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/firestore_database.md Retrieves an index asynchronously and invokes a callback function upon completion. Requires ServiceAuth authentication. ```APIDOC ## get (Callback) ### Description Gets an index asynchronously with a callback. ### Method ```cpp void get(AsyncClientClass &aClient, const Firestore::Parent &parent, const String &indexId, AsyncResultCallback cb, const String &uid = "") ``` ### Parameters - `aClient` - The async client. - `parent` - The Firestore::Parent object included project Id and database Id in its constructor. - `indexId` - The index to get. - `cb` - The async result callback (AsyncResultCallback). - `uid` - The user specified UID of async result (optional). ``` -------------------------------- ### Get Release with AsyncResult Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/rules.md Retrieves a Release by its name using an asynchronous client and an AsyncResult object to store the outcome. ```cpp void get(AsyncClientClass &aClient, const String &projectId, const String &releaseId, AsyncResult &aResult) ``` -------------------------------- ### Initialize as JSON Object Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/placeholders.md Initiates the placeholder to represent a JSON object. ```APIDOC ## initObject() ### Description Initiates the placeholder as JSON object representation. ### Method initObject ### Returns - `void` ``` -------------------------------- ### Perform OTA Update with AsyncResult Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/realtime_database.md Initiates an OTA update using a firmware file from the database. The firmware data should be a base64 encoded string. This version uses an AsyncResult object to capture the outcome. ```cpp Database.ota(aClient, "/path/to/data", aResult, U_FLASH); ``` -------------------------------- ### Firestore::Documents::batchGet Source: https://context7.com/mobizt/firebaseclient/llms.txt Retrieves multiple Firestore documents in a single request using a batch get operation. ```APIDOC ## Firestore::Documents::batchGet — Fetch Multiple Documents ### Description Retrieves multiple documents in a single request. ### Method `batchGet` ### Parameters - `aClient`: The Firebase client instance. - `parent`: The parent document path. - `batchOpts`: `BatchGetDocumentOptions` specifying documents to retrieve and optional field mask. ### Request Example ```cpp BatchGetDocumentOptions batchOpts; batchOpts.addDocument("projects/my-project-id/databases/(default)/documents/sensors/s1"); batchOpts.addDocument("projects/my-project-id/databases/(default)/documents/sensors/s2"); batchOpts.mask("temperature,sensorId"); // optional field mask String result = Docs.batchGet(aClient, Firestore::Parent("my-project-id"), batchOpts); if (aClient.lastError().code() == 0) Serial.println(result); // array of found/missing documents ``` ### Response - Returns a JSON string representing an array of found and missing documents. ``` -------------------------------- ### Get Boolean as C-String Source: https://github.com/mobizt/firebaseclient/blob/main/resources/docs/placeholders.md Returns a pointer to the internal string representation of the boolean value. Useful for logging or debugging. ```cpp const char * c_str() const ```