[e3d4e0a] | 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\Directory\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\Directory\Group;
|
---|
| 21 | use Google\Service\Directory\Groups as GroupsModel;
|
---|
| 22 |
|
---|
| 23 | /**
|
---|
| 24 | * The "groups" collection of methods.
|
---|
| 25 | * Typical usage is:
|
---|
| 26 | * <code>
|
---|
| 27 | * $adminService = new Google\Service\Directory(...);
|
---|
| 28 | * $groups = $adminService->groups;
|
---|
| 29 | * </code>
|
---|
| 30 | */
|
---|
| 31 | class Groups extends \Google\Service\Resource
|
---|
| 32 | {
|
---|
| 33 | /**
|
---|
| 34 | * Deletes a group. (groups.delete)
|
---|
| 35 | *
|
---|
| 36 | * @param string $groupKey Identifies the group in the API request. The value
|
---|
| 37 | * can be the group's email address, group alias, or the unique group ID.
|
---|
| 38 | * @param array $optParams Optional parameters.
|
---|
| 39 | * @throws \Google\Service\Exception
|
---|
| 40 | */
|
---|
| 41 | public function delete($groupKey, $optParams = [])
|
---|
| 42 | {
|
---|
| 43 | $params = ['groupKey' => $groupKey];
|
---|
| 44 | $params = array_merge($params, $optParams);
|
---|
| 45 | return $this->call('delete', [$params]);
|
---|
| 46 | }
|
---|
| 47 | /**
|
---|
| 48 | * Retrieves a group's properties. (groups.get)
|
---|
| 49 | *
|
---|
| 50 | * @param string $groupKey Identifies the group in the API request. The value
|
---|
| 51 | * can be the group's email address, group alias, or the unique group ID.
|
---|
| 52 | * @param array $optParams Optional parameters.
|
---|
| 53 | * @return Group
|
---|
| 54 | * @throws \Google\Service\Exception
|
---|
| 55 | */
|
---|
| 56 | public function get($groupKey, $optParams = [])
|
---|
| 57 | {
|
---|
| 58 | $params = ['groupKey' => $groupKey];
|
---|
| 59 | $params = array_merge($params, $optParams);
|
---|
| 60 | return $this->call('get', [$params], Group::class);
|
---|
| 61 | }
|
---|
| 62 | /**
|
---|
| 63 | * Creates a group. (groups.insert)
|
---|
| 64 | *
|
---|
| 65 | * @param Group $postBody
|
---|
| 66 | * @param array $optParams Optional parameters.
|
---|
| 67 | * @return Group
|
---|
| 68 | * @throws \Google\Service\Exception
|
---|
| 69 | */
|
---|
| 70 | public function insert(Group $postBody, $optParams = [])
|
---|
| 71 | {
|
---|
| 72 | $params = ['postBody' => $postBody];
|
---|
| 73 | $params = array_merge($params, $optParams);
|
---|
| 74 | return $this->call('insert', [$params], Group::class);
|
---|
| 75 | }
|
---|
| 76 | /**
|
---|
| 77 | * Retrieves all groups of a domain or of a user given a userKey (paginated).
|
---|
| 78 | * (groups.listGroups)
|
---|
| 79 | *
|
---|
| 80 | * @param array $optParams Optional parameters.
|
---|
| 81 | *
|
---|
| 82 | * @opt_param string customer The unique ID for the customer's Google Workspace
|
---|
| 83 | * account. In case of a multi-domain account, to fetch all groups for a
|
---|
| 84 | * customer, use this field instead of `domain`. You can also use the
|
---|
| 85 | * `my_customer` alias to represent your account's `customerId`. The
|
---|
| 86 | * `customerId` is also returned as part of the [Users](/admin-
|
---|
| 87 | * sdk/directory/v1/reference/users) resource. You must provide either the
|
---|
| 88 | * `customer` or the `domain` parameter.
|
---|
| 89 | * @opt_param string domain The domain name. Use this field to get groups from
|
---|
| 90 | * only one domain. To return all domains for a customer account, use the
|
---|
| 91 | * `customer` query parameter instead.
|
---|
| 92 | * @opt_param int maxResults Maximum number of results to return. Max allowed
|
---|
| 93 | * value is 200.
|
---|
| 94 | * @opt_param string orderBy Column to use for sorting results
|
---|
| 95 | * @opt_param string pageToken Token to specify next page in the list
|
---|
| 96 | * @opt_param string query Query string search. Should be of the form "".
|
---|
| 97 | * Complete documentation is at https: //developers.google.com/admin-
|
---|
| 98 | * sdk/directory/v1/guides/search-groups
|
---|
| 99 | * @opt_param string sortOrder Whether to return results in ascending or
|
---|
| 100 | * descending order. Only of use when orderBy is also used
|
---|
| 101 | * @opt_param string userKey Email or immutable ID of the user if only those
|
---|
| 102 | * groups are to be listed, the given user is a member of. If it's an ID, it
|
---|
| 103 | * should match with the ID of the user object. Cannot be used with the
|
---|
| 104 | * `customer` parameter.
|
---|
| 105 | * @return GroupsModel
|
---|
| 106 | * @throws \Google\Service\Exception
|
---|
| 107 | */
|
---|
| 108 | public function listGroups($optParams = [])
|
---|
| 109 | {
|
---|
| 110 | $params = [];
|
---|
| 111 | $params = array_merge($params, $optParams);
|
---|
| 112 | return $this->call('list', [$params], GroupsModel::class);
|
---|
| 113 | }
|
---|
| 114 | /**
|
---|
| 115 | * Updates a group's properties. This method supports [patch semantics](/admin-
|
---|
| 116 | * sdk/directory/v1/guides/performance#patch). (groups.patch)
|
---|
| 117 | *
|
---|
| 118 | * @param string $groupKey Identifies the group in the API request. The value
|
---|
| 119 | * can be the group's email address, group alias, or the unique group ID.
|
---|
| 120 | * @param Group $postBody
|
---|
| 121 | * @param array $optParams Optional parameters.
|
---|
| 122 | * @return Group
|
---|
| 123 | * @throws \Google\Service\Exception
|
---|
| 124 | */
|
---|
| 125 | public function patch($groupKey, Group $postBody, $optParams = [])
|
---|
| 126 | {
|
---|
| 127 | $params = ['groupKey' => $groupKey, 'postBody' => $postBody];
|
---|
| 128 | $params = array_merge($params, $optParams);
|
---|
| 129 | return $this->call('patch', [$params], Group::class);
|
---|
| 130 | }
|
---|
| 131 | /**
|
---|
| 132 | * Updates a group's properties. (groups.update)
|
---|
| 133 | *
|
---|
| 134 | * @param string $groupKey Identifies the group in the API request. The value
|
---|
| 135 | * can be the group's email address, group alias, or the unique group ID.
|
---|
| 136 | * @param Group $postBody
|
---|
| 137 | * @param array $optParams Optional parameters.
|
---|
| 138 | * @return Group
|
---|
| 139 | * @throws \Google\Service\Exception
|
---|
| 140 | */
|
---|
| 141 | public function update($groupKey, Group $postBody, $optParams = [])
|
---|
| 142 | {
|
---|
| 143 | $params = ['groupKey' => $groupKey, 'postBody' => $postBody];
|
---|
| 144 | $params = array_merge($params, $optParams);
|
---|
| 145 | return $this->call('update', [$params], Group::class);
|
---|
| 146 | }
|
---|
| 147 | }
|
---|
| 148 |
|
---|
| 149 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 150 | class_alias(Groups::class, 'Google_Service_Directory_Resource_Groups');
|
---|