fetch method
- FetchRemoteConfigRequest request,
- String project,
- String namespace, {
- String? $fields,
Fetch parameter values and any Firebase A/B Testing experiment information for the calling device.
An ETag header is also returned. Pass the ETag in future requests via the
If-None-Match
header to save bandwidth. NOTE: The Fetch REST API
requires an Instance ID to be populated in the request. The Instance ID
can obtained from the IID SDK. See
https://firebase.google.com/docs/reference/android/com/google/firebase/iid/FirebaseInstanceId
and
https://firebase.google.com/docs/reference/ios/firebaseinstanceid/api/reference/Classes/FIRInstanceID
request
- The metadata request object.
Request parameters:
project
- Required. The Firebase project ID or project number. (NOTE:
These identifiers can be retrieved from the Firebase console.)
namespace
- Required. The string "firebase".
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a FetchRemoteConfigResponse.
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<FetchRemoteConfigResponse> fetch(
FetchRemoteConfigRequest request,
core.String project,
core.String namespace, {
core.String? $fields,
}) async {
final _body = convert.json.encode(request);
final _queryParams = <core.String, core.List<core.String>>{
if ($fields != null) 'fields': [$fields],
};
final _url = 'v1/projects/' +
commons.escapeVariable('$project') +
'/namespaces/' +
commons.escapeVariable('$namespace') +
':fetch';
final _response = await _requester.request(
_url,
'POST',
body: _body,
queryParams: _queryParams,
);
return FetchRemoteConfigResponse.fromJson(
_response as core.Map<core.String, core.dynamic>);
}