[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\PeopleService\Resource;
|
---|
| 19 |
|
---|
| 20 | use Google\Service\PeopleService\BatchCreateContactsRequest;
|
---|
| 21 | use Google\Service\PeopleService\BatchCreateContactsResponse;
|
---|
| 22 | use Google\Service\PeopleService\BatchDeleteContactsRequest;
|
---|
| 23 | use Google\Service\PeopleService\BatchUpdateContactsRequest;
|
---|
| 24 | use Google\Service\PeopleService\BatchUpdateContactsResponse;
|
---|
| 25 | use Google\Service\PeopleService\DeleteContactPhotoResponse;
|
---|
| 26 | use Google\Service\PeopleService\GetPeopleResponse;
|
---|
| 27 | use Google\Service\PeopleService\ListDirectoryPeopleResponse;
|
---|
| 28 | use Google\Service\PeopleService\PeopleEmpty;
|
---|
| 29 | use Google\Service\PeopleService\Person;
|
---|
| 30 | use Google\Service\PeopleService\SearchDirectoryPeopleResponse;
|
---|
| 31 | use Google\Service\PeopleService\SearchResponse;
|
---|
| 32 | use Google\Service\PeopleService\UpdateContactPhotoRequest;
|
---|
| 33 | use Google\Service\PeopleService\UpdateContactPhotoResponse;
|
---|
| 34 |
|
---|
| 35 | /**
|
---|
| 36 | * The "people" collection of methods.
|
---|
| 37 | * Typical usage is:
|
---|
| 38 | * <code>
|
---|
| 39 | * $peopleService = new Google\Service\PeopleService(...);
|
---|
| 40 | * $people = $peopleService->people;
|
---|
| 41 | * </code>
|
---|
| 42 | */
|
---|
| 43 | class People extends \Google\Service\Resource
|
---|
| 44 | {
|
---|
| 45 | /**
|
---|
| 46 | * Create a batch of new contacts and return the PersonResponses for the newly
|
---|
| 47 | * Mutate requests for the same user should be sent sequentially to avoid
|
---|
| 48 | * increased latency and failures. (people.batchCreateContacts)
|
---|
| 49 | *
|
---|
| 50 | * @param BatchCreateContactsRequest $postBody
|
---|
| 51 | * @param array $optParams Optional parameters.
|
---|
| 52 | * @return BatchCreateContactsResponse
|
---|
| 53 | * @throws \Google\Service\Exception
|
---|
| 54 | */
|
---|
| 55 | public function batchCreateContacts(BatchCreateContactsRequest $postBody, $optParams = [])
|
---|
| 56 | {
|
---|
| 57 | $params = ['postBody' => $postBody];
|
---|
| 58 | $params = array_merge($params, $optParams);
|
---|
| 59 | return $this->call('batchCreateContacts', [$params], BatchCreateContactsResponse::class);
|
---|
| 60 | }
|
---|
| 61 | /**
|
---|
| 62 | * Delete a batch of contacts. Any non-contact data will not be deleted. Mutate
|
---|
| 63 | * requests for the same user should be sent sequentially to avoid increased
|
---|
| 64 | * latency and failures. (people.batchDeleteContacts)
|
---|
| 65 | *
|
---|
| 66 | * @param BatchDeleteContactsRequest $postBody
|
---|
| 67 | * @param array $optParams Optional parameters.
|
---|
| 68 | * @return PeopleEmpty
|
---|
| 69 | * @throws \Google\Service\Exception
|
---|
| 70 | */
|
---|
| 71 | public function batchDeleteContacts(BatchDeleteContactsRequest $postBody, $optParams = [])
|
---|
| 72 | {
|
---|
| 73 | $params = ['postBody' => $postBody];
|
---|
| 74 | $params = array_merge($params, $optParams);
|
---|
| 75 | return $this->call('batchDeleteContacts', [$params], PeopleEmpty::class);
|
---|
| 76 | }
|
---|
| 77 | /**
|
---|
| 78 | * Update a batch of contacts and return a map of resource names to
|
---|
| 79 | * PersonResponses for the updated contacts. Mutate requests for the same user
|
---|
| 80 | * should be sent sequentially to avoid increased latency and failures.
|
---|
| 81 | * (people.batchUpdateContacts)
|
---|
| 82 | *
|
---|
| 83 | * @param BatchUpdateContactsRequest $postBody
|
---|
| 84 | * @param array $optParams Optional parameters.
|
---|
| 85 | * @return BatchUpdateContactsResponse
|
---|
| 86 | * @throws \Google\Service\Exception
|
---|
| 87 | */
|
---|
| 88 | public function batchUpdateContacts(BatchUpdateContactsRequest $postBody, $optParams = [])
|
---|
| 89 | {
|
---|
| 90 | $params = ['postBody' => $postBody];
|
---|
| 91 | $params = array_merge($params, $optParams);
|
---|
| 92 | return $this->call('batchUpdateContacts', [$params], BatchUpdateContactsResponse::class);
|
---|
| 93 | }
|
---|
| 94 | /**
|
---|
| 95 | * Create a new contact and return the person resource for that contact. The
|
---|
| 96 | * request returns a 400 error if more than one field is specified on a field
|
---|
| 97 | * that is a singleton for contact sources: * biographies * birthdays * genders
|
---|
| 98 | * * names Mutate requests for the same user should be sent sequentially to
|
---|
| 99 | * avoid increased latency and failures. (people.createContact)
|
---|
| 100 | *
|
---|
| 101 | * @param Person $postBody
|
---|
| 102 | * @param array $optParams Optional parameters.
|
---|
| 103 | *
|
---|
| 104 | * @opt_param string personFields Required. A field mask to restrict which
|
---|
| 105 | * fields on each person are returned. Multiple fields can be specified by
|
---|
| 106 | * separating them with commas. Defaults to all fields if not set. Valid values
|
---|
| 107 | * are: * addresses * ageRanges * biographies * birthdays * calendarUrls *
|
---|
| 108 | * clientData * coverPhotos * emailAddresses * events * externalIds * genders *
|
---|
| 109 | * imClients * interests * locales * locations * memberships * metadata *
|
---|
| 110 | * miscKeywords * names * nicknames * occupations * organizations * phoneNumbers
|
---|
| 111 | * * photos * relations * sipAddresses * skills * urls * userDefined
|
---|
| 112 | * @opt_param string sources Optional. A mask of what source types to return.
|
---|
| 113 | * Defaults to READ_SOURCE_TYPE_CONTACT and READ_SOURCE_TYPE_PROFILE if not set.
|
---|
| 114 | * @return Person
|
---|
| 115 | * @throws \Google\Service\Exception
|
---|
| 116 | */
|
---|
| 117 | public function createContact(Person $postBody, $optParams = [])
|
---|
| 118 | {
|
---|
| 119 | $params = ['postBody' => $postBody];
|
---|
| 120 | $params = array_merge($params, $optParams);
|
---|
| 121 | return $this->call('createContact', [$params], Person::class);
|
---|
| 122 | }
|
---|
| 123 | /**
|
---|
| 124 | * Delete a contact person. Any non-contact data will not be deleted. Mutate
|
---|
| 125 | * requests for the same user should be sent sequentially to avoid increased
|
---|
| 126 | * latency and failures. (people.deleteContact)
|
---|
| 127 | *
|
---|
| 128 | * @param string $resourceName Required. The resource name of the contact to
|
---|
| 129 | * delete.
|
---|
| 130 | * @param array $optParams Optional parameters.
|
---|
| 131 | * @return PeopleEmpty
|
---|
| 132 | * @throws \Google\Service\Exception
|
---|
| 133 | */
|
---|
| 134 | public function deleteContact($resourceName, $optParams = [])
|
---|
| 135 | {
|
---|
| 136 | $params = ['resourceName' => $resourceName];
|
---|
| 137 | $params = array_merge($params, $optParams);
|
---|
| 138 | return $this->call('deleteContact', [$params], PeopleEmpty::class);
|
---|
| 139 | }
|
---|
| 140 | /**
|
---|
| 141 | * Delete a contact's photo. Mutate requests for the same user should be done
|
---|
| 142 | * sequentially to avoid // lock contention. (people.deleteContactPhoto)
|
---|
| 143 | *
|
---|
| 144 | * @param string $resourceName Required. The resource name of the contact whose
|
---|
| 145 | * photo will be deleted.
|
---|
| 146 | * @param array $optParams Optional parameters.
|
---|
| 147 | *
|
---|
| 148 | * @opt_param string personFields Optional. A field mask to restrict which
|
---|
| 149 | * fields on the person are returned. Multiple fields can be specified by
|
---|
| 150 | * separating them with commas. Defaults to empty if not set, which will skip
|
---|
| 151 | * the post mutate get. Valid values are: * addresses * ageRanges * biographies
|
---|
| 152 | * * birthdays * calendarUrls * clientData * coverPhotos * emailAddresses *
|
---|
| 153 | * events * externalIds * genders * imClients * interests * locales * locations
|
---|
| 154 | * * memberships * metadata * miscKeywords * names * nicknames * occupations *
|
---|
| 155 | * organizations * phoneNumbers * photos * relations * sipAddresses * skills *
|
---|
| 156 | * urls * userDefined
|
---|
| 157 | * @opt_param string sources Optional. A mask of what source types to return.
|
---|
| 158 | * Defaults to READ_SOURCE_TYPE_CONTACT and READ_SOURCE_TYPE_PROFILE if not set.
|
---|
| 159 | * @return DeleteContactPhotoResponse
|
---|
| 160 | * @throws \Google\Service\Exception
|
---|
| 161 | */
|
---|
| 162 | public function deleteContactPhoto($resourceName, $optParams = [])
|
---|
| 163 | {
|
---|
| 164 | $params = ['resourceName' => $resourceName];
|
---|
| 165 | $params = array_merge($params, $optParams);
|
---|
| 166 | return $this->call('deleteContactPhoto', [$params], DeleteContactPhotoResponse::class);
|
---|
| 167 | }
|
---|
| 168 | /**
|
---|
| 169 | * Provides information about a person by specifying a resource name. Use
|
---|
| 170 | * `people/me` to indicate the authenticated user. The request returns a 400
|
---|
| 171 | * error if 'personFields' is not specified. (people.get)
|
---|
| 172 | *
|
---|
| 173 | * @param string $resourceName Required. The resource name of the person to
|
---|
| 174 | * provide information about. - To get information about the authenticated user,
|
---|
| 175 | * specify `people/me`. - To get information about a google account, specify
|
---|
| 176 | * `people/{account_id}`. - To get information about a contact, specify the
|
---|
| 177 | * resource name that identifies the contact as returned by
|
---|
| 178 | * `people.connections.list`.
|
---|
| 179 | * @param array $optParams Optional parameters.
|
---|
| 180 | *
|
---|
| 181 | * @opt_param string personFields Required. A field mask to restrict which
|
---|
| 182 | * fields on the person are returned. Multiple fields can be specified by
|
---|
| 183 | * separating them with commas. Valid values are: * addresses * ageRanges *
|
---|
| 184 | * biographies * birthdays * calendarUrls * clientData * coverPhotos *
|
---|
| 185 | * emailAddresses * events * externalIds * genders * imClients * interests *
|
---|
| 186 | * locales * locations * memberships * metadata * miscKeywords * names *
|
---|
| 187 | * nicknames * occupations * organizations * phoneNumbers * photos * relations *
|
---|
| 188 | * sipAddresses * skills * urls * userDefined
|
---|
| 189 | * @opt_param string requestMask.includeField Required. Comma-separated list of
|
---|
| 190 | * person fields to be included in the response. Each path should start with
|
---|
| 191 | * `person.`: for example, `person.names` or `person.photos`.
|
---|
| 192 | * @opt_param string sources Optional. A mask of what source types to return.
|
---|
| 193 | * Defaults to READ_SOURCE_TYPE_PROFILE and READ_SOURCE_TYPE_CONTACT if not set.
|
---|
| 194 | * @return Person
|
---|
| 195 | * @throws \Google\Service\Exception
|
---|
| 196 | */
|
---|
| 197 | public function get($resourceName, $optParams = [])
|
---|
| 198 | {
|
---|
| 199 | $params = ['resourceName' => $resourceName];
|
---|
| 200 | $params = array_merge($params, $optParams);
|
---|
| 201 | return $this->call('get', [$params], Person::class);
|
---|
| 202 | }
|
---|
| 203 | /**
|
---|
| 204 | * Provides information about a list of specific people by specifying a list of
|
---|
| 205 | * requested resource names. Use `people/me` to indicate the authenticated user.
|
---|
| 206 | * The request returns a 400 error if 'personFields' is not specified.
|
---|
| 207 | * (people.getBatchGet)
|
---|
| 208 | *
|
---|
| 209 | * @param array $optParams Optional parameters.
|
---|
| 210 | *
|
---|
| 211 | * @opt_param string personFields Required. A field mask to restrict which
|
---|
| 212 | * fields on each person are returned. Multiple fields can be specified by
|
---|
| 213 | * separating them with commas. Valid values are: * addresses * ageRanges *
|
---|
| 214 | * biographies * birthdays * calendarUrls * clientData * coverPhotos *
|
---|
| 215 | * emailAddresses * events * externalIds * genders * imClients * interests *
|
---|
| 216 | * locales * locations * memberships * metadata * miscKeywords * names *
|
---|
| 217 | * nicknames * occupations * organizations * phoneNumbers * photos * relations *
|
---|
| 218 | * sipAddresses * skills * urls * userDefined
|
---|
| 219 | * @opt_param string requestMask.includeField Required. Comma-separated list of
|
---|
| 220 | * person fields to be included in the response. Each path should start with
|
---|
| 221 | * `person.`: for example, `person.names` or `person.photos`.
|
---|
| 222 | * @opt_param string resourceNames Required. The resource names of the people to
|
---|
| 223 | * provide information about. It's repeatable. The URL query parameter should be
|
---|
| 224 | * resourceNames=&resourceNames=&... - To get information about the
|
---|
| 225 | * authenticated user, specify `people/me`. - To get information about a google
|
---|
| 226 | * account, specify `people/{account_id}`. - To get information about a contact,
|
---|
| 227 | * specify the resource name that identifies the contact as returned by
|
---|
| 228 | * `people.connections.list`. There is a maximum of 200 resource names.
|
---|
| 229 | * @opt_param string sources Optional. A mask of what source types to return.
|
---|
| 230 | * Defaults to READ_SOURCE_TYPE_CONTACT and READ_SOURCE_TYPE_PROFILE if not set.
|
---|
| 231 | * @return GetPeopleResponse
|
---|
| 232 | * @throws \Google\Service\Exception
|
---|
| 233 | */
|
---|
| 234 | public function getBatchGet($optParams = [])
|
---|
| 235 | {
|
---|
| 236 | $params = [];
|
---|
| 237 | $params = array_merge($params, $optParams);
|
---|
| 238 | return $this->call('getBatchGet', [$params], GetPeopleResponse::class);
|
---|
| 239 | }
|
---|
| 240 | /**
|
---|
| 241 | * Provides a list of domain profiles and domain contacts in the authenticated
|
---|
| 242 | * user's domain directory. When the `sync_token` is specified, resources
|
---|
| 243 | * deleted since the last sync will be returned as a person with
|
---|
| 244 | * `PersonMetadata.deleted` set to true. When the `page_token` or `sync_token`
|
---|
| 245 | * is specified, all other request parameters must match the first call. Writes
|
---|
| 246 | * may have a propagation delay of several minutes for sync requests.
|
---|
| 247 | * Incremental syncs are not intended for read-after-write use cases. See
|
---|
| 248 | * example usage at [List the directory people that have
|
---|
| 249 | * changed](/people/v1/directory#list_the_directory_people_that_have_changed).
|
---|
| 250 | * (people.listDirectoryPeople)
|
---|
| 251 | *
|
---|
| 252 | * @param array $optParams Optional parameters.
|
---|
| 253 | *
|
---|
| 254 | * @opt_param string mergeSources Optional. Additional data to merge into the
|
---|
| 255 | * directory sources if they are connected through verified join keys such as
|
---|
| 256 | * email addresses or phone numbers.
|
---|
| 257 | * @opt_param int pageSize Optional. The number of people to include in the
|
---|
| 258 | * response. Valid values are between 1 and 1000, inclusive. Defaults to 100 if
|
---|
| 259 | * not set or set to 0.
|
---|
| 260 | * @opt_param string pageToken Optional. A page token, received from a previous
|
---|
| 261 | * response `next_page_token`. Provide this to retrieve the subsequent page.
|
---|
| 262 | * When paginating, all other parameters provided to
|
---|
| 263 | * `people.listDirectoryPeople` must match the first call that provided the page
|
---|
| 264 | * token.
|
---|
| 265 | * @opt_param string readMask Required. A field mask to restrict which fields on
|
---|
| 266 | * each person are returned. Multiple fields can be specified by separating them
|
---|
| 267 | * with commas. Valid values are: * addresses * ageRanges * biographies *
|
---|
| 268 | * birthdays * calendarUrls * clientData * coverPhotos * emailAddresses * events
|
---|
| 269 | * * externalIds * genders * imClients * interests * locales * locations *
|
---|
| 270 | * memberships * metadata * miscKeywords * names * nicknames * occupations *
|
---|
| 271 | * organizations * phoneNumbers * photos * relations * sipAddresses * skills *
|
---|
| 272 | * urls * userDefined
|
---|
| 273 | * @opt_param bool requestSyncToken Optional. Whether the response should return
|
---|
| 274 | * `next_sync_token`. It can be used to get incremental changes since the last
|
---|
| 275 | * request by setting it on the request `sync_token`. More details about sync
|
---|
| 276 | * behavior at `people.listDirectoryPeople`.
|
---|
| 277 | * @opt_param string sources Required. Directory sources to return.
|
---|
| 278 | * @opt_param string syncToken Optional. A sync token, received from a previous
|
---|
| 279 | * response `next_sync_token` Provide this to retrieve only the resources
|
---|
| 280 | * changed since the last request. When syncing, all other parameters provided
|
---|
| 281 | * to `people.listDirectoryPeople` must match the first call that provided the
|
---|
| 282 | * sync token. More details about sync behavior at `people.listDirectoryPeople`.
|
---|
| 283 | * @return ListDirectoryPeopleResponse
|
---|
| 284 | * @throws \Google\Service\Exception
|
---|
| 285 | */
|
---|
| 286 | public function listDirectoryPeople($optParams = [])
|
---|
| 287 | {
|
---|
| 288 | $params = [];
|
---|
| 289 | $params = array_merge($params, $optParams);
|
---|
| 290 | return $this->call('listDirectoryPeople', [$params], ListDirectoryPeopleResponse::class);
|
---|
| 291 | }
|
---|
| 292 | /**
|
---|
| 293 | * Provides a list of contacts in the authenticated user's grouped contacts that
|
---|
| 294 | * matches the search query. The query matches on a contact's `names`,
|
---|
| 295 | * `nickNames`, `emailAddresses`, `phoneNumbers`, and `organizations` fields
|
---|
| 296 | * that are from the CONTACT source. **IMPORTANT**: Before searching, clients
|
---|
| 297 | * should send a warmup request with an empty query to update the cache. See
|
---|
| 298 | * https://developers.google.com/people/v1/contacts#search_the_users_contacts
|
---|
| 299 | * (people.searchContacts)
|
---|
| 300 | *
|
---|
| 301 | * @param array $optParams Optional parameters.
|
---|
| 302 | *
|
---|
| 303 | * @opt_param int pageSize Optional. The number of results to return. Defaults
|
---|
| 304 | * to 10 if field is not set, or set to 0. Values greater than 30 will be capped
|
---|
| 305 | * to 30.
|
---|
| 306 | * @opt_param string query Required. The plain-text query for the request. The
|
---|
| 307 | * query is used to match prefix phrases of the fields on a person. For example,
|
---|
| 308 | * a person with name "foo name" matches queries such as "f", "fo", "foo", "foo
|
---|
| 309 | * n", "nam", etc., but not "oo n".
|
---|
| 310 | * @opt_param string readMask Required. A field mask to restrict which fields on
|
---|
| 311 | * each person are returned. Multiple fields can be specified by separating them
|
---|
| 312 | * with commas. Valid values are: * addresses * ageRanges * biographies *
|
---|
| 313 | * birthdays * calendarUrls * clientData * coverPhotos * emailAddresses * events
|
---|
| 314 | * * externalIds * genders * imClients * interests * locales * locations *
|
---|
| 315 | * memberships * metadata * miscKeywords * names * nicknames * occupations *
|
---|
| 316 | * organizations * phoneNumbers * photos * relations * sipAddresses * skills *
|
---|
| 317 | * urls * userDefined
|
---|
| 318 | * @opt_param string sources Optional. A mask of what source types to return.
|
---|
| 319 | * Defaults to READ_SOURCE_TYPE_CONTACT if not set.
|
---|
| 320 | * @return SearchResponse
|
---|
| 321 | * @throws \Google\Service\Exception
|
---|
| 322 | */
|
---|
| 323 | public function searchContacts($optParams = [])
|
---|
| 324 | {
|
---|
| 325 | $params = [];
|
---|
| 326 | $params = array_merge($params, $optParams);
|
---|
| 327 | return $this->call('searchContacts', [$params], SearchResponse::class);
|
---|
| 328 | }
|
---|
| 329 | /**
|
---|
| 330 | * Provides a list of domain profiles and domain contacts in the authenticated
|
---|
| 331 | * user's domain directory that match the search query.
|
---|
| 332 | * (people.searchDirectoryPeople)
|
---|
| 333 | *
|
---|
| 334 | * @param array $optParams Optional parameters.
|
---|
| 335 | *
|
---|
| 336 | * @opt_param string mergeSources Optional. Additional data to merge into the
|
---|
| 337 | * directory sources if they are connected through verified join keys such as
|
---|
| 338 | * email addresses or phone numbers.
|
---|
| 339 | * @opt_param int pageSize Optional. The number of people to include in the
|
---|
| 340 | * response. Valid values are between 1 and 500, inclusive. Defaults to 100 if
|
---|
| 341 | * not set or set to 0.
|
---|
| 342 | * @opt_param string pageToken Optional. A page token, received from a previous
|
---|
| 343 | * response `next_page_token`. Provide this to retrieve the subsequent page.
|
---|
| 344 | * When paginating, all other parameters provided to `SearchDirectoryPeople`
|
---|
| 345 | * must match the first call that provided the page token.
|
---|
| 346 | * @opt_param string query Required. Prefix query that matches fields in the
|
---|
| 347 | * person. Does NOT use the read_mask for determining what fields to match.
|
---|
| 348 | * @opt_param string readMask Required. A field mask to restrict which fields on
|
---|
| 349 | * each person are returned. Multiple fields can be specified by separating them
|
---|
| 350 | * with commas. Valid values are: * addresses * ageRanges * biographies *
|
---|
| 351 | * birthdays * calendarUrls * clientData * coverPhotos * emailAddresses * events
|
---|
| 352 | * * externalIds * genders * imClients * interests * locales * locations *
|
---|
| 353 | * memberships * metadata * miscKeywords * names * nicknames * occupations *
|
---|
| 354 | * organizations * phoneNumbers * photos * relations * sipAddresses * skills *
|
---|
| 355 | * urls * userDefined
|
---|
| 356 | * @opt_param string sources Required. Directory sources to return.
|
---|
| 357 | * @return SearchDirectoryPeopleResponse
|
---|
| 358 | * @throws \Google\Service\Exception
|
---|
| 359 | */
|
---|
| 360 | public function searchDirectoryPeople($optParams = [])
|
---|
| 361 | {
|
---|
| 362 | $params = [];
|
---|
| 363 | $params = array_merge($params, $optParams);
|
---|
| 364 | return $this->call('searchDirectoryPeople', [$params], SearchDirectoryPeopleResponse::class);
|
---|
| 365 | }
|
---|
| 366 | /**
|
---|
| 367 | * Update contact data for an existing contact person. Any non-contact data will
|
---|
| 368 | * not be modified. Any non-contact data in the person to update will be
|
---|
| 369 | * ignored. All fields specified in the `update_mask` will be replaced. The
|
---|
| 370 | * server returns a 400 error if `person.metadata.sources` is not specified for
|
---|
| 371 | * the contact to be updated or if there is no contact source. The server
|
---|
| 372 | * returns a 400 error with reason `"failedPrecondition"` if
|
---|
| 373 | * `person.metadata.sources.etag` is different than the contact's etag, which
|
---|
| 374 | * indicates the contact has changed since its data was read. Clients should get
|
---|
| 375 | * the latest person and merge their updates into the latest person. The server
|
---|
| 376 | * returns a 400 error if `memberships` are being updated and there are no
|
---|
| 377 | * contact group memberships specified on the person. The server returns a 400
|
---|
| 378 | * error if more than one field is specified on a field that is a singleton for
|
---|
| 379 | * contact sources: * biographies * birthdays * genders * names Mutate requests
|
---|
| 380 | * for the same user should be sent sequentially to avoid increased latency and
|
---|
| 381 | * failures. (people.updateContact)
|
---|
| 382 | *
|
---|
| 383 | * @param string $resourceName The resource name for the person, assigned by the
|
---|
| 384 | * server. An ASCII string in the form of `people/{person_id}`.
|
---|
| 385 | * @param Person $postBody
|
---|
| 386 | * @param array $optParams Optional parameters.
|
---|
| 387 | *
|
---|
| 388 | * @opt_param string personFields Optional. A field mask to restrict which
|
---|
| 389 | * fields on each person are returned. Multiple fields can be specified by
|
---|
| 390 | * separating them with commas. Defaults to all fields if not set. Valid values
|
---|
| 391 | * are: * addresses * ageRanges * biographies * birthdays * calendarUrls *
|
---|
| 392 | * clientData * coverPhotos * emailAddresses * events * externalIds * genders *
|
---|
| 393 | * imClients * interests * locales * locations * memberships * metadata *
|
---|
| 394 | * miscKeywords * names * nicknames * occupations * organizations * phoneNumbers
|
---|
| 395 | * * photos * relations * sipAddresses * skills * urls * userDefined
|
---|
| 396 | * @opt_param string sources Optional. A mask of what source types to return.
|
---|
| 397 | * Defaults to READ_SOURCE_TYPE_CONTACT and READ_SOURCE_TYPE_PROFILE if not set.
|
---|
| 398 | * @opt_param string updatePersonFields Required. A field mask to restrict which
|
---|
| 399 | * fields on the person are updated. Multiple fields can be specified by
|
---|
| 400 | * separating them with commas. All updated fields will be replaced. Valid
|
---|
| 401 | * values are: * addresses * biographies * birthdays * calendarUrls * clientData
|
---|
| 402 | * * emailAddresses * events * externalIds * genders * imClients * interests *
|
---|
| 403 | * locales * locations * memberships * miscKeywords * names * nicknames *
|
---|
| 404 | * occupations * organizations * phoneNumbers * relations * sipAddresses * urls
|
---|
| 405 | * * userDefined
|
---|
| 406 | * @return Person
|
---|
| 407 | * @throws \Google\Service\Exception
|
---|
| 408 | */
|
---|
| 409 | public function updateContact($resourceName, Person $postBody, $optParams = [])
|
---|
| 410 | {
|
---|
| 411 | $params = ['resourceName' => $resourceName, 'postBody' => $postBody];
|
---|
| 412 | $params = array_merge($params, $optParams);
|
---|
| 413 | return $this->call('updateContact', [$params], Person::class);
|
---|
| 414 | }
|
---|
| 415 | /**
|
---|
| 416 | * Update a contact's photo. Mutate requests for the same user should be sent
|
---|
| 417 | * sequentially to avoid increased latency and failures.
|
---|
| 418 | * (people.updateContactPhoto)
|
---|
| 419 | *
|
---|
| 420 | * @param string $resourceName Required. Person resource name
|
---|
| 421 | * @param UpdateContactPhotoRequest $postBody
|
---|
| 422 | * @param array $optParams Optional parameters.
|
---|
| 423 | * @return UpdateContactPhotoResponse
|
---|
| 424 | * @throws \Google\Service\Exception
|
---|
| 425 | */
|
---|
| 426 | public function updateContactPhoto($resourceName, UpdateContactPhotoRequest $postBody, $optParams = [])
|
---|
| 427 | {
|
---|
| 428 | $params = ['resourceName' => $resourceName, 'postBody' => $postBody];
|
---|
| 429 | $params = array_merge($params, $optParams);
|
---|
| 430 | return $this->call('updateContactPhoto', [$params], UpdateContactPhotoResponse::class);
|
---|
| 431 | }
|
---|
| 432 | }
|
---|
| 433 |
|
---|
| 434 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
| 435 | class_alias(People::class, 'Google_Service_PeopleService_Resource_People');
|
---|