[e3d4e0a] | 1 | <?php
|
---|
| 2 | /*
|
---|
| 3 | * Copyright 2014 Google Inc.
|
---|
| 4 | *
|
---|
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
---|
| 6 | * use this file except in compliance with the License. You may obtain a copy of
|
---|
| 7 | * the License at
|
---|
| 8 | *
|
---|
| 9 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
| 10 | *
|
---|
| 11 | * Unless required by applicable law or agreed to in writing, software
|
---|
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
---|
| 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
---|
| 14 | * License for the specific language governing permissions and limitations under
|
---|
| 15 | * the License.
|
---|
| 16 | */
|
---|
| 17 |
|
---|
| 18 | namespace Google\Service\Adsense\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\Adsense\AdUnit;
|
---|
| 21 | use Google\Service\Adsense\AdUnitAdCode;
|
---|
| 22 | use Google\Service\Adsense\ListAdUnitsResponse;
|
---|
| 23 | use Google\Service\Adsense\ListLinkedCustomChannelsResponse;
|
---|
| 24 |
|
---|
| 25 | /**
|
---|
| 26 | * The "adunits" collection of methods.
|
---|
| 27 | * Typical usage is:
|
---|
| 28 | * <code>
|
---|
| 29 | * $adsenseService = new Google\Service\Adsense(...);
|
---|
| 30 | * $adunits = $adsenseService->accounts_adclients_adunits;
|
---|
| 31 | * </code>
|
---|
| 32 | */
|
---|
| 33 | class AccountsAdclientsAdunits extends \Google\Service\Resource
|
---|
| 34 | {
|
---|
| 35 | /**
|
---|
| 36 | * Creates an ad unit. This method can be called only by a restricted set of
|
---|
| 37 | * projects, which are usually owned by [AdSense for
|
---|
| 38 | * Platforms](https://developers.google.com/adsense/platforms/) publishers.
|
---|
| 39 | * Contact your account manager if you need to use this method. Note that ad
|
---|
| 40 | * units can only be created for ad clients with an "AFC" product code. For more
|
---|
| 41 | * info see the [AdClient
|
---|
| 42 | * resource](/adsense/management/reference/rest/v2/accounts.adclients). For now,
|
---|
| 43 | * this method can only be used to create `DISPLAY` ad units. See:
|
---|
| 44 | * https://support.google.com/adsense/answer/9183566 (adunits.create)
|
---|
| 45 | *
|
---|
| 46 | * @param string $parent Required. Ad client to create an ad unit under. Format:
|
---|
| 47 | * accounts/{account}/adclients/{adclient}
|
---|
| 48 | * @param AdUnit $postBody
|
---|
| 49 | * @param array $optParams Optional parameters.
|
---|
| 50 | * @return AdUnit
|
---|
| 51 | * @throws \Google\Service\Exception
|
---|
| 52 | */
|
---|
| 53 | public function create($parent, AdUnit $postBody, $optParams = [])
|
---|
| 54 | {
|
---|
| 55 | $params = ['parent' => $parent, 'postBody' => $postBody];
|
---|
| 56 | $params = array_merge($params, $optParams);
|
---|
| 57 | return $this->call('create', [$params], AdUnit::class);
|
---|
| 58 | }
|
---|
| 59 | /**
|
---|
| 60 | * Gets an ad unit from a specified account and ad client. (adunits.get)
|
---|
| 61 | *
|
---|
| 62 | * @param string $name Required. AdUnit to get information about. Format:
|
---|
| 63 | * accounts/{account}/adclients/{adclient}/adunits/{adunit}
|
---|
| 64 | * @param array $optParams Optional parameters.
|
---|
| 65 | * @return AdUnit
|
---|
| 66 | * @throws \Google\Service\Exception
|
---|
| 67 | */
|
---|
| 68 | public function get($name, $optParams = [])
|
---|
| 69 | {
|
---|
| 70 | $params = ['name' => $name];
|
---|
| 71 | $params = array_merge($params, $optParams);
|
---|
| 72 | return $this->call('get', [$params], AdUnit::class);
|
---|
| 73 | }
|
---|
| 74 | /**
|
---|
| 75 | * Gets the ad unit code for a given ad unit. For more information, see [About
|
---|
| 76 | * the AdSense code](https://support.google.com/adsense/answer/9274634) and
|
---|
| 77 | * [Where to place the ad code in your
|
---|
| 78 | * HTML](https://support.google.com/adsense/answer/9190028). (adunits.getAdcode)
|
---|
| 79 | *
|
---|
| 80 | * @param string $name Required. Name of the adunit for which to get the adcode.
|
---|
| 81 | * Format: accounts/{account}/adclients/{adclient}/adunits/{adunit}
|
---|
| 82 | * @param array $optParams Optional parameters.
|
---|
| 83 | * @return AdUnitAdCode
|
---|
| 84 | * @throws \Google\Service\Exception
|
---|
| 85 | */
|
---|
| 86 | public function getAdcode($name, $optParams = [])
|
---|
| 87 | {
|
---|
| 88 | $params = ['name' => $name];
|
---|
| 89 | $params = array_merge($params, $optParams);
|
---|
| 90 | return $this->call('getAdcode', [$params], AdUnitAdCode::class);
|
---|
| 91 | }
|
---|
| 92 | /**
|
---|
| 93 | * Lists all ad units under a specified account and ad client.
|
---|
| 94 | * (adunits.listAccountsAdclientsAdunits)
|
---|
| 95 | *
|
---|
| 96 | * @param string $parent Required. The ad client which owns the collection of ad
|
---|
| 97 | * units. Format: accounts/{account}/adclients/{adclient}
|
---|
| 98 | * @param array $optParams Optional parameters.
|
---|
| 99 | *
|
---|
| 100 | * @opt_param int pageSize The maximum number of ad units to include in the
|
---|
| 101 | * response, used for paging. If unspecified, at most 10000 ad units will be
|
---|
| 102 | * returned. The maximum value is 10000; values above 10000 will be coerced to
|
---|
| 103 | * 10000.
|
---|
| 104 | * @opt_param string pageToken A page token, received from a previous
|
---|
| 105 | * `ListAdUnits` call. Provide this to retrieve the subsequent page. When
|
---|
| 106 | * paginating, all other parameters provided to `ListAdUnits` must match the
|
---|
| 107 | * call that provided the page token.
|
---|
| 108 | * @return ListAdUnitsResponse
|
---|
| 109 | * @throws \Google\Service\Exception
|
---|
| 110 | */
|
---|
| 111 | public function listAccountsAdclientsAdunits($parent, $optParams = [])
|
---|
| 112 | {
|
---|
| 113 | $params = ['parent' => $parent];
|
---|
| 114 | $params = array_merge($params, $optParams);
|
---|
| 115 | return $this->call('list', [$params], ListAdUnitsResponse::class);
|
---|
| 116 | }
|
---|
| 117 | /**
|
---|
| 118 | * Lists all the custom channels available for an ad unit.
|
---|
| 119 | * (adunits.listLinkedCustomChannels)
|
---|
| 120 | *
|
---|
| 121 | * @param string $parent Required. The ad unit which owns the collection of
|
---|
| 122 | * custom channels. Format:
|
---|
| 123 | * accounts/{account}/adclients/{adclient}/adunits/{adunit}
|
---|
| 124 | * @param array $optParams Optional parameters.
|
---|
| 125 | *
|
---|
| 126 | * @opt_param int pageSize The maximum number of custom channels to include in
|
---|
| 127 | * the response, used for paging. If unspecified, at most 10000 custom channels
|
---|
| 128 | * will be returned. The maximum value is 10000; values above 10000 will be
|
---|
| 129 | * coerced to 10000.
|
---|
| 130 | * @opt_param string pageToken A page token, received from a previous
|
---|
| 131 | * `ListLinkedCustomChannels` call. Provide this to retrieve the subsequent
|
---|
| 132 | * page. When paginating, all other parameters provided to
|
---|
| 133 | * `ListLinkedCustomChannels` must match the call that provided the page token.
|
---|
| 134 | * @return ListLinkedCustomChannelsResponse
|
---|
| 135 | * @throws \Google\Service\Exception
|
---|
| 136 | */
|
---|
| 137 | public function listLinkedCustomChannels($parent, $optParams = [])
|
---|
| 138 | {
|
---|
| 139 | $params = ['parent' => $parent];
|
---|
| 140 | $params = array_merge($params, $optParams);
|
---|
| 141 | return $this->call('listLinkedCustomChannels', [$params], ListLinkedCustomChannelsResponse::class);
|
---|
| 142 | }
|
---|
| 143 | /**
|
---|
| 144 | * Updates an ad unit. This method can be called only by a restricted set of
|
---|
| 145 | * projects, which are usually owned by [AdSense for
|
---|
| 146 | * Platforms](https://developers.google.com/adsense/platforms/) publishers.
|
---|
| 147 | * Contact your account manager if you need to use this method. For now, this
|
---|
| 148 | * method can only be used to update `DISPLAY` ad units. See:
|
---|
| 149 | * https://support.google.com/adsense/answer/9183566 (adunits.patch)
|
---|
| 150 | *
|
---|
| 151 | * @param string $name Output only. Resource name of the ad unit. Format:
|
---|
| 152 | * accounts/{account}/adclients/{adclient}/adunits/{adunit}
|
---|
| 153 | * @param AdUnit $postBody
|
---|
| 154 | * @param array $optParams Optional parameters.
|
---|
| 155 | *
|
---|
| 156 | * @opt_param string updateMask The list of fields to update. If empty, a full
|
---|
| 157 | * update is performed.
|
---|
| 158 | * @return AdUnit
|
---|
| 159 | * @throws \Google\Service\Exception
|
---|
| 160 | */
|
---|
| 161 | public function patch($name, AdUnit $postBody, $optParams = [])
|
---|
| 162 | {
|
---|
| 163 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
| 164 | $params = array_merge($params, $optParams);
|
---|
| 165 | return $this->call('patch', [$params], AdUnit::class);
|
---|
| 166 | }
|
---|
| 167 | }
|
---|
| 168 |
|
---|
| 169 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 170 | class_alias(AccountsAdclientsAdunits::class, 'Google_Service_Adsense_Resource_AccountsAdclientsAdunits');
|
---|