fetch method
- FetchEligibleCampaignsRequest request,
- String projectNumber, {
- String? $fields,
Retrieve fiam messages that are suitable for the current client app instance.
A suitable campaign message needs to satisfy 3 conditions 1 Active campaign 2 The requesting client app instance meets the targeting requirement for the campaign 3 The message is still yet to be rendered by the requesting client app instance based on the display policy for the campaign. Parameter already_seen_campaign in the request object is used to help serve this purpose. Due to potential risk of a long list of already_seen_campaigns causing the url to reach the length limit, it's modeled as a POST request (so we can use body to carry the request data) with custom method even though it's essentially a read operation. The returned list of campaign messages are sorted from high priority to low priority so that the client can display them in the order as seen in the response.
request
- The metadata request object.
Request parameters:
projectNumber
- [required] the unique numeric string identifying the
firebase project that the client app belongs
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a FetchEligibleCampaignsResponse.
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<FetchEligibleCampaignsResponse> fetch(
FetchEligibleCampaignsRequest request,
core.String projectNumber, {
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/sdkServing/projects/' +
commons.escapeVariable('$projectNumber') +
'/eligibleCampaigns:fetch';
final _response = await _requester.request(
_url,
'POST',
body: _body,
queryParams: _queryParams,
);
return FetchEligibleCampaignsResponse.fromJson(
_response as core.Map<core.String, core.dynamic>);
}