listTestGridSessions method

Future<ListTestGridSessionsResult> listTestGridSessions({
  1. required String projectArn,
  2. DateTime? creationTimeAfter,
  3. DateTime? creationTimeBefore,
  4. DateTime? endTimeAfter,
  5. DateTime? endTimeBefore,
  6. int? maxResult,
  7. String? nextToken,
  8. TestGridSessionStatus? status,
})

Retrieves a list of sessions for a TestGridProject.

May throw NotFoundException. May throw ArgumentException. May throw InternalServiceException.

Parameter projectArn : ARN of a TestGridProject.

Parameter creationTimeAfter : Return only sessions created after this time.

Parameter creationTimeBefore : Return only sessions created before this time.

Parameter endTimeAfter : Return only sessions that ended after this time.

Parameter endTimeBefore : Return only sessions that ended before this time.

Parameter maxResult : Return only this many results at a time.

Parameter nextToken : Pagination token.

Parameter status : Return only sessions in this state.

Implementation

Future<ListTestGridSessionsResult> listTestGridSessions({
  required String projectArn,
  DateTime? creationTimeAfter,
  DateTime? creationTimeBefore,
  DateTime? endTimeAfter,
  DateTime? endTimeBefore,
  int? maxResult,
  String? nextToken,
  TestGridSessionStatus? status,
}) async {
  ArgumentError.checkNotNull(projectArn, 'projectArn');
  _s.validateStringLength(
    'projectArn',
    projectArn,
    32,
    1011,
    isRequired: true,
  );
  _s.validateNumRange(
    'maxResult',
    maxResult,
    1,
    1000,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    4,
    1024,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'DeviceFarm_20150623.ListTestGridSessions'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'projectArn': projectArn,
      if (creationTimeAfter != null)
        'creationTimeAfter': unixTimestampToJson(creationTimeAfter),
      if (creationTimeBefore != null)
        'creationTimeBefore': unixTimestampToJson(creationTimeBefore),
      if (endTimeAfter != null)
        'endTimeAfter': unixTimestampToJson(endTimeAfter),
      if (endTimeBefore != null)
        'endTimeBefore': unixTimestampToJson(endTimeBefore),
      if (maxResult != null) 'maxResult': maxResult,
      if (nextToken != null) 'nextToken': nextToken,
      if (status != null) 'status': status.toValue(),
    },
  );

  return ListTestGridSessionsResult.fromJson(jsonResponse.body);
}