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\Adsense\Resource;
19
20use Google\Service\Adsense\AdUnit;
21use Google\Service\Adsense\AdUnitAdCode;
22use Google\Service\Adsense\ListAdUnitsResponse;
23use 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->adunits;
31 *  </code>
32 */
33class AccountsAdclientsAdunits extends \Google\Service\Resource
34{
35  /**
36   * Gets an ad unit from a specified account and ad client. (adunits.get)
37   *
38   * @param string $name Required. AdUnit to get information about. Format:
39   * accounts/{account}/adclients/{adclient}/adunits/{adunit}
40   * @param array $optParams Optional parameters.
41   * @return AdUnit
42   */
43  public function get($name, $optParams = [])
44  {
45    $params = ['name' => $name];
46    $params = array_merge($params, $optParams);
47    return $this->call('get', [$params], AdUnit::class);
48  }
49  /**
50   * Gets the AdSense code for a given ad unit. (adunits.getAdcode)
51   *
52   * @param string $name Required. Name of the adunit for which to get the adcode.
53   * Format: accounts/{account}/adclients/{adclient}/adunits/{adunit}
54   * @param array $optParams Optional parameters.
55   * @return AdUnitAdCode
56   */
57  public function getAdcode($name, $optParams = [])
58  {
59    $params = ['name' => $name];
60    $params = array_merge($params, $optParams);
61    return $this->call('getAdcode', [$params], AdUnitAdCode::class);
62  }
63  /**
64   * Lists all ad units under a specified account and ad client.
65   * (adunits.listAccountsAdclientsAdunits)
66   *
67   * @param string $parent Required. The ad client which owns the collection of ad
68   * units. Format: accounts/{account}/adclients/{adclient}
69   * @param array $optParams Optional parameters.
70   *
71   * @opt_param int pageSize The maximum number of ad units to include in the
72   * response, used for paging. If unspecified, at most 10000 ad units will be
73   * returned. The maximum value is 10000; values above 10000 will be coerced to
74   * 10000.
75   * @opt_param string pageToken A page token, received from a previous
76   * `ListAdUnits` call. Provide this to retrieve the subsequent page. When
77   * paginating, all other parameters provided to `ListAdUnits` must match the
78   * call that provided the page token.
79   * @return ListAdUnitsResponse
80   */
81  public function listAccountsAdclientsAdunits($parent, $optParams = [])
82  {
83    $params = ['parent' => $parent];
84    $params = array_merge($params, $optParams);
85    return $this->call('list', [$params], ListAdUnitsResponse::class);
86  }
87  /**
88   * Lists all the custom channels available for an ad unit.
89   * (adunits.listLinkedCustomChannels)
90   *
91   * @param string $parent Required. The ad unit which owns the collection of
92   * custom channels. Format:
93   * accounts/{account}/adclients/{adclient}/adunits/{adunit}
94   * @param array $optParams Optional parameters.
95   *
96   * @opt_param int pageSize The maximum number of custom channels to include in
97   * the response, used for paging. If unspecified, at most 10000 custom channels
98   * will be returned. The maximum value is 10000; values above 10000 will be
99   * coerced to 10000.
100   * @opt_param string pageToken A page token, received from a previous
101   * `ListLinkedCustomChannels` call. Provide this to retrieve the subsequent
102   * page. When paginating, all other parameters provided to
103   * `ListLinkedCustomChannels` must match the call that provided the page token.
104   * @return ListLinkedCustomChannelsResponse
105   */
106  public function listLinkedCustomChannels($parent, $optParams = [])
107  {
108    $params = ['parent' => $parent];
109    $params = array_merge($params, $optParams);
110    return $this->call('listLinkedCustomChannels', [$params], ListLinkedCustomChannelsResponse::class);
111  }
112}
113
114// Adding a class alias for backwards compatibility with the previous class name.
115class_alias(AccountsAdclientsAdunits::class, 'Google_Service_Adsense_Resource_AccountsAdclientsAdunits');
116