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\MyBusinessAccountManagement\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\MyBusinessAccountManagement\Account;
|
---|
21 | use Google\Service\MyBusinessAccountManagement\ListAccountsResponse;
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * The "accounts" collection of methods.
|
---|
25 | * Typical usage is:
|
---|
26 | * <code>
|
---|
27 | * $mybusinessaccountmanagementService = new Google\Service\MyBusinessAccountManagement(...);
|
---|
28 | * $accounts = $mybusinessaccountmanagementService->accounts;
|
---|
29 | * </code>
|
---|
30 | */
|
---|
31 | class Accounts extends \Google\Service\Resource
|
---|
32 | {
|
---|
33 | /**
|
---|
34 | * Creates an account with the specified name and type under the given parent. -
|
---|
35 | * Personal accounts and Organizations cannot be created. - User Groups cannot
|
---|
36 | * be created with a Personal account as primary owner. - Location Groups cannot
|
---|
37 | * be created with a primary owner of a Personal account if the Personal account
|
---|
38 | * is in an Organization. - Location Groups cannot own Location Groups.
|
---|
39 | * (accounts.create)
|
---|
40 | *
|
---|
41 | * @param Account $postBody
|
---|
42 | * @param array $optParams Optional parameters.
|
---|
43 | * @return Account
|
---|
44 | * @throws \Google\Service\Exception
|
---|
45 | */
|
---|
46 | public function create(Account $postBody, $optParams = [])
|
---|
47 | {
|
---|
48 | $params = ['postBody' => $postBody];
|
---|
49 | $params = array_merge($params, $optParams);
|
---|
50 | return $this->call('create', [$params], Account::class);
|
---|
51 | }
|
---|
52 | /**
|
---|
53 | * Gets the specified account. Returns `NOT_FOUND` if the account does not exist
|
---|
54 | * or if the caller does not have access rights to it. (accounts.get)
|
---|
55 | *
|
---|
56 | * @param string $name Required. The name of the account to fetch.
|
---|
57 | * @param array $optParams Optional parameters.
|
---|
58 | * @return Account
|
---|
59 | * @throws \Google\Service\Exception
|
---|
60 | */
|
---|
61 | public function get($name, $optParams = [])
|
---|
62 | {
|
---|
63 | $params = ['name' => $name];
|
---|
64 | $params = array_merge($params, $optParams);
|
---|
65 | return $this->call('get', [$params], Account::class);
|
---|
66 | }
|
---|
67 | /**
|
---|
68 | * Lists all of the accounts for the authenticated user. This includes all
|
---|
69 | * accounts that the user owns, as well as any accounts for which the user has
|
---|
70 | * management rights. (accounts.listAccounts)
|
---|
71 | *
|
---|
72 | * @param array $optParams Optional parameters.
|
---|
73 | *
|
---|
74 | * @opt_param string filter Optional. A filter constraining the accounts to
|
---|
75 | * return. The response includes only entries that match the filter. If `filter`
|
---|
76 | * is empty, then no constraints are applied and all accounts (paginated) are
|
---|
77 | * retrieved for the requested account. For example, a request with the filter
|
---|
78 | * `type=USER_GROUP` will only return user groups. The `type` field is the only
|
---|
79 | * supported filter.
|
---|
80 | * @opt_param int pageSize Optional. How many accounts to fetch per page. The
|
---|
81 | * default and maximum is 20.
|
---|
82 | * @opt_param string pageToken Optional. If specified, the next page of accounts
|
---|
83 | * is retrieved. The `pageToken` is returned when a call to `accounts.list`
|
---|
84 | * returns more results than can fit into the requested page size.
|
---|
85 | * @opt_param string parentAccount Optional. The resource name of the account
|
---|
86 | * for which the list of directly accessible accounts is to be retrieved. This
|
---|
87 | * only makes sense for Organizations and User Groups. If empty, will return
|
---|
88 | * `ListAccounts` for the authenticated user. `accounts/{account_id}`.
|
---|
89 | * @return ListAccountsResponse
|
---|
90 | * @throws \Google\Service\Exception
|
---|
91 | */
|
---|
92 | public function listAccounts($optParams = [])
|
---|
93 | {
|
---|
94 | $params = [];
|
---|
95 | $params = array_merge($params, $optParams);
|
---|
96 | return $this->call('list', [$params], ListAccountsResponse::class);
|
---|
97 | }
|
---|
98 | /**
|
---|
99 | * Updates the specified business account. Personal accounts cannot be updated
|
---|
100 | * using this method. (accounts.patch)
|
---|
101 | *
|
---|
102 | * @param string $name Immutable. The resource name, in the format
|
---|
103 | * `accounts/{account_id}`.
|
---|
104 | * @param Account $postBody
|
---|
105 | * @param array $optParams Optional parameters.
|
---|
106 | *
|
---|
107 | * @opt_param string updateMask Required. The specific fields that should be
|
---|
108 | * updated. The only editable field is `accountName`.
|
---|
109 | * @opt_param bool validateOnly Optional. If true, the request is validated
|
---|
110 | * without actually updating the account.
|
---|
111 | * @return Account
|
---|
112 | * @throws \Google\Service\Exception
|
---|
113 | */
|
---|
114 | public function patch($name, Account $postBody, $optParams = [])
|
---|
115 | {
|
---|
116 | $params = ['name' => $name, 'postBody' => $postBody];
|
---|
117 | $params = array_merge($params, $optParams);
|
---|
118 | return $this->call('patch', [$params], Account::class);
|
---|
119 | }
|
---|
120 | }
|
---|
121 |
|
---|
122 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
123 | class_alias(Accounts::class, 'Google_Service_MyBusinessAccountManagement_Resource_Accounts');
|
---|