Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions etc/firebase-admin.remote-config.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,22 @@ export interface ExplicitParameterValue {
// @public
export function getRemoteConfig(app?: App): RemoteConfig;

// @public
export interface GetServerTemplateOptions {
defaultConfig?: ServerConfig;
}

// @public
export interface InAppDefaultValue {
useInAppDefault: boolean;
}

// @public
export interface InitServerTemplateOptions {
defaultConfig?: ServerConfig;
template?: ServerTemplateData;
}

// @public
export interface ListVersionsOptions {
endTime?: Date | string;
Expand Down Expand Up @@ -98,10 +109,10 @@ export class RemoteConfig {
// (undocumented)
readonly app: App;
createTemplateFromJSON(json: string): RemoteConfigTemplate;
getServerTemplate(options?: ServerTemplateOptions): Promise<ServerTemplate>;
getServerTemplate(options?: GetServerTemplateOptions): Promise<ServerTemplate>;
getTemplate(): Promise<RemoteConfigTemplate>;
getTemplateAtVersion(versionNumber: number | string): Promise<RemoteConfigTemplate>;
initServerTemplate(options?: ServerTemplateOptions): ServerTemplate;
initServerTemplate(options?: InitServerTemplateOptions): ServerTemplate;
listVersions(options?: ListVersionsOptions): Promise<ListVersionsResult>;
publishTemplate(template: RemoteConfigTemplate, options?: {
force: boolean;
Expand Down Expand Up @@ -181,12 +192,6 @@ export interface ServerTemplateData {
version?: Version;
}

// @public
export interface ServerTemplateOptions {
defaultConfig?: ServerConfig;
template?: ServerTemplateData;
}

// @public
export type TagColor = 'BLUE' | 'BROWN' | 'CYAN' | 'DEEP_ORANGE' | 'GREEN' | 'INDIGO' | 'LIME' | 'ORANGE' | 'PINK' | 'PURPLE' | 'TEAL';

Expand Down
3 changes: 2 additions & 1 deletion src/remote-config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ export {
AndCondition,
EvaluationContext,
ExplicitParameterValue,
GetServerTemplateOptions,
InAppDefaultValue,
InitServerTemplateOptions,
ListVersionsOptions,
ListVersionsResult,
MicroPercentRange,
Expand All @@ -47,7 +49,6 @@ export {
ServerConfig,
ServerTemplate,
ServerTemplateData,
ServerTemplateOptions,
TagColor,
Version,
} from './remote-config-api';
Expand Down
16 changes: 15 additions & 1 deletion src/remote-config/remote-config-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,21 @@ export interface ServerTemplateData {
/**
* Represents optional arguments that can be used when instantiating {@link ServerTemplate}.
*/
export interface ServerTemplateOptions {
export interface GetServerTemplateOptions {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it makes sense to create a base type and extend from it?

export interface InitServerTemplateOptions extends GetServerTemplateOptions {
      template?: ServerTemplateData,
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. I'll update it.


/**
* Defines in-app default parameter values, so that your app behaves as
* intended before it connects to the Remote Config backend, and so that
* default values are available if none are set on the backend.
*/
defaultConfig?: ServerConfig,
}

/**
* Represents optional arguments that can be used when instantiating
* {@link ServerTemplate} synchonously.
*/
export interface InitServerTemplateOptions {

/**
* Defines in-app default parameter values, so that your app behaves as
Expand Down
7 changes: 4 additions & 3 deletions src/remote-config/remote-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ import {
RemoteConfigParameterValue,
EvaluationContext,
ServerTemplateData,
ServerTemplateOptions,
NamedCondition,
GetServerTemplateOptions,
InitServerTemplateOptions,
} from './remote-config-api';

/**
Expand Down Expand Up @@ -184,7 +185,7 @@ export class RemoteConfig {
* Instantiates {@link ServerTemplate} and then fetches and caches the latest
* template version of the project.
*/
public async getServerTemplate(options?: ServerTemplateOptions): Promise<ServerTemplate> {
public async getServerTemplate(options?: GetServerTemplateOptions): Promise<ServerTemplate> {
const template = this.initServerTemplate(options);
await template.load();
return template;
Expand All @@ -193,7 +194,7 @@ export class RemoteConfig {
/**
* Synchronously instantiates {@link ServerTemplate}.
*/
public initServerTemplate(options?: ServerTemplateOptions): ServerTemplate {
public initServerTemplate(options?: InitServerTemplateOptions): ServerTemplate {
const template = new ServerTemplateImpl(
this.client, new ConditionEvaluator(), options?.defaultConfig);
if (options?.template) {
Expand Down