-
Notifications
You must be signed in to change notification settings - Fork 990
/
Copy pathrollback.ts
31 lines (28 loc) · 992 Bytes
/
rollback.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { remoteConfigApiOrigin } from "../api";
import { Client } from "../apiv2";
import { RemoteConfigTemplate } from "./interfaces";
const apiClient = new Client({
urlPrefix: remoteConfigApiOrigin(),
apiVersion: "v1",
});
const TIMEOUT = 30000;
/**
* Rolls back to a specific version of the Remote Config template
* @param projectId Remote Config Template Project Id
* @param versionNumber Remote Config Template version number to roll back to
* @return Returns a promise of a Remote Config Template using the RemoteConfigTemplate interface
*/
export async function rollbackTemplate(
projectId: string,
versionNumber?: number,
): Promise<RemoteConfigTemplate> {
const params = new URLSearchParams();
params.set("versionNumber", `${versionNumber}`);
const res = await apiClient.request<void, RemoteConfigTemplate>({
method: "POST",
path: `/projects/${projectId}/remoteConfig:rollback`,
queryParams: params,
timeout: TIMEOUT,
});
return res.body;
}