deleteBranch method

Future<DeleteBranchOutput> deleteBranch({
  1. required String branchName,
  2. required String repositoryName,
})

Deletes a branch from a repository, unless that branch is the default branch for the repository.

May throw BranchNameRequiredException. May throw DefaultBranchCannotBeDeletedException. 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 to delete.

Parameter repositoryName : The name of the repository that contains the branch to be deleted.

Implementation

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

  return DeleteBranchOutput.fromJson(jsonResponse.body);
}