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\Directory\Resource; 19 20use Google\Service\Directory\Member; 21use Google\Service\Directory\Members as MembersModel; 22use 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 */ 32class 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 */ 44 public function delete($groupKey, $memberKey, $optParams = []) 45 { 46 $params = ['groupKey' => $groupKey, 'memberKey' => $memberKey]; 47 $params = array_merge($params, $optParams); 48 return $this->call('delete', [$params]); 49 } 50 /** 51 * Retrieves a group member's properties. (members.get) 52 * 53 * @param string $groupKey Identifies the group in the API request. The value 54 * can be the group's email address, group alias, or the unique group ID. 55 * @param string $memberKey Identifies the group member in the API request. A 56 * group member can be a user or another group. The value can be the member's 57 * (group or user) primary email address, alias, or unique ID. 58 * @param array $optParams Optional parameters. 59 * @return Member 60 */ 61 public function get($groupKey, $memberKey, $optParams = []) 62 { 63 $params = ['groupKey' => $groupKey, 'memberKey' => $memberKey]; 64 $params = array_merge($params, $optParams); 65 return $this->call('get', [$params], Member::class); 66 } 67 /** 68 * Checks whether the given user is a member of the group. Membership can be 69 * direct or nested. (members.hasMember) 70 * 71 * @param string $groupKey Identifies the group in the API request. The value 72 * can be the group's email address, group alias, or the unique group ID. 73 * @param string $memberKey Identifies the user member in the API request. The 74 * value can be the user's primary email address, alias, or unique ID. 75 * @param array $optParams Optional parameters. 76 * @return MembersHasMember 77 */ 78 public function hasMember($groupKey, $memberKey, $optParams = []) 79 { 80 $params = ['groupKey' => $groupKey, 'memberKey' => $memberKey]; 81 $params = array_merge($params, $optParams); 82 return $this->call('hasMember', [$params], MembersHasMember::class); 83 } 84 /** 85 * Adds a user to the specified group. (members.insert) 86 * 87 * @param string $groupKey Identifies the group in the API request. The value 88 * can be the group's email address, group alias, or the unique group ID. 89 * @param Member $postBody 90 * @param array $optParams Optional parameters. 91 * @return Member 92 */ 93 public function insert($groupKey, Member $postBody, $optParams = []) 94 { 95 $params = ['groupKey' => $groupKey, 'postBody' => $postBody]; 96 $params = array_merge($params, $optParams); 97 return $this->call('insert', [$params], Member::class); 98 } 99 /** 100 * Retrieves a paginated list of all members in a group. (members.listMembers) 101 * 102 * @param string $groupKey Identifies the group in the API request. The value 103 * can be the group's email address, group alias, or the unique group ID. 104 * @param array $optParams Optional parameters. 105 * 106 * @opt_param bool includeDerivedMembership Whether to list indirect 107 * memberships. Default: false. 108 * @opt_param int maxResults Maximum number of results to return. Max allowed 109 * value is 200. 110 * @opt_param string pageToken Token to specify next page in the list. 111 * @opt_param string roles The `roles` query parameter allows you to retrieve 112 * group members by role. Allowed values are `OWNER`, `MANAGER`, and `MEMBER`. 113 * @return MembersModel 114 */ 115 public function listMembers($groupKey, $optParams = []) 116 { 117 $params = ['groupKey' => $groupKey]; 118 $params = array_merge($params, $optParams); 119 return $this->call('list', [$params], MembersModel::class); 120 } 121 /** 122 * Updates the membership properties of a user in the specified group. This 123 * method supports [patch semantics](/admin- 124 * sdk/directory/v1/guides/performance#patch). (members.patch) 125 * 126 * @param string $groupKey Identifies the group in the API request. The value 127 * can be the group's email address, group alias, or the unique group ID. 128 * @param string $memberKey Identifies the group member in the API request. A 129 * group member can be a user or another group. The value can be the member's 130 * (group or user) primary email address, alias, or unique ID. 131 * @param Member $postBody 132 * @param array $optParams Optional parameters. 133 * @return Member 134 */ 135 public function patch($groupKey, $memberKey, Member $postBody, $optParams = []) 136 { 137 $params = ['groupKey' => $groupKey, 'memberKey' => $memberKey, 'postBody' => $postBody]; 138 $params = array_merge($params, $optParams); 139 return $this->call('patch', [$params], Member::class); 140 } 141 /** 142 * Updates the membership of a user in the specified group. (members.update) 143 * 144 * @param string $groupKey Identifies the group in the API request. The value 145 * can be the group's email address, group alias, or the unique group ID. 146 * @param string $memberKey Identifies the group member in the API request. A 147 * group member can be a user or another group. The value can be the member's 148 * (group or user) primary email address, alias, or unique ID. 149 * @param Member $postBody 150 * @param array $optParams Optional parameters. 151 * @return Member 152 */ 153 public function update($groupKey, $memberKey, Member $postBody, $optParams = []) 154 { 155 $params = ['groupKey' => $groupKey, 'memberKey' => $memberKey, 'postBody' => $postBody]; 156 $params = array_merge($params, $optParams); 157 return $this->call('update', [$params], Member::class); 158 } 159} 160 161// Adding a class alias for backwards compatibility with the previous class name. 162class_alias(Members::class, 'Google_Service_Directory_Resource_Members'); 163