[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\Member;
|
---|
| 21 | use Google\Service\Directory\Members as MembersModel;
|
---|
| 22 | use Google\Service\Directory\MembersHasMember;
|
---|
| 23 |
|
---|
| 24 | /**
|
---|
| 25 | * The "members" collection of methods.
|
---|
| 26 | * Typical usage is:
|
---|
| 27 | * <code>
|
---|
| 28 | * $adminService = new Google\Service\Directory(...);
|
---|
| 29 | * $members = $adminService->members;
|
---|
| 30 | * </code>
|
---|
| 31 | */
|
---|
| 32 | class Members extends \Google\Service\Resource
|
---|
| 33 | {
|
---|
| 34 | /**
|
---|
| 35 | * Removes a member from a group. (members.delete)
|
---|
| 36 | *
|
---|
| 37 | * @param string $groupKey Identifies the group in the API request. The value
|
---|
| 38 | * can be the group's email address, group alias, or the unique group ID.
|
---|
| 39 | * @param string $memberKey Identifies the group member in the API request. A
|
---|
| 40 | * group member can be a user or another group. The value can be the member's
|
---|
| 41 | * (group or user) primary email address, alias, or unique ID.
|
---|
| 42 | * @param array $optParams Optional parameters.
|
---|
| 43 | * @throws \Google\Service\Exception
|
---|
| 44 | */
|
---|
| 45 | public function delete($groupKey, $memberKey, $optParams = [])
|
---|
| 46 | {
|
---|
| 47 | $params = ['groupKey' => $groupKey, 'memberKey' => $memberKey];
|
---|
| 48 | $params = array_merge($params, $optParams);
|
---|
| 49 | return $this->call('delete', [$params]);
|
---|
| 50 | }
|
---|
| 51 | /**
|
---|
| 52 | * Retrieves a group member's properties. (members.get)
|
---|
| 53 | *
|
---|
| 54 | * @param string $groupKey Identifies the group in the API request. The value
|
---|
| 55 | * can be the group's email address, group alias, or the unique group ID.
|
---|
| 56 | * @param string $memberKey Identifies the group member in the API request. A
|
---|
| 57 | * group member can be a user or another group. The value can be the member's
|
---|
| 58 | * (group or user) primary email address, alias, or unique ID.
|
---|
| 59 | * @param array $optParams Optional parameters.
|
---|
| 60 | * @return Member
|
---|
| 61 | * @throws \Google\Service\Exception
|
---|
| 62 | */
|
---|
| 63 | public function get($groupKey, $memberKey, $optParams = [])
|
---|
| 64 | {
|
---|
| 65 | $params = ['groupKey' => $groupKey, 'memberKey' => $memberKey];
|
---|
| 66 | $params = array_merge($params, $optParams);
|
---|
| 67 | return $this->call('get', [$params], Member::class);
|
---|
| 68 | }
|
---|
| 69 | /**
|
---|
| 70 | * Checks whether the given user is a member of the group. Membership can be
|
---|
| 71 | * direct or nested, but if nested, the `memberKey` and `groupKey` must be
|
---|
| 72 | * entities in the same domain or an `Invalid input` error is returned. To check
|
---|
| 73 | * for nested memberships that include entities outside of the group's domain,
|
---|
| 74 | * use the [`checkTransitiveMembership()`](https://cloud.google.com/identity/doc
|
---|
| 75 | * s/reference/rest/v1/groups.memberships/checkTransitiveMembership) method in
|
---|
| 76 | * the Cloud Identity Groups API. (members.hasMember)
|
---|
| 77 | *
|
---|
| 78 | * @param string $groupKey Identifies the group in the API request. The value
|
---|
| 79 | * can be the group's email address, group alias, or the unique group ID.
|
---|
| 80 | * @param string $memberKey Identifies the user member in the API request. The
|
---|
| 81 | * value can be the user's primary email address, alias, or unique ID.
|
---|
| 82 | * @param array $optParams Optional parameters.
|
---|
| 83 | * @return MembersHasMember
|
---|
| 84 | * @throws \Google\Service\Exception
|
---|
| 85 | */
|
---|
| 86 | public function hasMember($groupKey, $memberKey, $optParams = [])
|
---|
| 87 | {
|
---|
| 88 | $params = ['groupKey' => $groupKey, 'memberKey' => $memberKey];
|
---|
| 89 | $params = array_merge($params, $optParams);
|
---|
| 90 | return $this->call('hasMember', [$params], MembersHasMember::class);
|
---|
| 91 | }
|
---|
| 92 | /**
|
---|
| 93 | * Adds a user to the specified group. (members.insert)
|
---|
| 94 | *
|
---|
| 95 | * @param string $groupKey Identifies the group in the API request. The value
|
---|
| 96 | * can be the group's email address, group alias, or the unique group ID.
|
---|
| 97 | * @param Member $postBody
|
---|
| 98 | * @param array $optParams Optional parameters.
|
---|
| 99 | * @return Member
|
---|
| 100 | * @throws \Google\Service\Exception
|
---|
| 101 | */
|
---|
| 102 | public function insert($groupKey, Member $postBody, $optParams = [])
|
---|
| 103 | {
|
---|
| 104 | $params = ['groupKey' => $groupKey, 'postBody' => $postBody];
|
---|
| 105 | $params = array_merge($params, $optParams);
|
---|
| 106 | return $this->call('insert', [$params], Member::class);
|
---|
| 107 | }
|
---|
| 108 | /**
|
---|
| 109 | * Retrieves a paginated list of all members in a group. This method times out
|
---|
| 110 | * after 60 minutes. For more information, see [Troubleshoot error
|
---|
| 111 | * codes](https://developers.google.com/admin-
|
---|
| 112 | * sdk/directory/v1/guides/troubleshoot-error-codes). (members.listMembers)
|
---|
| 113 | *
|
---|
| 114 | * @param string $groupKey Identifies the group in the API request. The value
|
---|
| 115 | * can be the group's email address, group alias, or the unique group ID.
|
---|
| 116 | * @param array $optParams Optional parameters.
|
---|
| 117 | *
|
---|
| 118 | * @opt_param bool includeDerivedMembership Whether to list indirect
|
---|
| 119 | * memberships. Default: false.
|
---|
| 120 | * @opt_param int maxResults Maximum number of results to return. Max allowed
|
---|
| 121 | * value is 200.
|
---|
| 122 | * @opt_param string pageToken Token to specify next page in the list.
|
---|
| 123 | * @opt_param string roles The `roles` query parameter allows you to retrieve
|
---|
| 124 | * group members by role. Allowed values are `OWNER`, `MANAGER`, and `MEMBER`.
|
---|
| 125 | * @return MembersModel
|
---|
| 126 | * @throws \Google\Service\Exception
|
---|
| 127 | */
|
---|
| 128 | public function listMembers($groupKey, $optParams = [])
|
---|
| 129 | {
|
---|
| 130 | $params = ['groupKey' => $groupKey];
|
---|
| 131 | $params = array_merge($params, $optParams);
|
---|
| 132 | return $this->call('list', [$params], MembersModel::class);
|
---|
| 133 | }
|
---|
| 134 | /**
|
---|
| 135 | * Updates the membership properties of a user in the specified group. This
|
---|
| 136 | * method supports [patch semantics](/admin-
|
---|
| 137 | * sdk/directory/v1/guides/performance#patch). (members.patch)
|
---|
| 138 | *
|
---|
| 139 | * @param string $groupKey Identifies the group in the API request. The value
|
---|
| 140 | * can be the group's email address, group alias, or the unique group ID.
|
---|
| 141 | * @param string $memberKey Identifies the group member in the API request. A
|
---|
| 142 | * group member can be a user or another group. The value can be the member's
|
---|
| 143 | * (group or user) primary email address, alias, or unique ID.
|
---|
| 144 | * @param Member $postBody
|
---|
| 145 | * @param array $optParams Optional parameters.
|
---|
| 146 | * @return Member
|
---|
| 147 | * @throws \Google\Service\Exception
|
---|
| 148 | */
|
---|
| 149 | public function patch($groupKey, $memberKey, Member $postBody, $optParams = [])
|
---|
| 150 | {
|
---|
| 151 | $params = ['groupKey' => $groupKey, 'memberKey' => $memberKey, 'postBody' => $postBody];
|
---|
| 152 | $params = array_merge($params, $optParams);
|
---|
| 153 | return $this->call('patch', [$params], Member::class);
|
---|
| 154 | }
|
---|
| 155 | /**
|
---|
| 156 | * Updates the membership of a user in the specified group. (members.update)
|
---|
| 157 | *
|
---|
| 158 | * @param string $groupKey Identifies the group in the API request. The value
|
---|
| 159 | * can be the group's email address, group alias, or the unique group ID.
|
---|
| 160 | * @param string $memberKey Identifies the group member in the API request. A
|
---|
| 161 | * group member can be a user or another group. The value can be the member's
|
---|
| 162 | * (group or user) primary email address, alias, or unique ID.
|
---|
| 163 | * @param Member $postBody
|
---|
| 164 | * @param array $optParams Optional parameters.
|
---|
| 165 | * @return Member
|
---|
| 166 | * @throws \Google\Service\Exception
|
---|
| 167 | */
|
---|
| 168 | public function update($groupKey, $memberKey, Member $postBody, $optParams = [])
|
---|
| 169 | {
|
---|
| 170 | $params = ['groupKey' => $groupKey, 'memberKey' => $memberKey, 'postBody' => $postBody];
|
---|
| 171 | $params = array_merge($params, $optParams);
|
---|
| 172 | return $this->call('update', [$params], Member::class);
|
---|
| 173 | }
|
---|
| 174 | }
|
---|
| 175 |
|
---|
| 176 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 177 | class_alias(Members::class, 'Google_Service_Directory_Resource_Members');
|
---|