UNPKG

2.4 kBTypeScriptView Raw
1/**
2 * Firebase Installations
3 *
4 * @packageDocumentation
5 */
6
7import { FirebaseApp } from '@firebase/app';
8
9/**
10 * Deletes the Firebase Installation and all associated data.
11 * @param installations - The `Installations` instance.
12 *
13 * @public
14 */
15export declare function deleteInstallations(installations: Installations): Promise<void>;
16
17/* Excluded from this release type: _FirebaseInstallationsInternal */
18
19/**
20 * Creates a Firebase Installation if there isn't one for the app and
21 * returns the Installation ID.
22 * @param installations - The `Installations` instance.
23 *
24 * @public
25 */
26export declare function getId(installations: Installations): Promise<string>;
27
28/**
29 * Returns an instance of {@link Installations} associated with the given
30 * {@link @firebase/app#FirebaseApp} instance.
31 * @param app - The {@link @firebase/app#FirebaseApp} instance.
32 *
33 * @public
34 */
35export declare function getInstallations(app?: FirebaseApp): Installations;
36
37/**
38 * Returns a Firebase Installations auth token, identifying the current
39 * Firebase Installation.
40 * @param installations - The `Installations` instance.
41 * @param forceRefresh - Force refresh regardless of token expiration.
42 *
43 * @public
44 */
45export declare function getToken(installations: Installations, forceRefresh?: boolean): Promise<string>;
46
47/**
48 * An user defined callback function that gets called when Installations ID changes.
49 *
50 * @public
51 */
52export declare type IdChangeCallbackFn = (installationId: string) => void;
53
54/**
55 * Unsubscribe a callback function previously added via {@link IdChangeCallbackFn}.
56 *
57 * @public
58 */
59export declare type IdChangeUnsubscribeFn = () => void;
60
61/**
62 * Public interface of the Firebase Installations SDK.
63 *
64 * @public
65 */
66export declare interface Installations {
67 /**
68 * The {@link @firebase/app#FirebaseApp} this `Installations` instance is associated with.
69 */
70 app: FirebaseApp;
71}
72
73/**
74 * Sets a new callback that will get called when Installation ID changes.
75 * Returns an unsubscribe function that will remove the callback when called.
76 * @param installations - The `Installations` instance.
77 * @param callback - The callback function that is invoked when FID changes.
78 * @returns A function that can be called to unsubscribe.
79 *
80 * @public
81 */
82export declare function onIdChange(installations: Installations, callback: IdChangeCallbackFn): IdChangeUnsubscribeFn;
83
84export { }