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