UNPKG

2.97 kBTypeScriptView Raw
1import { CloudFunction, EventContext } from "../cloud-functions";
2/**
3 * Registers a function that triggers on Firebase Remote Config template
4 * update events.
5 *
6 * @param handler A function that takes the updated Remote Config
7 * template version metadata as an argument.
8 *
9 * @returns A function that you can export and deploy.
10 */
11export declare function onUpdate(handler: (version: TemplateVersion, context: EventContext) => PromiseLike<any> | any): CloudFunction<TemplateVersion>;
12/** Builder used to create Cloud Functions for Remote Config. */
13export declare class UpdateBuilder {
14 private triggerResource;
15 private options;
16 /**
17 * Handle all updates (including rollbacks) that affect a Remote Config
18 * project.
19 * @param handler A function that takes the updated Remote Config template
20 * version metadata as an argument.
21 */
22 onUpdate(handler: (version: TemplateVersion, context: EventContext) => PromiseLike<any> | any): CloudFunction<TemplateVersion>;
23}
24/**
25 * An interface representing a Remote Config template version metadata object
26 * emitted when a project is updated.
27 */
28export interface TemplateVersion {
29 /** The version number of the updated Remote Config template. */
30 versionNumber: number;
31 /** When the template was updated in format (ISO8601 timestamp). */
32 updateTime: string;
33 /**
34 * Metadata about the account that performed the update, of
35 * type [`RemoteConfigUser`](/docs/reference/remote-config/rest/v1/Version#remoteconfiguser).
36 */
37 updateUser: RemoteConfigUser;
38 /** A description associated with this Remote Config template version. */
39 description: string;
40 /**
41 * The origin of the caller - either the Firebase console or the Remote Config
42 * REST API. See [`RemoteConfigUpdateOrigin`](/docs/reference/remote-config/rest/v1/Version#remoteconfigupdateorigin)
43 * for valid values.
44 */
45 updateOrigin: string;
46 /**
47 * The type of update action that was performed, whether forced,
48 * incremental, or a rollback operation. See
49 * [`RemoteConfigUpdateType`](/docs/reference/remote-config/rest/v1/Version#remoteconfigupdatetype)
50 * for valid values.
51 */
52 updateType: string;
53 /**
54 * The version number of the Remote Config template that this update rolled back to.
55 * Only applies if this update was a rollback.
56 */
57 rollbackSource?: number;
58}
59/**
60 * An interface representing metadata for a Remote Config account
61 * that performed the update. Contains the same fields as
62 * [`RemoteConfigUser`](/docs/reference/remote-config/rest/v1/Version#remoteconfiguser).
63 */
64export interface RemoteConfigUser {
65 /** Name of the Remote Config account that performed the update. */
66 name?: string;
67 /** Email address of the Remote Config account that performed the update. */
68 email: string;
69 /** Image URL of the Remote Config account that performed the update. */
70 imageUrl?: string;
71}