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\Account;
21use Google\Service\Adsense\ListAccountsResponse;
22use Google\Service\Adsense\ListChildAccountsResponse;
23
24/**
25 * The "accounts" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $adsenseService = new Google\Service\Adsense(...);
29 *   $accounts = $adsenseService->accounts;
30 *  </code>
31 */
32class Accounts extends \Google\Service\Resource
33{
34  /**
35   * Gets information about the selected AdSense account. (accounts.get)
36   *
37   * @param string $name Required. Account to get information about. Format:
38   * accounts/{account}
39   * @param array $optParams Optional parameters.
40   * @return Account
41   */
42  public function get($name, $optParams = [])
43  {
44    $params = ['name' => $name];
45    $params = array_merge($params, $optParams);
46    return $this->call('get', [$params], Account::class);
47  }
48  /**
49   * Lists all accounts available to this user. (accounts.listAccounts)
50   *
51   * @param array $optParams Optional parameters.
52   *
53   * @opt_param int pageSize The maximum number of accounts to include in the
54   * response, used for paging. If unspecified, at most 10000 accounts will be
55   * returned. The maximum value is 10000; values above 10000 will be coerced to
56   * 10000.
57   * @opt_param string pageToken A page token, received from a previous
58   * `ListAccounts` call. Provide this to retrieve the subsequent page. When
59   * paginating, all other parameters provided to `ListAccounts` must match the
60   * call that provided the page token.
61   * @return ListAccountsResponse
62   */
63  public function listAccounts($optParams = [])
64  {
65    $params = [];
66    $params = array_merge($params, $optParams);
67    return $this->call('list', [$params], ListAccountsResponse::class);
68  }
69  /**
70   * Lists all accounts directly managed by the given AdSense account.
71   * (accounts.listChildAccounts)
72   *
73   * @param string $parent Required. The parent account, which owns the child
74   * accounts. Format: accounts/{account}
75   * @param array $optParams Optional parameters.
76   *
77   * @opt_param int pageSize The maximum number of accounts to include in the
78   * response, used for paging. If unspecified, at most 10000 accounts will be
79   * returned. The maximum value is 10000; values above 10000 will be coerced to
80   * 10000.
81   * @opt_param string pageToken A page token, received from a previous
82   * `ListAccounts` call. Provide this to retrieve the subsequent page. When
83   * paginating, all other parameters provided to `ListAccounts` must match the
84   * call that provided the page token.
85   * @return ListChildAccountsResponse
86   */
87  public function listChildAccounts($parent, $optParams = [])
88  {
89    $params = ['parent' => $parent];
90    $params = array_merge($params, $optParams);
91    return $this->call('listChildAccounts', [$params], ListChildAccountsResponse::class);
92  }
93}
94
95// Adding a class alias for backwards compatibility with the previous class name.
96class_alias(Accounts::class, 'Google_Service_Adsense_Resource_Accounts');
97