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