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