getAdcode method
Gets the ad unit code for a given ad unit.
For more information, see About the AdSense code and Where to place the ad code in your HTML.
Request parameters:
name
- Required. Name of the adunit for which to get the adcode. Format:
accounts/{account}/adclients/{adclient}/adunits/{adunit}
Value must have pattern
^accounts/\[^/\]+/adclients/\[^/\]+/adunits/\[^/\]+$
.
$fields
- Selector specifying which fields to include in a partial
response.
Completes with a AdUnitAdCode.
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<AdUnitAdCode> getAdcode(
core.String name, {
core.String? $fields,
}) async {
final queryParams_ = <core.String, core.List<core.String>>{
if ($fields != null) 'fields': [$fields],
};
final url_ = 'v2/' + core.Uri.encodeFull('$name') + '/adcode';
final response_ = await _requester.request(
url_,
'GET',
queryParams: queryParams_,
);
return AdUnitAdCode.fromJson(
response_ as core.Map<core.String, core.dynamic>);
}