createSourceRepositoryBranch method

Future<CreateSourceRepositoryBranchResponse> createSourceRepositoryBranch({
  1. required String name,
  2. required String projectName,
  3. required String sourceRepositoryName,
  4. required String spaceName,
  5. String? headCommitId,
})

Creates a branch in a specified source repository in Amazon CodeCatalyst.

Parameter name : The name for the branch you're creating.

Parameter projectName : The name of the project in the space.

Parameter sourceRepositoryName : The name of the repository where you want to create a branch.

Parameter spaceName : The name of the space.

Parameter headCommitId : The commit ID in an existing branch from which you want to create the new branch.

Implementation

Future<CreateSourceRepositoryBranchResponse> createSourceRepositoryBranch({
  required String name,
  required String projectName,
  required String sourceRepositoryName,
  required String spaceName,
  String? headCommitId,
}) async {
  final $payload = <String, dynamic>{
    if (headCommitId != null) 'headCommitId': headCommitId,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri:
        '/v1/spaces/${Uri.encodeComponent(spaceName)}/projects/${Uri.encodeComponent(projectName)}/sourceRepositories/${Uri.encodeComponent(sourceRepositoryName)}/branches/${Uri.encodeComponent(name)}',
    exceptionFnMap: _exceptionFns,
  );
  return CreateSourceRepositoryBranchResponse.fromJson(response);
}