list method

Future<ListSessionsResponse> list(
  1. String userId, {
  2. List<int>? activityType,
  3. String? endTime,
  4. bool? includeDeleted,
  5. String? pageToken,
  6. String? startTime,
  7. String? $fields,
})

Lists sessions previously created.

Request parameters:

userId - List sessions for the person identified. Use me to indicate the authenticated user. Only me is supported at this time.

activityType - If non-empty, only sessions with these activity types should be returned.

endTime - An RFC3339 timestamp. Only sessions ending between the start and end times will be included in the response. If this time is omitted but startTime is specified, all sessions from startTime to the end of time will be returned.

includeDeleted - If true, and if both startTime and endTime are omitted, session deletions will be returned.

pageToken - The continuation token, which is used for incremental syncing. To get the next batch of changes, set this parameter to the value of nextPageToken from the previous response. The page token is ignored if either start or end time is specified. If none of start time, end time, and the page token is specified, sessions modified in the last 30 days are returned.

startTime - An RFC3339 timestamp. Only sessions ending between the start and end times will be included in the response. If this time is omitted but endTime is specified, all sessions from the start of time up to endTime will be returned.

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

Completes with a ListSessionsResponse.

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<ListSessionsResponse> list(
  core.String userId, {
  core.List<core.int>? activityType,
  core.String? endTime,
  core.bool? includeDeleted,
  core.String? pageToken,
  core.String? startTime,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (activityType != null)
      'activityType': activityType.map((item) => '${item}').toList(),
    if (endTime != null) 'endTime': [endTime],
    if (includeDeleted != null) 'includeDeleted': ['${includeDeleted}'],
    if (pageToken != null) 'pageToken': [pageToken],
    if (startTime != null) 'startTime': [startTime],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = commons.escapeVariable('$userId') + '/sessions';

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