Skip to content
Merged
48 changes: 37 additions & 11 deletions src/providers/remoteConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,13 @@ export const provider = 'google.firebase.remoteconfig';
export const service = 'firebaseremoteconfig.googleapis.com';

/**
* Handle all updates (including rollbacks) that affect a Remote Config project.
* @param handler A function that takes the updated Remote Config template
* version metadata as an argument.
* Registers a function that triggers on Firebase Remote Config template
* update events.
*
* @param handler A function that takes the updated Remote Config
* template version metadata as an argument.
*
* @return A Cloud Function that you can export and deploy.
*/
export function onUpdate(
handler: (
Expand Down Expand Up @@ -97,8 +101,8 @@ export class UpdateBuilder {
}

/**
* Interface representing a Remote Config template version metadata object that
* was emitted when the project was updated.
* An interface representing a Remote Config template version metadata object
* emitted when a project is updated.
*/
export interface TemplateVersion {
/** The version number of the updated Remote Config template. */
Expand All @@ -107,27 +111,49 @@ export interface TemplateVersion {
/** When the template was updated in format (ISO8601 timestamp). */
updateTime: string;

/** Metadata about the account that performed the update. */
/**
* Metadata about the account that performed the update, of
* type [`RemoteConfigUser`](/docs/reference/remote-config/rest/v1/Version#remoteconfiguser).
*/
updateUser: RemoteConfigUser;

/** A description associated with the particular Remote Config template. */
/** A description associated with this Remote Config template version. */
description: string;

/** The origin of the caller. */
/**
* The origin of the caller - either the Firebase console or the Remote Config
* REST API. See [`RemoteConfigUpdateOrigin`](/docs/reference/remote-config/rest/v1/Version#remoteconfigupdateorigin)
* for valid values.
*/
updateOrigin: string;

/** The type of update action that was performed. */
/**
* The type of update action that was performed, whether forced,
* incremental, or a rollback operation. See
* [`RemoteConfigUpdateType`](/docs/reference/remote-config/rest/v1/Version#remoteconfigupdatetype)
* for valid values.
*/
updateType: string;

/**
* The version number of the Remote Config template that was rolled back to,
* if the update was a rollback.
* The version number of the Remote Config template that this update rolled back to.
* Only applies if this update was a rollback.
*/
rollbackSource?: number;
}

/**
* An interface representing metadata for a Remote Config account
* that performed the update. Contains the same fields as
* [`RemoteConfigUser`](/docs/reference/remote-config/rest/v1/Version#remoteconfiguser).
*/
export interface RemoteConfigUser {
/** Name of the Remote Config account that performed the update. */
name?: string;

/** Email address of the Remote Config account that performed the update. */
email: string;

/** Image URL of the Remote Config account that performed the update. */
imageUrl?: string;
}