UNPKG

2.77 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/**
18 * An interface for Firebase internal SDKs use only.
19 *
20 * @internal
21 */
22export declare interface _FirebaseInstallationsInternal {
23 /**
24 * Creates a Firebase Installation if there isn't one for the app and
25 * returns the Installation ID.
26 */
27 getId(): Promise<string>;
28 /**
29 * Returns an Authentication Token for the current Firebase Installation.
30 */
31 getToken(forceRefresh?: boolean): Promise<string>;
32}
33
34/**
35 * Creates a Firebase Installation if there isn't one for the app and
36 * returns the Installation ID.
37 * @param installations - The `Installations` instance.
38 *
39 * @public
40 */
41export declare function getId(installations: Installations): Promise<string>;
42
43/**
44 * Returns an instance of {@link Installations} associated with the given
45 * {@link @firebase/app#FirebaseApp} instance.
46 * @param app - The {@link @firebase/app#FirebaseApp} instance.
47 *
48 * @public
49 */
50export declare function getInstallations(app?: FirebaseApp): Installations;
51
52/**
53 * Returns a Firebase Installations auth token, identifying the current
54 * Firebase Installation.
55 * @param installations - The `Installations` instance.
56 * @param forceRefresh - Force refresh regardless of token expiration.
57 *
58 * @public
59 */
60export declare function getToken(installations: Installations, forceRefresh?: boolean): Promise<string>;
61
62/**
63 * An user defined callback function that gets called when Installations ID changes.
64 *
65 * @public
66 */
67export declare type IdChangeCallbackFn = (installationId: string) => void;
68
69/**
70 * Unsubscribe a callback function previously added via {@link IdChangeCallbackFn}.
71 *
72 * @public
73 */
74export declare type IdChangeUnsubscribeFn = () => void;
75
76/**
77 * Public interface of the Firebase Installations SDK.
78 *
79 * @public
80 */
81export declare interface Installations {
82 /**
83 * The {@link @firebase/app#FirebaseApp} this `Installations` instance is associated with.
84 */
85 app: FirebaseApp;
86}
87
88/**
89 * Sets a new callback that will get called when Installation ID changes.
90 * Returns an unsubscribe function that will remove the callback when called.
91 * @param installations - The `Installations` instance.
92 * @param callback - The callback function that is invoked when FID changes.
93 * @returns A function that can be called to unsubscribe.
94 *
95 * @public
96 */
97export declare function onIdChange(installations: Installations, callback: IdChangeCallbackFn): IdChangeUnsubscribeFn;
98
99export { }