create method

Future<AssignedLocation> create(
  1. AssignedLocation request,
  2. String advertiserId,
  3. String locationListId, {
  4. String? $fields,
})

Creates an assignment between a location and a location list.

request - The metadata request object.

Request parameters:

advertiserId - Required. The ID of the DV360 advertiser to which the location list belongs.

locationListId - Required. The ID of the location list for which the assignment will be created.

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

Completes with a AssignedLocation.

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<AssignedLocation> create(
  AssignedLocation request,
  core.String advertiserId,
  core.String locationListId, {
  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_ = 'v2/advertisers/' +
      commons.escapeVariable('$advertiserId') +
      '/locationLists/' +
      commons.escapeVariable('$locationListId') +
      '/assignedLocations';

  final response_ = await _requester.request(
    url_,
    'POST',
    body: body_,
    queryParams: queryParams_,
  );
  return AssignedLocation.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}