diff --git a/routers/api/v1/org/action.go b/routers/api/v1/org/action.go index e50a77f362..5af6125773 100644 --- a/routers/api/v1/org/action.go +++ b/routers/api/v1/org/action.go @@ -40,6 +40,8 @@ func ListActionsSecrets(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/SecretList" + // "404": + // "$ref": "#/responses/notFound" opts := &secret_model.FindSecretsOptions{ OwnerID: ctx.Org.Organization.ID, diff --git a/routers/api/v1/org/avatar.go b/routers/api/v1/org/avatar.go index b3cb0b81a6..a7b5008525 100644 --- a/routers/api/v1/org/avatar.go +++ b/routers/api/v1/org/avatar.go @@ -33,6 +33,8 @@ func UpdateAvatar(ctx *context.APIContext) { // responses: // "204": // "$ref": "#/responses/empty" + // "404": + // "$ref": "#/responses/notFound" form := web.GetForm(ctx).(*api.UpdateUserAvatarOption) content, err := base64.StdEncoding.DecodeString(form.Image) @@ -65,6 +67,8 @@ func DeleteAvatar(ctx *context.APIContext) { // responses: // "204": // "$ref": "#/responses/empty" + // "404": + // "$ref": "#/responses/notFound" err := user_service.DeleteAvatar(ctx.Org.Organization.AsUser()) if err != nil { ctx.Error(http.StatusInternalServerError, "DeleteAvatar", err) diff --git a/routers/api/v1/org/hook.go b/routers/api/v1/org/hook.go index a6ea618a7d..3c3f058b5d 100644 --- a/routers/api/v1/org/hook.go +++ b/routers/api/v1/org/hook.go @@ -37,6 +37,8 @@ func ListHooks(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/HookList" + // "404": + // "$ref": "#/responses/notFound" utils.ListOwnerHooks( ctx, @@ -66,6 +68,8 @@ func GetHook(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/Hook" + // "404": + // "$ref": "#/responses/notFound" hook, err := utils.GetOwnerHook(ctx, ctx.ContextUser.ID, ctx.ParamsInt64("id")) if err != nil { @@ -103,6 +107,8 @@ func CreateHook(ctx *context.APIContext) { // responses: // "201": // "$ref": "#/responses/Hook" + // "404": + // "$ref": "#/responses/notFound" utils.AddOwnerHook( ctx, @@ -139,6 +145,8 @@ func EditHook(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/Hook" + // "404": + // "$ref": "#/responses/notFound" utils.EditOwnerHook( ctx, @@ -170,6 +178,8 @@ func DeleteHook(ctx *context.APIContext) { // responses: // "204": // "$ref": "#/responses/empty" + // "404": + // "$ref": "#/responses/notFound" utils.DeleteOwnerHook( ctx, diff --git a/routers/api/v1/org/label.go b/routers/api/v1/org/label.go index 9ef28d4db9..2dd4505a91 100644 --- a/routers/api/v1/org/label.go +++ b/routers/api/v1/org/label.go @@ -41,6 +41,8 @@ func ListLabels(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/LabelList" + // "404": + // "$ref": "#/responses/notFound" labels, err := issues_model.GetLabelsByOrgID(ctx, ctx.Org.Organization.ID, ctx.FormString("sort"), utils.GetListOptions(ctx)) if err != nil { @@ -80,6 +82,8 @@ func CreateLabel(ctx *context.APIContext) { // responses: // "201": // "$ref": "#/responses/Label" + // "404": + // "$ref": "#/responses/notFound" // "422": // "$ref": "#/responses/validationError" form := web.GetForm(ctx).(*api.CreateLabelOption) @@ -128,6 +132,8 @@ func GetLabel(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/Label" + // "404": + // "$ref": "#/responses/notFound" var ( label *issues_model.Label @@ -179,6 +185,8 @@ func EditLabel(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/Label" + // "404": + // "$ref": "#/responses/notFound" // "422": // "$ref": "#/responses/validationError" form := web.GetForm(ctx).(*api.EditLabelOption) @@ -238,6 +246,8 @@ func DeleteLabel(ctx *context.APIContext) { // responses: // "204": // "$ref": "#/responses/empty" + // "404": + // "$ref": "#/responses/notFound" if err := issues_model.DeleteLabel(ctx.Org.Organization.ID, ctx.ParamsInt64(":id")); err != nil { ctx.Error(http.StatusInternalServerError, "DeleteLabel", err) diff --git a/routers/api/v1/org/member.go b/routers/api/v1/org/member.go index e4afd7f3c6..e5ea584d5d 100644 --- a/routers/api/v1/org/member.go +++ b/routers/api/v1/org/member.go @@ -70,6 +70,8 @@ func ListMembers(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/UserList" + // "404": + // "$ref": "#/responses/notFound" publicOnly := true if ctx.Doer != nil { @@ -107,6 +109,8 @@ func ListPublicMembers(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/UserList" + // "404": + // "$ref": "#/responses/notFound" listMembers(ctx, true) } @@ -225,6 +229,8 @@ func PublicizeMember(ctx *context.APIContext) { // description: membership publicized // "403": // "$ref": "#/responses/forbidden" + // "404": + // "$ref": "#/responses/notFound" userToPublicize := user.GetUserByParams(ctx) if ctx.Written() { @@ -265,6 +271,8 @@ func ConcealMember(ctx *context.APIContext) { // "$ref": "#/responses/empty" // "403": // "$ref": "#/responses/forbidden" + // "404": + // "$ref": "#/responses/notFound" userToConceal := user.GetUserByParams(ctx) if ctx.Written() { @@ -303,6 +311,8 @@ func DeleteMember(ctx *context.APIContext) { // responses: // "204": // description: member removed + // "404": + // "$ref": "#/responses/notFound" member := user.GetUserByParams(ctx) if ctx.Written() { diff --git a/routers/api/v1/org/org.go b/routers/api/v1/org/org.go index b0666c87f8..0216b62352 100644 --- a/routers/api/v1/org/org.go +++ b/routers/api/v1/org/org.go @@ -70,6 +70,8 @@ func ListMyOrgs(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/OrganizationList" + // "404": + // "$ref": "#/responses/notFound" listUserOrgs(ctx, ctx.Doer) } @@ -98,6 +100,8 @@ func ListUserOrgs(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/OrganizationList" + // "404": + // "$ref": "#/responses/notFound" listUserOrgs(ctx, ctx.ContextUser) } @@ -295,6 +299,8 @@ func Get(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/Organization" + // "404": + // "$ref": "#/responses/notFound" if !organization.HasOrgOrUserVisible(ctx, ctx.Org.Organization.AsUser(), ctx.Doer) { ctx.NotFound("HasOrgOrUserVisible", nil) @@ -334,6 +340,8 @@ func Edit(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/Organization" + // "404": + // "$ref": "#/responses/notFound" form := web.GetForm(ctx).(*api.EditOrgOption) org := ctx.Org.Organization org.FullName = form.FullName @@ -374,6 +382,8 @@ func Delete(ctx *context.APIContext) { // responses: // "204": // "$ref": "#/responses/empty" + // "404": + // "$ref": "#/responses/notFound" if err := org.DeleteOrganization(ctx.Org.Organization); err != nil { ctx.Error(http.StatusInternalServerError, "DeleteOrganization", err) diff --git a/routers/api/v1/org/team.go b/routers/api/v1/org/team.go index 4b52fb8987..abb5381a70 100644 --- a/routers/api/v1/org/team.go +++ b/routers/api/v1/org/team.go @@ -50,6 +50,8 @@ func ListTeams(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/TeamList" + // "404": + // "$ref": "#/responses/notFound" teams, count, err := organization.SearchTeam(&organization.SearchTeamOptions{ ListOptions: utils.GetListOptions(ctx), @@ -126,6 +128,8 @@ func GetTeam(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/Team" + // "404": + // "$ref": "#/responses/notFound" apiTeam, err := convert.ToTeam(ctx, ctx.Org.Team, true) if err != nil { @@ -204,6 +208,8 @@ func CreateTeam(ctx *context.APIContext) { // responses: // "201": // "$ref": "#/responses/Team" + // "404": + // "$ref": "#/responses/notFound" // "422": // "$ref": "#/responses/validationError" form := web.GetForm(ctx).(*api.CreateTeamOption) @@ -272,6 +278,8 @@ func EditTeam(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/Team" + // "404": + // "$ref": "#/responses/notFound" form := web.GetForm(ctx).(*api.EditTeamOption) team := ctx.Org.Team @@ -350,6 +358,8 @@ func DeleteTeam(ctx *context.APIContext) { // responses: // "204": // description: team deleted + // "404": + // "$ref": "#/responses/notFound" if err := models.DeleteTeam(ctx.Org.Team); err != nil { ctx.Error(http.StatusInternalServerError, "DeleteTeam", err) @@ -383,6 +393,8 @@ func GetTeamMembers(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/UserList" + // "404": + // "$ref": "#/responses/notFound" isMember, err := organization.IsOrganizationMember(ctx, ctx.Org.Team.OrgID, ctx.Doer.ID) if err != nil { @@ -550,6 +562,8 @@ func GetTeamRepos(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/RepositoryList" + // "404": + // "$ref": "#/responses/notFound" team := ctx.Org.Team teamRepos, err := organization.GetTeamRepositories(ctx, &organization.SearchTeamRepoOptions{ @@ -665,6 +679,8 @@ func AddTeamRepository(ctx *context.APIContext) { // "$ref": "#/responses/empty" // "403": // "$ref": "#/responses/forbidden" + // "404": + // "$ref": "#/responses/notFound" repo := getRepositoryByParams(ctx) if ctx.Written() { @@ -715,6 +731,8 @@ func RemoveTeamRepository(ctx *context.APIContext) { // "$ref": "#/responses/empty" // "403": // "$ref": "#/responses/forbidden" + // "404": + // "$ref": "#/responses/notFound" repo := getRepositoryByParams(ctx) if ctx.Written() { @@ -775,6 +793,8 @@ func SearchTeam(ctx *context.APIContext) { // type: array // items: // "$ref": "#/definitions/Team" + // "404": + // "$ref": "#/responses/notFound" listOptions := utils.GetListOptions(ctx) diff --git a/routers/api/v1/packages/package.go b/routers/api/v1/packages/package.go index 5129c7d4f0..53724179a2 100644 --- a/routers/api/v1/packages/package.go +++ b/routers/api/v1/packages/package.go @@ -48,6 +48,8 @@ func ListPackages(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/PackageList" + // "404": + // "$ref": "#/responses/notFound" listOptions := utils.GetListOptions(ctx) diff --git a/routers/api/v1/repo/avatar.go b/routers/api/v1/repo/avatar.go index 48bd143d0c..1b661955f0 100644 --- a/routers/api/v1/repo/avatar.go +++ b/routers/api/v1/repo/avatar.go @@ -38,6 +38,8 @@ func UpdateAvatar(ctx *context.APIContext) { // responses: // "204": // "$ref": "#/responses/empty" + // "404": + // "$ref": "#/responses/notFound" form := web.GetForm(ctx).(*api.UpdateRepoAvatarOption) content, err := base64.StdEncoding.DecodeString(form.Image) @@ -75,6 +77,8 @@ func DeleteAvatar(ctx *context.APIContext) { // responses: // "204": // "$ref": "#/responses/empty" + // "404": + // "$ref": "#/responses/notFound" err := repo_service.DeleteAvatar(ctx, ctx.Repo.Repository) if err != nil { ctx.Error(http.StatusInternalServerError, "DeleteAvatar", err) diff --git a/routers/api/v1/repo/blob.go b/routers/api/v1/repo/blob.go index d0004f0686..26605bba03 100644 --- a/routers/api/v1/repo/blob.go +++ b/routers/api/v1/repo/blob.go @@ -38,6 +38,8 @@ func GetBlob(ctx *context.APIContext) { // "$ref": "#/responses/GitBlobResponse" // "400": // "$ref": "#/responses/error" + // "404": + // "$ref": "#/responses/notFound" sha := ctx.Params("sha") if len(sha) == 0 { diff --git a/routers/api/v1/repo/collaborators.go b/routers/api/v1/repo/collaborators.go index 66e7577a4b..4be43d46ad 100644 --- a/routers/api/v1/repo/collaborators.go +++ b/routers/api/v1/repo/collaborators.go @@ -50,6 +50,8 @@ func ListCollaborators(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/UserList" + // "404": + // "$ref": "#/responses/notFound" count, err := repo_model.CountCollaborators(ctx.Repo.Repository.ID) if err != nil { @@ -154,6 +156,8 @@ func AddCollaborator(ctx *context.APIContext) { // responses: // "204": // "$ref": "#/responses/empty" + // "404": + // "$ref": "#/responses/notFound" // "422": // "$ref": "#/responses/validationError" @@ -215,6 +219,8 @@ func DeleteCollaborator(ctx *context.APIContext) { // responses: // "204": // "$ref": "#/responses/empty" + // "404": + // "$ref": "#/responses/notFound" // "422": // "$ref": "#/responses/validationError" @@ -311,6 +317,8 @@ func GetReviewers(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/UserList" + // "404": + // "$ref": "#/responses/notFound" reviewers, err := repo_model.GetReviewers(ctx, ctx.Repo.Repository, ctx.Doer.ID, 0) if err != nil { @@ -341,6 +349,8 @@ func GetAssignees(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/UserList" + // "404": + // "$ref": "#/responses/notFound" assignees, err := repo_model.GetRepoAssignees(ctx, ctx.Repo.Repository) if err != nil { diff --git a/routers/api/v1/repo/fork.go b/routers/api/v1/repo/fork.go index f75153ab2d..7ae4356204 100644 --- a/routers/api/v1/repo/fork.go +++ b/routers/api/v1/repo/fork.go @@ -52,6 +52,8 @@ func ListForks(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/RepositoryList" + // "404": + // "$ref": "#/responses/notFound" forks, err := repo_model.GetForks(ctx.Repo.Repository, utils.GetListOptions(ctx)) if err != nil { @@ -99,6 +101,8 @@ func CreateFork(ctx *context.APIContext) { // "$ref": "#/responses/Repository" // "403": // "$ref": "#/responses/forbidden" + // "404": + // "$ref": "#/responses/notFound" // "409": // description: The repository with the same name already exists. // "422": diff --git a/routers/api/v1/repo/git_hook.go b/routers/api/v1/repo/git_hook.go index 40bd355428..7e471e263b 100644 --- a/routers/api/v1/repo/git_hook.go +++ b/routers/api/v1/repo/git_hook.go @@ -34,6 +34,8 @@ func ListGitHooks(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/GitHookList" + // "404": + // "$ref": "#/responses/notFound" hooks, err := ctx.Repo.GitRepo.Hooks() if err != nil { diff --git a/routers/api/v1/repo/hook.go b/routers/api/v1/repo/hook.go index d0b77b5687..e0f99b48fd 100644 --- a/routers/api/v1/repo/hook.go +++ b/routers/api/v1/repo/hook.go @@ -50,6 +50,8 @@ func ListHooks(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/HookList" + // "404": + // "$ref": "#/responses/notFound" opts := &webhook.ListWebhookOptions{ ListOptions: utils.GetListOptions(ctx), @@ -157,6 +159,8 @@ func TestHook(ctx *context.APIContext) { // responses: // "204": // "$ref": "#/responses/empty" + // "404": + // "$ref": "#/responses/notFound" if ctx.Repo.Commit == nil { // if repo does not have any commits, then don't send a webhook @@ -224,6 +228,8 @@ func CreateHook(ctx *context.APIContext) { // responses: // "201": // "$ref": "#/responses/Hook" + // "404": + // "$ref": "#/responses/notFound" utils.AddRepoHook(ctx, web.GetForm(ctx).(*api.CreateHookOption)) } @@ -259,6 +265,8 @@ func EditHook(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/Hook" + // "404": + // "$ref": "#/responses/notFound" form := web.GetForm(ctx).(*api.EditHookOption) hookID := ctx.ParamsInt64(":id") utils.EditRepoHook(ctx, form, hookID) diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go index 2fad55df3d..c6248bacec 100644 --- a/routers/api/v1/repo/issue.go +++ b/routers/api/v1/repo/issue.go @@ -388,6 +388,8 @@ func ListIssues(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/IssueList" + // "404": + // "$ref": "#/responses/notFound" before, since, err := context.GetQueryBeforeSince(ctx.Base) if err != nil { ctx.Error(http.StatusUnprocessableEntity, "GetQueryBeforeSince", err) @@ -623,6 +625,8 @@ func CreateIssue(ctx *context.APIContext) { // "$ref": "#/responses/Issue" // "403": // "$ref": "#/responses/forbidden" + // "404": + // "$ref": "#/responses/notFound" // "412": // "$ref": "#/responses/error" // "422": diff --git a/routers/api/v1/repo/issue_comment.go b/routers/api/v1/repo/issue_comment.go index 1f8e16147f..c9179e69db 100644 --- a/routers/api/v1/repo/issue_comment.go +++ b/routers/api/v1/repo/issue_comment.go @@ -58,6 +58,8 @@ func ListIssueComments(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/CommentList" + // "404": + // "$ref": "#/responses/notFound" before, since, err := context.GetQueryBeforeSince(ctx.Base) if err != nil { @@ -155,6 +157,8 @@ func ListIssueCommentsAndTimeline(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/TimelineList" + // "404": + // "$ref": "#/responses/notFound" before, since, err := context.GetQueryBeforeSince(ctx.Base) if err != nil { @@ -258,6 +262,8 @@ func ListRepoIssueComments(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/CommentList" + // "404": + // "$ref": "#/responses/notFound" before, since, err := context.GetQueryBeforeSince(ctx.Base) if err != nil { @@ -350,6 +356,8 @@ func CreateIssueComment(ctx *context.APIContext) { // "$ref": "#/responses/Comment" // "403": // "$ref": "#/responses/forbidden" + // "404": + // "$ref": "#/responses/notFound" form := web.GetForm(ctx).(*api.CreateIssueCommentOption) issue, err := issues_model.GetIssueByIndex(ctx, ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) if err != nil { diff --git a/routers/api/v1/repo/issue_dependency.go b/routers/api/v1/repo/issue_dependency.go index b0eb208a32..5ea3836da1 100644 --- a/routers/api/v1/repo/issue_dependency.go +++ b/routers/api/v1/repo/issue_dependency.go @@ -52,6 +52,8 @@ func GetIssueDependencies(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/IssueList" + // "404": + // "$ref": "#/responses/notFound" // If this issue's repository does not enable dependencies then there can be no dependencies by default if !ctx.Repo.Repository.IsDependenciesEnabled(ctx) { @@ -242,6 +244,8 @@ func RemoveIssueDependency(ctx *context.APIContext) { // responses: // "200": // "$ref": "#/responses/Issue" + // "404": + // "$ref": "#/responses/notFound" // We want to make <:index> depend on