create method
Creates a creative.
request
- The metadata request object.
Request parameters:
accountId
- The account that this creative belongs to. Can be used to
filter the response of the creatives.list method.
duplicateIdMode
- Indicates if multiple creatives can share an ID or
not. Default is NO_DUPLICATES (one ID per creative).
Possible string values are:
- "NO_DUPLICATES" : Recommended. This means that an ID will be unique to a single creative. Multiple creatives will not share an ID.
- "FORCE_ENABLE_DUPLICATE_IDS" : Not recommended. Using this option will allow multiple creatives to share the same ID. Get and Update requests will not be possible for any ID that has more than one creative associated. (List will still function.) This is only intended for backwards compatibility in cases where a single ID is already shared by multiple creatives from previous APIs.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a Creative.
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<Creative> create(
Creative request,
core.String accountId, {
core.String? duplicateIdMode,
core.String? $fields,
}) async {
final body_ = convert.json.encode(request);
final queryParams_ = <core.String, core.List<core.String>>{
if (duplicateIdMode != null) 'duplicateIdMode': [duplicateIdMode],
if ($fields != null) 'fields': [$fields],
};
final url_ = 'v2beta1/accounts/' +
commons.escapeVariable('$accountId') +
'/creatives';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return Creative.fromJson(response_ as core.Map<core.String, core.dynamic>);
}