listBuildsForProject method

Future<ListBuildsForProjectOutput> listBuildsForProject({
  1. required String projectName,
  2. String? nextToken,
  3. SortOrderType? sortOrder,
})

Gets a list of build identifiers for the specified build project, with each build identifier representing a single build.

May throw InvalidInputException. May throw ResourceNotFoundException.

Parameter projectName : The name of the CodeBuild project.

Parameter nextToken : During a previous call, if there are more than 100 items in the list, only the first 100 items are returned, along with a unique string called a nextToken. To get the next batch of items in the list, call this operation again, adding the next token to the call. To get all of the items in the list, keep calling this operation with each subsequent next token that is returned, until no more next tokens are returned.

Parameter sortOrder : The order to sort the results in. The results are sorted by build number, not the build identifier. If this is not specified, the results are sorted in descending order.

Valid values include:

  • ASCENDING: List the build identifiers in ascending order, by build number.
  • DESCENDING: List the build identifiers in descending order, by build number.
If the project has more than 100 builds, setting the sort order will result in an error.

Implementation

Future<ListBuildsForProjectOutput> listBuildsForProject({
  required String projectName,
  String? nextToken,
  SortOrderType? sortOrder,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'CodeBuild_20161006.ListBuildsForProject'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'projectName': projectName,
      if (nextToken != null) 'nextToken': nextToken,
      if (sortOrder != null) 'sortOrder': sortOrder.value,
    },
  );

  return ListBuildsForProjectOutput.fromJson(jsonResponse.body);
}