mergePullRequestByFastForward method

Future<MergePullRequestByFastForwardOutput> mergePullRequestByFastForward({
  1. required String pullRequestId,
  2. required String repositoryName,
  3. String? sourceCommitId,
})

Attempts to merge the source commit of a pull request into the specified destination branch for that pull request at the specified commit using the fast-forward merge strategy. If the merge is successful, it closes the pull request.

May throw ManualMergeRequiredException. May throw PullRequestAlreadyClosedException. May throw PullRequestDoesNotExistException. May throw InvalidPullRequestIdException. May throw PullRequestIdRequiredException. May throw TipOfSourceReferenceIsDifferentException. May throw ReferenceDoesNotExistException. May throw InvalidCommitIdException. May throw RepositoryNotAssociatedWithPullRequestException. May throw RepositoryNameRequiredException. May throw InvalidRepositoryNameException. May throw RepositoryDoesNotExistException. May throw ConcurrentReferenceUpdateException. May throw PullRequestApprovalRulesNotSatisfiedException. May throw EncryptionIntegrityChecksFailedException. May throw EncryptionKeyAccessDeniedException. May throw EncryptionKeyDisabledException. May throw EncryptionKeyNotFoundException. May throw EncryptionKeyUnavailableException.

Parameter pullRequestId : The system-generated ID of the pull request. To get this ID, use ListPullRequests.

Parameter repositoryName : The name of the repository where the pull request was created.

Parameter sourceCommitId : The full commit ID of the original or updated commit in the pull request source branch. Pass this value if you want an exception thrown if the current commit ID of the tip of the source branch does not match this commit ID.

Implementation

Future<MergePullRequestByFastForwardOutput> mergePullRequestByFastForward({
  required String pullRequestId,
  required String repositoryName,
  String? sourceCommitId,
}) async {
  ArgumentError.checkNotNull(pullRequestId, 'pullRequestId');
  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.MergePullRequestByFastForward'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'pullRequestId': pullRequestId,
      'repositoryName': repositoryName,
      if (sourceCommitId != null) 'sourceCommitId': sourceCommitId,
    },
  );

  return MergePullRequestByFastForwardOutput.fromJson(jsonResponse.body);
}