firebase-admin package

Firebase 命名空间 API(旧版)。

功能

功能描述
应用程序(名称)
应用程序检查(应用程序)获取默认应用程序或给定应用程序的AppCheck服务。可以不带参数调用admin.appCheck()来访问默认应用程序的AppCheck服务,或者作为admin.appCheck(app)来访问与特定应用程序关联的AppCheck服务。
授权(应用程序)获取默认应用程序或给定应用程序的身份验证服务。可以不带参数调用admin.auth()来访问默认应用程序的身份验证服务,或作为admin.auth(app)来访问与特定应用程序关联的身份验证服务。
数据库(应用程序)获取默认应用程序或给定应用程序的数据库服务。可以不带参数调用admin.database()来访问默认应用程序的Database服务,也可以调用admin.database(app)来访问与特定应用程序关联的Database服务。 admin.database也是一个命名空间,可用于访问与Database服务关联的全局常量和方法。
火库(应用程序)
初始化应用程序(选项,名称)
安装(应用程序)获取默认应用程序或给定应用程序的安装服务。可以不带参数调用admin.installations()来访问默认应用程序的安装服务,或者作为admin.installations(app)来访问与特定应用程序关联的安装服务。
实例ID(应用程序)获取默认应用程序或给定应用程序的InstanceId服务。可以不带参数调用admin.instanceId()来访问默认应用程序的InstanceId服务,或作为admin.instanceId(app)来访问与特定应用程序关联的InstanceId服务。
机器学习(应用程序)获取默认应用程序或给定应用程序的机器学习服务。可以不带参数调用admin.machineLearning()来访问默认应用程序的MachineLearning服务,或者作为admin.machineLearning(app)来访问与特定应用程序关联的MachineLearning服务。
消息传递(应用程序)获取默认应用程序或给定应用程序的消息传递服务。可以不带任何参数调用admin.messaging()来访问默认应用程序的Messaging服务,或者作为admin.messaging(app)来访问与特定应用程序关联的Messaging服务。
项目管理(应用程序)获取默认应用程序或给定应用程序的ProjectManagement服务。可以不带参数调用admin.projectManagement()来访问默认应用程序的ProjectManagement服务,或者作为admin.projectManagement(app)来访问与特定应用程序关联的ProjectManagement服务。
远程配置(应用程序)获取默认应用程序或给定应用程序的RemoteConfig服务。可以不带参数调用admin.remoteConfig()来访问默认应用程序的RemoteConfig服务,或者作为admin.remoteConfig(app)来访问与特定应用程序关联的RemoteConfig服务。
安全规则(应用程序)获取默认应用程序或给定应用程序的SecurityRules服务。可以不带参数调用admin.securityRules()来访问默认应用程序的SecurityRules服务,或者作为admin.securityRules(app)来访问与特定应用程序关联的SecurityRules服务。
存储(应用程序)获取默认应用程序或给定应用程序的存储服务。可以不带参数调用admin.storage()来访问默认应用程序的Storage服务,或者作为admin.storage(app)来访问与特定应用程序关联的Storage服务。

接口

界面描述
应用程序选项传递给initializeApp()的可用选项
FirebaseArrayIndex错误复合类型,其中包含FirebaseError对象和可用于获取错误项目的索引。
Firebase错误FirebaseError是标准 JavaScript Error对象的子类。除了消息字符串和堆栈跟踪之外,它还包含字符串代码。
GoogleOAuth访问令牌Google OAuth 2.0 访问令牌的接口。
服务帐户

命名空间

命名空间描述
应用程序
应用检查
授权
凭据
数据库
火库
装置
实例ID
机器学习
消息传递
项目管理
远程配置
安全规则
贮存

变量

多变的描述
应用
SDK_VERSION

应用程序()

签名:

export declare function app(name?: string): app.App;

参数

范围类型描述
姓名细绳

返回:

应用程序

应用检查()

获取默认应用程序或给定应用程序的AppCheck服务。

可以不带参数调用admin.appCheck()来访问默认应用程序的AppCheck服务,或者作为admin.appCheck(app)来访问与特定应用程序关联的AppCheck服务。

签名:

export declare function appCheck(app?: App): appCheck.AppCheck;

参数

范围类型描述
应用程序应用程序为其返回AppCheck服务的可选应用程序。如果未提供,则返回默认的AppCheck服务。

