insert method
Future<CampaignCreativeAssociation>
insert(
- CampaignCreativeAssociation request,
- String profileId,
- String campaignId, {
- String? $fields,
Associates a creative with the specified campaign.
This method creates a default ad with dimensions matching the creative in the campaign if such a default ad does not exist already.
request
- The metadata request object.
Request parameters:
profileId
- User profile ID associated with this request.
Value must have pattern ^\[^/\]+$
.
campaignId
- Campaign ID in this association.
Value must have pattern ^\[^/\]+$
.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a CampaignCreativeAssociation.
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<CampaignCreativeAssociation> insert(
CampaignCreativeAssociation request,
core.String profileId,
core.String campaignId, {
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_ = 'userprofiles/' +
core.Uri.encodeFull('$profileId') +
'/campaigns/' +
core.Uri.encodeFull('$campaignId') +
'/campaignCreativeAssociations';
final response_ = await _requester.request(
url_,
'POST',
body: body_,
queryParams: queryParams_,
);
return CampaignCreativeAssociation.fromJson(
response_ as core.Map<core.String, core.dynamic>);
}