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