返回:

应用检查.应用检查

如果未提供应用程序,则为默认AppCheck服务,或者与所提供的应用程序关联的AppCheck服务。

实施例1

// Get the `AppCheck` service for the default app
var defaultAppCheck = admin.appCheck();

实施例2

// Get the `AppCheck` service for a given app
var otherAppCheck = admin.appCheck(otherApp);

授权()

获取默认应用程序或给定应用程序的身份验证服务。

可以不带参数调用admin.auth()来访问默认应用程序的身份验证服务,或作为admin.auth(app)来访问与特定应用程序关联的身份验证服务。

签名:

export declare function auth(app?: App): auth.Auth;

参数

范围类型描述
应用程序应用程序

返回:

验证.Auth

实施例1

// Get the Auth service for the default app
var defaultAuth = admin.auth();

实施例2

// Get the Auth service for a given app
var otherAuth = admin.auth(otherApp);

数据库()

获取默认应用程序或给定应用程序的数据库服务。

可以不带参数调用admin.database()来访问默认应用程序的Database服务,也可以调用admin.database(app)来访问与特定应用程序关联的Database服务。

admin.database也是一个命名空间,可用于访问与Database服务关联的全局常量和方法。

签名:

export declare function database(app?: App): database.Database;

参数

范围类型描述
应用程序应用程序

返回:

数据库.数据库

如果未提供应用程序或与提供的应用程序关联的Database服务,则为默认Database服务。

实施例1

// Get the Database service for the default app
var defaultDatabase = admin.database();

实施例2

// Get the Database service for a specific app
var otherDatabase = admin.database(app);

火库()

签名:

export declare function firestore(app?: App): _firestore.Firestore;

参数

范围类型描述
应用程序应用程序

返回:

_firestore.Firestore

初始化应用程序()

签名:

export declare function initializeApp(options?: AppOptions, name?: string): app.App;

参数

范围类型描述
选项应用程序选项
姓名细绳

返回:

应用程序

装置()

获取默认应用程序或给定应用程序的安装服务。

可以不带参数调用admin.installations()来访问默认应用程序的安装服务,或者作为admin.installations(app)来访问与特定应用程序关联的安装服务。

签名:

export declare function installations(app?: App): installations.Installations;

参数

范围类型描述
应用程序应用程序要返回其Installations服务的可选应用程序。如果未提供,则返回默认的Installations服务。

返回:

装置.装置

默认Installations服务(如果未提供应用程序)或与提供的应用程序关联的Installations服务。

实施例1

// Get the Installations service for the default app
var defaultInstallations = admin.installations();

实施例2

// Get the Installations service for a given app
var otherInstallations = admin.installations(otherApp);

实例ID()

获取默认应用程序或给定应用程序的InstanceId服务。

可以不带参数调用admin.instanceId()来访问默认应用程序的InstanceId服务,或作为admin.instanceId(app)来访问与特定应用程序关联的InstanceId服务。

签名:

export declare function instanceId(app?: App): instanceId.InstanceId;

参数

范围类型描述
应用程序应用程序要返回其InstanceId服务的可选应用程序。如果不提供,将返回默认的InstanceId服务。

返回:

实例Id.实例Id

默认InstanceId服务(如果未提供应用程序)或与提供的应用程序关联的InstanceId服务。

实施例1

// Get the Instance ID service for the default app
var defaultInstanceId = admin.instanceId();

实施例2

// Get the Instance ID service for a given app
var otherInstanceId = admin.instanceId(otherApp);

机器学习()

获取默认应用程序或给定应用程序的机器学习服务。

可以不带参数调用admin.machineLearning()来访问默认应用程序的MachineLearning服务,或者作为admin.machineLearning(app)来访问与特定应用程序关联的MachineLearning服务。

签名:

export declare function machineLearning(app?: App): machineLearning.MachineLearning;

参数

范围类型描述
应用程序应用程序要返回其MachineLearning服务的可选应用程序。如果未提供,将返回默认的MachineLearning服务。

返回:

机器学习.机器学习

默认MachineLearning服务(如果未提供应用程序)或与提供的应用程序关联的MachineLearning服务。

实施例1

// Get the MachineLearning service for the default app
var defaultMachineLearning = admin.machineLearning();

