TypeScript typings for Firebase Management API v1beta1
The Firebase Management API enables programmatic setup and management of Firebase projects, including a project's Firebase resources and Firebase apps.
For detailed description please check documentation.
Installing
Install typings for Firebase Management API:
npm install @types/gapi.client.firebase-v1beta1 --save-dev
Usage
You need to initialize Google API client in your code:
gapi.load('client', () => {
});
Then load api client wrapper:
gapi.client.load('https://firebase.googleapis.com/$discovery/rest?version=v1beta1', () => {
});
gapi.client.load('firebase', 'v1beta1', () => {
});
Don't forget to authenticate your client before sending any request to resources:
var client_id = '',
scope = [
'https://www.googleapis.com/auth/cloud-platform',
'https://www.googleapis.com/auth/cloud-platform.read-only',
'https://www.googleapis.com/auth/firebase',
'https://www.googleapis.com/auth/firebase.readonly',
],
immediate = true;
gapi.auth.authorize(
{ client_id: client_id, scope: scope, immediate: immediate },
authResult => {
if (authResult && !authResult.error) {
} else {
}
});
After that you can use Firebase Management API resources:
await gapi.client.firebase.availableProjects.list({ });
await gapi.client.firebase.operations.get({ name: "name", });
await gapi.client.firebase.projects.addFirebase({ project: "project", });
await gapi.client.firebase.projects.addGoogleAnalytics({ parent: "parent", });
await gapi.client.firebase.projects.get({ name: "name", });
await gapi.client.firebase.projects.getAdminSdkConfig({ name: "name", });
await gapi.client.firebase.projects.getAnalyticsDetails({ name: "name", });
await gapi.client.firebase.projects.list({ });
await gapi.client.firebase.projects.patch({ name: "name", });
await gapi.client.firebase.projects.removeAnalytics({ parent: "parent", });
await gapi.client.firebase.projects.searchApps({ parent: "parent", });