mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-28 23:41:19 +00:00
refactor: use default error response for swagger (#40048)
ref: https://github.com/go-gitea/gitea/pull/39942#discussion_r4393487959
This commit is contained in:
1 parent
30e5ef4228
commit
5671c5192d
93 files changed
+2600
-6894
No files matched your search
@@ -140,8 +140,8 @@ breaking v1.
|
||||
|
||||
### Adding and maintaining API routes
|
||||
|
||||
- All possible results (errors, success, and failure messages) must be documented in
|
||||
the swagger comments on the route.
|
||||
- Document success responses in the swagger comments on the route. Replace explicit
|
||||
error responses with a `default` response referencing `#/responses/error`.
|
||||
- Every JSON request body must be defined as a struct in `modules/structs/` and
|
||||
registered in [`routers/api/v1/swagger/options.go`](../routers/api/v1/swagger/options.go).
|
||||
- Every JSON response must be defined as a struct in `modules/structs/` and
|
||||
|
||||
@@ -40,12 +40,8 @@ func ListWorkflowJobs(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/WorkflowJobsList"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
|
||||
shared.ListJobs(ctx, 0, 0, 0, nil)
|
||||
}
|
||||
@@ -94,10 +90,8 @@ func ListWorkflowRuns(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/WorkflowRunsList"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
shared.ListRuns(ctx, 0, 0, "")
|
||||
}
|
||||
@@ -38,8 +38,8 @@ func ListUnadoptedRepositories(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/StringSlice"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
listOptions := utils.GetListOptions(ctx)
|
||||
if listOptions.Page == 0 {
|
||||
@@ -77,10 +77,8 @@ func AdoptRepository(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
ownerName := ctx.PathParam("username")
|
||||
repoName := ctx.PathParam("reponame")
|
||||
|
||||
@@ -141,8 +139,8 @@ func DeleteUnadoptedRepository(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
ownerName := ctx.PathParam("username")
|
||||
repoName := ctx.PathParam("reponame")
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@ func ListCronTasks(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/CronList"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
tasks := cron.ListTasks()
|
||||
count := len(tasks)
|
||||
|
||||
@@ -72,8 +72,8 @@ func PostCronTask(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
task := cron.GetTask(ctx.PathParam("task"))
|
||||
if task == nil {
|
||||
ctx.APIErrorNotFound()
|
||||
|
||||
@@ -32,8 +32,8 @@ func GetAllEmails(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/EmailList"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
listOptions := utils.GetListOptions(ctx)
|
||||
|
||||
@@ -79,8 +79,8 @@ func SearchEmail(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/EmailList"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
ctx.SetPathParam("email", ctx.FormTrim("q"))
|
||||
GetAllEmails(ctx)
|
||||
|
||||
@@ -41,10 +41,8 @@ func CreateOrg(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Organization"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.CreateOrgOption](ctx)
|
||||
|
||||
@@ -100,8 +98,8 @@ func GetAllOrgs(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/OrganizationList"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
listOptions := utils.GetListOptions(ctx)
|
||||
|
||||
|
||||
@@ -42,8 +42,8 @@ func ListPackages(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/PackageList"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
listOptions := utils.GetListOptions(ctx)
|
||||
|
||||
|
||||
@@ -32,16 +32,8 @@ func CreateRepo(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Repository"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "409":
|
||||
// "$ref": "#/responses/error"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
|
||||
form := web.GetForm[*api.CreateRepoOption](ctx)
|
||||
|
||||
|
||||
@@ -41,10 +41,8 @@ func ListRunners(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/RunnerList"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
shared.ListRunners(ctx, 0, 0)
|
||||
}
|
||||
|
||||
@@ -64,10 +62,8 @@ func GetRunner(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Runner"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
shared.GetRunner(ctx, 0, 0, ctx.PathParamInt64("runner_id"))
|
||||
}
|
||||
|
||||
@@ -87,10 +83,8 @@ func DeleteRunner(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// description: runner has been deleted
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
shared.DeleteRunner(ctx, 0, 0, ctx.PathParamInt64("runner_id"))
|
||||
}
|
||||
|
||||
@@ -116,11 +110,7 @@ func UpdateRunner(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Runner"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
shared.UpdateRunner(ctx, 0, 0, ctx.PathParamInt64("runner_id"))
|
||||
}
|
||||
@@ -70,14 +70,8 @@ func CreateUser(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/User"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "409":
|
||||
// "$ref": "#/responses/error"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
|
||||
form := web.GetForm[*api.CreateUserOption](ctx)
|
||||
|
||||
@@ -179,14 +173,8 @@ func EditUser(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/User"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "409":
|
||||
// "$ref": "#/responses/error"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
|
||||
form := web.GetForm[*api.EditUserOption](ctx)
|
||||
|
||||
@@ -282,12 +270,8 @@ func DeleteUser(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
if ctx.ContextUser.IsOrganization() {
|
||||
ctx.APIError(http.StatusUnprocessableEntity, "target is an organization but not user")
|
||||
@@ -338,10 +322,8 @@ func CreatePublicKey(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/PublicKey"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.CreateKeyOption](ctx)
|
||||
|
||||
@@ -370,10 +352,8 @@ func DeleteUserPublicKey(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
if err := asymkey_service.DeletePublicKey(ctx, ctx.ContextUser, ctx.PathParamInt64("id")); err != nil {
|
||||
if asymkey_model.IsErrKeyNotExist(err) {
|
||||
@@ -458,10 +438,8 @@ func SearchUsers(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/UserList"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
listOptions := utils.GetListOptions(ctx)
|
||||
|
||||
@@ -544,10 +522,8 @@ func RenameUser(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
if ctx.ContextUser.IsOrganization() {
|
||||
ctx.APIError(http.StatusUnprocessableEntity, "target is an organization but not user")
|
||||
|
||||
@@ -28,8 +28,8 @@ func ListUserBadges(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/BadgeList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
badges, maxResults, err := user_model.GetUserBadges(ctx, ctx.ContextUser)
|
||||
if err != nil {
|
||||
@@ -63,8 +63,8 @@ func AddUserBadges(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.UserBadgeOption](ctx)
|
||||
badges := prepareBadgesForReplaceOrAdd(*form)
|
||||
@@ -97,10 +97,8 @@ func DeleteUserBadges(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.UserBadgeOption](ctx)
|
||||
badges := prepareBadgesForReplaceOrAdd(*form)
|
||||
|
||||
@@ -42,8 +42,8 @@ func GetGitignoreTemplateInfo(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/GitignoreTemplateInfo"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
name := util.PathJoinRelX(ctx.PathParam("name"))
|
||||
|
||||
text, err := options.Gitignore(name)
|
||||
|
||||
@@ -46,8 +46,8 @@ func GetLabelTemplate(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/LabelTemplateInfo"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
name := util.PathJoinRelX(ctx.PathParam("name"))
|
||||
|
||||
labels, err := repo_module.LoadTemplateLabelsByDisplayName(name)
|
||||
|
||||
@@ -52,8 +52,8 @@ func GetLicenseTemplateInfo(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/LicenseTemplateInfo"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
name := util.PathJoinRelX(ctx.PathParam("name"))
|
||||
|
||||
text, err := options.License(name)
|
||||
|
||||
@@ -31,8 +31,8 @@ func Markup(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/MarkupRender"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.MarkupOption](ctx)
|
||||
mode := util.Iif(form.Wiki, "wiki", form.Mode) //nolint:staticcheck // form.Wiki is deprecated
|
||||
@@ -56,8 +56,8 @@ func Markdown(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/MarkdownRender"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.MarkdownOption](ctx)
|
||||
mode := util.Iif(form.Wiki, "wiki", form.Mode) //nolint:staticcheck // form.Wiki is deprecated
|
||||
@@ -83,8 +83,8 @@ func MarkdownRaw(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/MarkdownRender"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
textBytes, _ := io.ReadAll(io.LimitReader(ctx.Req.Body, setting.UI.MaxDisplayFileSize))
|
||||
common.RenderMarkup(ctx.Base, ctx.Repo, "markdown", util.UnsafeBytesToString(textBytes), "", "")
|
||||
}
|
||||
@@ -33,10 +33,8 @@ func GetThread(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/NotificationThread"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
n := getThread(ctx)
|
||||
if n == nil {
|
||||
@@ -74,10 +72,8 @@ func ReadThread(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "205":
|
||||
// "$ref": "#/responses/NotificationThread"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
n := getThread(ctx)
|
||||
if n == nil {
|
||||
|
||||
@@ -45,8 +45,8 @@ func (Action) ListActionsSecrets(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/SecretList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
opts := &secret_model.FindSecretsOptions{
|
||||
BelongingScope: actions_model.BelongingScopeOwner(ctx.Org.Organization.ID),
|
||||
@@ -102,10 +102,8 @@ func (Action) CreateOrUpdateSecret(ctx *context.APIContext) {
|
||||
// description: response when creating a secret
|
||||
// "204":
|
||||
// description: response when updating a secret
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
opt := web.GetForm[*api.CreateOrUpdateSecretOption](ctx)
|
||||
|
||||
@@ -151,10 +149,8 @@ func (Action) DeleteSecret(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// description: delete one secret of the organization
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
s, err := secret_service.DeleteSecretByName(ctx, actions_model.BelongingScopeOwner(ctx.Org.Organization.ID), ctx.PathParam("secretname"))
|
||||
if err != nil {
|
||||
@@ -212,10 +208,8 @@ func (Action) ListVariables(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/VariableList"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
listOptions := utils.GetListOptions(ctx)
|
||||
vars, count, err := db.FindAndCount[actions_model.ActionVariable](ctx, &actions_model.FindVariablesOpts{
|
||||
@@ -263,10 +257,8 @@ func (Action) GetVariable(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ActionVariable"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
v, err := actions_service.GetVariable(ctx, actions_model.FindVariablesOpts{
|
||||
BelongingScope: actions_model.BelongingScopeOwner(ctx.Org.Organization.ID),
|
||||
@@ -313,10 +305,8 @@ func (Action) DeleteVariable(ctx *context.APIContext) {
|
||||
// description: response when deleting a variable
|
||||
// "204":
|
||||
// description: response when deleting a variable
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
if err := actions_service.DeleteVariableByName(ctx, actions_model.BelongingScopeOwner(ctx.Org.Organization.ID), ctx.PathParam("variablename")); err != nil {
|
||||
ctx.APIErrorAuto(err)
|
||||
@@ -353,11 +343,7 @@ func (Action) CreateVariable(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// description: successfully created the org-level variable
|
||||
// "400":
|
||||
// "$ref": "#/responses/error"
|
||||
// "409":
|
||||
// description: variable name already exists.
|
||||
// "500":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
opt := web.GetForm[*api.CreateVariableOption](ctx)
|
||||
@@ -415,10 +401,8 @@ func (Action) UpdateVariable(ctx *context.APIContext) {
|
||||
// description: response when updating an org-level variable
|
||||
// "204":
|
||||
// description: response when updating an org-level variable
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
opt := web.GetForm[*api.UpdateVariableOption](ctx)
|
||||
|
||||
@@ -468,10 +452,8 @@ func (Action) ListRunners(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/RunnerList"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
shared.ListRunners(ctx, ctx.Org.Organization.ID, 0)
|
||||
}
|
||||
|
||||
@@ -496,10 +478,8 @@ func (Action) GetRunner(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Runner"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
shared.GetRunner(ctx, ctx.Org.Organization.ID, 0, ctx.PathParamInt64("runner_id"))
|
||||
}
|
||||
|
||||
@@ -524,10 +504,8 @@ func (Action) DeleteRunner(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// description: runner has been deleted
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
shared.DeleteRunner(ctx, ctx.Org.Organization.ID, 0, ctx.PathParamInt64("runner_id"))
|
||||
}
|
||||
|
||||
@@ -558,12 +536,8 @@ func (Action) UpdateRunner(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Runner"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
shared.UpdateRunner(ctx, ctx.Org.Organization.ID, 0, ctx.PathParamInt64("runner_id"))
|
||||
}
|
||||
|
||||
@@ -595,10 +569,8 @@ func (Action) ListWorkflowJobs(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/WorkflowJobsList"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
shared.ListJobs(ctx, ctx.Org.Organization.ID, 0, 0, nil)
|
||||
}
|
||||
|
||||
@@ -650,10 +622,8 @@ func (Action) ListWorkflowRuns(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/WorkflowRunsList"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
shared.ListRuns(ctx, ctx.Org.Organization.ID, 0, "")
|
||||
}
|
||||
|
||||
|
||||
@@ -33,8 +33,8 @@ func UpdateAvatar(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
form := web.GetForm[*api.UpdateUserAvatarOption](ctx)
|
||||
|
||||
content, err := base64.StdEncoding.DecodeString(form.Image)
|
||||
@@ -68,8 +68,8 @@ func DeleteAvatar(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
err := user_service.DeleteAvatar(ctx, ctx.Org.Organization.AsUser())
|
||||
if err != nil {
|
||||
ctx.APIErrorInternal(err)
|
||||
|
||||
@@ -53,8 +53,8 @@ func CheckUserBlock(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
shared.CheckUserBlock(ctx, ctx.Org.Organization.AsUser())
|
||||
}
|
||||
@@ -81,10 +81,8 @@ func BlockUser(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
shared.BlockUser(ctx, ctx.Org.Organization.AsUser())
|
||||
}
|
||||
@@ -107,10 +105,8 @@ func UnblockUser(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
shared.UnblockUser(ctx, ctx.Doer, ctx.Org.Organization.AsUser())
|
||||
}
|
||||
+10
-10
@@ -37,8 +37,8 @@ func ListHooks(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/HookList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
utils.ListOwnerHooks(
|
||||
ctx,
|
||||
@@ -68,8 +68,8 @@ func GetHook(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Hook"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
hook, err := utils.GetOwnerHook(ctx, ctx.ContextUser.ID, ctx.PathParamInt64("id"))
|
||||
if err != nil {
|
||||
@@ -107,8 +107,8 @@ func CreateHook(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Hook"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
utils.AddOwnerHook(
|
||||
ctx,
|
||||
@@ -145,8 +145,8 @@ func EditHook(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Hook"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
utils.EditOwnerHook(
|
||||
ctx,
|
||||
@@ -178,8 +178,8 @@ func DeleteHook(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
utils.DeleteOwnerHook(
|
||||
ctx,
|
||||
|
||||
+10
-14
@@ -41,8 +41,8 @@ func ListLabels(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/LabelList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
labels, err := issues_model.GetLabelsByOrgID(ctx, ctx.Org.Organization.ID, ctx.FormString("sort"), utils.GetListOptions(ctx))
|
||||
if err != nil {
|
||||
@@ -82,10 +82,8 @@ func CreateLabel(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Label"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
form := web.GetForm[*api.CreateLabelOption](ctx)
|
||||
form.Color = strings.Trim(form.Color, " ")
|
||||
color, err := label.NormalizeColor(form.Color)
|
||||
@@ -132,8 +130,8 @@ func GetLabel(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Label"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
var (
|
||||
label *issues_model.Label
|
||||
@@ -185,10 +183,8 @@ func EditLabel(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Label"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
form := web.GetForm[*api.EditLabelOption](ctx)
|
||||
l, err := issues_model.GetLabelInOrgByID(ctx, ctx.Org.Organization.ID, ctx.PathParamInt64("id"))
|
||||
if err != nil {
|
||||
@@ -246,8 +242,8 @@ func DeleteLabel(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
if err := issues_model.DeleteOrgLabel(ctx, ctx.Org.Organization.ID, ctx.PathParamInt64("id")); err != nil {
|
||||
ctx.APIErrorInternal(err)
|
||||
|
||||
@@ -74,8 +74,8 @@ func ListMembers(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/UserList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
var (
|
||||
isMember bool
|
||||
@@ -116,8 +116,8 @@ func ListPublicMembers(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/UserList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
listMembers(ctx, false)
|
||||
}
|
||||
@@ -143,8 +143,8 @@ func IsMember(ctx *context.APIContext) {
|
||||
// description: user is a member
|
||||
// "303":
|
||||
// description: redirection to /orgs/{org}/public_members/{username}
|
||||
// "404":
|
||||
// description: user is not a member
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
userToCheck := user.GetContextUserByPathParam(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -194,8 +194,8 @@ func IsPublicMember(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// description: user is a public member
|
||||
// "404":
|
||||
// description: user is not a public member
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
userToCheck := user.GetContextUserByPathParam(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -248,10 +248,8 @@ func PublicizeMember(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// description: membership publicized
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
userToPublicize := user.GetContextUserByPathParam(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -290,10 +288,8 @@ func ConcealMember(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
userToConceal := user.GetContextUserByPathParam(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -332,8 +328,8 @@ func DeleteMember(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// description: member removed
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
member := user.GetContextUserByPathParam(ctx)
|
||||
if ctx.Written() {
|
||||
|
||||
+20
-28
@@ -77,8 +77,8 @@ func ListMyOrgs(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/OrganizationList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
listUserOrgs(ctx, ctx.Doer)
|
||||
}
|
||||
@@ -107,8 +107,8 @@ func ListUserOrgs(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/OrganizationList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
listUserOrgs(ctx, ctx.ContextUser)
|
||||
}
|
||||
@@ -134,10 +134,8 @@ func GetUserOrgsPermissions(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/OrganizationPermissions"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
var o *user_model.User
|
||||
if o = user.GetUserByPathParam(ctx, "org"); o == nil {
|
||||
@@ -250,10 +248,8 @@ func Create(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Organization"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
form := web.GetForm[*api.CreateOrgOption](ctx)
|
||||
if !ctx.Doer.CanCreateOrganization() {
|
||||
ctx.APIError(http.StatusForbidden, "not allowed to create org")
|
||||
@@ -310,8 +306,8 @@ func Get(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Organization"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
if !organization.HasOrgOrUserVisible(ctx, ctx.Org.Organization.AsUser(), ctx.Doer) {
|
||||
ctx.APIErrorNotFound()
|
||||
@@ -348,10 +344,8 @@ func Rename(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.RenameOrgOption](ctx)
|
||||
orgUser := ctx.Org.Organization.AsUser()
|
||||
@@ -389,8 +383,8 @@ func Edit(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Organization"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.EditOrgOption](ctx)
|
||||
|
||||
@@ -435,8 +429,8 @@ func Delete(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
if err := org.DeleteOrganization(ctx, ctx.Org.Organization, false); err != nil {
|
||||
ctx.APIErrorInternal(err)
|
||||
@@ -473,8 +467,8 @@ func ListOrgActivityFeeds(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ActivityFeedsList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
includePrivate := false
|
||||
if ctx.IsSigned {
|
||||
@@ -554,10 +548,8 @@ func DeleteOrgRepos(ctx *context.APIContext) {
|
||||
// "$ref": "#/responses/empty"
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// Intentionally it only loads repository IDs to avoid loading too much data into memory
|
||||
// There is no need to do pagination here as the number of repositories is expected to be manageable
|
||||
|
||||
+30
-38
@@ -53,8 +53,8 @@ func ListTeams(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/TeamList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
listOptions := utils.GetListOptions(ctx)
|
||||
opts := &organization.SearchTeamOptions{
|
||||
@@ -140,8 +140,8 @@ func GetTeam(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Team"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
apiTeam, err := convert.ToTeam(ctx, ctx.Org.Team, true)
|
||||
if err != nil {
|
||||
@@ -207,10 +207,8 @@ func CreateTeam(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Team"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
form := web.GetForm[*api.CreateTeamOption](ctx)
|
||||
team := &organization.Team{
|
||||
OrgID: ctx.Org.Organization.ID,
|
||||
@@ -265,8 +263,8 @@ func EditTeam(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Team"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.EditTeamOption](ctx)
|
||||
team := ctx.Org.Team
|
||||
@@ -336,8 +334,8 @@ func DeleteTeam(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// description: team deleted
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
if err := org_service.DeleteTeam(ctx, ctx.Org.Team); err != nil {
|
||||
ctx.APIErrorInternal(err)
|
||||
@@ -371,8 +369,8 @@ func GetTeamMembers(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/UserList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
listOptions := utils.GetListOptions(ctx)
|
||||
teamMembers, err := organization.GetTeamMembers(ctx, &organization.SearchMembersOptions{
|
||||
@@ -416,8 +414,8 @@ func GetTeamMember(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/User"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
u := user.GetContextUserByPathParam(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -457,10 +455,8 @@ func AddTeamMember(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
u := user.GetContextUserByPathParam(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -499,8 +495,8 @@ func RemoveTeamMember(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
u := user.GetContextUserByPathParam(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -539,8 +535,8 @@ func GetTeamRepos(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/RepositoryList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
team := ctx.Org.Team
|
||||
listOptions := utils.GetListOptions(ctx)
|
||||
@@ -608,8 +604,8 @@ func GetTeamRepo(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Repository"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
repo, permission := getRepositoryByParams(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -682,10 +678,8 @@ func AddTeamRepository(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
repo, perm := getRepositoryByParams(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -730,10 +724,8 @@ func RemoveTeamRepository(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
repo, perm := getRepositoryByParams(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -790,8 +782,8 @@ func SearchTeam(ctx *context.APIContext) {
|
||||
// type: array
|
||||
// items:
|
||||
// "$ref": "#/definitions/Team"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
listOptions := utils.GetListOptions(ctx)
|
||||
|
||||
@@ -860,8 +852,8 @@ func ListTeamActivityFeeds(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ActivityFeedsList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
listOptions := utils.GetListOptions(ctx)
|
||||
|
||||
|
||||
@@ -51,8 +51,8 @@ func ListPackages(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/PackageList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
listOptions := utils.GetListOptions(ctx)
|
||||
|
||||
@@ -104,8 +104,8 @@ func GetPackage(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Package"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
apiPackage, err := convert.ToPackage(ctx, ctx.Package.Descriptor, ctx.Doer)
|
||||
if err != nil {
|
||||
@@ -140,8 +140,8 @@ func DeletePackage(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
err := packages_service.RemovePackage(ctx, ctx.Doer, ctx.Package.Descriptor.Package)
|
||||
if err != nil {
|
||||
@@ -180,8 +180,8 @@ func DeletePackageVersion(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
err := packages_service.RemovePackageVersion(ctx, ctx.Doer, ctx.Package.Descriptor.Version)
|
||||
if err != nil {
|
||||
@@ -222,8 +222,8 @@ func ListPackageFiles(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/PackageFileList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
apiPackageFiles := make([]*api.PackageFile, 0, len(ctx.Package.Descriptor.Files))
|
||||
for _, pfd := range ctx.Package.Descriptor.Files {
|
||||
@@ -267,8 +267,8 @@ func ListPackageVersions(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/PackageList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
listOptions := utils.GetListOptions(ctx)
|
||||
|
||||
@@ -315,8 +315,8 @@ func GetLatestPackageVersion(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Package"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
pvs, _, err := packages.SearchLatestVersions(ctx, &packages.PackageSearchOptions{
|
||||
OwnerID: ctx.Package.Owner.ID,
|
||||
@@ -377,8 +377,8 @@ func LinkPackage(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
pkg, err := packages.GetPackageByName(ctx, ctx.ContextUser.ID, packages.Type(ctx.PathParam("type")), ctx.PathParam("name"))
|
||||
if err != nil {
|
||||
@@ -439,8 +439,8 @@ func UnlinkPackage(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
pkg, err := packages.GetPackageByName(ctx, ctx.ContextUser.ID, packages.Type(ctx.PathParam("type")), ctx.PathParam("name"))
|
||||
if err != nil {
|
||||
|
||||
+36
-164
@@ -65,8 +65,8 @@ func (Action) ListActionsSecrets(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/SecretList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
repo := ctx.Repo.Repository
|
||||
listOptions := utils.GetListOptions(ctx)
|
||||
@@ -129,10 +129,8 @@ func (Action) CreateOrUpdateSecret(ctx *context.APIContext) {
|
||||
// description: response when creating a secret
|
||||
// "204":
|
||||
// description: response when updating a secret
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
repo := ctx.Repo.Repository
|
||||
|
||||
@@ -185,10 +183,8 @@ func (Action) DeleteSecret(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// description: delete one secret of the repository
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
repo := ctx.Repo.Repository
|
||||
|
||||
@@ -229,10 +225,8 @@ func (Action) GetVariable(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ActionVariable"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
v, err := actions_service.GetVariable(ctx, actions_model.FindVariablesOpts{
|
||||
BelongingScope: actions_model.BelongingScopeRepo(ctx.Repo.Repository.ID),
|
||||
Name: ctx.PathParam("variablename"),
|
||||
@@ -283,10 +277,8 @@ func (Action) DeleteVariable(ctx *context.APIContext) {
|
||||
// description: response when deleting a variable
|
||||
// "204":
|
||||
// description: response when deleting a variable
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
if err := actions_service.DeleteVariableByName(ctx, actions_model.BelongingScopeRepo(ctx.Repo.Repository.ID), ctx.PathParam("variablename")); err != nil {
|
||||
ctx.APIErrorAuto(err)
|
||||
@@ -326,11 +318,7 @@ func (Action) CreateVariable(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// description: response when creating a repo-level variable
|
||||
// "400":
|
||||
// "$ref": "#/responses/error"
|
||||
// "409":
|
||||
// description: variable name already exists.
|
||||
// "500":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
opt := web.GetForm[*api.CreateVariableOption](ctx)
|
||||
@@ -391,10 +379,8 @@ func (Action) UpdateVariable(ctx *context.APIContext) {
|
||||
// description: response when updating a repo-level variable
|
||||
// "204":
|
||||
// description: response when updating a repo-level variable
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
opt := web.GetForm[*api.UpdateVariableOption](ctx)
|
||||
|
||||
@@ -452,10 +438,8 @@ func (Action) ListVariables(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/VariableList"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
listOptions := utils.GetListOptions(ctx)
|
||||
|
||||
@@ -535,10 +519,8 @@ func (Action) ListRunners(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/RunnerList"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
shared.ListRunners(ctx, 0, ctx.Repo.Repository.ID)
|
||||
}
|
||||
|
||||
@@ -568,10 +550,8 @@ func (Action) GetRunner(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Runner"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
shared.GetRunner(ctx, 0, ctx.Repo.Repository.ID, ctx.PathParamInt64("runner_id"))
|
||||
}
|
||||
|
||||
@@ -601,10 +581,8 @@ func (Action) DeleteRunner(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// description: runner has been deleted
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
shared.DeleteRunner(ctx, 0, ctx.Repo.Repository.ID, ctx.PathParamInt64("runner_id"))
|
||||
}
|
||||
|
||||
@@ -640,12 +618,8 @@ func (Action) UpdateRunner(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Runner"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
shared.UpdateRunner(ctx, 0, ctx.Repo.Repository.ID, ctx.PathParamInt64("runner_id"))
|
||||
}
|
||||
|
||||
@@ -691,12 +665,8 @@ func (Action) ListWorkflowJobs(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/WorkflowJobsList"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
|
||||
repoID := ctx.Repo.Repository.ID
|
||||
|
||||
@@ -762,10 +732,8 @@ func (Action) ListWorkflowRuns(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/WorkflowRunsList"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
repoID := ctx.Repo.Repository.ID
|
||||
|
||||
@@ -811,16 +779,8 @@ func ListActionTasks(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/TasksList"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "409":
|
||||
// "$ref": "#/responses/conflict"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
listOptions := utils.GetListOptions(ctx)
|
||||
|
||||
tasks, total, err := db.FindAndCount[actions_model.ActionTask](ctx, &actions_model.FindTaskOptions{
|
||||
@@ -876,15 +836,7 @@ func ActionsListRepositoryWorkflows(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ActionWorkflowList"
|
||||
// "400":
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "500":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
workflows, err := convert.ListActionWorkflows(ctx, ctx.Repo.GitRepo, ctx.Repo.Repository)
|
||||
@@ -921,15 +873,7 @@ func ActionsGetWorkflow(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ActionWorkflow"
|
||||
// "400":
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "500":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
workflowID := ctx.PathParam("workflow_id")
|
||||
@@ -1010,12 +954,8 @@ func ActionsListWorkflowRuns(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/WorkflowRunsList"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
workflowID := ctx.PathParam("workflow_id")
|
||||
scopedWorkflowSourceRepoID := ctx.FormInt64("scoped_workflow_source_repo_id")
|
||||
@@ -1068,14 +1008,8 @@ func ActionsDisableWorkflow(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// description: No Content
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
|
||||
workflowID := ctx.PathParam("workflow_id")
|
||||
err := actions_service.EnableOrDisableWorkflow(ctx, workflowID, false)
|
||||
@@ -1127,14 +1061,8 @@ func ActionsDispatchWorkflow(ctx *context.APIContext) {
|
||||
// "$ref": "#/responses/RunDetails"
|
||||
// "204":
|
||||
// description: No Content, if return_run_details is missing or false
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
|
||||
workflowID := ctx.PathParam("workflow_id")
|
||||
opt := web.GetForm[*api.CreateActionWorkflowDispatch](ctx)
|
||||
@@ -1215,16 +1143,8 @@ func ActionsEnableWorkflow(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// description: No Content
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "409":
|
||||
// "$ref": "#/responses/conflict"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
|
||||
workflowID := ctx.PathParam("workflow_id")
|
||||
err := actions_service.EnableOrDisableWorkflow(ctx, workflowID, true)
|
||||
@@ -1313,10 +1233,8 @@ func GetWorkflowRun(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/WorkflowRun"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
run := getCurrentRepoActionRunByID(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -1357,10 +1275,8 @@ func GetWorkflowRunAttempt(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/WorkflowRun"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
run, attempt := getCurrentRepoActionRunAttemptByNumber(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -1401,16 +1317,8 @@ func RerunWorkflowRun(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/WorkflowRun"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "409":
|
||||
// "$ref": "#/responses/error"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
|
||||
run, jobs := getCurrentRepoActionRunJobsByID(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -1454,16 +1362,8 @@ func RerunFailedWorkflowRun(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "409":
|
||||
// "$ref": "#/responses/error"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
|
||||
run, jobs := getCurrentRepoActionRunJobsByID(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -1516,16 +1416,8 @@ func RerunWorkflowJob(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/WorkflowJob"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "409":
|
||||
// "$ref": "#/responses/error"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
|
||||
run, jobs := getCurrentRepoActionRunJobsByID(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -1616,12 +1508,8 @@ func ListWorkflowRunJobs(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/WorkflowJobsList"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
|
||||
repoID, runID := ctx.Repo.Repository.ID, ctx.PathParamInt64("run")
|
||||
|
||||
@@ -1685,10 +1573,8 @@ func ListWorkflowRunAttemptJobs(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/WorkflowJobsList"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
run, attempt := getCurrentRepoActionRunAttemptByNumber(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -1724,10 +1610,8 @@ func GetWorkflowJob(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/WorkflowJob"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
jobID := ctx.PathParamInt64("job_id")
|
||||
job, has, err := db.GetByID[actions_model.ActionRunJob](ctx, jobID)
|
||||
@@ -1780,10 +1664,8 @@ func GetArtifactsOfRun(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ArtifactsList"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
artifactName := ctx.Req.URL.Query().Get("name")
|
||||
repoID, runID := ctx.Repo.Repository.ID, ctx.PathParamInt64("run")
|
||||
@@ -1837,10 +1719,8 @@ func DeleteActionRun(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// description: "No Content"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
run := getCurrentRepoActionRunByID(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -1885,10 +1765,8 @@ func GetArtifacts(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ArtifactsList"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
repoID := ctx.Repo.Repository.ID
|
||||
artifactName := ctx.Req.URL.Query().Get("name")
|
||||
@@ -1941,10 +1819,8 @@ func GetArtifact(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Artifact"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
art := getArtifactByPathParam(ctx, ctx.Repo.Repository)
|
||||
if ctx.Written() {
|
||||
@@ -1985,10 +1861,8 @@ func DeleteArtifact(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// description: "No Content"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
art := getArtifactByPathParam(ctx, ctx.Repo.Repository)
|
||||
if ctx.Written() {
|
||||
@@ -2048,10 +1922,8 @@ func DownloadArtifact(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "302":
|
||||
// description: redirect to the blob download
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
art := getArtifactByPathParam(ctx, ctx.Repo.Repository)
|
||||
if ctx.Written() {
|
||||
|
||||
@@ -37,10 +37,8 @@ func DownloadActionsRunJobLogs(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// description: output blob content
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
jobID := ctx.PathParamInt64("job_id")
|
||||
curJob, err := actions_model.GetRunJobByRepoAndID(ctx, ctx.Repo.Repository.ID, jobID)
|
||||
@@ -79,14 +77,8 @@ func CancelWorkflowRun(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/WorkflowRun"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "409":
|
||||
// "$ref": "#/responses/conflict"
|
||||
|
||||
cancelWorkflowRun(ctx, false)
|
||||
}
|
||||
@@ -120,14 +112,8 @@ func ForceCancelWorkflowRun(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/WorkflowRun"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "409":
|
||||
// "$ref": "#/responses/conflict"
|
||||
|
||||
cancelWorkflowRun(ctx, true)
|
||||
}
|
||||
@@ -182,14 +168,8 @@ func ApproveWorkflowRun(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/WorkflowRun"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "409":
|
||||
// "$ref": "#/responses/conflict"
|
||||
|
||||
run := getCurrentRepoActionRunByID(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -240,8 +220,8 @@ func GetWorkflowRunLogs(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// description: Logs archive
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
run := getCurrentRepoActionRunByID(ctx)
|
||||
if ctx.Written() {
|
||||
|
||||
@@ -38,8 +38,8 @@ func UpdateAvatar(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
form := web.GetForm[*api.UpdateRepoAvatarOption](ctx)
|
||||
|
||||
content, err := base64.StdEncoding.DecodeString(form.Image)
|
||||
@@ -77,8 +77,8 @@ func DeleteAvatar(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
err := repo_service.DeleteAvatar(ctx, ctx.Repo.Repository)
|
||||
if err != nil {
|
||||
ctx.APIErrorInternal(err)
|
||||
|
||||
@@ -36,10 +36,8 @@ func GetBlob(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/GitBlobResponse"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
sha := ctx.PathParam("sha")
|
||||
if len(sha) == 0 {
|
||||
|
||||
@@ -54,8 +54,8 @@ func GetBranch(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Branch"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
branchName := ctx.PathParam("*")
|
||||
|
||||
@@ -115,12 +115,8 @@ func DeleteBranch(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
if ctx.Repo.Repository.IsEmpty {
|
||||
ctx.APIError(http.StatusNotFound, "Git Repository is empty.")
|
||||
return
|
||||
@@ -194,14 +190,8 @@ func CreateBranch(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Branch"
|
||||
// "403":
|
||||
// description: The branch is archived or a mirror.
|
||||
// "404":
|
||||
// description: The old branch does not exist.
|
||||
// "409":
|
||||
// description: The branch with the same name already exists.
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
if ctx.Repo.Repository.IsEmpty {
|
||||
ctx.APIError(http.StatusNotFound, "Git Repository is empty.")
|
||||
@@ -418,14 +408,8 @@ func UpdateBranch(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "409":
|
||||
// "$ref": "#/responses/conflict"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
opt := web.GetForm[*api.UpdateBranchRepoOption](ctx)
|
||||
|
||||
@@ -493,12 +477,8 @@ func RenameBranch(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
opt := web.GetForm[*api.RenameBranchRepoOption](ctx)
|
||||
|
||||
@@ -565,8 +545,8 @@ func GetBranchProtection(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/BranchProtection"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
repo := ctx.Repo.Repository
|
||||
bpName := ctx.PathParam("*")
|
||||
@@ -674,14 +654,8 @@ func CreateBranchProtection(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/BranchProtection"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.CreateBranchProtectionOption](ctx)
|
||||
repo := ctx.Repo.Repository
|
||||
@@ -882,12 +856,8 @@ func EditBranchProtection(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/BranchProtection"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
form := web.GetForm[*api.EditBranchProtectionOption](ctx)
|
||||
repo := ctx.Repo.Repository
|
||||
bpName := ctx.PathParam("*")
|
||||
@@ -1231,8 +1201,8 @@ func DeleteBranchProtection(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
repo := ctx.Repo.Repository
|
||||
bpName := ctx.PathParam("*")
|
||||
@@ -1281,12 +1251,8 @@ func UpdateBranchProtectionPriories(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
form := web.GetForm[*api.UpdateBranchProtectionPriories](ctx)
|
||||
repo := ctx.Repo.Repository
|
||||
|
||||
@@ -1322,11 +1288,7 @@ func MergeUpstream(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/MergeUpstreamResponse"
|
||||
// "400":
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "409":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
form := web.GetForm[*api.MergeUpstreamRequest](ctx)
|
||||
mergeStyle, err := repo_service.MergeUpstream(ctx, ctx.Doer, ctx.Repo.Repository, form.Branch, form.FfOnly)
|
||||
|
||||
@@ -52,8 +52,8 @@ func ListCollaborators(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/UserList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
collaborators, total, err := repo_model.GetCollaborators(ctx, &repo_model.FindCollaborationOptions{
|
||||
ListOptions: utils.GetListOptions(ctx),
|
||||
@@ -99,10 +99,8 @@ func IsCollaborator(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
user, err := user_model.GetUserByName(ctx, ctx.PathParam("collaborator"))
|
||||
if err != nil {
|
||||
@@ -155,12 +153,8 @@ func AddOrUpdateCollaborator(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.AddCollaboratorOption](ctx)
|
||||
|
||||
@@ -222,10 +216,8 @@ func DeleteCollaborator(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
collaborator, err := user_model.GetUserByName(ctx, ctx.PathParam("collaborator"))
|
||||
if err != nil {
|
||||
@@ -270,10 +262,8 @@ func GetRepoPermissions(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/RepoCollaboratorPermission"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
collaboratorUsername := ctx.PathParam("collaborator")
|
||||
if !ctx.Doer.IsAdmin && !strings.EqualFold(ctx.Doer.LowerName, collaboratorUsername) && !ctx.IsUserRepoAdmin() {
|
||||
@@ -321,8 +311,8 @@ func GetReviewers(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/UserList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
canChooseReviewer := issue_service.CanDoerChangeReviewRequests(ctx, ctx.Doer, ctx.Repo.Repository, 0)
|
||||
if !canChooseReviewer {
|
||||
@@ -359,8 +349,8 @@ func GetAssignees(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/UserList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
assignees, err := repo_model.GetRepoAssignees(ctx, ctx.Repo.Repository)
|
||||
if err != nil {
|
||||
@@ -397,10 +387,8 @@ func CheckRepoIssueAssignee(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
if checkAssignableUser(ctx, ctx.PathParam("assignee"), ctx.Repo.Repository) {
|
||||
ctx.Status(http.StatusNoContent)
|
||||
|
||||
@@ -58,10 +58,8 @@ func GetSingleCommit(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Commit"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
sha := ctx.PathParam("sha")
|
||||
if !git.IsValidRefPattern(sha) {
|
||||
@@ -154,10 +152,8 @@ func GetAllCommits(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/CommitList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "409":
|
||||
// "$ref": "#/responses/EmptyRepository"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
since := ctx.FormString("since")
|
||||
until := ctx.FormString("until")
|
||||
@@ -354,8 +350,8 @@ func DownloadCommitDiffOrPatch(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/string"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
sha := ctx.PathParam("sha")
|
||||
diffType := git.RawDiffType(ctx.PathParam("diffType"))
|
||||
|
||||
@@ -395,8 +391,8 @@ func GetCommitPullRequest(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/PullRequest"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
pr, err := issues_model.GetPullRequestByMergedCommit(ctx, ctx.Repo.Repository.ID, ctx.PathParam("sha"))
|
||||
if err != nil {
|
||||
|
||||
@@ -59,10 +59,8 @@ func CompareDiff(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Compare"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
if ctx.Repo.GitRepo == nil {
|
||||
var err error
|
||||
|
||||
+22
-48
@@ -67,8 +67,8 @@ func GetRawFile(ctx *context.APIContext) {
|
||||
// description: Returns raw file content.
|
||||
// schema:
|
||||
// type: file
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
if ctx.Repo.Repository.IsEmpty {
|
||||
ctx.APIErrorNotFound()
|
||||
@@ -120,8 +120,8 @@ func GetRawFileOrLFS(ctx *context.APIContext) {
|
||||
// description: Returns raw file content.
|
||||
// schema:
|
||||
// type: file
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
if ctx.Repo.Repository.IsEmpty {
|
||||
ctx.APIErrorNotFound()
|
||||
@@ -260,8 +260,8 @@ func GetArchive(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// 200:
|
||||
// description: success
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
serveRepoArchive(ctx, ctx.PathParam("*"), ctx.FormStrings("path"))
|
||||
}
|
||||
|
||||
@@ -296,8 +296,8 @@ func GetEditorconfig(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// 200:
|
||||
// description: success
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
ec, _, err := ctx.Repo.GetEditorconfig(ctx)
|
||||
if err != nil {
|
||||
@@ -391,14 +391,8 @@ func ChangeFiles(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/FilesResponse"
|
||||
// "403":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/error"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
apiOpts, opts := getAPIChangeRepoFileOptions[*api.ChangeFilesOptions](ctx)
|
||||
if ctx.Written() {
|
||||
return
|
||||
@@ -465,14 +459,8 @@ func CreateFile(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/FileResponse"
|
||||
// "403":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/error"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
|
||||
apiOpts, opts := getAPIChangeRepoFileOptions[*api.CreateFileOptions](ctx)
|
||||
if ctx.Written() {
|
||||
@@ -536,14 +524,8 @@ func UpdateFile(ctx *context.APIContext) {
|
||||
// "$ref": "#/responses/FileResponse"
|
||||
// "201":
|
||||
// "$ref": "#/responses/FileResponse"
|
||||
// "403":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/error"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
|
||||
apiOpts, opts := getAPIChangeRepoFileOptions[*api.UpdateFileOptions](ctx)
|
||||
if ctx.Written() {
|
||||
@@ -659,16 +641,8 @@ func DeleteFile(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/FileDeleteResponse"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/error"
|
||||
// "422":
|
||||
// "$ref": "#/responses/error"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
|
||||
apiOpts, opts := getAPIChangeRepoFileOptions[*api.DeleteFileOptions](ctx)
|
||||
if ctx.Written() {
|
||||
@@ -743,8 +717,8 @@ func GetContentsExt(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ContentsExtResponse"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
if treePath := ctx.PathParam("*"); treePath == "." || treePath == "/" {
|
||||
ctx.SetPathParam("*", "") // workaround for swagger, it requires path parameter to be "required", but we need to list root directory
|
||||
@@ -802,8 +776,8 @@ func GetContents(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ContentsResponse"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
ret := getRepoContents(ctx, files_service.GetContentsOrListOptions{
|
||||
TreePath: ctx.PathParam("*"),
|
||||
IncludeSingleFileContent: true,
|
||||
@@ -854,8 +828,8 @@ func GetContentsList(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ContentsListResponse"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// same as GetContents(), this function is here because swagger fails if path is empty in GetContents() interface
|
||||
GetContents(ctx)
|
||||
@@ -892,8 +866,8 @@ func GetFileContentsGet(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ContentsListResponse"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// The POST method requires "write" permission, so we also support this "GET" method
|
||||
opts := &api.GetFilesOptions{}
|
||||
@@ -939,8 +913,8 @@ func GetFileContentsPost(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ContentsListResponse"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// This is actually a "read" request, but we need to accept a "files" list, then POST method seems easy to use.
|
||||
// But the permission system requires that the caller must have "write" permission to use POST method.
|
||||
|
||||
@@ -51,8 +51,8 @@ func ListForks(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/RepositoryList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
listOptions := utils.GetListOptions(ctx)
|
||||
forks, total, err := repo_service.FindForks(ctx, ctx.Repo.Repository, ctx.Doer, listOptions)
|
||||
@@ -138,14 +138,8 @@ func CreateFork(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "202":
|
||||
// "$ref": "#/responses/Repository"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "409":
|
||||
// description: The repository with the same name already exists.
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.CreateForkOption](ctx)
|
||||
forkOwner := ctx.Doer // user/org that will own the fork
|
||||
|
||||
@@ -35,8 +35,8 @@ func ListGitHooks(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/GitHookList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
hooks, err := git.ListHooks(ctx.Repo.GitRepo)
|
||||
if err != nil {
|
||||
@@ -77,8 +77,8 @@ func GetGitHook(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/GitHook"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
hookID := ctx.PathParam("id")
|
||||
hook, err := git.GetHook(ctx.Repo.GitRepo, hookID)
|
||||
@@ -123,8 +123,8 @@ func EditGitHook(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/GitHook"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.EditGitHookOption](ctx)
|
||||
hookID := ctx.PathParam("id")
|
||||
@@ -173,8 +173,8 @@ func DeleteGitHook(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
hookID := ctx.PathParam("id")
|
||||
hook, err := git.GetHook(ctx.Repo.GitRepo, hookID)
|
||||
|
||||
@@ -36,8 +36,8 @@ func GetGitAllRefs(ctx *context.APIContext) {
|
||||
// "200":
|
||||
// # "$ref": "#/responses/Reference" TODO: swagger doesn't support different output formats by ref
|
||||
// "$ref": "#/responses/ReferenceList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
getGitRefsInternal(ctx, "")
|
||||
}
|
||||
@@ -69,8 +69,8 @@ func GetGitRefs(ctx *context.APIContext) {
|
||||
// "200":
|
||||
// # "$ref": "#/responses/Reference" TODO: swagger doesn't support different output formats by ref
|
||||
// "$ref": "#/responses/ReferenceList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
getGitRefsInternal(ctx, ctx.PathParam("*"))
|
||||
}
|
||||
|
||||
+16
-16
@@ -51,8 +51,8 @@ func ListHooks(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/HookList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
opts := &webhook.ListWebhookOptions{
|
||||
ListOptions: utils.GetListOptions(ctx),
|
||||
@@ -105,8 +105,8 @@ func GetHook(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Hook"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
repo := ctx.Repo
|
||||
hookID := ctx.PathParamInt64("id")
|
||||
@@ -156,8 +156,8 @@ func ListDeliveries(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/HookDeliveryList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
hookID := ctx.PathParamInt64("id")
|
||||
if _, err := utils.GetRepoHook(ctx, ctx.Repo.Repository.ID, hookID); err != nil {
|
||||
@@ -224,8 +224,8 @@ func GetDelivery(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/HookDelivery"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
hookID := ctx.PathParamInt64("id")
|
||||
if _, err := utils.GetRepoHook(ctx, ctx.Repo.Repository.ID, hookID); err != nil {
|
||||
@@ -276,8 +276,8 @@ func TestHook(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
if ctx.Repo.Commit == nil {
|
||||
// if repo does not have any commits, then don't send a webhook
|
||||
@@ -345,8 +345,8 @@ func CreateHook(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Hook"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
utils.AddRepoHook(ctx, web.GetForm[*api.CreateHookOption](ctx))
|
||||
}
|
||||
@@ -382,8 +382,8 @@ func EditHook(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Hook"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
form := web.GetForm[*api.EditHookOption](ctx)
|
||||
hookID := ctx.PathParamInt64("id")
|
||||
utils.EditRepoHook(ctx, form, hookID)
|
||||
@@ -416,8 +416,8 @@ func DeleteHook(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
if err := webhook.DeleteWebhookByRepoID(ctx, ctx.Repo.Repository.ID, ctx.PathParamInt64("id")); err != nil {
|
||||
if webhook.IsErrWebhookNotExist(err) {
|
||||
ctx.APIErrorNotFound()
|
||||
|
||||
@@ -122,10 +122,8 @@ func SearchIssues(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/IssueList"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
|
||||
before, since, err := context.GetQueryBeforeSince(ctx.Base)
|
||||
if err != nil {
|
||||
@@ -322,8 +320,8 @@ func ListIssues(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/IssueList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
before, since, err := context.GetQueryBeforeSince(ctx.Base)
|
||||
if err != nil {
|
||||
ctx.APIError(http.StatusUnprocessableEntity, err.Error())
|
||||
@@ -507,8 +505,8 @@ func GetIssue(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Issue"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
issue := getRepoIssueByIndexForDoer(ctx, ctx.PathParamInt64("index"))
|
||||
if issue == nil {
|
||||
@@ -581,16 +579,8 @@ func CreateIssue(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Issue"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "412":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
|
||||
form := web.GetForm[*api.CreateIssueOption](ctx)
|
||||
issue := &issues_model.Issue{
|
||||
@@ -689,14 +679,8 @@ func EditIssue(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Issue"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "412":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
|
||||
form := web.GetForm[*api.EditIssueOption](ctx)
|
||||
issue := getRepoIssueByIndexForDoer(ctx, ctx.PathParamInt64("index"))
|
||||
@@ -872,12 +856,8 @@ func DeleteIssue(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
issue := getRepoIssueByIndexForDoer(ctx, ctx.PathParamInt64("index"))
|
||||
if issue == nil {
|
||||
return
|
||||
@@ -941,10 +921,8 @@ func UpdateIssueDeadline(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/IssueDeadline"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
form := web.GetForm[*api.EditDeadlineOption](ctx)
|
||||
issue := getRepoIssueByIndexForDoer(ctx, ctx.PathParamInt64("index"))
|
||||
if issue == nil {
|
||||
|
||||
@@ -53,14 +53,8 @@ func AddIssueAssignees(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Issue"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
|
||||
opts := web.GetForm[*api.IssueAssigneesOption](ctx)
|
||||
updateIssueAssignees(ctx, *opts, true)
|
||||
@@ -100,12 +94,8 @@ func DeleteIssueAssignees(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Issue"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
opts := web.GetForm[*api.IssueAssigneesOption](ctx)
|
||||
updateIssueAssignees(ctx, *opts, false)
|
||||
@@ -143,10 +133,8 @@ func CheckIssueAssignee(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
issue := getRepoIssueByIndexForDoer(ctx, ctx.PathParamInt64("index"))
|
||||
if issue == nil {
|
||||
|
||||
@@ -54,7 +54,7 @@ func GetIssueAttachment(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Attachment"
|
||||
// "404":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
issue := getRepoIssueByIndexForDoer(ctx, ctx.PathParamInt64("index"))
|
||||
@@ -97,7 +97,7 @@ func ListIssueAttachments(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/AttachmentList"
|
||||
// "404":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
issue := getRepoIssueByIndexForDoer(ctx, ctx.PathParamInt64("index"))
|
||||
@@ -152,16 +152,8 @@ func CreateIssueAttachment(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Attachment"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/error"
|
||||
// "413":
|
||||
// "$ref": "#/responses/error"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
|
||||
issue := getRepoIssueByIndexForDoer(ctx, ctx.PathParamInt64("index"))
|
||||
if issue == nil {
|
||||
@@ -252,12 +244,8 @@ func EditIssueAttachment(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Attachment"
|
||||
// "404":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
|
||||
attachment := getIssueAttachmentSafeWrite(ctx)
|
||||
if attachment == nil {
|
||||
@@ -315,10 +303,8 @@ func DeleteIssueAttachment(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
|
||||
attachment := getIssueAttachmentSafeWrite(ctx)
|
||||
if attachment == nil {
|
||||
|
||||
@@ -58,8 +58,8 @@ func ListIssueComments(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/CommentList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
before, since, err := context.GetQueryBeforeSince(ctx.Base)
|
||||
if err != nil {
|
||||
@@ -155,8 +155,8 @@ func ListIssueCommentsAndTimeline(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/TimelineList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
before, since, err := context.GetQueryBeforeSince(ctx.Base)
|
||||
if err != nil {
|
||||
@@ -242,8 +242,8 @@ func ListRepoIssueComments(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/CommentList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
before, since, err := context.GetQueryBeforeSince(ctx.Base)
|
||||
if err != nil {
|
||||
@@ -345,12 +345,8 @@ func CreateIssueComment(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Comment"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.CreateIssueCommentOption](ctx)
|
||||
issue := getRepoIssueByIndexForDoer(ctx, ctx.PathParamInt64("index"))
|
||||
@@ -407,10 +403,8 @@ func GetIssueComment(ctx *context.APIContext) {
|
||||
// "$ref": "#/responses/Comment"
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
comment, err := issues_model.GetCommentWithRepoID(ctx, ctx.Repo.Repository.ID, ctx.PathParamInt64("id"))
|
||||
if err != nil {
|
||||
@@ -471,12 +465,8 @@ func EditIssueComment(ctx *context.APIContext) {
|
||||
// "$ref": "#/responses/Comment"
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.EditIssueCommentOption](ctx)
|
||||
editIssueComment(ctx, *form)
|
||||
@@ -523,10 +513,8 @@ func EditIssueCommentDeprecated(ctx *context.APIContext) {
|
||||
// "$ref": "#/responses/Comment"
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.EditIssueCommentOption](ctx)
|
||||
editIssueComment(ctx, *form)
|
||||
@@ -589,10 +577,8 @@ func DeleteIssueComment(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
deleteIssueComment(ctx)
|
||||
}
|
||||
@@ -628,10 +614,8 @@ func DeleteIssueCommentDeprecated(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
deleteIssueComment(ctx)
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ func GetIssueCommentAttachment(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Attachment"
|
||||
// "404":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
comment := getIssueCommentSafe(ctx)
|
||||
@@ -103,7 +103,7 @@ func ListIssueCommentAttachments(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/AttachmentList"
|
||||
// "404":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
comment := getIssueCommentSafe(ctx)
|
||||
if comment == nil {
|
||||
@@ -157,18 +157,8 @@ func CreateIssueCommentAttachment(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Attachment"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/error"
|
||||
// "413":
|
||||
// "$ref": "#/responses/error"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
|
||||
// Check if comment exists and load comment
|
||||
comment := getIssueCommentSafe(ctx)
|
||||
@@ -268,12 +258,8 @@ func EditIssueCommentAttachment(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Attachment"
|
||||
// "404":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
attach := getIssueCommentAttachmentSafeWrite(ctx)
|
||||
if attach == nil {
|
||||
return
|
||||
@@ -328,10 +314,8 @@ func DeleteIssueCommentAttachment(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
attach := getIssueCommentAttachmentSafeWrite(ctx)
|
||||
if attach == nil {
|
||||
return
|
||||
|
||||
@@ -52,8 +52,8 @@ func GetIssueDependencies(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/IssueList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// If this issue's repository does not enable dependencies then there can be no dependencies by default
|
||||
if !ctx.Repo.Repository.IsDependenciesEnabled(ctx) {
|
||||
@@ -164,10 +164,8 @@ func CreateIssueDependency(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Issue"
|
||||
// "404":
|
||||
// description: the issue does not exist
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// We want to make <:index> depend on <Form>, i.e. <:index> is the target
|
||||
target := getRepoIssueByIndexForDoer(ctx, ctx.PathParamInt64("index"))
|
||||
@@ -225,10 +223,8 @@ func RemoveIssueDependency(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Issue"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// We want to make <:index> depend on <Form>, i.e. <:index> is the target
|
||||
target := getRepoIssueByIndexForDoer(ctx, ctx.PathParamInt64("index"))
|
||||
@@ -290,8 +286,8 @@ func GetIssueBlocks(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/IssueList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// We need to list the issues that DEPEND on this issue not the other way round
|
||||
// Therefore whether dependencies are enabled or not in this repository is potentially irrelevant.
|
||||
@@ -384,8 +380,8 @@ func CreateIssueBlocking(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Issue"
|
||||
// "404":
|
||||
// description: the issue does not exist
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
dependency := getRepoIssueByIndexForDoer(ctx, ctx.PathParamInt64("index"))
|
||||
if ctx.Written() {
|
||||
@@ -441,8 +437,8 @@ func RemoveIssueBlocking(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Issue"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
dependency := getRepoIssueByIndexForDoer(ctx, ctx.PathParamInt64("index"))
|
||||
if ctx.Written() {
|
||||
|
||||
@@ -45,8 +45,8 @@ func ListIssueLabels(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/LabelList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
issue := getRepoIssueByIndexForDoer(ctx, ctx.PathParamInt64("index"))
|
||||
if issue == nil {
|
||||
@@ -94,12 +94,8 @@ func AddIssueLabels(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/LabelList"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.IssueLabelsOption](ctx)
|
||||
issue, labels, err := prepareForReplaceOrAdd(ctx, *form)
|
||||
@@ -154,14 +150,8 @@ func DeleteIssueLabel(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
issue := getRepoIssueByIndexForDoer(ctx, ctx.PathParamInt64("index"))
|
||||
if issue == nil {
|
||||
@@ -223,12 +213,8 @@ func ReplaceIssueLabels(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/LabelList"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
form := web.GetForm[*api.IssueLabelsOption](ctx)
|
||||
issue, labels, err := prepareForReplaceOrAdd(ctx, *form)
|
||||
if err != nil {
|
||||
@@ -276,12 +262,8 @@ func ClearIssueLabels(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
issue := getRepoIssueByIndexForDoer(ctx, ctx.PathParamInt64("index"))
|
||||
if issue == nil {
|
||||
|
||||
@@ -45,10 +45,8 @@ func LockIssue(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
reason := web.GetForm[*api.LockIssueOption](ctx).Reason
|
||||
issue := getRepoIssueByIndexForDoer(ctx, ctx.PathParamInt64("index"))
|
||||
@@ -108,10 +106,8 @@ func UnlockIssue(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
issue := getRepoIssueByIndexForDoer(ctx, ctx.PathParamInt64("index"))
|
||||
if issue == nil {
|
||||
|
||||
@@ -37,10 +37,8 @@ func PinIssue(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
issue := getRepoIssueByIndexForDoer(ctx, ctx.PathParamInt64("index"))
|
||||
if issue == nil {
|
||||
return
|
||||
@@ -87,10 +85,8 @@ func UnpinIssue(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
issue := getRepoIssueByIndexForDoer(ctx, ctx.PathParamInt64("index"))
|
||||
if issue == nil {
|
||||
return
|
||||
@@ -143,10 +139,8 @@ func MoveIssuePin(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
issue := getRepoIssueByIndexForDoer(ctx, ctx.PathParamInt64("index"))
|
||||
if issue == nil {
|
||||
return
|
||||
@@ -182,8 +176,8 @@ func ListPinnedIssues(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/IssueList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
issues, err := issues_model.GetPinnedIssues(ctx, ctx.Repo.Repository.ID, false)
|
||||
if err != nil {
|
||||
ctx.APIErrorInternal(err)
|
||||
@@ -214,8 +208,8 @@ func ListPinnedPullRequests(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/PullRequestList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
issues, err := issues_model.GetPinnedIssues(ctx, ctx.Repo.Repository.ID, true)
|
||||
if err != nil {
|
||||
ctx.APIErrorInternal(err)
|
||||
@@ -271,8 +265,8 @@ func AreNewIssuePinsAllowed(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/RepoNewIssuePinsAllowed"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
pinsAllowed := api.NewIssuePinsAllowed{}
|
||||
var err error
|
||||
|
||||
|
||||
@@ -47,10 +47,8 @@ func GetIssueCommentReactions(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ReactionList"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
comment, err := issues_model.GetCommentByID(ctx, ctx.PathParamInt64("id"))
|
||||
if err != nil {
|
||||
@@ -131,10 +129,8 @@ func PostIssueCommentReaction(ctx *context.APIContext) {
|
||||
// "$ref": "#/responses/Reaction"
|
||||
// "201":
|
||||
// "$ref": "#/responses/Reaction"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.EditReactionOption](ctx)
|
||||
|
||||
@@ -174,10 +170,8 @@ func DeleteIssueCommentReaction(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.EditReactionOption](ctx)
|
||||
|
||||
@@ -266,10 +260,8 @@ func GetIssueReactions(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ReactionList"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
issue, err := issues_model.GetIssueWithAttrsByIndex(ctx, ctx.Repo.Repository.ID, ctx.PathParamInt64("index"))
|
||||
if err != nil {
|
||||
@@ -345,10 +337,8 @@ func PostIssueReaction(ctx *context.APIContext) {
|
||||
// "$ref": "#/responses/Reaction"
|
||||
// "201":
|
||||
// "$ref": "#/responses/Reaction"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
form := web.GetForm[*api.EditReactionOption](ctx)
|
||||
changeIssueReaction(ctx, *form, true)
|
||||
}
|
||||
@@ -386,10 +376,8 @@ func DeleteIssueReaction(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
form := web.GetForm[*api.EditReactionOption](ctx)
|
||||
changeIssueReaction(ctx, *form, false)
|
||||
}
|
||||
|
||||
@@ -42,12 +42,8 @@ func StartIssueStopwatch(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// description: Not repo writer, user does not have rights to toggle stopwatch
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "409":
|
||||
// description: Cannot start a stopwatch again if it already exists
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
issue := prepareIssueForStopwatch(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -95,12 +91,8 @@ func StopIssueStopwatch(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// description: Not repo writer, user does not have rights to toggle stopwatch
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "409":
|
||||
// description: Cannot stop a non-existent stopwatch
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
issue := prepareIssueForStopwatch(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -147,12 +139,8 @@ func DeleteIssueStopwatch(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// description: Not repo writer, user does not have rights to toggle stopwatch
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "409":
|
||||
// description: Cannot cancel a non-existent stopwatch
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
issue := prepareIssueForStopwatch(ctx)
|
||||
if ctx.Written() {
|
||||
|
||||
@@ -53,8 +53,8 @@ func AddIssueSubscription(ctx *context.APIContext) {
|
||||
// description: Successfully Subscribed
|
||||
// "304":
|
||||
// description: User can only subscribe itself if he is no admin
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
setIssueSubscription(ctx, true)
|
||||
}
|
||||
@@ -97,8 +97,8 @@ func DelIssueSubscription(ctx *context.APIContext) {
|
||||
// description: Successfully Unsubscribed
|
||||
// "304":
|
||||
// description: User can only subscribe itself if he is no admin
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
setIssueSubscription(ctx, false)
|
||||
}
|
||||
@@ -176,8 +176,8 @@ func CheckIssueSubscription(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/WatchInfo"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
issue := getRepoIssueByIndexForDoer(ctx, ctx.PathParamInt64("index"))
|
||||
if issue == nil {
|
||||
@@ -236,8 +236,8 @@ func GetIssueSubscribers(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/UserList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
issue := getRepoIssueByIndexForDoer(ctx, ctx.PathParamInt64("index"))
|
||||
if issue == nil {
|
||||
|
||||
@@ -68,8 +68,8 @@ func ListTrackedTimes(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/TrackedTimeList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
if !ctx.Repo.Repository.IsTimetrackerEnabled(ctx) {
|
||||
ctx.APIErrorNotFound("timetracker is disabled")
|
||||
@@ -193,12 +193,8 @@ func AddTime(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/TrackedTime"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
form := web.GetForm[*api.AddTimeOption](ctx)
|
||||
issue := getRepoIssueByIndexForDoer(ctx, ctx.PathParamInt64("index"))
|
||||
if issue == nil {
|
||||
@@ -273,12 +269,8 @@ func ResetIssueTime(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
issue := getRepoIssueByIndexForDoer(ctx, ctx.PathParamInt64("index"))
|
||||
if issue == nil {
|
||||
@@ -341,12 +333,8 @@ func DeleteTime(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
issue := getRepoIssueByIndexForDoer(ctx, ctx.PathParamInt64("index"))
|
||||
if issue == nil {
|
||||
@@ -413,12 +401,8 @@ func ListTrackedTimesByUser(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/TrackedTimeList"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
if !ctx.Repo.Repository.IsTimetrackerEnabled(ctx) {
|
||||
ctx.APIError(http.StatusBadRequest, "time tracking disabled")
|
||||
@@ -499,12 +483,8 @@ func ListTrackedTimesByRepository(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/TrackedTimeList"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
if !ctx.Repo.Repository.IsTimetrackerEnabled(ctx) {
|
||||
ctx.APIError(http.StatusBadRequest, "time tracking disabled")
|
||||
|
||||
+10
-16
@@ -76,8 +76,8 @@ func ListDeployKeys(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/DeployKeyList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
opts := deploykey_model.ListDeployKeysOptions{
|
||||
ListOptions: utils.GetListOptions(ctx),
|
||||
@@ -131,8 +131,8 @@ func GetDeployKey(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/DeployKey"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
key, err := deploykey_model.GetDeployKeyByID(ctx, ctx.Repo.Repository.ID, ctx.PathParamInt64("id"))
|
||||
if err != nil {
|
||||
@@ -201,10 +201,8 @@ func CreateDeployKey(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/DeployKey"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.CreateKeyOption](ctx)
|
||||
content, err := asymkey_model.CheckPublicKeyString(form.Key)
|
||||
@@ -249,10 +247,8 @@ func CreateDeployToken(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/DeployKey"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.CreateDeployKeyTokenOption](ctx)
|
||||
accessMode := util.Iif(form.ReadOnly, perm.AccessModeRead, perm.AccessModeWrite)
|
||||
@@ -290,10 +286,8 @@ func DeleteDeployKey(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// a key that is already gone still leaves the caller with the state it asked for
|
||||
if _, err := asymkey_service.DeleteDeployKey(ctx, ctx.Repo.Repository, ctx.PathParamInt64("id")); err != nil && !deploykey_model.IsErrDeployKeyNotExist(err) {
|
||||
|
||||
@@ -46,8 +46,8 @@ func ListLabels(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/LabelList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
labels, err := issues_model.GetLabelsByRepoID(ctx, ctx.Repo.Repository.ID, ctx.FormString("sort"), utils.GetListOptions(ctx))
|
||||
if err != nil {
|
||||
@@ -92,8 +92,8 @@ func GetLabel(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Label"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
var (
|
||||
l *issues_model.Label
|
||||
@@ -140,10 +140,8 @@ func CreateLabel(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Label"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.CreateLabelOption](ctx)
|
||||
|
||||
@@ -202,10 +200,8 @@ func EditLabel(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Label"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.EditLabelOption](ctx)
|
||||
l, err := issues_model.GetLabelInRepoByID(ctx, ctx.Repo.Repository.ID, ctx.PathParamInt64("id"))
|
||||
@@ -265,8 +261,8 @@ func DeleteLabel(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
if err := issues_model.DeleteRepoLabel(ctx, ctx.Repo.Repository.ID, ctx.PathParamInt64("id")); err != nil {
|
||||
ctx.APIErrorInternal(err)
|
||||
|
||||
@@ -62,10 +62,10 @@ func GetLanguages(ctx *context.APIContext) {
|
||||
// type: string
|
||||
// required: true
|
||||
// responses:
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "200":
|
||||
// "$ref": "#/responses/LanguageStatistics"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
langs, err := repo_model.GetLanguageStats(ctx, ctx.Repo.Repository)
|
||||
if err != nil {
|
||||
|
||||
@@ -30,10 +30,10 @@ func GetLicenses(ctx *context.APIContext) {
|
||||
// type: string
|
||||
// required: true
|
||||
// responses:
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "200":
|
||||
// "$ref": "#/responses/LicensesList"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
licenses, err := repo_model.GetRepoLicenses(ctx, ctx.Repo.Repository)
|
||||
if err != nil {
|
||||
|
||||
@@ -49,12 +49,8 @@ func Migrate(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Repository"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "409":
|
||||
// description: The repository with the same name already exists.
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.MigrateRepoOptions](ctx)
|
||||
|
||||
|
||||
@@ -56,8 +56,8 @@ func ListMilestones(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/MilestoneList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
isClosed := common.ParseIssueFilterStateIsClosed(ctx.FormString("state"))
|
||||
|
||||
@@ -107,8 +107,8 @@ func GetMilestone(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Milestone"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
milestone := getMilestoneByIDOrName(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -145,8 +145,8 @@ func CreateMilestone(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Milestone"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
form := web.GetForm[*api.CreateMilestoneOption](ctx)
|
||||
|
||||
milestone := &issues_model.Milestone{
|
||||
@@ -203,8 +203,8 @@ func EditMilestone(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Milestone"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
form := web.GetForm[*api.EditMilestoneOption](ctx)
|
||||
milestone := getMilestoneByIDOrName(ctx)
|
||||
if milestone == nil {
|
||||
@@ -258,8 +258,8 @@ func DeleteMilestone(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
m := getMilestoneByIDOrName(ctx)
|
||||
if ctx.Written() {
|
||||
|
||||
@@ -46,10 +46,8 @@ func MirrorSync(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
repo := ctx.Repo.Repository
|
||||
|
||||
@@ -97,14 +95,8 @@ func PushMirrorSync(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
|
||||
if !setting.Mirror.Enabled {
|
||||
ctx.APIError(http.StatusBadRequest, "Mirror feature is disabled")
|
||||
@@ -160,12 +152,8 @@ func ListPushMirrors(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/PushMirrorList"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
if !setting.Mirror.Enabled {
|
||||
ctx.APIError(http.StatusBadRequest, "Mirror feature is disabled")
|
||||
@@ -218,12 +206,8 @@ func GetPushMirrorByName(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/PushMirror"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
if !setting.Mirror.Enabled {
|
||||
ctx.APIError(http.StatusBadRequest, "Mirror feature is disabled")
|
||||
@@ -279,12 +263,8 @@ func AddPushMirror(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/PushMirror"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
if !setting.Mirror.Enabled {
|
||||
ctx.APIError(http.StatusBadRequest, "Mirror feature is disabled")
|
||||
@@ -326,9 +306,7 @@ func DeletePushMirrorByRemoteName(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
if !setting.Mirror.Enabled {
|
||||
|
||||
@@ -46,10 +46,8 @@ func GetNote(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Note"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
sha := ctx.PathParam("sha")
|
||||
if !git.IsValidRefPattern(sha) {
|
||||
|
||||
@@ -40,10 +40,8 @@ func ApplyDiffPatch(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/FileResponse"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
apiOpts, changeRepoFileOpts := getAPIChangeRepoFileOptions[*api.ApplyDiffPatchFileOptions](ctx)
|
||||
opts := &files.ApplyDiffPatchOptions{
|
||||
Content: apiOpts.Content,
|
||||
|
||||
+19
-57
@@ -107,9 +107,7 @@ func ListPullRequests(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/PullRequestList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "500":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
labelIDs, err := base.StringsToInt64s(ctx.FormStrings("labels"))
|
||||
@@ -183,8 +181,8 @@ func GetPullRequest(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/PullRequest"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
pr, err := issues_model.GetPullRequestByIndex(ctx, ctx.Repo.Repository.ID, ctx.PathParamInt64("index"))
|
||||
if err != nil {
|
||||
@@ -242,8 +240,8 @@ func GetPullRequestByBaseHead(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/PullRequest"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
var headRepoID int64
|
||||
var headBranch string
|
||||
@@ -337,8 +335,8 @@ func DownloadPullDiffOrPatch(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/string"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
pr, err := issues_model.GetPullRequestByIndex(ctx, ctx.Repo.Repository.ID, ctx.PathParamInt64("index"))
|
||||
if err != nil {
|
||||
if issues_model.IsErrPullRequestNotExist(err) {
|
||||
@@ -390,16 +388,8 @@ func CreatePullRequest(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/PullRequest"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "409":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
|
||||
form := *web.GetForm[*api.CreatePullRequestOption](ctx)
|
||||
if form.Head == form.Base {
|
||||
@@ -591,18 +581,8 @@ func EditPullRequest(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/PullRequest"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "409":
|
||||
// "$ref": "#/responses/error"
|
||||
// "412":
|
||||
// "$ref": "#/responses/error"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
|
||||
form := web.GetForm[*api.EditPullRequestOption](ctx)
|
||||
pr, err := issues_model.GetPullRequestByIndex(ctx, ctx.Repo.Repository.ID, ctx.PathParamInt64("index"))
|
||||
@@ -826,8 +806,8 @@ func IsPullRequestMerged(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// description: pull request has been merged
|
||||
// "404":
|
||||
// description: pull request has not been merged
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
pr, err := issues_model.GetPullRequestByIndex(ctx, ctx.Repo.Repository.ID, ctx.PathParamInt64("index"))
|
||||
if err != nil {
|
||||
@@ -876,16 +856,8 @@ func MergePullRequest(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "405":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "409":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
|
||||
form := web.GetForm[*forms.MergePullRequestForm](ctx)
|
||||
|
||||
@@ -1168,14 +1140,8 @@ func UpdatePullRequest(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "409":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
|
||||
pr, err := issues_model.GetPullRequestByIndex(ctx, ctx.Repo.Repository.ID, ctx.PathParamInt64("index"))
|
||||
if err != nil {
|
||||
@@ -1266,12 +1232,8 @@ func CancelScheduledAutoMerge(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
pullIndex := ctx.PathParamInt64("index")
|
||||
pull, err := issues_model.GetPullRequestByIndex(ctx, ctx.Repo.Repository.ID, pullIndex)
|
||||
@@ -1356,8 +1318,8 @@ func GetPullRequestCommits(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/CommitList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
pr, err := issues_model.GetPullRequestByIndex(ctx, ctx.Repo.Repository.ID, ctx.PathParamInt64("index"))
|
||||
if err != nil {
|
||||
@@ -1482,8 +1444,8 @@ func GetPullRequestFiles(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ChangedFileList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
pr, err := issues_model.GetPullRequestByIndex(ctx, ctx.Repo.Repository.ID, ctx.PathParamInt64("index"))
|
||||
if err != nil {
|
||||
|
||||
@@ -58,8 +58,8 @@ func ListPullReviews(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/PullReviewList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
pr, err := issues_model.GetPullRequestByIndex(ctx, ctx.Repo.Repository.ID, ctx.PathParamInt64("index"))
|
||||
if err != nil {
|
||||
@@ -137,8 +137,8 @@ func GetPullReview(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/PullReview"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
review, _, statusSet := prepareSingleReview(ctx)
|
||||
if statusSet {
|
||||
@@ -187,8 +187,8 @@ func GetPullReviewComments(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/PullReviewCommentList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
review, _, statusSet := prepareSingleReview(ctx)
|
||||
if statusSet {
|
||||
@@ -245,12 +245,8 @@ func CreatePullReviewCommentReply(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/PullReviewComment"
|
||||
// "400":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
opts := web.GetForm[*api.CreatePullReviewCommentReplyOptions](ctx)
|
||||
|
||||
@@ -313,12 +309,8 @@ func ResolvePullReviewComment(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "400":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
updatePullReviewCommentResolve(ctx, true)
|
||||
}
|
||||
|
||||
@@ -349,12 +341,8 @@ func UnresolvePullReviewComment(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "400":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
updatePullReviewCommentResolve(ctx, false)
|
||||
}
|
||||
|
||||
@@ -435,10 +423,8 @@ func DeletePullReview(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
review, _, statusSet := prepareSingleReview(ctx)
|
||||
if statusSet {
|
||||
@@ -494,10 +480,8 @@ func CreatePullReview(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/PullReview"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
opts := web.GetForm[*api.CreatePullReviewOptions](ctx)
|
||||
pr, err := issues_model.GetPullRequestByIndex(ctx, ctx.Repo.Repository.ID, ctx.PathParamInt64("index"))
|
||||
@@ -617,10 +601,8 @@ func SubmitPullReview(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/PullReview"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
opts := web.GetForm[*api.SubmitPullReviewOptions](ctx)
|
||||
review, pr, isWrong := prepareSingleReview(ctx)
|
||||
@@ -772,10 +754,8 @@ func CreateReviewRequests(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/PullReviewList"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
opts := web.GetForm[*api.PullReviewRequestOptions](ctx)
|
||||
apiReviewRequest(ctx, *opts, true)
|
||||
@@ -813,12 +793,8 @@ func DeleteReviewRequests(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
opts := web.GetForm[*api.PullReviewRequestOptions](ctx)
|
||||
apiReviewRequest(ctx, *opts, false)
|
||||
}
|
||||
@@ -993,12 +969,8 @@ func DismissPullReview(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/PullReview"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
opts := web.GetForm[*api.DismissPullReviewOptions](ctx)
|
||||
dismissReview(ctx, opts.Message, true, opts.Priors)
|
||||
}
|
||||
@@ -1036,12 +1008,8 @@ func UnDismissPullReview(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/PullReview"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
dismissReview(ctx, "", false, false)
|
||||
}
|
||||
|
||||
|
||||
@@ -61,8 +61,8 @@ func GetRelease(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Release"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
id := ctx.PathParamInt64("id")
|
||||
release, err := repo_model.GetReleaseForRepoByID(ctx, ctx.Repo.Repository.ID, id)
|
||||
@@ -108,8 +108,8 @@ func GetLatestRelease(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Release"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
release, err := repo_model.GetLatestReleaseByRepoID(ctx, ctx.Repo.Repository.ID)
|
||||
if err != nil && !repo_model.IsErrReleaseNotExist(err) {
|
||||
ctx.APIErrorInternal(err)
|
||||
@@ -169,8 +169,8 @@ func ListReleases(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ReleaseList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
listOptions := utils.GetListOptions(ctx)
|
||||
if ctx.Written() {
|
||||
return
|
||||
@@ -237,12 +237,8 @@ func CreateRelease(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Release"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "409":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
|
||||
form := web.GetForm[*api.CreateReleaseOption](ctx)
|
||||
if ctx.Repo.Repository.IsEmpty {
|
||||
@@ -343,8 +339,8 @@ func EditRelease(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Release"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.EditReleaseOption](ctx)
|
||||
id := ctx.PathParamInt64("id")
|
||||
@@ -419,10 +415,8 @@ func DeleteRelease(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
id := ctx.PathParamInt64("id")
|
||||
rel, err := repo_model.GetReleaseForRepoByID(ctx, ctx.Repo.Repository.ID, id)
|
||||
|
||||
@@ -74,8 +74,8 @@ func GetReleaseAttachment(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Attachment"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
releaseID := ctx.PathParamInt64("id")
|
||||
if !checkReleaseMatchRepo(ctx, releaseID) {
|
||||
@@ -128,8 +128,8 @@ func ListReleaseAttachments(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/AttachmentList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
releaseID := ctx.PathParamInt64("id")
|
||||
release, err := repo_model.GetReleaseByID(ctx, releaseID)
|
||||
@@ -196,11 +196,7 @@ func CreateReleaseAttachment(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Attachment"
|
||||
// "400":
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "413":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// Check if attachments are enabled
|
||||
@@ -305,10 +301,8 @@ func EditReleaseAttachment(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Attachment"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.EditAttachmentOptions](ctx)
|
||||
|
||||
@@ -382,8 +376,8 @@ func DeleteReleaseAttachment(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// Check if release exists an load release
|
||||
releaseID := ctx.PathParamInt64("id")
|
||||
|
||||
@@ -39,8 +39,8 @@ func GetReleaseByTag(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Release"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
tag := ctx.PathParam("tag")
|
||||
|
||||
@@ -97,10 +97,8 @@ func DeleteReleaseByTag(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
tag := ctx.PathParam("tag")
|
||||
|
||||
|
||||
+24
-48
@@ -132,8 +132,8 @@ func Search(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/SearchResults"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
private := ctx.IsSigned && (ctx.FormString("private") == "" || ctx.FormBool("private"))
|
||||
|
||||
@@ -294,12 +294,8 @@ func Create(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Repository"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "409":
|
||||
// description: The repository with the same name already exists.
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
opt := web.GetForm[*api.CreateRepoOption](ctx)
|
||||
if ctx.Doer.IsOrganization() {
|
||||
// Shouldn't reach this condition, but just in case.
|
||||
@@ -336,14 +332,8 @@ func Generate(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Repository"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "409":
|
||||
// description: The repository with the same name already exists.
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
form := web.GetForm[*api.GenerateRepoOption](ctx)
|
||||
|
||||
if !ctx.Repo.Repository.IsTemplate {
|
||||
@@ -448,12 +438,8 @@ func CreateOrgRepoDeprecated(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Repository"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
CreateOrgRepo(ctx)
|
||||
}
|
||||
@@ -480,12 +466,8 @@ func CreateOrgRepo(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Repository"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
opt := web.GetForm[*api.CreateRepoOption](ctx)
|
||||
orgName := ctx.PathParam("org")
|
||||
org := prepareDoerCreateRepoInOrg(ctx, orgName)
|
||||
@@ -516,8 +498,8 @@ func Get(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Repository"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
if err := ctx.Repo.Repository.LoadAttributes(ctx); err != nil {
|
||||
ctx.APIErrorInternal(err)
|
||||
@@ -544,8 +526,8 @@ func GetByID(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Repository"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
repo, err := repo_model.GetRepositoryByID(ctx, ctx.PathParamInt64("id"))
|
||||
if err != nil {
|
||||
@@ -593,12 +575,8 @@ func Edit(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Repository"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
opts := *web.GetForm[*api.EditRepoOption](ctx)
|
||||
|
||||
@@ -1149,10 +1127,8 @@ func Delete(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
owner := ctx.Repo.Owner
|
||||
repo := ctx.Repo.Repository
|
||||
@@ -1191,8 +1167,8 @@ func GetIssueTemplates(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/IssueTemplates"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
ret := issue.ParseTemplatesFromDefaultBranch(ctx, ctx.Repo.Repository, ctx.Repo.GitRepo)
|
||||
if cnt := len(ret.TemplateErrors); cnt != 0 {
|
||||
ctx.Resp.Header().Add("X-Gitea-Warning", "error occurs when parsing issue template: count="+strconv.Itoa(cnt))
|
||||
@@ -1221,8 +1197,8 @@ func GetIssueConfig(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/RepoIssueConfig"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
issueConfig, _ := issue.GetTemplateConfigFromDefaultBranch(ctx, ctx.Repo.Repository, ctx.Repo.GitRepo)
|
||||
ctx.JSON(http.StatusOK, issueConfig)
|
||||
}
|
||||
@@ -1248,8 +1224,8 @@ func ValidateIssueConfig(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/RepoIssueConfigValidation"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
_, err := issue.GetTemplateConfigFromDefaultBranch(ctx, ctx.Repo.Repository, ctx.Repo.GitRepo)
|
||||
|
||||
if err == nil {
|
||||
@@ -1292,8 +1268,8 @@ func ListRepoActivityFeeds(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ActivityFeedsList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
listOptions := utils.GetListOptions(ctx)
|
||||
|
||||
|
||||
@@ -42,10 +42,8 @@ func ListStargazers(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/UserList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
stargazers, err := repo_model.GetStargazers(ctx, ctx.Repo.Repository, utils.GetListOptions(ctx))
|
||||
if err != nil {
|
||||
|
||||
@@ -47,10 +47,8 @@ func NewCommitStatus(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/CommitStatus"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
form := web.GetForm[*api.CreateStatusOption](ctx)
|
||||
sha := ctx.PathParam("sha")
|
||||
@@ -118,10 +116,8 @@ func GetCommitStatuses(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/CommitStatusList"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
getCommitStatuses(ctx, ctx.PathParam("sha"))
|
||||
}
|
||||
@@ -172,10 +168,8 @@ func GetCommitStatusesByRef(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/CommitStatusList"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
refCommit := resolveRefCommit(ctx, ctx.PathParam("ref"), 7)
|
||||
if ctx.Written() {
|
||||
@@ -246,10 +240,8 @@ func GetCombinedCommitStatusByRef(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/CombinedStatus"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
refCommit := resolveRefCommit(ctx, ctx.PathParam("ref"), 7)
|
||||
if ctx.Written() {
|
||||
|
||||
@@ -42,8 +42,8 @@ func ListSubscribers(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/UserList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
subscribers, err := repo_model.GetRepoWatchers(ctx, ctx.Repo.Repository.ID, utils.GetListOptions(ctx))
|
||||
if err != nil {
|
||||
|
||||
+17
-45
@@ -51,8 +51,8 @@ func ListTags(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/TagList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
listOpts := utils.GetListOptions(ctx)
|
||||
|
||||
@@ -97,10 +97,8 @@ func GetAnnotatedTag(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/AnnotatedTag"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
sha := ctx.PathParam("sha")
|
||||
if len(sha) == 0 {
|
||||
@@ -148,8 +146,8 @@ func GetTag(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Tag"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
tagName := ctx.PathParam("*")
|
||||
|
||||
tag, err := ctx.Repo.GitRepo.GetTag(ctx, tagName)
|
||||
@@ -185,16 +183,8 @@ func CreateTag(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Tag"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "405":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "409":
|
||||
// "$ref": "#/responses/conflict"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
form := web.GetForm[*api.CreateTagOption](ctx)
|
||||
|
||||
// If target is not provided use default branch
|
||||
@@ -256,16 +246,8 @@ func DeleteTag(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "405":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "409":
|
||||
// "$ref": "#/responses/conflict"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
tagName := ctx.PathParam("*")
|
||||
|
||||
tag, err := repo_model.GetRelease(ctx, ctx.Repo.Repository.ID, tagName)
|
||||
@@ -357,8 +339,8 @@ func GetTagProtection(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/TagProtection"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
repo := ctx.Repo.Repository
|
||||
id := ctx.PathParamInt64("id")
|
||||
@@ -403,14 +385,8 @@ func CreateTagProtection(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/TagProtection"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.CreateTagProtectionOption](ctx)
|
||||
repo := ctx.Repo.Repository
|
||||
@@ -515,12 +491,8 @@ func EditTagProtection(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/TagProtection"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
repo := ctx.Repo.Repository
|
||||
form := web.GetForm[*api.EditTagProtectionOption](ctx)
|
||||
@@ -616,8 +588,8 @@ func DeleteTagProtection(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
repo := ctx.Repo.Repository
|
||||
id := ctx.PathParamInt64("id")
|
||||
|
||||
@@ -35,8 +35,8 @@ func ListTeams(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/TeamList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
if !ctx.Repo.Owner.IsOrganization() {
|
||||
ctx.APIError(http.StatusMethodNotAllowed, "repo is not owned by an organization")
|
||||
@@ -84,9 +84,7 @@ func IsTeam(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Team"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "405":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
if !ctx.Repo.Owner.IsOrganization() {
|
||||
@@ -138,14 +136,8 @@ func AddTeam(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "405":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
changeRepoTeam(ctx, true)
|
||||
}
|
||||
@@ -176,14 +168,8 @@ func DeleteTeam(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "405":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
changeRepoTeam(ctx, false)
|
||||
}
|
||||
|
||||
@@ -46,8 +46,8 @@ func ListTopics(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/TopicNames"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
opts := &repo_model.FindTopicOptions{
|
||||
ListOptions: utils.GetListOptions(ctx),
|
||||
@@ -96,12 +96,8 @@ func UpdateTopics(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/invalidTopicsError"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.RepoTopicOptions](ctx)
|
||||
topicNames := form.Topics
|
||||
@@ -159,12 +155,8 @@ func AddTopic(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/invalidTopicsError"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
topicName := strings.TrimSpace(strings.ToLower(ctx.PathParam("topic")))
|
||||
|
||||
@@ -228,12 +220,8 @@ func DeleteTopic(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/invalidTopicsError"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
topicName := strings.TrimSpace(strings.ToLower(ctx.PathParam("topic")))
|
||||
|
||||
@@ -284,10 +272,8 @@ func TopicSearch(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/TopicListResponse"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
opts := &repo_model.FindTopicOptions{
|
||||
Keyword: ctx.FormString("q"),
|
||||
|
||||
@@ -49,12 +49,8 @@ func Transfer(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "202":
|
||||
// "$ref": "#/responses/Repository"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
opts := web.GetForm[*api.TransferRepoOption](ctx)
|
||||
|
||||
@@ -154,10 +150,8 @@ func AcceptTransfer(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "202":
|
||||
// "$ref": "#/responses/Repository"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
err := repo_service.AcceptTransferOwnership(ctx, ctx.Repo.Repository, ctx.Doer)
|
||||
if err != nil {
|
||||
@@ -198,10 +192,8 @@ func RejectTransfer(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Repository"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
err := repo_service.RejectRepositoryTransfer(ctx, ctx.Repo.Repository, ctx.Doer)
|
||||
if err != nil {
|
||||
|
||||
@@ -51,10 +51,8 @@ func GetTree(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/GitTreeResponse"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
sha := ctx.PathParam("sha")
|
||||
if len(sha) == 0 {
|
||||
|
||||
+10
-26
@@ -45,14 +45,8 @@ func NewWikiPage(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/WikiPage"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
|
||||
form := web.GetForm[*api.CreateWikiPageOptions](ctx)
|
||||
wikiName := wiki_service.UserTitleToWebPath("", form.Title)
|
||||
@@ -117,14 +111,8 @@ func EditWikiPage(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/WikiPage"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
|
||||
form := web.GetForm[*api.CreateWikiPageOptions](ctx)
|
||||
|
||||
@@ -227,12 +215,8 @@ func DeleteWikiPage(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
wikiName := wiki_service.WebPathFromRequest(ctx.PathParamRaw("pageName"))
|
||||
|
||||
@@ -275,8 +259,8 @@ func ListWikiPages(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/WikiPageList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
wikiRepo, commit := findWikiRepoCommit(ctx)
|
||||
if wikiRepo != nil {
|
||||
@@ -352,8 +336,8 @@ func GetWikiPage(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/WikiPage"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// get requested pagename
|
||||
pageName := wiki_service.WebPathFromRequest(ctx.PathParamRaw("pageName"))
|
||||
@@ -394,8 +378,8 @@ func ListPageRevisions(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/WikiCommitList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
wikiRepo, commit := findWikiRepoCommit(ctx)
|
||||
if wikiRepo != nil {
|
||||
|
||||
@@ -202,8 +202,8 @@ func ListProjects(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ProjectList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation GET /orgs/{org}/projects organization orgListProjects
|
||||
// ---
|
||||
@@ -233,8 +233,8 @@ func ListProjects(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ProjectList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation GET /user/projects user userCurrentListProjects
|
||||
// ---
|
||||
@@ -288,8 +288,8 @@ func ListProjects(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ProjectList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
scope := projectScopeFromContext(ctx)
|
||||
listOptions := utils.GetListOptions(ctx)
|
||||
@@ -344,8 +344,8 @@ func GetProject(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Project"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation GET /orgs/{org}/projects/{id} organization orgGetProject
|
||||
// ---
|
||||
@@ -367,8 +367,8 @@ func GetProject(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Project"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation GET /user/projects/{id} user userCurrentGetProject
|
||||
// ---
|
||||
@@ -385,8 +385,8 @@ func GetProject(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Project"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
project := projectScopeFromContext(ctx).findProject(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -425,12 +425,8 @@ func CreateProject(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Project"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation POST /orgs/{org}/projects organization orgCreateProject
|
||||
// ---
|
||||
@@ -452,10 +448,8 @@ func CreateProject(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Project"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation POST /user/projects user userCurrentCreateProject
|
||||
// ---
|
||||
@@ -472,8 +466,8 @@ func CreateProject(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/Project"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
scope := projectScopeFromContext(ctx)
|
||||
form := web.GetForm[*api.CreateProjectOption](ctx)
|
||||
@@ -540,12 +534,8 @@ func EditProject(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Project"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation PATCH /orgs/{org}/projects/{id} organization orgEditProject
|
||||
// ---
|
||||
@@ -573,10 +563,8 @@ func EditProject(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Project"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation PATCH /user/projects/{id} user userCurrentEditProject
|
||||
// ---
|
||||
@@ -599,10 +587,8 @@ func EditProject(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Project"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
project := projectScopeFromContext(ctx).findProject(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -669,10 +655,8 @@ func DeleteProject(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation DELETE /orgs/{org}/projects/{id} organization orgDeleteProject
|
||||
// ---
|
||||
@@ -692,8 +676,8 @@ func DeleteProject(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation DELETE /user/projects/{id} user userCurrentDeleteProject
|
||||
// ---
|
||||
@@ -708,8 +692,8 @@ func DeleteProject(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
project := projectScopeFromContext(ctx).findProject(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -756,8 +740,8 @@ func ListProjectColumns(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ProjectColumnList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation GET /orgs/{org}/projects/{id}/columns organization orgListProjectColumns
|
||||
// ---
|
||||
@@ -787,8 +771,8 @@ func ListProjectColumns(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ProjectColumnList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation GET /user/projects/{id}/columns user userCurrentListProjectColumns
|
||||
// ---
|
||||
@@ -813,8 +797,8 @@ func ListProjectColumns(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ProjectColumnList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
project := projectScopeFromContext(ctx).findProject(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -870,14 +854,8 @@ func CreateProjectColumn(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/ProjectColumn"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation POST /orgs/{org}/projects/{id}/columns organization orgCreateProjectColumn
|
||||
// ---
|
||||
@@ -905,12 +883,8 @@ func CreateProjectColumn(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/ProjectColumn"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation POST /user/projects/{id}/columns user userCurrentCreateProjectColumn
|
||||
// ---
|
||||
@@ -933,12 +907,8 @@ func CreateProjectColumn(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/ProjectColumn"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
project := projectScopeFromContext(ctx).findOpenProject(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -991,8 +961,8 @@ func GetProjectColumn(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ProjectColumn"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation GET /orgs/{org}/projects/{id}/columns/{column_id} organization orgGetProjectColumn
|
||||
// ---
|
||||
@@ -1020,8 +990,8 @@ func GetProjectColumn(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ProjectColumn"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation GET /user/projects/{id}/columns/{column_id} user userCurrentGetProjectColumn
|
||||
// ---
|
||||
@@ -1044,8 +1014,8 @@ func GetProjectColumn(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ProjectColumn"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
_, column := projectScopeFromContext(ctx).findColumn(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -1092,14 +1062,8 @@ func EditProjectColumn(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ProjectColumn"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation PATCH /orgs/{org}/projects/{id}/columns/{column_id} organization orgEditProjectColumn
|
||||
// ---
|
||||
@@ -1133,12 +1097,8 @@ func EditProjectColumn(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ProjectColumn"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation PATCH /user/projects/{id}/columns/{column_id} user userCurrentEditProjectColumn
|
||||
// ---
|
||||
@@ -1167,12 +1127,8 @@ func EditProjectColumn(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ProjectColumn"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
_, column := projectScopeFromContext(ctx).findOpenColumn(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -1232,14 +1188,8 @@ func DeleteProjectColumn(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation DELETE /orgs/{org}/projects/{id}/columns/{column_id} organization orgDeleteProjectColumn
|
||||
// ---
|
||||
@@ -1266,12 +1216,8 @@ func DeleteProjectColumn(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation DELETE /user/projects/{id}/columns/{column_id} user userCurrentDeleteProjectColumn
|
||||
// ---
|
||||
@@ -1293,12 +1239,8 @@ func DeleteProjectColumn(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
_, column := projectScopeFromContext(ctx).findOpenColumn(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -1342,12 +1284,8 @@ func SetDefaultProjectColumn(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation POST /orgs/{org}/projects/{id}/columns/{column_id}/default organization orgSetDefaultProjectColumn
|
||||
// ---
|
||||
@@ -1374,10 +1312,8 @@ func SetDefaultProjectColumn(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation POST /user/projects/{id}/columns/{column_id}/default user userCurrentSetDefaultProjectColumn
|
||||
// ---
|
||||
@@ -1399,10 +1335,8 @@ func SetDefaultProjectColumn(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
project, column := projectScopeFromContext(ctx).findOpenColumn(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -1446,14 +1380,8 @@ func MoveProjectColumns(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation POST /orgs/{org}/projects/{id}/columns/move organization orgMoveProjectColumns
|
||||
// ---
|
||||
@@ -1480,12 +1408,8 @@ func MoveProjectColumns(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation POST /user/projects/{id}/columns/move user userCurrentMoveProjectColumns
|
||||
// ---
|
||||
@@ -1507,12 +1431,8 @@ func MoveProjectColumns(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
project := projectScopeFromContext(ctx).findOpenProject(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -1582,8 +1502,8 @@ func ListProjectColumnIssues(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/IssueList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation GET /orgs/{org}/projects/{id}/columns/{column_id}/issues organization orgListProjectColumnIssues
|
||||
// ---
|
||||
@@ -1619,8 +1539,8 @@ func ListProjectColumnIssues(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/IssueList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation GET /user/projects/{id}/columns/{column_id}/issues user userCurrentListProjectColumnIssues
|
||||
// ---
|
||||
@@ -1651,8 +1571,8 @@ func ListProjectColumnIssues(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/IssueList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
scope := projectScopeFromContext(ctx)
|
||||
project, column := scope.findColumn(ctx)
|
||||
@@ -1744,14 +1664,8 @@ func AddIssueToProjectColumn(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation POST /orgs/{org}/projects/{id}/columns/{column_id}/issues/{issue_id} organization orgAddIssueToProjectColumn
|
||||
// ---
|
||||
@@ -1784,14 +1698,8 @@ func AddIssueToProjectColumn(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation POST /user/projects/{id}/columns/{column_id}/issues/{issue_id} user userCurrentAddIssueToProjectColumn
|
||||
// ---
|
||||
@@ -1819,14 +1727,8 @@ func AddIssueToProjectColumn(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
column, issue := projectScopeFromContext(ctx).findColumnIssue(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -1875,12 +1777,8 @@ func RemoveIssueFromProjectColumn(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation DELETE /orgs/{org}/projects/{id}/columns/{column_id}/issues/{issue_id} organization orgRemoveIssueFromProjectColumn
|
||||
// ---
|
||||
@@ -1912,12 +1810,8 @@ func RemoveIssueFromProjectColumn(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation DELETE /user/projects/{id}/columns/{column_id}/issues/{issue_id} user userCurrentRemoveIssueFromProjectColumn
|
||||
// ---
|
||||
@@ -1944,12 +1838,8 @@ func RemoveIssueFromProjectColumn(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
column, issue := projectScopeFromContext(ctx).findColumnIssue(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -1998,14 +1888,8 @@ func MoveProjectIssue(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation POST /orgs/{org}/projects/{id}/issues/{issue_id}/move organization orgMoveProjectIssue
|
||||
// ---
|
||||
@@ -2037,14 +1921,8 @@ func MoveProjectIssue(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation POST /user/projects/{id}/issues/{issue_id}/move user userCurrentMoveProjectIssue
|
||||
// ---
|
||||
@@ -2071,14 +1949,8 @@ func MoveProjectIssue(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
scope := projectScopeFromContext(ctx)
|
||||
project := scope.findOpenProject(ctx)
|
||||
|
||||
@@ -59,8 +59,8 @@ func ListProjectWorkflows(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ProjectWorkflowList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation GET /orgs/{org}/projects/{id}/workflows organization orgListProjectWorkflows
|
||||
// ---
|
||||
@@ -90,8 +90,8 @@ func ListProjectWorkflows(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ProjectWorkflowList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation GET /user/projects/{id}/workflows user userCurrentListProjectWorkflows
|
||||
// ---
|
||||
@@ -116,8 +116,8 @@ func ListProjectWorkflows(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ProjectWorkflowList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
project := projectScopeFromContext(ctx).findProject(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -166,8 +166,8 @@ func GetProjectWorkflow(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ProjectWorkflow"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation GET /orgs/{org}/projects/{id}/workflows/{workflow_id} organization orgGetProjectWorkflow
|
||||
// ---
|
||||
@@ -195,8 +195,8 @@ func GetProjectWorkflow(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ProjectWorkflow"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation GET /user/projects/{id}/workflows/{workflow_id} user userCurrentGetProjectWorkflow
|
||||
// ---
|
||||
@@ -219,8 +219,8 @@ func GetProjectWorkflow(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ProjectWorkflow"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
project := projectScopeFromContext(ctx).findProject(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -265,14 +265,8 @@ func CreateProjectWorkflow(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/ProjectWorkflow"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation POST /orgs/{org}/projects/{id}/workflows organization orgCreateProjectWorkflow
|
||||
// ---
|
||||
@@ -300,12 +294,8 @@ func CreateProjectWorkflow(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/ProjectWorkflow"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation POST /user/projects/{id}/workflows user userCurrentCreateProjectWorkflow
|
||||
// ---
|
||||
@@ -328,12 +318,8 @@ func CreateProjectWorkflow(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/ProjectWorkflow"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
project := projectScopeFromContext(ctx).findOpenProject(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -385,14 +371,8 @@ func EditProjectWorkflow(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ProjectWorkflow"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation PATCH /orgs/{org}/projects/{id}/workflows/{workflow_id} organization orgEditProjectWorkflow
|
||||
// ---
|
||||
@@ -426,12 +406,8 @@ func EditProjectWorkflow(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ProjectWorkflow"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation PATCH /user/projects/{id}/workflows/{workflow_id} user userCurrentEditProjectWorkflow
|
||||
// ---
|
||||
@@ -460,12 +436,8 @@ func EditProjectWorkflow(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ProjectWorkflow"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
project := projectScopeFromContext(ctx).findOpenProject(ctx)
|
||||
if ctx.Written() {
|
||||
@@ -512,12 +484,8 @@ func DeleteProjectWorkflow(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "423":
|
||||
// "$ref": "#/responses/repoArchivedError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation DELETE /orgs/{org}/projects/{id}/workflows/{workflow_id} organization orgDeleteProjectWorkflow
|
||||
// ---
|
||||
@@ -543,10 +511,8 @@ func DeleteProjectWorkflow(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
// swagger:operation DELETE /user/projects/{id}/workflows/{workflow_id} user userCurrentDeleteProjectWorkflow
|
||||
// ---
|
||||
@@ -567,10 +533,8 @@ func DeleteProjectWorkflow(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
project := projectScopeFromContext(ctx).findOpenProject(ctx)
|
||||
if ctx.Written() {
|
||||
|
||||
@@ -303,13 +303,6 @@ type swaggerNote struct {
|
||||
Body api.Note `json:"body"`
|
||||
}
|
||||
|
||||
// EmptyRepository
|
||||
// swagger:response EmptyRepository
|
||||
type swaggerEmptyRepository struct {
|
||||
// in: body
|
||||
Body api.APIError `json:"body"`
|
||||
}
|
||||
|
||||
// FileResponse
|
||||
// swagger:response FileResponse
|
||||
type swaggerFileResponse struct {
|
||||
|
||||
@@ -44,10 +44,8 @@ func CreateOrUpdateSecret(ctx *context.APIContext) {
|
||||
// description: response when creating a secret
|
||||
// "204":
|
||||
// description: response when updating a secret
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
opt := web.GetForm[*api.CreateOrUpdateSecretOption](ctx)
|
||||
|
||||
@@ -88,10 +86,8 @@ func DeleteSecret(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// description: delete one secret of the user
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
s, err := secret_service.DeleteSecretByName(ctx, actions_model.BelongingScopeOwner(ctx.Doer.ID), ctx.PathParam("secretname"))
|
||||
if err != nil {
|
||||
@@ -126,10 +122,8 @@ func CreateVariable(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// description: successfully created the user-level variable
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "409":
|
||||
// description: variable name already exists.
|
||||
|
||||
opt := web.GetForm[*api.CreateVariableOption](ctx)
|
||||
|
||||
@@ -181,10 +175,8 @@ func UpdateVariable(ctx *context.APIContext) {
|
||||
// description: response when updating a variable
|
||||
// "204":
|
||||
// description: response when updating a variable
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
opt := web.GetForm[*api.UpdateVariableOption](ctx)
|
||||
|
||||
@@ -231,10 +223,8 @@ func DeleteVariable(ctx *context.APIContext) {
|
||||
// description: response when deleting a variable
|
||||
// "204":
|
||||
// description: response when deleting a variable
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
if err := actions_service.DeleteVariableByName(ctx, actions_model.BelongingScopeOwner(ctx.Doer.ID), ctx.PathParam("variablename")); err != nil {
|
||||
ctx.APIErrorAuto(err)
|
||||
@@ -260,10 +250,8 @@ func GetVariable(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ActionVariable"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
v, err := actions_service.GetVariable(ctx, actions_model.FindVariablesOpts{
|
||||
BelongingScope: actions_model.BelongingScopeOwner(ctx.Doer.ID),
|
||||
@@ -304,10 +292,8 @@ func ListVariables(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/VariableList"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
listOptions := utils.GetListOptions(ctx)
|
||||
vars, count, err := db.FindAndCount[actions_model.ActionVariable](ctx, &actions_model.FindVariablesOpts{
|
||||
BelongingScope: actions_model.BelongingScopeOwner(ctx.Doer.ID),
|
||||
@@ -378,10 +364,8 @@ func ListWorkflowRuns(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/WorkflowRunsList"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
shared.ListRuns(ctx, ctx.Doer.ID, 0, "")
|
||||
}
|
||||
|
||||
@@ -417,12 +401,8 @@ func ListWorkflowJobs(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/WorkflowJobsList"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
|
||||
shared.ListJobs(ctx, ctx.Doer.ID, 0, 0, nil)
|
||||
}
|
||||
+10
-18
@@ -47,8 +47,8 @@ func ListAccessTokens(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/AccessTokenList"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
opts := auth_model.ListAccessTokensOptions{UserID: ctx.ContextUser.ID, ListOptions: utils.GetListOptions(ctx)}
|
||||
|
||||
@@ -96,10 +96,8 @@ func CreateAccessToken(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/AccessToken"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
|
||||
form := web.GetForm[*api.CreateAccessTokenOption](ctx)
|
||||
|
||||
@@ -185,11 +183,7 @@ func DeleteAccessToken(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
token := ctx.PathParam("id")
|
||||
@@ -249,7 +243,7 @@ func CreateOauth2Application(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/OAuth2Application"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
data := web.GetForm[*api.CreateOAuth2ApplicationOptions](ctx)
|
||||
@@ -336,8 +330,8 @@ func DeleteOauth2Application(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
appID := ctx.PathParamInt64("id")
|
||||
app, err := auth_model.GetOAuth2ApplicationByID(ctx, appID)
|
||||
if err != nil {
|
||||
@@ -379,8 +373,8 @@ func GetOauth2Application(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/OAuth2Application"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
appID := ctx.PathParamInt64("id")
|
||||
app, err := auth_model.GetOAuth2ApplicationByID(ctx, appID)
|
||||
if err != nil {
|
||||
@@ -423,10 +417,8 @@ func UpdateOauth2Application(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/OAuth2Application"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
appID := ctx.PathParamInt64("id")
|
||||
|
||||
data := web.GetForm[*api.CreateOAuth2ApplicationOptions](ctx)
|
||||
|
||||
@@ -43,8 +43,8 @@ func CheckUserBlock(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
shared.CheckUserBlock(ctx, ctx.Doer)
|
||||
}
|
||||
@@ -66,10 +66,8 @@ func BlockUser(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
shared.BlockUser(ctx, ctx.Doer)
|
||||
}
|
||||
@@ -87,10 +85,8 @@ func UnblockUser(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
shared.UnblockUser(ctx, ctx.Doer, ctx.Doer)
|
||||
}
|
||||
@@ -54,12 +54,8 @@ func AddEmail(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// '201':
|
||||
// "$ref": "#/responses/EmailList"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "409":
|
||||
// "$ref": "#/responses/error"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
|
||||
if user_model.IsFeatureDisabledWithLoginType(ctx.Doer, setting.UserFeatureManageCredentials) {
|
||||
ctx.APIErrorNotFound("emails are not allowed to be changed")
|
||||
@@ -105,8 +101,8 @@ func DeleteEmail(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
if user_model.IsFeatureDisabledWithLoginType(ctx.Doer, setting.UserFeatureManageCredentials) {
|
||||
ctx.APIErrorNotFound("emails are not allowed to be changed")
|
||||
|
||||
@@ -83,8 +83,8 @@ func ListFollowers(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/UserList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
listUserFollowers(ctx, ctx.ContextUser)
|
||||
}
|
||||
@@ -149,8 +149,8 @@ func ListFollowing(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/UserList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
listUserFollowing(ctx, ctx.ContextUser)
|
||||
}
|
||||
@@ -177,8 +177,8 @@ func CheckMyFollowing(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
checkUserFollowing(ctx, ctx.Doer, ctx.ContextUser.ID)
|
||||
}
|
||||
@@ -202,8 +202,8 @@ func CheckFollowing(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
target := GetUserByPathParam(ctx, "target") // FIXME: it is not right to call this function, it should load the "target" directly
|
||||
if ctx.Written() {
|
||||
@@ -226,10 +226,8 @@ func Follow(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
if err := user_model.FollowUser(ctx, ctx.Doer, ctx.ContextUser); err != nil {
|
||||
if errors.Is(err, user_model.ErrBlockedUser) {
|
||||
@@ -256,8 +254,8 @@ func Unfollow(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
if err := user_model.UnfollowUser(ctx, ctx.Doer.ID, ctx.ContextUser.ID); err != nil {
|
||||
ctx.APIErrorInternal(err)
|
||||
|
||||
@@ -66,8 +66,8 @@ func ListGPGKeys(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/GPGKeyList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
listGPGKeys(ctx, ctx.ContextUser.ID, utils.GetListOptions(ctx))
|
||||
}
|
||||
@@ -91,10 +91,8 @@ func ListMyGPGKeys(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/GPGKeyList"
|
||||
// "401":
|
||||
// "$ref": "#/responses/unauthorized"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
listGPGKeys(ctx, ctx.Doer.ID, utils.GetListOptions(ctx))
|
||||
}
|
||||
@@ -116,12 +114,8 @@ func GetGPGKey(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/GPGKey"
|
||||
// "401":
|
||||
// "$ref": "#/responses/unauthorized"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
key, err := asymkey_model.GetGPGKeyForUserByID(ctx, ctx.Doer.ID, ctx.PathParamInt64("id"))
|
||||
if err != nil {
|
||||
@@ -171,12 +165,8 @@ func GetVerificationToken(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/string"
|
||||
// "401":
|
||||
// "$ref": "#/responses/unauthorized"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
token := asymkey_model.VerificationToken(ctx.Doer, 1)
|
||||
ctx.PlainText(http.StatusOK, token)
|
||||
@@ -194,14 +184,8 @@ func VerifyUserGPGKey(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/GPGKey"
|
||||
// "401":
|
||||
// "$ref": "#/responses/unauthorized"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.VerifyGPGKeyOption](ctx)
|
||||
token := asymkey_model.VerificationToken(ctx.Doer, 1)
|
||||
@@ -259,14 +243,8 @@ func CreateGPGKey(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/GPGKey"
|
||||
// "401":
|
||||
// "$ref": "#/responses/unauthorized"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.CreateGPGKeyOption](ctx)
|
||||
CreateUserGPGKey(ctx, *form, ctx.Doer.ID)
|
||||
@@ -289,12 +267,8 @@ func DeleteGPGKey(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "401":
|
||||
// "$ref": "#/responses/unauthorized"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
if user_model.IsFeatureDisabledWithLoginType(ctx.Doer, setting.UserFeatureManageGPGKeys) {
|
||||
ctx.APIErrorNotFound("gpg keys setting is not allowed to be changed")
|
||||
|
||||
+10
-24
@@ -121,10 +121,8 @@ func ListMyPublicKeys(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/PublicKeyList"
|
||||
// "401":
|
||||
// "$ref": "#/responses/unauthorized"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
listPublicKeys(ctx, ctx.Doer)
|
||||
}
|
||||
@@ -157,8 +155,8 @@ func ListPublicKeys(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/PublicKeyList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
listPublicKeys(ctx, ctx.ContextUser)
|
||||
}
|
||||
@@ -180,12 +178,8 @@ func GetPublicKey(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/PublicKey"
|
||||
// "401":
|
||||
// "$ref": "#/responses/unauthorized"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
key, err := asymkey_model.GetPublicKeyByID(ctx, ctx.PathParamInt64("id"))
|
||||
if err != nil {
|
||||
@@ -248,12 +242,8 @@ func CreatePublicKey(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "201":
|
||||
// "$ref": "#/responses/PublicKey"
|
||||
// "401":
|
||||
// "$ref": "#/responses/unauthorized"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
form := web.GetForm[*api.CreateKeyOption](ctx)
|
||||
CreateUserPublicKey(ctx, *form, ctx.Doer.ID)
|
||||
@@ -276,12 +266,8 @@ func DeletePublicKey(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "401":
|
||||
// "$ref": "#/responses/unauthorized"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
if user_model.IsFeatureDisabledWithLoginType(ctx.Doer, setting.UserFeatureManageSSHKeys) {
|
||||
ctx.APIErrorNotFound("ssh keys setting is not allowed to be changed")
|
||||
|
||||
@@ -77,8 +77,8 @@ func ListUserRepos(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/RepositoryList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
listUserRepos(ctx, ctx.ContextUser, ctx.IsSigned)
|
||||
}
|
||||
@@ -159,8 +159,8 @@ func ListOrgRepos(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/RepositoryList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
listUserRepos(ctx, ctx.Org.Organization.AsUser(), ctx.IsSigned)
|
||||
}
|
||||
@@ -41,10 +41,8 @@ func ListRunners(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/RunnerList"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
shared.ListRunners(ctx, ctx.Doer.ID, 0)
|
||||
}
|
||||
|
||||
@@ -64,10 +62,8 @@ func GetRunner(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Runner"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
shared.GetRunner(ctx, ctx.Doer.ID, 0, ctx.PathParamInt64("runner_id"))
|
||||
}
|
||||
|
||||
@@ -87,10 +83,8 @@ func DeleteRunner(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// description: runner has been deleted
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
shared.DeleteRunner(ctx, ctx.Doer.ID, 0, ctx.PathParamInt64("runner_id"))
|
||||
}
|
||||
|
||||
@@ -116,11 +110,7 @@ func UpdateRunner(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Runner"
|
||||
// "400":
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "422":
|
||||
// "$ref": "#/responses/validationError"
|
||||
shared.UpdateRunner(ctx, ctx.Doer.ID, 0, ctx.PathParamInt64("runner_id"))
|
||||
}
|
||||
+10
-18
@@ -70,10 +70,8 @@ func GetStarredRepos(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/RepositoryList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
private := ctx.ContextUser.ID == ctx.Doer.ID
|
||||
repos, err := getStarredRepos(ctx, ctx.ContextUser, private)
|
||||
@@ -106,8 +104,8 @@ func GetMyStarredRepos(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/RepositoryList"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
repos, err := getStarredRepos(ctx, ctx.Doer, true)
|
||||
if err != nil {
|
||||
@@ -138,10 +136,8 @@ func IsStarring(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
if repo_model.IsStaring(ctx, ctx.Doer.ID, ctx.Repo.Repository.ID) {
|
||||
ctx.Status(http.StatusNoContent)
|
||||
@@ -169,10 +165,8 @@ func Star(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
err := repo_model.StarRepo(ctx, ctx.Doer, ctx.Repo.Repository, true)
|
||||
if err != nil {
|
||||
@@ -205,10 +199,8 @@ func Unstar(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
err := repo_model.StarRepo(ctx, ctx.Doer, ctx.Repo.Repository, false)
|
||||
if err != nil {
|
||||
|
||||
@@ -109,8 +109,8 @@ func GetInfo(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/User"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
if !user_model.IsUserVisibleToViewer(ctx, ctx.ContextUser, ctx.Doer) {
|
||||
// fake ErrUserNotExist error message to not leak information about existence
|
||||
@@ -150,8 +150,8 @@ func GetUserHeatmapData(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/UserHeatmapData"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
heatmap, err := activities_model.GetUserHeatmapDataByUser(ctx, ctx.ContextUser, ctx.Doer)
|
||||
if err != nil {
|
||||
@@ -193,8 +193,8 @@ func ListUserActivityFeeds(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ActivityFeedsList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
includePrivate := ctx.IsSigned && (ctx.Doer.IsAdmin || ctx.Doer.ID == ctx.ContextUser.ID)
|
||||
listOptions := utils.GetListOptions(ctx)
|
||||
|
||||
@@ -65,8 +65,8 @@ func GetWatchedRepos(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/RepositoryList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
private := ctx.ContextUser.ID == ctx.Doer.ID
|
||||
repos, total, err := getWatchedRepos(ctx, ctx.ContextUser, private)
|
||||
@@ -128,8 +128,8 @@ func IsWatching(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/WatchInfo"
|
||||
// "404":
|
||||
// description: User is not watching this repo or repo do not exist
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
if repo_model.IsWatchingRepo(ctx, ctx.Doer.ID, ctx.Repo.Repository.ID) {
|
||||
ctx.JSON(http.StatusOK, api.WatchInfo{
|
||||
@@ -164,10 +164,8 @@ func Watch(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/WatchInfo"
|
||||
// "403":
|
||||
// "$ref": "#/responses/forbidden"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
err := repo_model.WatchRepoAuto(ctx, ctx.Doer, ctx.Repo.Repository, true)
|
||||
if err != nil {
|
||||
@@ -207,8 +205,8 @@ func Unwatch(ctx *context.APIContext) {
|
||||
// responses:
|
||||
// "204":
|
||||
// "$ref": "#/responses/empty"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
// default:
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
err := repo_model.WatchRepoAuto(ctx, ctx.Doer, ctx.Repo.Repository, false)
|
||||
if err != nil {
|
||||
|
||||
@@ -66,54 +66,14 @@ type APIError struct {
|
||||
URL string `json:"url"`
|
||||
}
|
||||
|
||||
// APIValidationError is error format response related to input validation
|
||||
// swagger:response validationError
|
||||
type APIValidationError struct {
|
||||
Message string `json:"message"`
|
||||
URL string `json:"url"`
|
||||
}
|
||||
|
||||
// APIInvalidTopicsError is error format response to invalid topics
|
||||
// swagger:response invalidTopicsError
|
||||
type APIInvalidTopicsError struct {
|
||||
Message string `json:"message"`
|
||||
InvalidTopics []string `json:"invalidTopics"`
|
||||
}
|
||||
|
||||
// APIEmpty is an empty response
|
||||
// swagger:response empty
|
||||
type APIEmpty struct{}
|
||||
|
||||
// APIForbiddenError is a forbidden error response
|
||||
// swagger:response forbidden
|
||||
type APIForbiddenError struct {
|
||||
APIError
|
||||
}
|
||||
|
||||
// APIUnauthorizedError is an unauthorized error response
|
||||
// swagger:response unauthorized
|
||||
type APIUnauthorizedError struct {
|
||||
APIError
|
||||
}
|
||||
|
||||
// APINotFound is a not found empty response
|
||||
// swagger:response notFound
|
||||
type APINotFound struct{}
|
||||
|
||||
// APIConflict is a conflict empty response
|
||||
// swagger:response conflict
|
||||
type APIConflict struct{}
|
||||
|
||||
// APIString is a string response
|
||||
// swagger:response string
|
||||
type APIString string
|
||||
|
||||
// APIRepoArchivedError is an error that is raised when an archived repo should be modified
|
||||
// swagger:response repoArchivedError
|
||||
type APIRepoArchivedError struct {
|
||||
APIError
|
||||
}
|
||||
|
||||
// APIErrorInternal responds with error message, status is 500
|
||||
func (ctx *APIContext) APIErrorInternal(err error) {
|
||||
ctx.apiErrorInternal(1, err)
|
||||
|
||||
+866
-2496
File diff suppressed because it is too large.
Load diff
+866
-2471
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user