实施例2

// Get the MachineLearning service for a given app
var otherMachineLearning = admin.machineLearning(otherApp);

消息传递()

获取默认应用程序或给定应用程序的消息传递服务。

可以不带任何参数调用admin.messaging()来访问默认应用程序的Messaging服务,或者作为admin.messaging(app)来访问与特定应用程序关联的Messaging服务。

签名:

export declare function messaging(app?: App): messaging.Messaging;

参数

范围类型描述
应用程序应用程序返回其Messaging服务的可选应用程序。如果未提供,将返回默认的Messaging服务。

返回:

消息传递.消息传递

默认Messaging服务(如果未提供应用程序)或与所提供的应用程序关联的Messaging服务。

实施例1

// Get the Messaging service for the default app
var defaultMessaging = admin.messaging();

实施例2

// Get the Messaging service for a given app
var otherMessaging = admin.messaging(otherApp);

项目管理()

获取默认应用程序或给定应用程序的ProjectManagement服务。

可以不带参数调用admin.projectManagement()来访问默认应用程序的ProjectManagement服务,或者作为admin.projectManagement(app)来访问与特定应用程序关联的ProjectManagement服务。

签名:

export declare function projectManagement(app?: App): projectManagement.ProjectManagement;

参数

范围类型描述
应用程序应用程序要返回其ProjectManagement服务的可选应用程序。如果未提供,将返回默认的ProjectManagement服务。 *

返回:

项目管理.项目管理

如果未提供应用程序,则使用默认的ProjectManagement服务,或者与所提供的应用程序关联的ProjectManagement服务。

实施例1

// Get the ProjectManagement service for the default app
var defaultProjectManagement = admin.projectManagement();

实施例2

// Get the ProjectManagement service for a given app
var otherProjectManagement = admin.projectManagement(otherApp);

远程配置()

获取默认应用程序或给定应用程序的RemoteConfig服务。

可以不带参数调用admin.remoteConfig()来访问默认应用程序的RemoteConfig服务,或者作为admin.remoteConfig(app)来访问与特定应用程序关联的RemoteConfig服务。

签名:

export declare function remoteConfig(app?: App): remoteConfig.RemoteConfig;

参数

范围类型描述
应用程序应用程序返回RemoteConfig服务的可选应用程序。如果未提供,则返回默认的RemoteConfig服务。

返回:

远程配置.远程配置

如果未提供应用程序,则为默认RemoteConfig服务,或者与提供的应用程序关联的RemoteConfig服务。

实施例1

// Get the `RemoteConfig` service for the default app
var defaultRemoteConfig = admin.remoteConfig();

实施例2

// Get the `RemoteConfig` service for a given app
var otherRemoteConfig = admin.remoteConfig(otherApp);

安全规则()

获取默认应用程序或给定应用程序的SecurityRules服务。

可以不带参数调用admin.securityRules()来访问默认应用程序的SecurityRules服务,或者作为admin.securityRules(app)来访问与特定应用程序关联的SecurityRules服务。

签名:

export declare function securityRules(app?: App): securityRules.SecurityRules;

参数

范围类型描述
应用程序应用程序用于返回SecurityRules服务的可选应用程序。如果未提供,则返回默认的SecurityRules服务。

返回:

securityRules.SecurityRules

如果未提供应用程序,则为默认的SecurityRules服务,或者与所提供的应用程序关联的SecurityRules服务。

实施例1

// Get the SecurityRules service for the default app
var defaultSecurityRules = admin.securityRules();

实施例2

// Get the SecurityRules service for a given app
var otherSecurityRules = admin.securityRules(otherApp);

贮存()

获取默认应用程序或给定应用程序的存储服务。

可以不带参数调用admin.storage()来访问默认应用程序的Storage服务,或者作为admin.storage(app)来访问与特定应用程序关联的Storage服务。

签名:

export declare function storage(app?: App): storage.Storage;

参数

范围类型描述
应用程序应用程序

返回:

存储.存储

实施例1

// Get the Storage service for the default app
var defaultStorage = admin.storage();

实施例2

// Get the Storage service for a given app
var otherStorage = admin.storage(otherApp);

应用

签名:

apps: (app.App | null)[]

SDK_VERSION

签名:

SDK_VERSION: string