list method

Future<ListConnectionsResponse> list(
  1. String resourceName, {
  2. int? pageSize,
  3. String? pageToken,
  4. String? personFields,
  5. String? requestMask_includeField,
  6. bool? requestSyncToken,
  7. String? sortOrder,
  8. List<String>? sources,
  9. String? syncToken,
  10. String? $fields,
})

Provides a list of the authenticated user's contacts.

Sync tokens expire 7 days after the full sync. A request with an expired sync token will get an error with an google.rpc.ErrorInfo with reason "EXPIRED_SYNC_TOKEN". In the case of such an error clients should make a full sync request without a sync_token. The first page of a full sync request has an additional quota. If the quota is exceeded, a 429 error will be returned. This quota is fixed and can not be increased. When the sync_token is specified, resources deleted since the last sync will be returned as a person with PersonMetadata.deleted set to true. When the page_token or sync_token is specified, all other request parameters must match the first call. Writes may have a propagation delay of several minutes for sync requests. Incremental syncs are not intended for read-after-write use cases. See example usage at [List the user's contacts that have changed](/people/v1/contacts#list_the_users_contacts_that_have_changed).

Request parameters:

resourceName - Required. The resource name to return connections for. Only people/me is valid. Value must have pattern ^people/\[^/\]+$.

pageSize - Optional. The number of connections to include in the response. Valid values are between 1 and 1000, inclusive. Defaults to 100 if not set or set to 0.

pageToken - Optional. A page token, received from a previous response next_page_token. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to people.connections.list must match the first call that provided the page token.

personFields - Required. A field mask to restrict which fields on each person are returned. Multiple fields can be specified by separating them with commas. Valid values are: * addresses * ageRanges * biographies * birthdays * calendarUrls * clientData * coverPhotos * emailAddresses * events * externalIds * genders * imClients * interests * locales * locations * memberships * metadata * miscKeywords * names * nicknames * occupations * organizations * phoneNumbers * photos * relations * sipAddresses * skills * urls * userDefined

requestMask_includeField - Required. Comma-separated list of person fields to be included in the response. Each path should start with person.: for example, person.names or person.photos.

requestSyncToken - Optional. Whether the response should return next_sync_token on the last page of results. It can be used to get incremental changes since the last request by setting it on the request sync_token. More details about sync behavior at people.connections.list.

sortOrder - Optional. The order in which the connections should be sorted. Defaults to LAST_MODIFIED_ASCENDING. Possible string values are:

  • "LAST_MODIFIED_ASCENDING" : Sort people by when they were changed; older entries first.
  • "LAST_MODIFIED_DESCENDING" : Sort people by when they were changed; newer entries first.
  • "FIRST_NAME_ASCENDING" : Sort people by first name.
  • "LAST_NAME_ASCENDING" : Sort people by last name.

sources - Optional. A mask of what source types to return. Defaults to READ_SOURCE_TYPE_CONTACT and READ_SOURCE_TYPE_PROFILE if not set.

syncToken - Optional. A sync token, received from a previous response next_sync_token Provide this to retrieve only the resources changed since the last request. When syncing, all other parameters provided to people.connections.list must match the first call that provided the sync token. More details about sync behavior at people.connections.list.

$fields - Selector specifying which fields to include in a partial response.

Completes with a ListConnectionsResponse.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<ListConnectionsResponse> list(
  core.String resourceName, {
  core.int? pageSize,
  core.String? pageToken,
  core.String? personFields,
  core.String? requestMask_includeField,
  core.bool? requestSyncToken,
  core.String? sortOrder,
  core.List<core.String>? sources,
  core.String? syncToken,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (pageSize != null) 'pageSize': ['${pageSize}'],
    if (pageToken != null) 'pageToken': [pageToken],
    if (personFields != null) 'personFields': [personFields],
    if (requestMask_includeField != null)
      'requestMask.includeField': [requestMask_includeField],
    if (requestSyncToken != null) 'requestSyncToken': ['${requestSyncToken}'],
    if (sortOrder != null) 'sortOrder': [sortOrder],
    if (sources != null) 'sources': sources,
    if (syncToken != null) 'syncToken': [syncToken],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v1/' + core.Uri.encodeFull('$resourceName') + '/connections';

  final response_ = await _requester.request(
    url_,
    'GET',
    queryParams: queryParams_,
  );
  return ListConnectionsResponse.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}