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\AdSenseHost\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\AdSenseHost\AdCode;
|
---|
21 | use Google\Service\AdSenseHost\AdUnit;
|
---|
22 | use Google\Service\AdSenseHost\AdUnits;
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * The "adunits" collection of methods.
|
---|
26 | * Typical usage is:
|
---|
27 | * <code>
|
---|
28 | * $adsensehostService = new Google\Service\AdSenseHost(...);
|
---|
29 | * $adunits = $adsensehostService->accounts_adunits;
|
---|
30 | * </code>
|
---|
31 | */
|
---|
32 | class AccountsAdunits extends \Google\Service\Resource
|
---|
33 | {
|
---|
34 | /**
|
---|
35 | * Delete the specified ad unit from the specified publisher AdSense account.
|
---|
36 | * (adunits.delete)
|
---|
37 | *
|
---|
38 | * @param string $accountId Account which contains the ad unit.
|
---|
39 | * @param string $adClientId Ad client for which to get ad unit.
|
---|
40 | * @param string $adUnitId Ad unit to delete.
|
---|
41 | * @param array $optParams Optional parameters.
|
---|
42 | * @return AdUnit
|
---|
43 | * @throws \Google\Service\Exception
|
---|
44 | */
|
---|
45 | public function delete($accountId, $adClientId, $adUnitId, $optParams = [])
|
---|
46 | {
|
---|
47 | $params = ['accountId' => $accountId, 'adClientId' => $adClientId, 'adUnitId' => $adUnitId];
|
---|
48 | $params = array_merge($params, $optParams);
|
---|
49 | return $this->call('delete', [$params], AdUnit::class);
|
---|
50 | }
|
---|
51 | /**
|
---|
52 | * Get the specified host ad unit in this AdSense account. (adunits.get)
|
---|
53 | *
|
---|
54 | * @param string $accountId Account which contains the ad unit.
|
---|
55 | * @param string $adClientId Ad client for which to get ad unit.
|
---|
56 | * @param string $adUnitId Ad unit to get.
|
---|
57 | * @param array $optParams Optional parameters.
|
---|
58 | * @return AdUnit
|
---|
59 | * @throws \Google\Service\Exception
|
---|
60 | */
|
---|
61 | public function get($accountId, $adClientId, $adUnitId, $optParams = [])
|
---|
62 | {
|
---|
63 | $params = ['accountId' => $accountId, 'adClientId' => $adClientId, 'adUnitId' => $adUnitId];
|
---|
64 | $params = array_merge($params, $optParams);
|
---|
65 | return $this->call('get', [$params], AdUnit::class);
|
---|
66 | }
|
---|
67 | /**
|
---|
68 | * Get ad code for the specified ad unit, attaching the specified host custom
|
---|
69 | * channels. (adunits.getAdCode)
|
---|
70 | *
|
---|
71 | * @param string $accountId Account which contains the ad client.
|
---|
72 | * @param string $adClientId Ad client with contains the ad unit.
|
---|
73 | * @param string $adUnitId Ad unit to get the code for.
|
---|
74 | * @param array $optParams Optional parameters.
|
---|
75 | *
|
---|
76 | * @opt_param string hostCustomChannelId Host custom channel to attach to the ad
|
---|
77 | * code.
|
---|
78 | * @return AdCode
|
---|
79 | * @throws \Google\Service\Exception
|
---|
80 | */
|
---|
81 | public function getAdCode($accountId, $adClientId, $adUnitId, $optParams = [])
|
---|
82 | {
|
---|
83 | $params = ['accountId' => $accountId, 'adClientId' => $adClientId, 'adUnitId' => $adUnitId];
|
---|
84 | $params = array_merge($params, $optParams);
|
---|
85 | return $this->call('getAdCode', [$params], AdCode::class);
|
---|
86 | }
|
---|
87 | /**
|
---|
88 | * Insert the supplied ad unit into the specified publisher AdSense account.
|
---|
89 | * (adunits.insert)
|
---|
90 | *
|
---|
91 | * @param string $accountId Account which will contain the ad unit.
|
---|
92 | * @param string $adClientId Ad client into which to insert the ad unit.
|
---|
93 | * @param AdUnit $postBody
|
---|
94 | * @param array $optParams Optional parameters.
|
---|
95 | * @return AdUnit
|
---|
96 | * @throws \Google\Service\Exception
|
---|
97 | */
|
---|
98 | public function insert($accountId, $adClientId, AdUnit $postBody, $optParams = [])
|
---|
99 | {
|
---|
100 | $params = ['accountId' => $accountId, 'adClientId' => $adClientId, 'postBody' => $postBody];
|
---|
101 | $params = array_merge($params, $optParams);
|
---|
102 | return $this->call('insert', [$params], AdUnit::class);
|
---|
103 | }
|
---|
104 | /**
|
---|
105 | * List all ad units in the specified publisher's AdSense account.
|
---|
106 | * (adunits.listAccountsAdunits)
|
---|
107 | *
|
---|
108 | * @param string $accountId Account which contains the ad client.
|
---|
109 | * @param string $adClientId Ad client for which to list ad units.
|
---|
110 | * @param array $optParams Optional parameters.
|
---|
111 | *
|
---|
112 | * @opt_param bool includeInactive Whether to include inactive ad units.
|
---|
113 | * Default: true.
|
---|
114 | * @opt_param string maxResults The maximum number of ad units to include in the
|
---|
115 | * response, used for paging.
|
---|
116 | * @opt_param string pageToken A continuation token, used to page through ad
|
---|
117 | * units. To retrieve the next page, set this parameter to the value of
|
---|
118 | * "nextPageToken" from the previous response.
|
---|
119 | * @return AdUnits
|
---|
120 | * @throws \Google\Service\Exception
|
---|
121 | */
|
---|
122 | public function listAccountsAdunits($accountId, $adClientId, $optParams = [])
|
---|
123 | {
|
---|
124 | $params = ['accountId' => $accountId, 'adClientId' => $adClientId];
|
---|
125 | $params = array_merge($params, $optParams);
|
---|
126 | return $this->call('list', [$params], AdUnits::class);
|
---|
127 | }
|
---|
128 | /**
|
---|
129 | * Update the supplied ad unit in the specified publisher AdSense account. This
|
---|
130 | * method supports patch semantics. (adunits.patch)
|
---|
131 | *
|
---|
132 | * @param string $accountId Account which contains the ad client.
|
---|
133 | * @param string $adClientId Ad client which contains the ad unit.
|
---|
134 | * @param string $adUnitId Ad unit to get.
|
---|
135 | * @param AdUnit $postBody
|
---|
136 | * @param array $optParams Optional parameters.
|
---|
137 | * @return AdUnit
|
---|
138 | * @throws \Google\Service\Exception
|
---|
139 | */
|
---|
140 | public function patch($accountId, $adClientId, $adUnitId, AdUnit $postBody, $optParams = [])
|
---|
141 | {
|
---|
142 | $params = ['accountId' => $accountId, 'adClientId' => $adClientId, 'adUnitId' => $adUnitId, 'postBody' => $postBody];
|
---|
143 | $params = array_merge($params, $optParams);
|
---|
144 | return $this->call('patch', [$params], AdUnit::class);
|
---|
145 | }
|
---|
146 | /**
|
---|
147 | * Update the supplied ad unit in the specified publisher AdSense account.
|
---|
148 | * (adunits.update)
|
---|
149 | *
|
---|
150 | * @param string $accountId Account which contains the ad client.
|
---|
151 | * @param string $adClientId Ad client which contains the ad unit.
|
---|
152 | * @param AdUnit $postBody
|
---|
153 | * @param array $optParams Optional parameters.
|
---|
154 | * @return AdUnit
|
---|
155 | * @throws \Google\Service\Exception
|
---|
156 | */
|
---|
157 | public function update($accountId, $adClientId, AdUnit $postBody, $optParams = [])
|
---|
158 | {
|
---|
159 | $params = ['accountId' => $accountId, 'adClientId' => $adClientId, 'postBody' => $postBody];
|
---|
160 | $params = array_merge($params, $optParams);
|
---|
161 | return $this->call('update', [$params], AdUnit::class);
|
---|
162 | }
|
---|
163 | }
|
---|
164 |
|
---|
165 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
166 | class_alias(AccountsAdunits::class, 'Google_Service_AdSenseHost_Resource_AccountsAdunits');
|
---|