listCodeReviews method

Future<ListCodeReviewsResponse> listCodeReviews({
  1. required Type type,
  2. int? maxResults,
  3. String? nextToken,
  4. List<ProviderType>? providerTypes,
  5. List<String>? repositoryNames,
  6. List<JobState>? states,
})

Lists all the code reviews that the customer has created in the past 90 days.

May throw InternalServerException. May throw ValidationException. May throw ThrottlingException. May throw AccessDeniedException.

Parameter type : The type of code reviews to list in the response.

Parameter maxResults : The maximum number of results that are returned per call. The default is 100.

Parameter nextToken : If nextToken is returned, there are more results available. The value of nextToken is a unique pagination token for each page. Make the call again using the returned token to retrieve the next page. Keep all other arguments unchanged.

Parameter providerTypes : List of provider types for filtering that needs to be applied before displaying the result. For example, providerTypes=GitHub lists code reviews from GitHub.

Parameter repositoryNames : List of repository names for filtering that needs to be applied before displaying the result.

Parameter states : List of states for filtering that needs to be applied before displaying the result. For example, states=Pending lists code reviews in the Pending state.

The valid code review states are:

  • Completed: The code review is complete.
  • Pending: The code review started and has not completed or failed.
  • Failed: The code review failed.
  • Deleting: The code review is being deleted.

Implementation

Future<ListCodeReviewsResponse> listCodeReviews({
  required Type type,
  int? maxResults,
  String? nextToken,
  List<ProviderType>? providerTypes,
  List<String>? repositoryNames,
  List<JobState>? states,
}) async {
  ArgumentError.checkNotNull(type, 'type');
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    1,
    2048,
  );
  final $query = <String, List<String>>{
    'Type': [type.toValue()],
    if (maxResults != null) 'MaxResults': [maxResults.toString()],
    if (nextToken != null) 'NextToken': [nextToken],
    if (providerTypes != null)
      'ProviderTypes': providerTypes.map((e) => e.toValue()).toList(),
    if (repositoryNames != null) 'RepositoryNames': repositoryNames,
    if (states != null) 'States': states.map((e) => e.toValue()).toList(),
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/codereviews',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListCodeReviewsResponse.fromJson(response);
}