createSourceRepository method

Future<CreateSourceRepositoryResponse> createSourceRepository({
  1. required String name,
  2. required String projectName,
  3. required String spaceName,
  4. String? description,
})

Creates an empty Git-based source repository in a specified project. The repository is created with an initial empty commit with a default branch named main.

Parameter name : The name of the source repository. For more information about name requirements, see Quotas for source repositories.

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

Parameter spaceName : The name of the space.

Parameter description : The description of the source repository.

Implementation

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