fix: [CODE-2192]: (Swagger) Add Update default-branch API (#2519)

* add update default branch open api
pull/3545/head
Atefeh Mohseni Ejiyeh 2024-08-16 00:45:45 +00:00 committed by Harness
parent e1ef7e9609
commit aa66cca792
1 changed files with 16 additions and 0 deletions

View File

@ -50,6 +50,11 @@ type updateRepoRequest struct {
repo.UpdateInput
}
type updateDefaultBranchRequest struct {
repoRequest
repo.UpdateDefaultBranchInput
}
type moveRepoRequest struct {
repoRequest
repo.MoveInput
@ -693,6 +698,17 @@ func repoOperations(reflector *openapi3.Reflector) {
_ = reflector.SetJSONResponse(&opUpdate, new(usererror.Error), http.StatusNotFound)
_ = reflector.Spec.AddOperation(http.MethodPatch, "/repos/{repo_ref}", opUpdate)
opUpdateDefaultBranch := openapi3.Operation{}
opUpdateDefaultBranch.WithTags("repository")
opUpdateDefaultBranch.WithMapOfAnything(map[string]interface{}{"operationId": "updateDefaultBranch"})
_ = reflector.SetRequest(&opUpdateDefaultBranch, new(updateDefaultBranchRequest), http.MethodPost)
_ = reflector.SetJSONResponse(&opUpdateDefaultBranch, new(repo.RepositoryOutput), http.StatusOK)
_ = reflector.SetJSONResponse(&opUpdateDefaultBranch, new(usererror.Error), http.StatusBadRequest)
_ = reflector.SetJSONResponse(&opUpdateDefaultBranch, new(usererror.Error), http.StatusInternalServerError)
_ = reflector.SetJSONResponse(&opUpdateDefaultBranch, new(usererror.Error), http.StatusUnauthorized)
_ = reflector.SetJSONResponse(&opUpdateDefaultBranch, new(usererror.Error), http.StatusForbidden)
_ = reflector.Spec.AddOperation(http.MethodPost, "/repos/{repo_ref}/default-branch", opUpdateDefaultBranch)
opDelete := openapi3.Operation{}
opDelete.WithTags("repository")
opDelete.WithMapOfAnything(map[string]interface{}{"operationId": "deleteRepository"})