createPullRequest method
Creates a pull request in the specified repository.
May throw ClientRequestTokenRequiredException.
May throw EncryptionIntegrityChecksFailedException.
May throw EncryptionKeyAccessDeniedException.
May throw EncryptionKeyDisabledException.
May throw EncryptionKeyNotFoundException.
May throw EncryptionKeyUnavailableException.
May throw IdempotencyParameterMismatchException.
May throw InvalidClientRequestTokenException.
May throw InvalidDescriptionException.
May throw InvalidReferenceNameException.
May throw InvalidRepositoryNameException.
May throw InvalidTargetException.
May throw InvalidTargetsException.
May throw InvalidTitleException.
May throw MaximumOpenPullRequestsExceededException.
May throw MultipleRepositoriesInPullRequestException.
May throw ReferenceDoesNotExistException.
May throw ReferenceNameRequiredException.
May throw ReferenceTypeNotSupportedException.
May throw RepositoryDoesNotExistException.
May throw RepositoryNameRequiredException.
May throw SourceAndDestinationAreSameException.
May throw TargetRequiredException.
May throw TargetsRequiredException.
May throw TitleRequiredException.
Parameter targets :
The targets for the pull request, including the source of the code to be
reviewed (the source branch) and the destination where the creator of the
pull request intends the code to be merged after the pull request is
closed (the destination branch).
Parameter title :
The title of the pull request. This title is used to identify the pull
request to other users in the repository.
Parameter clientRequestToken :
A unique, client-generated idempotency token that, when provided in a
request, ensures the request cannot be repeated with a changed parameter.
If a request is received with the same parameters and a token is included,
the request returns information about the initial request that used that
token.
Parameter description :
A description of the pull request.
Implementation
Future<CreatePullRequestOutput> createPullRequest({
required List<Target> targets,
required String title,
String? clientRequestToken,
String? description,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'CodeCommit_20150413.CreatePullRequest'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'targets': targets,
'title': title,
'clientRequestToken':
clientRequestToken ?? _s.generateIdempotencyToken(),
if (description != null) 'description': description,
},
);
return CreatePullRequestOutput.fromJson(jsonResponse.body);
}