updateRemoteConfig method

Future<RemoteConfig> updateRemoteConfig(
  1. RemoteConfig request,
  2. String project, {
  3. bool? validateOnly,
  4. String? $fields,
})

Publish a project's Remote Config template.

Pass the ETag returned by GetRemoteConfig as an If-Match header to ensure the last seen Remote Config template is the one being overwritten by this update. Pass If-Match: * to force an update, regardless of the current version. Returns the published RemoteConfig and the updated ETag as a response header if successful, or an error. See the publishing guide for a list of [error codes](/docs/remote-config/use-config-rest#step_5_publish_json_data_to_replace_data_in_the_service).

request - The metadata request object.

Request parameters:

project - Required. The Firebase project's Project ID or Project Number, prefixed with "projects/". Value must have pattern ^projects/\[^/\]+$.

validateOnly - Optional. Defaults to false. If true, the server will only attempt to validate the RemoteConfig. If validation succeeds, the RemoteConfig is not written to the Remote Config server, instead a 200 OK response is returned. If validation fails, a validation error is returned. Note: other errors may still occur after this boolean is set to false, even if getting a 200 OK when calling with UpdateRemoteConfig with validate_only set to true.

$fields - Selector specifying which fields to include in a partial response.

Completes with a RemoteConfig.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<RemoteConfig> updateRemoteConfig(
  RemoteConfig request,
  core.String project, {
  core.bool? validateOnly,
  core.String? $fields,
}) async {
  final _body = convert.json.encode(request);
  final _queryParams = <core.String, core.List<core.String>>{
    if (validateOnly != null) 'validateOnly': ['${validateOnly}'],
    if ($fields != null) 'fields': [$fields],
  };

  final _url = 'v1/' + core.Uri.encodeFull('$project') + '/remoteConfig';

  final _response = await _requester.request(
    _url,
    'PUT',
    body: _body,
    queryParams: _queryParams,
  );
  return RemoteConfig.fromJson(
      _response as core.Map<core.String, core.dynamic>);
}