@@ -374,6 +374,37 @@ declare namespace admin {
374
374
*/
375
375
function projectManagement ( app ?: admin . app . App ) : admin . projectManagement . ProjectManagement ;
376
376
377
+ /**
378
+ * Gets the {@link admin.remoteConfig.RemoteConfig `RemoteConfig`} service for the
379
+ * default app or a given app.
380
+ *
381
+ * `admin.remoteConfig()` can be called with no arguments to access the default
382
+ * app's {@link admin.remoteConfig.RemoteConfig `RemoteConfig`} service or as
383
+ * `admin.remoteConfig(app)` to access the
384
+ * {@link admin.remoteConfig.RemoteConfig `RemoteConfig`} service associated with a
385
+ * specific app.
386
+ *
387
+ * @example
388
+ * ```javascript
389
+ * // Get the `RemoteConfig` service for the default app
390
+ * var defaultRemoteConfig = admin.remoteConfig();
391
+ * ```
392
+ *
393
+ * @example
394
+ * ```javascript
395
+ * // Get the `RemoteConfig` service for a given app
396
+ * var otherRemoteConfig = admin.remoteConfig(otherApp);
397
+ * ```
398
+ *
399
+ * @param app Optional app for which to return the `RemoteConfig` service.
400
+ * If not provided, the default `RemoteConfig` service is returned.
401
+ *
402
+ * @return The default `RemoteConfig` service if no
403
+ * app is provided, or the `RemoteConfig` service associated with the provided
404
+ * app.
405
+ */
406
+ function remoteConfig ( app ?: admin . app . App ) : admin . remoteConfig . RemoteConfig ;
407
+
377
408
/**
378
409
* Gets the {@link admin.securityRules.SecurityRules
379
410
* `SecurityRules`} service for the default app or a given app.
@@ -496,6 +527,7 @@ declare namespace admin.app {
496
527
machineLearning ( ) : admin . machineLearning . MachineLearning ;
497
528
messaging ( ) : admin . messaging . Messaging ;
498
529
projectManagement ( ) : admin . projectManagement . ProjectManagement ;
530
+ remoteConfig ( ) : admin . remoteConfig . RemoteConfig ;
499
531
securityRules ( ) : admin . securityRules . SecurityRules ;
500
532
storage ( ) : admin . storage . Storage ;
501
533
@@ -812,6 +844,196 @@ declare namespace admin.projectManagement {
812
844
export import ProjectManagement = _projectManagement . admin . projectManagement . ProjectManagement ;
813
845
}
814
846
847
+ declare namespace admin . remoteConfig {
848
+
849
+ /**
850
+ * Colors that are associated with conditions for display purposes.
851
+ */
852
+ type TagColor = 'BLUE' | 'BROWN' | 'CYAN' | 'DEEP_ORANGE' | 'GREEN' |
853
+ 'INDIGO' | 'LIME' | 'ORANGE' | 'PINK' | 'PURPLE' | 'TEAL' ;
854
+
855
+ /**
856
+ * Interface representing a Remote Config template.
857
+ */
858
+ interface RemoteConfigTemplate {
859
+ /**
860
+ * A list of conditions in descending order by priority.
861
+ */
862
+ conditions : RemoteConfigCondition [ ] ;
863
+
864
+ /**
865
+ * Map of parameter keys to their optional default values and optional conditional values.
866
+ */
867
+ parameters : { [ key : string ] : RemoteConfigParameter } ;
868
+
869
+ /**
870
+ * Map of parameter group names to their parameter group objects.
871
+ * A group's name is mutable but must be unique among groups in the Remote Config template.
872
+ * The name is limited to 256 characters and intended to be human-readable. Any Unicode
873
+ * characters are allowed.
874
+ */
875
+ parameterGroups : { [ key : string ] : RemoteConfigParameterGroup } ;
876
+
877
+ /**
878
+ * ETag of the current Remote Config template (readonly).
879
+ */
880
+ readonly etag : string ;
881
+ }
882
+
883
+ /**
884
+ * Interface representing a Remote Config parameter.
885
+ * At minimum, a `defaultValue` or a `conditionalValues` entry must be present for the
886
+ * parameter to have any effect.
887
+ */
888
+ interface RemoteConfigParameter {
889
+
890
+ /**
891
+ * The value to set the parameter to, when none of the named conditions evaluate to `true`.
892
+ */
893
+ defaultValue ?: RemoteConfigParameterValue ;
894
+
895
+ /**
896
+ * A `(condition name, value)` map. The condition name of the highest priority
897
+ * (the one listed first in the Remote Config template's conditions list) determines the value of
898
+ * this parameter.
899
+ */
900
+ conditionalValues ?: { [ key : string ] : RemoteConfigParameterValue } ;
901
+
902
+ /**
903
+ * A description for this parameter. Should not be over 100 characters and may contain any
904
+ * Unicode characters.
905
+ */
906
+ description ?: string ;
907
+ }
908
+
909
+ /**
910
+ * Interface representing a Remote Config parameter group.
911
+ * Grouping parameters is only for management purposes and does not affect client-side
912
+ * fetching of parameter values.
913
+ */
914
+ export interface RemoteConfigParameterGroup {
915
+ /**
916
+ * A description for the group. Its length must be less than or equal to 256 characters.
917
+ * A description may contain any Unicode characters.
918
+ */
919
+ description ?: string ;
920
+
921
+ /**
922
+ * Map of parameter keys to their optional default values and optional conditional values for
923
+ * parameters that belong to this group. A parameter only appears once per
924
+ * Remote Config template. An ungrouped parameter appears at the top level, whereas a
925
+ * parameter organized within a group appears within its group's map of parameters.
926
+ */
927
+ parameters : { [ key : string ] : RemoteConfigParameter } ;
928
+ }
929
+
930
+ /**
931
+ * Interface representing a Remote Config condition.
932
+ * A condition targets a specific group of users. A list of these conditions make up
933
+ * part of a Remote Config template.
934
+ */
935
+ interface RemoteConfigCondition {
936
+
937
+ /**
938
+ * A non-empty and unique name of this condition.
939
+ */
940
+ name : string ;
941
+
942
+ /**
943
+ * The logic of this condition.
944
+ * See the documentation on
945
+ * {@link https://firebase.google.com/docs/remote-config/condition-reference condition expressions}
946
+ * for the expected syntax of this field.
947
+ */
948
+ expression : string ;
949
+
950
+ /**
951
+ * The color associated with this condition for display purposes in the Firebase Console.
952
+ * Not specifying this value results in the console picking an arbitrary color to associate
953
+ * with the condition.
954
+ */
955
+ tagColor ?: TagColor ;
956
+ }
957
+
958
+ /**
959
+ * Interface representing an explicit parameter value.
960
+ */
961
+ interface ExplicitParameterValue {
962
+ /**
963
+ * The `string` value that the parameter is set to.
964
+ */
965
+ value : string ;
966
+ }
967
+
968
+ /**
969
+ * Interface representing an in-app-default value.
970
+ */
971
+ interface InAppDefaultValue {
972
+ /**
973
+ * If `true`, the parameter is omitted from the parameter values returned to a client.
974
+ */
975
+ useInAppDefault : boolean ;
976
+ }
977
+
978
+ /**
979
+ * Type representing a Remote Config parameter value.
980
+ * A `RemoteConfigParameterValue` could be either an `ExplicitParameterValue` or
981
+ * an `InAppDefaultValue`.
982
+ */
983
+ type RemoteConfigParameterValue = ExplicitParameterValue | InAppDefaultValue ;
984
+
985
+ /**
986
+ * The Firebase `RemoteConfig` service interface.
987
+ *
988
+ * Do not call this constructor directly. Instead, use
989
+ * [`admin.remoteConfig()`](admin.remoteConfig#remoteConfig).
990
+ */
991
+ interface RemoteConfig {
992
+ app : admin . app . App ;
993
+
994
+ /**
995
+ * Gets the current active version of the {@link admin.remoteConfig.RemoteConfigTemplate
996
+ * `RemoteConfigTemplate`} of the project.
997
+ *
998
+ * @return A promise that fulfills with a `RemoteConfigTemplate`.
999
+ */
1000
+ getTemplate ( ) : Promise < RemoteConfigTemplate > ;
1001
+
1002
+ /**
1003
+ * Validates a {@link admin.remoteConfig.RemoteConfigTemplate `RemoteConfigTemplate`}.
1004
+ *
1005
+ * @param template The Remote Config template to be validated.
1006
+ * @returns A promise that fulfills with the validated `RemoteConfigTemplate`.
1007
+ */
1008
+ validateTemplate ( template : RemoteConfigTemplate ) : Promise < RemoteConfigTemplate > ;
1009
+
1010
+ /**
1011
+ * Publishes a Remote Config template.
1012
+ *
1013
+ * @param template The Remote Config template to be published.
1014
+ * @param options Optional options object when publishing a Remote Config template:
1015
+ * - {boolean} `force` Setting this to `true` forces the Remote Config template to
1016
+ * be updated and circumvent the ETag. This approach is not recommended
1017
+ * because it risks causing the loss of updates to your Remote Config
1018
+ * template if multiple clients are updating the Remote Config template.
1019
+ * See {@link https://firebase.google.com/docs/remote-config/use-config-rest#etag_usage_and_forced_updates
1020
+ * ETag usage and forced updates}.
1021
+ *
1022
+ * @return A Promise that fulfills with the published `RemoteConfigTemplate`.
1023
+ */
1024
+ publishTemplate ( template : RemoteConfigTemplate , options ?: { force : boolean } ) : Promise < RemoteConfigTemplate > ;
1025
+
1026
+ /**
1027
+ * Creates and returns a new Remote Config template from a JSON string.
1028
+ *
1029
+ * @param json The JSON string to populate a Remote Config template.
1030
+ *
1031
+ * @return A new template instance.
1032
+ */
1033
+ createTemplateFromJSON ( json : string ) : RemoteConfigTemplate ;
1034
+ }
1035
+ }
1036
+
815
1037
declare namespace admin . securityRules {
816
1038
export import RulesFile = _securityRules . admin . securityRules . RulesFile ;
817
1039
export import RulesetMetadata = _securityRules . admin . securityRules . RulesetMetadata ;
0 commit comments