getDifferences method

Future<GetDifferencesOutput> getDifferences({
  1. required String afterCommitSpecifier,
  2. required String repositoryName,
  3. int? maxResults,
  4. String? nextToken,
  5. String? afterPath,
  6. String? beforeCommitSpecifier,
  7. String? beforePath,
})

Returns information about the differences in a valid commit specifier (such as a branch, tag, HEAD, commit ID, or other fully qualified reference). Results can be limited to a specified path.

May throw RepositoryNameRequiredException. May throw RepositoryDoesNotExistException. May throw InvalidRepositoryNameException. May throw InvalidContinuationTokenException. May throw InvalidMaxResultsException. May throw InvalidCommitIdException. May throw CommitRequiredException. May throw InvalidCommitException. May throw CommitDoesNotExistException. May throw InvalidPathException. May throw PathDoesNotExistException. May throw EncryptionIntegrityChecksFailedException. May throw EncryptionKeyAccessDeniedException. May throw EncryptionKeyDisabledException. May throw EncryptionKeyNotFoundException. May throw EncryptionKeyUnavailableException.

Parameter afterCommitSpecifier : The branch, tag, HEAD, or other fully qualified reference used to identify a commit.

Parameter repositoryName : The name of the repository where you want to get differences.

Parameter maxResults : A non-zero, non-negative integer used to limit the number of returned results.

Parameter nextToken : An enumeration token that, when provided in a request, returns the next batch of the results.

Parameter afterPath : The file path in which to check differences. Limits the results to this path. Can also be used to specify the changed name of a directory or folder, if it has changed. If not specified, differences are shown for all paths.

Parameter beforeCommitSpecifier : The branch, tag, HEAD, or other fully qualified reference used to identify a commit (for example, the full commit ID). Optional. If not specified, all changes before the afterCommitSpecifier value are shown. If you do not use beforeCommitSpecifier in your request, consider limiting the results with maxResults.

Parameter beforePath : The file path in which to check for differences. Limits the results to this path. Can also be used to specify the previous name of a directory or folder. If beforePath and afterPath are not specified, differences are shown for all paths.

Implementation

Future<GetDifferencesOutput> getDifferences({
  required String afterCommitSpecifier,
  required String repositoryName,
  int? maxResults,
  String? nextToken,
  String? afterPath,
  String? beforeCommitSpecifier,
  String? beforePath,
}) async {
  ArgumentError.checkNotNull(afterCommitSpecifier, 'afterCommitSpecifier');
  ArgumentError.checkNotNull(repositoryName, 'repositoryName');
  _s.validateStringLength(
    'repositoryName',
    repositoryName,
    1,
    100,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'CodeCommit_20150413.GetDifferences'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'afterCommitSpecifier': afterCommitSpecifier,
      'repositoryName': repositoryName,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (afterPath != null) 'afterPath': afterPath,
      if (beforeCommitSpecifier != null)
        'beforeCommitSpecifier': beforeCommitSpecifier,
      if (beforePath != null) 'beforePath': beforePath,
    },
  );

  return GetDifferencesOutput.fromJson(jsonResponse.body);
}