UNPKG

2.4 kBJavaScriptView Raw
1/*! firebase-admin v10.0.0 */
2"use strict";
3/*!
4 * Copyright 2021 Google Inc.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18Object.defineProperty(exports, "__esModule", { value: true });
19exports.Installations = void 0;
20var error_1 = require("../utils/error");
21var installations_request_handler_1 = require("./installations-request-handler");
22var validator = require("../utils/validator");
23/**
24 * The `Installations` service for the current app.
25 */
26var Installations = /** @class */ (function () {
27 /**
28 * @param app - The app for this Installations service.
29 * @constructor
30 * @internal
31 */
32 function Installations(app) {
33 if (!validator.isNonNullObject(app) || !('options' in app)) {
34 throw new error_1.FirebaseInstallationsError(error_1.InstallationsClientErrorCode.INVALID_ARGUMENT, 'First argument passed to admin.installations() must be a valid Firebase app instance.');
35 }
36 this.app_ = app;
37 this.requestHandler = new installations_request_handler_1.FirebaseInstallationsRequestHandler(app);
38 }
39 /**
40 * Deletes the specified installation ID and the associated data from Firebase.
41 *
42 * @param fid - The Firebase installation ID to be deleted.
43 *
44 * @returns A promise fulfilled when the installation ID is deleted.
45 */
46 Installations.prototype.deleteInstallation = function (fid) {
47 return this.requestHandler.deleteInstallation(fid);
48 };
49 Object.defineProperty(Installations.prototype, "app", {
50 /**
51 * Returns the app associated with this Installations instance.
52 *
53 * @returns The app associated with this Installations instance.
54 */
55 get: function () {
56 return this.app_;
57 },
58 enumerable: false,
59 configurable: true
60 });
61 return Installations;
62}());
63exports.Installations = Installations;