getBranch method

Future<GetBranchOutput> getBranch({
  1. String? branchName,
  2. String? repositoryName,
})

Returns information about a repository branch, including its name and the last commit ID.

May throw BranchDoesNotExistException. May throw BranchNameRequiredException. May throw EncryptionIntegrityChecksFailedException. May throw EncryptionKeyAccessDeniedException. May throw EncryptionKeyDisabledException. May throw EncryptionKeyNotFoundException. May throw EncryptionKeyUnavailableException. May throw InvalidBranchNameException. May throw InvalidRepositoryNameException. May throw RepositoryDoesNotExistException. May throw RepositoryNameRequiredException.

Parameter branchName : The name of the branch for which you want to retrieve information.

Parameter repositoryName : The name of the repository that contains the branch for which you want to retrieve information.

Implementation

Future<GetBranchOutput> getBranch({
  String? branchName,
  String? repositoryName,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'CodeCommit_20150413.GetBranch'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (branchName != null) 'branchName': branchName,
      if (repositoryName != null) 'repositoryName': repositoryName,
    },
  );

  return GetBranchOutput.fromJson(jsonResponse.body);
}