addCreative method

Future<FinalizedDeal> addCreative(
  1. AddCreativeRequest request,
  2. String deal, {
  3. String? $fields,
})

Add creative to be used in the bidding process for a finalized deal.

For programmatic guaranteed deals, it's recommended that you associate at least one approved creative with the deal before calling SetReadyToServe, to help reduce the number of bid responses filtered because they don't contain approved creatives. Creatives successfully added to a deal can be found in the Realtime-bidding Creatives API creative.deal_ids. This method only applies to programmatic guaranteed deals. Maximum number of 1000 creatives can be added to a finalized deal.

request - The metadata request object.

Request parameters:

deal - Required. Name of the finalized deal in the format of: buyers/{accountId}/finalizedDeals/{dealId} Value must have pattern ^buyers/\[^/\]+/finalizedDeals/\[^/\]+$.

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

Completes with a FinalizedDeal.

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<FinalizedDeal> addCreative(
  AddCreativeRequest request,
  core.String deal, {
  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/' + core.Uri.encodeFull('$deal') + ':addCreative';

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