remote-config.d.ts 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*! firebase-admin v12.1.1 */
  2. /*!
  3. * Copyright 2020 Google Inc.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. import { App } from '../app';
  18. import { ListVersionsOptions, ListVersionsResult, ServerTemplate, RemoteConfigTemplate, GetServerTemplateOptions, InitServerTemplateOptions } from './remote-config-api';
  19. /**
  20. * The Firebase `RemoteConfig` service interface.
  21. */
  22. export declare class RemoteConfig {
  23. readonly app: App;
  24. private readonly client;
  25. /**
  26. * Gets the current active version of the {@link RemoteConfigTemplate} of the project.
  27. *
  28. * @returns A promise that fulfills with a `RemoteConfigTemplate`.
  29. */
  30. getTemplate(): Promise<RemoteConfigTemplate>;
  31. /**
  32. * Gets the requested version of the {@link RemoteConfigTemplate} of the project.
  33. *
  34. * @param versionNumber - Version number of the Remote Config template to look up.
  35. *
  36. * @returns A promise that fulfills with a `RemoteConfigTemplate`.
  37. */
  38. getTemplateAtVersion(versionNumber: number | string): Promise<RemoteConfigTemplate>;
  39. /**
  40. * Validates a {@link RemoteConfigTemplate}.
  41. *
  42. * @param template - The Remote Config template to be validated.
  43. * @returns A promise that fulfills with the validated `RemoteConfigTemplate`.
  44. */
  45. validateTemplate(template: RemoteConfigTemplate): Promise<RemoteConfigTemplate>;
  46. /**
  47. * Publishes a Remote Config template.
  48. *
  49. * @param template - The Remote Config template to be published.
  50. * @param options - Optional options object when publishing a Remote Config template:
  51. * - `force`: Setting this to `true` forces the Remote Config template to
  52. * be updated and circumvent the ETag. This approach is not recommended
  53. * because it risks causing the loss of updates to your Remote Config
  54. * template if multiple clients are updating the Remote Config template.
  55. * See {@link https://firebase.google.com/docs/remote-config/use-config-rest#etag_usage_and_forced_updates |
  56. * ETag usage and forced updates}.
  57. *
  58. * @returns A Promise that fulfills with the published `RemoteConfigTemplate`.
  59. */
  60. publishTemplate(template: RemoteConfigTemplate, options?: {
  61. force: boolean;
  62. }): Promise<RemoteConfigTemplate>;
  63. /**
  64. * Rolls back a project's published Remote Config template to the specified version.
  65. * A rollback is equivalent to getting a previously published Remote Config
  66. * template and re-publishing it using a force update.
  67. *
  68. * @param versionNumber - The version number of the Remote Config template to roll back to.
  69. * The specified version number must be lower than the current version number, and not have
  70. * been deleted due to staleness. Only the last 300 versions are stored.
  71. * All versions that correspond to non-active Remote Config templates (that is, all except the
  72. * template that is being fetched by clients) are also deleted if they are more than 90 days old.
  73. * @returns A promise that fulfills with the published `RemoteConfigTemplate`.
  74. */
  75. rollback(versionNumber: number | string): Promise<RemoteConfigTemplate>;
  76. /**
  77. * Gets a list of Remote Config template versions that have been published, sorted in reverse
  78. * chronological order. Only the last 300 versions are stored.
  79. * All versions that correspond to non-active Remote Config templates (i.e., all except the
  80. * template that is being fetched by clients) are also deleted if they are older than 90 days.
  81. *
  82. * @param options - Optional options object for getting a list of versions.
  83. * @returns A promise that fulfills with a `ListVersionsResult`.
  84. */
  85. listVersions(options?: ListVersionsOptions): Promise<ListVersionsResult>;
  86. /**
  87. * Creates and returns a new Remote Config template from a JSON string.
  88. *
  89. * @param json - The JSON string to populate a Remote Config template.
  90. *
  91. * @returns A new template instance.
  92. */
  93. createTemplateFromJSON(json: string): RemoteConfigTemplate;
  94. /**
  95. * Instantiates {@link ServerTemplate} and then fetches and caches the latest
  96. * template version of the project.
  97. */
  98. getServerTemplate(options?: GetServerTemplateOptions): Promise<ServerTemplate>;
  99. /**
  100. * Synchronously instantiates {@link ServerTemplate}.
  101. */
  102. initServerTemplate(options?: InitServerTemplateOptions): ServerTemplate;
  103. }