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\PeopleService\Resource; 19 20use Google\Service\PeopleService\BatchGetContactGroupsResponse; 21use Google\Service\PeopleService\ContactGroup; 22use Google\Service\PeopleService\CreateContactGroupRequest; 23use Google\Service\PeopleService\ListContactGroupsResponse; 24use Google\Service\PeopleService\PeopleEmpty; 25use Google\Service\PeopleService\UpdateContactGroupRequest; 26 27/** 28 * The "contactGroups" collection of methods. 29 * Typical usage is: 30 * <code> 31 * $peopleService = new Google\Service\PeopleService(...); 32 * $contactGroups = $peopleService->contactGroups; 33 * </code> 34 */ 35class ContactGroups extends \Google\Service\Resource 36{ 37 /** 38 * Get a list of contact groups owned by the authenticated user by specifying a 39 * list of contact group resource names. (contactGroups.batchGet) 40 * 41 * @param array $optParams Optional parameters. 42 * 43 * @opt_param string groupFields Optional. A field mask to restrict which fields 44 * on the group are returned. Defaults to `metadata`, `groupType`, 45 * `memberCount`, and `name` if not set or set to empty. Valid fields are: * 46 * clientData * groupType * memberCount * metadata * name 47 * @opt_param int maxMembers Optional. Specifies the maximum number of members 48 * to return for each group. Defaults to 0 if not set, which will return zero 49 * members. 50 * @opt_param string resourceNames Required. The resource names of the contact 51 * groups to get. There is a maximum of 200 resource names. 52 * @return BatchGetContactGroupsResponse 53 */ 54 public function batchGet($optParams = []) 55 { 56 $params = []; 57 $params = array_merge($params, $optParams); 58 return $this->call('batchGet', [$params], BatchGetContactGroupsResponse::class); 59 } 60 /** 61 * Create a new contact group owned by the authenticated user. Created contact 62 * group names must be unique to the users contact groups. Attempting to create 63 * a group with a duplicate name will return a HTTP 409 error. Mutate requests 64 * for the same user should be sent sequentially to avoid increased latency and 65 * failures. (contactGroups.create) 66 * 67 * @param CreateContactGroupRequest $postBody 68 * @param array $optParams Optional parameters. 69 * @return ContactGroup 70 */ 71 public function create(CreateContactGroupRequest $postBody, $optParams = []) 72 { 73 $params = ['postBody' => $postBody]; 74 $params = array_merge($params, $optParams); 75 return $this->call('create', [$params], ContactGroup::class); 76 } 77 /** 78 * Delete an existing contact group owned by the authenticated user by 79 * specifying a contact group resource name. Mutate requests for the same user 80 * should be sent sequentially to avoid increased latency and failures. 81 * (contactGroups.delete) 82 * 83 * @param string $resourceName Required. The resource name of the contact group 84 * to delete. 85 * @param array $optParams Optional parameters. 86 * 87 * @opt_param bool deleteContacts Optional. Set to true to also delete the 88 * contacts in the specified group. 89 * @return PeopleEmpty 90 */ 91 public function delete($resourceName, $optParams = []) 92 { 93 $params = ['resourceName' => $resourceName]; 94 $params = array_merge($params, $optParams); 95 return $this->call('delete', [$params], PeopleEmpty::class); 96 } 97 /** 98 * Get a specific contact group owned by the authenticated user by specifying a 99 * contact group resource name. (contactGroups.get) 100 * 101 * @param string $resourceName Required. The resource name of the contact group 102 * to get. 103 * @param array $optParams Optional parameters. 104 * 105 * @opt_param string groupFields Optional. A field mask to restrict which fields 106 * on the group are returned. Defaults to `metadata`, `groupType`, 107 * `memberCount`, and `name` if not set or set to empty. Valid fields are: * 108 * clientData * groupType * memberCount * metadata * name 109 * @opt_param int maxMembers Optional. Specifies the maximum number of members 110 * to return. Defaults to 0 if not set, which will return zero members. 111 * @return ContactGroup 112 */ 113 public function get($resourceName, $optParams = []) 114 { 115 $params = ['resourceName' => $resourceName]; 116 $params = array_merge($params, $optParams); 117 return $this->call('get', [$params], ContactGroup::class); 118 } 119 /** 120 * List all contact groups owned by the authenticated user. Members of the 121 * contact groups are not populated. (contactGroups.listContactGroups) 122 * 123 * @param array $optParams Optional parameters. 124 * 125 * @opt_param string groupFields Optional. A field mask to restrict which fields 126 * on the group are returned. Defaults to `metadata`, `groupType`, 127 * `memberCount`, and `name` if not set or set to empty. Valid fields are: * 128 * clientData * groupType * memberCount * metadata * name 129 * @opt_param int pageSize Optional. The maximum number of resources to return. 130 * Valid values are between 1 and 1000, inclusive. Defaults to 30 if not set or 131 * set to 0. 132 * @opt_param string pageToken Optional. The next_page_token value returned from 133 * a previous call to 134 * [ListContactGroups](/people/api/rest/v1/contactgroups/list). Requests the 135 * next page of resources. 136 * @opt_param string syncToken Optional. A sync token, returned by a previous 137 * call to `contactgroups.list`. Only resources changed since the sync token was 138 * created will be returned. 139 * @return ListContactGroupsResponse 140 */ 141 public function listContactGroups($optParams = []) 142 { 143 $params = []; 144 $params = array_merge($params, $optParams); 145 return $this->call('list', [$params], ListContactGroupsResponse::class); 146 } 147 /** 148 * Update the name of an existing contact group owned by the authenticated user. 149 * Updated contact group names must be unique to the users contact groups. 150 * Attempting to create a group with a duplicate name will return a HTTP 409 151 * error. Mutate requests for the same user should be sent sequentially to avoid 152 * increased latency and failures. (contactGroups.update) 153 * 154 * @param string $resourceName The resource name for the contact group, assigned 155 * by the server. An ASCII string, in the form of 156 * `contactGroups/{contact_group_id}`. 157 * @param UpdateContactGroupRequest $postBody 158 * @param array $optParams Optional parameters. 159 * @return ContactGroup 160 */ 161 public function update($resourceName, UpdateContactGroupRequest $postBody, $optParams = []) 162 { 163 $params = ['resourceName' => $resourceName, 'postBody' => $postBody]; 164 $params = array_merge($params, $optParams); 165 return $this->call('update', [$params], ContactGroup::class); 166 } 167} 168 169// Adding a class alias for backwards compatibility with the previous class name. 170class_alias(ContactGroups::class, 'Google_Service_PeopleService_Resource_ContactGroups'); 171