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