No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

versionslist.js 1.1KB

123456789101112131415161718192021222324252627282930313233
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.getVersions = void 0;
  4. const api_1 = require("../api");
  5. const apiv2_1 = require("../apiv2");
  6. const error_1 = require("../error");
  7. const logger_1 = require("../logger");
  8. const apiClient = new apiv2_1.Client({
  9. urlPrefix: api_1.remoteConfigApiOrigin,
  10. apiVersion: "v1",
  11. });
  12. const TIMEOUT = 30000;
  13. async function getVersions(projectId, maxResults = 10) {
  14. maxResults = maxResults || 300;
  15. try {
  16. const params = new URLSearchParams();
  17. if (maxResults) {
  18. params.set("pageSize", `${maxResults}`);
  19. }
  20. const response = await apiClient.request({
  21. method: "GET",
  22. path: `/projects/${projectId}/remoteConfig:listVersions`,
  23. queryParams: params,
  24. timeout: TIMEOUT,
  25. });
  26. return response.body;
  27. }
  28. catch (err) {
  29. logger_1.logger.debug(err.message);
  30. throw new error_1.FirebaseError(`Failed to get Remote Config template versions for Firebase project ${projectId}. `, { original: err });
  31. }
  32. }
  33. exports.getVersions = getVersions;