|
16 | 16 | */ |
17 | 17 |
|
18 | 18 | import { FirebaseApp } from '@firebase/app'; |
19 | | -import { FetchResponse } from './client/remote_config_fetch_client'; |
20 | | - |
21 | | -export { |
22 | | - FetchResponse, |
23 | | - FirebaseRemoteConfigObject |
24 | | -} from './client/remote_config_fetch_client'; |
25 | | - |
26 | | -/** |
27 | | - * Options for Remote Config initialization. |
28 | | - * |
29 | | - * @public |
30 | | - */ |
31 | | -export interface RemoteConfigOptions { |
32 | | - /** |
33 | | - * The ID of the template to use. If not provided, defaults to "firebase". |
34 | | - */ |
35 | | - templateId?: string; |
36 | | - |
37 | | - /** |
38 | | - * Hydrates the state with an initial fetch response. |
39 | | - */ |
40 | | - initialFetchResponse?: FetchResponse; |
41 | | -} |
42 | 19 |
|
43 | 20 | /** |
44 | 21 | * The Firebase Remote Config service interface. |
@@ -73,6 +50,67 @@ export interface RemoteConfig { |
73 | 50 | lastFetchStatus: FetchStatus; |
74 | 51 | } |
75 | 52 |
|
| 53 | +/** |
| 54 | + * Defines a self-descriptive reference for config key-value pairs. |
| 55 | + */ |
| 56 | +export interface FirebaseRemoteConfigObject { |
| 57 | + [key: string]: string; |
| 58 | +} |
| 59 | + |
| 60 | +/** |
| 61 | + * Defines a successful response (200 or 304). |
| 62 | + * |
| 63 | + * <p>Modeled after the native {@link Response} interface, but simplified for Remote Config's |
| 64 | + * use case. |
| 65 | + */ |
| 66 | +export interface FetchResponse { |
| 67 | + /** |
| 68 | + * The HTTP status, which is useful for differentiating success responses with data from |
| 69 | + * those without. |
| 70 | + * |
| 71 | + * <p>{@link RemoteConfigClient} is modeled after the native {@link GlobalFetch} interface, so |
| 72 | + * HTTP status is first-class. |
| 73 | + * |
| 74 | + * <p>Disambiguation: the fetch response returns a legacy "state" value that is redundant with the |
| 75 | + * HTTP status code. The former is normalized into the latter. |
| 76 | + */ |
| 77 | + status: number; |
| 78 | + |
| 79 | + /** |
| 80 | + * Defines the ETag response header value. |
| 81 | + * |
| 82 | + * <p>Only defined for 200 and 304 responses. |
| 83 | + */ |
| 84 | + eTag?: string; |
| 85 | + |
| 86 | + /** |
| 87 | + * Defines the map of parameters returned as "entries" in the fetch response body. |
| 88 | + * |
| 89 | + * <p>Only defined for 200 responses. |
| 90 | + */ |
| 91 | + config?: FirebaseRemoteConfigObject; |
| 92 | + |
| 93 | + // Note: we're not extracting experiment metadata until |
| 94 | + // ABT and Analytics have Web SDKs. |
| 95 | +} |
| 96 | + |
| 97 | +/** |
| 98 | + * Options for Remote Config initialization. |
| 99 | + * |
| 100 | + * @public |
| 101 | + */ |
| 102 | +export interface RemoteConfigOptions { |
| 103 | + /** |
| 104 | + * The ID of the template to use. If not provided, defaults to "firebase". |
| 105 | + */ |
| 106 | + templateId?: string; |
| 107 | + |
| 108 | + /** |
| 109 | + * Hydrates the state with an initial fetch response. |
| 110 | + */ |
| 111 | + initialFetchResponse?: FetchResponse; |
| 112 | +} |
| 113 | + |
76 | 114 | /** |
77 | 115 | * Indicates the source of a value. |
78 | 116 | * |
|
0 commit comments