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\CopyOtherContactToMyContactsGroupRequest; 21use Google\Service\PeopleService\ListOtherContactsResponse; 22use Google\Service\PeopleService\Person; 23use Google\Service\PeopleService\SearchResponse; 24 25/** 26 * The "otherContacts" collection of methods. 27 * Typical usage is: 28 * <code> 29 * $peopleService = new Google\Service\PeopleService(...); 30 * $otherContacts = $peopleService->otherContacts; 31 * </code> 32 */ 33class OtherContacts extends \Google\Service\Resource 34{ 35 /** 36 * Copies an "Other contact" to a new contact in the user's "myContacts" group 37 * Mutate requests for the same user should be sent sequentially to avoid 38 * increased latency and failures. 39 * (otherContacts.copyOtherContactToMyContactsGroup) 40 * 41 * @param string $resourceName Required. The resource name of the "Other 42 * contact" to copy. 43 * @param CopyOtherContactToMyContactsGroupRequest $postBody 44 * @param array $optParams Optional parameters. 45 * @return Person 46 */ 47 public function copyOtherContactToMyContactsGroup($resourceName, CopyOtherContactToMyContactsGroupRequest $postBody, $optParams = []) 48 { 49 $params = ['resourceName' => $resourceName, 'postBody' => $postBody]; 50 $params = array_merge($params, $optParams); 51 return $this->call('copyOtherContactToMyContactsGroup', [$params], Person::class); 52 } 53 /** 54 * List all "Other contacts", that is contacts that are not in a contact group. 55 * "Other contacts" are typically auto created contacts from interactions. Sync 56 * tokens expire 7 days after the full sync. A request with an expired sync 57 * token will result in a 410 error. In the case of such an error clients should 58 * make a full sync request without a `sync_token`. The first page of a full 59 * sync request has an additional quota. If the quota is exceeded, a 429 error 60 * will be returned. This quota is fixed and can not be increased. When the 61 * `sync_token` is specified, resources deleted since the last sync will be 62 * returned as a person with `PersonMetadata.deleted` set to true. When the 63 * `page_token` or `sync_token` is specified, all other request parameters must 64 * match the first call. Writes may have a propagation delay of several minutes 65 * for sync requests. Incremental syncs are not intended for read-after-write 66 * use cases. See example usage at [List the user's other contacts that have 67 * changed](/people/v1/other- 68 * contacts#list_the_users_other_contacts_that_have_changed). 69 * (otherContacts.listOtherContacts) 70 * 71 * @param array $optParams Optional parameters. 72 * 73 * @opt_param int pageSize Optional. The number of "Other contacts" to include 74 * in the response. Valid values are between 1 and 1000, inclusive. Defaults to 75 * 100 if not set or set to 0. 76 * @opt_param string pageToken Optional. A page token, received from a previous 77 * response `next_page_token`. Provide this to retrieve the subsequent page. 78 * When paginating, all other parameters provided to `otherContacts.list` must 79 * match the first call that provided the page token. 80 * @opt_param string readMask Required. A field mask to restrict which fields on 81 * each person are returned. Multiple fields can be specified by separating them 82 * with commas. What values are valid depend on what ReadSourceType is used. If 83 * READ_SOURCE_TYPE_CONTACT is used, valid values are: * emailAddresses * 84 * metadata * names * phoneNumbers * photos If READ_SOURCE_TYPE_PROFILE is used, 85 * valid values are: * addresses * ageRanges * biographies * birthdays * 86 * calendarUrls * clientData * coverPhotos * emailAddresses * events * 87 * externalIds * genders * imClients * interests * locales * locations * 88 * memberships * metadata * miscKeywords * names * nicknames * occupations * 89 * organizations * phoneNumbers * photos * relations * sipAddresses * skills * 90 * urls * userDefined 91 * @opt_param bool requestSyncToken Optional. Whether the response should return 92 * `next_sync_token` on the last page of results. It can be used to get 93 * incremental changes since the last request by setting it on the request 94 * `sync_token`. More details about sync behavior at `otherContacts.list`. 95 * @opt_param string sources Optional. A mask of what source types to return. 96 * Defaults to READ_SOURCE_TYPE_CONTACT if not set. Possible values for this 97 * field are: * READ_SOURCE_TYPE_CONTACT * 98 * READ_SOURCE_TYPE_CONTACT,READ_SOURCE_TYPE_PROFILE Specifying 99 * READ_SOURCE_TYPE_PROFILE without specifying READ_SOURCE_TYPE_CONTACT is not 100 * permitted. 101 * @opt_param string syncToken Optional. A sync token, received from a previous 102 * response `next_sync_token` Provide this to retrieve only the resources 103 * changed since the last request. When syncing, all other parameters provided 104 * to `otherContacts.list` must match the first call that provided the sync 105 * token. More details about sync behavior at `otherContacts.list`. 106 * @return ListOtherContactsResponse 107 */ 108 public function listOtherContacts($optParams = []) 109 { 110 $params = []; 111 $params = array_merge($params, $optParams); 112 return $this->call('list', [$params], ListOtherContactsResponse::class); 113 } 114 /** 115 * Provides a list of contacts in the authenticated user's other contacts that 116 * matches the search query. The query matches on a contact's `names`, 117 * `emailAddresses`, and `phoneNumbers` fields that are from the OTHER_CONTACT 118 * source. **IMPORTANT**: Before searching, clients should send a warmup request 119 * with an empty query to update the cache. See 120 * https://developers.google.com/people/v1/other- 121 * contacts#search_the_users_other_contacts (otherContacts.search) 122 * 123 * @param array $optParams Optional parameters. 124 * 125 * @opt_param int pageSize Optional. The number of results to return. Defaults 126 * to 10 if field is not set, or set to 0. Values greater than 30 will be capped 127 * to 30. 128 * @opt_param string query Required. The plain-text query for the request. The 129 * query is used to match prefix phrases of the fields on a person. For example, 130 * a person with name "foo name" matches queries such as "f", "fo", "foo", "foo 131 * n", "nam", etc., but not "oo n". 132 * @opt_param string readMask Required. A field mask to restrict which fields on 133 * each person are returned. Multiple fields can be specified by separating them 134 * with commas. Valid values are: * emailAddresses * metadata * names * 135 * phoneNumbers 136 * @return SearchResponse 137 */ 138 public function search($optParams = []) 139 { 140 $params = []; 141 $params = array_merge($params, $optParams); 142 return $this->call('search', [$params], SearchResponse::class); 143 } 144} 145 146// Adding a class alias for backwards compatibility with the previous class name. 147class_alias(OtherContacts::class, 'Google_Service_PeopleService_Resource_OtherContacts'); 148