{"id":13448703,"url":"https://github.com/RomainVialard/FirebaseApp","last_synced_at":"2025-03-22T17:32:16.727Z","repository":{"id":45717760,"uuid":"89213679","full_name":"RomainVialard/FirebaseApp","owner":"RomainVialard","description":"Google Apps Script binding for Firebase Realtime Database","archived":false,"fork":false,"pushed_at":"2021-02-01T11:26:01.000Z","size":106,"stargazers_count":116,"open_issues_count":6,"forks_count":30,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-10-02T20:05:44.017Z","etag":null,"topics":["apps-script","firebase","firebase-realtime-database","google-apps-script"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RomainVialard.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-24T08:08:33.000Z","updated_at":"2024-09-09T22:59:02.000Z","dependencies_parsed_at":"2022-09-26T17:41:41.078Z","dependency_job_id":null,"html_url":"https://github.com/RomainVialard/FirebaseApp","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RomainVialard%2FFirebaseApp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RomainVialard%2FFirebaseApp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RomainVialard%2FFirebaseApp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RomainVialard%2FFirebaseApp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RomainVialard","download_url":"https://codeload.github.com/RomainVialard/FirebaseApp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221832217,"owners_count":16888195,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apps-script","firebase","firebase-realtime-database","google-apps-script"],"created_at":"2024-07-31T06:00:17.950Z","updated_at":"2024-10-28T13:30:44.353Z","avatar_url":"https://github.com/RomainVialard.png","language":"JavaScript","funding_links":[],"categories":["Samples","Libraries \u0026 Modules","3. Libraries \u0026 Modules"],"sub_categories":["Using databases","3.1. Using Databases"],"readme":"\n# FirebaseApp\nThe Google Apps Script binding for the Firebase Realtime Database\n\n# Install\nBest it to copy the content of this file in your Google Apps Script project:\nhttps://github.com/RomainVialard/FirebaseApp/blob/master/src/Code.gs\n\nYou can also add it as a library, though this is not recommended.  \nhttps://developers.google.com/apps-script/guides/libraries  \nLibrary's script ID: **1VlYLzhwx0YEoxIe62eItLAZeobVt_l-GQUKt2MXXuBHFVsqBkl9C_yBB**\n\n\n# Documentation / Reference\n\n## Class FirebaseApp\n\n## `getDatabaseByUrl(url, optSecret)`\n\nRetrieves a database by url\n\n * **Parameters:**\n   * `url` — `string` — - the database url\n   * `[optSecret]` — `string` — - a Firebase app secret\n\n     \u003cp\u003e\n * **Returns:** `Database` — the Database found at the given URL\n\n\n## `encodeAsFirebaseKey(string)`\n\nReturns a valid Firebase key from a given string Firebase Keys can't contain any of the following characters: . $ # [ ] / https://firebase.google.com/docs/database/usage/limits#data_tree https://groups.google.com/forum/#!msg/firebase-talk/vtX8lfxxShk/skzA5vQFdosJ\n\n * **Parameters:** `string` — `string` — - the string to encode\n\n     \u003cp\u003e\n * **Returns:** `string` — the encoded string\n\n## `decodeFirebaseKey(string)`\n\nReturns a decoded string from a Firebase key encoded by encodeAsFirebaseKey()\n\n * **Parameters:** `string` — `string` — - the encoded Firebase key\n\n     \u003cp\u003e\n * **Returns:** `string` — the decoded string\n\n## `signInWithIdp(firebaseConfig, idToken)`\n\nSigns in or signs up a user using credentials from an Identity Provider (IdP) - eg: google.com. https://cloud.google.com/identity-platform/docs/reference/rest/v1/accounts/signInWithIdp\n\n * **Parameters:**\n   * `firebaseConfig` — `object` — - see the \"Get config object for your web app\" section in the page linked below.\n\n     https://support.google.com/firebase/answer/7015592?hl=en\n   * `idToken` — `string` — - an OpenID Connect identity token retrieved via ScriptApp.getIdentityToken()\n * **Returns:** `object` — the auth token granting access to firebase\n\n## Class Database\n## `createAuthToken(userEmail, optAuthData, serviceAccountEmail, privateKey)`\n\nGenerates an authorization token to firebase\n\n * **Parameters:**\n   * `userEmail` — `string` — the email account of the user you want to authenticate\n   * `optAuthData` — `object` — key-pairs of data to be associated to this user.\n   * `serviceAccountEmail` — `string` — the email of the service account used to generate this token\n   * `privateKey` — `string` — the private key of this service account\n * **Returns:** `object` — the auth token granting access to firebase\n\n## `createAuthTokenFromServiceAccount(userEmail, optCustomClaims)`\n\nGenerates an authorization token to Firebase\n\n * **Parameters:**\n   * `userEmail` — `string` — - the email account of the user you want to authenticate\n   * `optCustomClaims` — `object` — - key-pairs of data to be associated to this user (aka custom claims).\n\n     \u003cp\u003e\n * **Returns:** `object` — the auth token granting access to firebase\n\n## `createLegacyAuthToken(userEmail, optCustomClaims)`\n\nGenerates an authorization token to firebase\n\n * **Parameters:**\n   * `userEmail` — `string` — the email account of the user you want to authenticate\n   * `optCustomClaims` — `object` — - key-pairs of data to be associated to this user (aka custom claims).\n * **Returns:** `object` — the auth token granting access to firebase\n\n## `getData(path, optQueryParameters)`\n\nReturns the data at this path\n\n * **Parameters:**\n   * `path` — `string` — - the path where the data is stored\n   * `[optQueryParameters]` — `OptQueryParameters` — - a set of query parameters\n\n     \u003cp\u003e\n * **Returns:** `object` — the data found at the given path\n\n## `getAllData(requests)`\n\nReturns data in all specified paths\n\n * **Parameters:** `{Array.\u003cstring` — FirebaseApp_.request\u003e} requests - array of requests\n\n     \u003cp\u003e\n * **Returns:** `object` — responses to each requests\n\n## `pushData(path, data, optQueryParameters)`\n\nGenerates a new child location using a unique key\n\n * **Parameters:**\n   * `path` — `string` — - the path where to create a new child\n   * `data` — `object` — - the data to be written at the generated location\n   * `[optQueryParameters]` — `OptQueryParameters` — - a set of query parameters\n\n     \u003cp\u003e\n * **Returns:** `string` — the child name of the new data that was added\n\n## `setData(path, data, optQueryParameters)`\n\nWrite data at the specified path\n\n * **Parameters:**\n   * `path` — `string` — - the path where to write data\n   * `data` — `object` — - the data to be written at the specified path\n   * `[optQueryParameters]` — `OptQueryParameters` — - a set of query parameters\n\n     \u003cp\u003e\n * **Returns:** `object` — the data written\n\n## `updateData(path, data, optQueryParameters)`\n\nUpdate specific children at the specified path without overwriting existing data\n\n * **Parameters:**\n   * `path` — `string` — - the path where to update data\n   * `data` — `object` — - the children to overwrite\n   * `[optQueryParameters]` — `OptQueryParameters` — a - set of query parameters\n\n     \u003cp\u003e\n * **Returns:** `object` — the data written\n\n## `removeData(path, optQueryParameters)`\n\nDelete data at the specified path\n\n * **Parameters:**\n   * `path` — `string` — - the path where to delete data\n   * `[optQueryParameters]` — `OptQueryParameters` — - a set of query parameters\n\n     \u003cp\u003e\n * **Returns:** `null` — \n\n## `getUrlFromPath(path)`\n\nGets the absolute URL from the specified path\n\n * **Parameters:** `path` — `string` — - the path / location to convert to URL\n * **Returns:** `string` — an encoded URL that is ready to be put into a browser\n\n#Tutorials\nhttps://sites.google.com/site/scriptsexamples/new-connectors-to-google-services/firebase/tutorials\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRomainVialard%2FFirebaseApp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRomainVialard%2FFirebaseApp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRomainVialard%2FFirebaseApp/lists"}