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\Dfareporting\Resource;
19
20use Google\Service\Dfareporting\Account;
21use Google\Service\Dfareporting\AccountsListResponse;
22
23/**
24 * The "accounts" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $dfareportingService = new Google\Service\Dfareporting(...);
28 *   $accounts = $dfareportingService->accounts;
29 *  </code>
30 */
31class Accounts extends \Google\Service\Resource
32{
33  /**
34   * Gets one account by ID. (accounts.get)
35   *
36   * @param string $profileId User profile ID associated with this request.
37   * @param string $id Account ID.
38   * @param array $optParams Optional parameters.
39   * @return Account
40   */
41  public function get($profileId, $id, $optParams = [])
42  {
43    $params = ['profileId' => $profileId, 'id' => $id];
44    $params = array_merge($params, $optParams);
45    return $this->call('get', [$params], Account::class);
46  }
47  /**
48   * Retrieves the list of accounts, possibly filtered. This method supports
49   * paging. (accounts.listAccounts)
50   *
51   * @param string $profileId User profile ID associated with this request.
52   * @param array $optParams Optional parameters.
53   *
54   * @opt_param bool active Select only active accounts. Don't set this field to
55   * select both active and non-active accounts.
56   * @opt_param string ids Select only accounts with these IDs.
57   * @opt_param int maxResults Maximum number of results to return.
58   * @opt_param string pageToken Value of the nextPageToken from the previous
59   * result page.
60   * @opt_param string searchString Allows searching for objects by name or ID.
61   * Wildcards (*) are allowed. For example, "account*2015" will return objects
62   * with names like "account June 2015", "account April 2015", or simply "account
63   * 2015". Most of the searches also add wildcards implicitly at the start and
64   * the end of the search string. For example, a search string of "account" will
65   * match objects with name "my account", "account 2015", or simply "account".
66   * @opt_param string sortField Field by which to sort the list.
67   * @opt_param string sortOrder Order of sorted results.
68   * @return AccountsListResponse
69   */
70  public function listAccounts($profileId, $optParams = [])
71  {
72    $params = ['profileId' => $profileId];
73    $params = array_merge($params, $optParams);
74    return $this->call('list', [$params], AccountsListResponse::class);
75  }
76  /**
77   * Updates an existing account. This method supports patch semantics.
78   * (accounts.patch)
79   *
80   * @param string $profileId User profile ID associated with this request.
81   * @param string $id Account ID.
82   * @param Account $postBody
83   * @param array $optParams Optional parameters.
84   * @return Account
85   */
86  public function patch($profileId, $id, Account $postBody, $optParams = [])
87  {
88    $params = ['profileId' => $profileId, 'id' => $id, 'postBody' => $postBody];
89    $params = array_merge($params, $optParams);
90    return $this->call('patch', [$params], Account::class);
91  }
92  /**
93   * Updates an existing account. (accounts.update)
94   *
95   * @param string $profileId User profile ID associated with this request.
96   * @param Account $postBody
97   * @param array $optParams Optional parameters.
98   * @return Account
99   */
100  public function update($profileId, Account $postBody, $optParams = [])
101  {
102    $params = ['profileId' => $profileId, 'postBody' => $postBody];
103    $params = array_merge($params, $optParams);
104    return $this->call('update', [$params], Account::class);
105  }
106}
107
108// Adding a class alias for backwards compatibility with the previous class name.
109class_alias(Accounts::class, 'Google_Service_Dfareporting_Resource_Accounts');
110