Add missing 404 response to Swagger (#27038)

Most middleware throw a 404 in case something is not found e.g. a Repo
that is not existing. But most API endpoints don't include the 404
response in their documentation. This PR changes this.
This commit is contained in:
JakobDev 2023-09-13 04:37:54 +02:00 committed by GitHub
parent 8ecdc93f8b
commit aaeec2a392
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
46 changed files with 750 additions and 0 deletions

View File

@ -40,6 +40,8 @@ func ListActionsSecrets(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/SecretList" // "$ref": "#/responses/SecretList"
// "404":
// "$ref": "#/responses/notFound"
opts := &secret_model.FindSecretsOptions{ opts := &secret_model.FindSecretsOptions{
OwnerID: ctx.Org.Organization.ID, OwnerID: ctx.Org.Organization.ID,

View File

@ -33,6 +33,8 @@ func UpdateAvatar(ctx *context.APIContext) {
// responses: // responses:
// "204": // "204":
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "404":
// "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.UpdateUserAvatarOption) form := web.GetForm(ctx).(*api.UpdateUserAvatarOption)
content, err := base64.StdEncoding.DecodeString(form.Image) content, err := base64.StdEncoding.DecodeString(form.Image)
@ -65,6 +67,8 @@ func DeleteAvatar(ctx *context.APIContext) {
// responses: // responses:
// "204": // "204":
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "404":
// "$ref": "#/responses/notFound"
err := user_service.DeleteAvatar(ctx.Org.Organization.AsUser()) err := user_service.DeleteAvatar(ctx.Org.Organization.AsUser())
if err != nil { if err != nil {
ctx.Error(http.StatusInternalServerError, "DeleteAvatar", err) ctx.Error(http.StatusInternalServerError, "DeleteAvatar", err)

View File

@ -37,6 +37,8 @@ func ListHooks(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/HookList" // "$ref": "#/responses/HookList"
// "404":
// "$ref": "#/responses/notFound"
utils.ListOwnerHooks( utils.ListOwnerHooks(
ctx, ctx,
@ -66,6 +68,8 @@ func GetHook(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/Hook" // "$ref": "#/responses/Hook"
// "404":
// "$ref": "#/responses/notFound"
hook, err := utils.GetOwnerHook(ctx, ctx.ContextUser.ID, ctx.ParamsInt64("id")) hook, err := utils.GetOwnerHook(ctx, ctx.ContextUser.ID, ctx.ParamsInt64("id"))
if err != nil { if err != nil {
@ -103,6 +107,8 @@ func CreateHook(ctx *context.APIContext) {
// responses: // responses:
// "201": // "201":
// "$ref": "#/responses/Hook" // "$ref": "#/responses/Hook"
// "404":
// "$ref": "#/responses/notFound"
utils.AddOwnerHook( utils.AddOwnerHook(
ctx, ctx,
@ -139,6 +145,8 @@ func EditHook(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/Hook" // "$ref": "#/responses/Hook"
// "404":
// "$ref": "#/responses/notFound"
utils.EditOwnerHook( utils.EditOwnerHook(
ctx, ctx,
@ -170,6 +178,8 @@ func DeleteHook(ctx *context.APIContext) {
// responses: // responses:
// "204": // "204":
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "404":
// "$ref": "#/responses/notFound"
utils.DeleteOwnerHook( utils.DeleteOwnerHook(
ctx, ctx,

View File

@ -41,6 +41,8 @@ func ListLabels(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/LabelList" // "$ref": "#/responses/LabelList"
// "404":
// "$ref": "#/responses/notFound"
labels, err := issues_model.GetLabelsByOrgID(ctx, ctx.Org.Organization.ID, ctx.FormString("sort"), utils.GetListOptions(ctx)) labels, err := issues_model.GetLabelsByOrgID(ctx, ctx.Org.Organization.ID, ctx.FormString("sort"), utils.GetListOptions(ctx))
if err != nil { if err != nil {
@ -80,6 +82,8 @@ func CreateLabel(ctx *context.APIContext) {
// responses: // responses:
// "201": // "201":
// "$ref": "#/responses/Label" // "$ref": "#/responses/Label"
// "404":
// "$ref": "#/responses/notFound"
// "422": // "422":
// "$ref": "#/responses/validationError" // "$ref": "#/responses/validationError"
form := web.GetForm(ctx).(*api.CreateLabelOption) form := web.GetForm(ctx).(*api.CreateLabelOption)
@ -128,6 +132,8 @@ func GetLabel(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/Label" // "$ref": "#/responses/Label"
// "404":
// "$ref": "#/responses/notFound"
var ( var (
label *issues_model.Label label *issues_model.Label
@ -179,6 +185,8 @@ func EditLabel(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/Label" // "$ref": "#/responses/Label"
// "404":
// "$ref": "#/responses/notFound"
// "422": // "422":
// "$ref": "#/responses/validationError" // "$ref": "#/responses/validationError"
form := web.GetForm(ctx).(*api.EditLabelOption) form := web.GetForm(ctx).(*api.EditLabelOption)
@ -238,6 +246,8 @@ func DeleteLabel(ctx *context.APIContext) {
// responses: // responses:
// "204": // "204":
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "404":
// "$ref": "#/responses/notFound"
if err := issues_model.DeleteLabel(ctx.Org.Organization.ID, ctx.ParamsInt64(":id")); err != nil { if err := issues_model.DeleteLabel(ctx.Org.Organization.ID, ctx.ParamsInt64(":id")); err != nil {
ctx.Error(http.StatusInternalServerError, "DeleteLabel", err) ctx.Error(http.StatusInternalServerError, "DeleteLabel", err)

View File

@ -70,6 +70,8 @@ func ListMembers(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/UserList" // "$ref": "#/responses/UserList"
// "404":
// "$ref": "#/responses/notFound"
publicOnly := true publicOnly := true
if ctx.Doer != nil { if ctx.Doer != nil {
@ -107,6 +109,8 @@ func ListPublicMembers(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/UserList" // "$ref": "#/responses/UserList"
// "404":
// "$ref": "#/responses/notFound"
listMembers(ctx, true) listMembers(ctx, true)
} }
@ -225,6 +229,8 @@ func PublicizeMember(ctx *context.APIContext) {
// description: membership publicized // description: membership publicized
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
userToPublicize := user.GetUserByParams(ctx) userToPublicize := user.GetUserByParams(ctx)
if ctx.Written() { if ctx.Written() {
@ -265,6 +271,8 @@ func ConcealMember(ctx *context.APIContext) {
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
userToConceal := user.GetUserByParams(ctx) userToConceal := user.GetUserByParams(ctx)
if ctx.Written() { if ctx.Written() {
@ -303,6 +311,8 @@ func DeleteMember(ctx *context.APIContext) {
// responses: // responses:
// "204": // "204":
// description: member removed // description: member removed
// "404":
// "$ref": "#/responses/notFound"
member := user.GetUserByParams(ctx) member := user.GetUserByParams(ctx)
if ctx.Written() { if ctx.Written() {

View File

@ -70,6 +70,8 @@ func ListMyOrgs(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/OrganizationList" // "$ref": "#/responses/OrganizationList"
// "404":
// "$ref": "#/responses/notFound"
listUserOrgs(ctx, ctx.Doer) listUserOrgs(ctx, ctx.Doer)
} }
@ -98,6 +100,8 @@ func ListUserOrgs(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/OrganizationList" // "$ref": "#/responses/OrganizationList"
// "404":
// "$ref": "#/responses/notFound"
listUserOrgs(ctx, ctx.ContextUser) listUserOrgs(ctx, ctx.ContextUser)
} }
@ -295,6 +299,8 @@ func Get(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/Organization" // "$ref": "#/responses/Organization"
// "404":
// "$ref": "#/responses/notFound"
if !organization.HasOrgOrUserVisible(ctx, ctx.Org.Organization.AsUser(), ctx.Doer) { if !organization.HasOrgOrUserVisible(ctx, ctx.Org.Organization.AsUser(), ctx.Doer) {
ctx.NotFound("HasOrgOrUserVisible", nil) ctx.NotFound("HasOrgOrUserVisible", nil)
@ -334,6 +340,8 @@ func Edit(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/Organization" // "$ref": "#/responses/Organization"
// "404":
// "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.EditOrgOption) form := web.GetForm(ctx).(*api.EditOrgOption)
org := ctx.Org.Organization org := ctx.Org.Organization
org.FullName = form.FullName org.FullName = form.FullName
@ -374,6 +382,8 @@ func Delete(ctx *context.APIContext) {
// responses: // responses:
// "204": // "204":
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "404":
// "$ref": "#/responses/notFound"
if err := org.DeleteOrganization(ctx.Org.Organization); err != nil { if err := org.DeleteOrganization(ctx.Org.Organization); err != nil {
ctx.Error(http.StatusInternalServerError, "DeleteOrganization", err) ctx.Error(http.StatusInternalServerError, "DeleteOrganization", err)

View File

@ -50,6 +50,8 @@ func ListTeams(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/TeamList" // "$ref": "#/responses/TeamList"
// "404":
// "$ref": "#/responses/notFound"
teams, count, err := organization.SearchTeam(&organization.SearchTeamOptions{ teams, count, err := organization.SearchTeam(&organization.SearchTeamOptions{
ListOptions: utils.GetListOptions(ctx), ListOptions: utils.GetListOptions(ctx),
@ -126,6 +128,8 @@ func GetTeam(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/Team" // "$ref": "#/responses/Team"
// "404":
// "$ref": "#/responses/notFound"
apiTeam, err := convert.ToTeam(ctx, ctx.Org.Team, true) apiTeam, err := convert.ToTeam(ctx, ctx.Org.Team, true)
if err != nil { if err != nil {
@ -204,6 +208,8 @@ func CreateTeam(ctx *context.APIContext) {
// responses: // responses:
// "201": // "201":
// "$ref": "#/responses/Team" // "$ref": "#/responses/Team"
// "404":
// "$ref": "#/responses/notFound"
// "422": // "422":
// "$ref": "#/responses/validationError" // "$ref": "#/responses/validationError"
form := web.GetForm(ctx).(*api.CreateTeamOption) form := web.GetForm(ctx).(*api.CreateTeamOption)
@ -272,6 +278,8 @@ func EditTeam(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/Team" // "$ref": "#/responses/Team"
// "404":
// "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.EditTeamOption) form := web.GetForm(ctx).(*api.EditTeamOption)
team := ctx.Org.Team team := ctx.Org.Team
@ -350,6 +358,8 @@ func DeleteTeam(ctx *context.APIContext) {
// responses: // responses:
// "204": // "204":
// description: team deleted // description: team deleted
// "404":
// "$ref": "#/responses/notFound"
if err := models.DeleteTeam(ctx.Org.Team); err != nil { if err := models.DeleteTeam(ctx.Org.Team); err != nil {
ctx.Error(http.StatusInternalServerError, "DeleteTeam", err) ctx.Error(http.StatusInternalServerError, "DeleteTeam", err)
@ -383,6 +393,8 @@ func GetTeamMembers(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/UserList" // "$ref": "#/responses/UserList"
// "404":
// "$ref": "#/responses/notFound"
isMember, err := organization.IsOrganizationMember(ctx, ctx.Org.Team.OrgID, ctx.Doer.ID) isMember, err := organization.IsOrganizationMember(ctx, ctx.Org.Team.OrgID, ctx.Doer.ID)
if err != nil { if err != nil {
@ -550,6 +562,8 @@ func GetTeamRepos(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/RepositoryList" // "$ref": "#/responses/RepositoryList"
// "404":
// "$ref": "#/responses/notFound"
team := ctx.Org.Team team := ctx.Org.Team
teamRepos, err := organization.GetTeamRepositories(ctx, &organization.SearchTeamRepoOptions{ teamRepos, err := organization.GetTeamRepositories(ctx, &organization.SearchTeamRepoOptions{
@ -665,6 +679,8 @@ func AddTeamRepository(ctx *context.APIContext) {
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
repo := getRepositoryByParams(ctx) repo := getRepositoryByParams(ctx)
if ctx.Written() { if ctx.Written() {
@ -715,6 +731,8 @@ func RemoveTeamRepository(ctx *context.APIContext) {
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
repo := getRepositoryByParams(ctx) repo := getRepositoryByParams(ctx)
if ctx.Written() { if ctx.Written() {
@ -775,6 +793,8 @@ func SearchTeam(ctx *context.APIContext) {
// type: array // type: array
// items: // items:
// "$ref": "#/definitions/Team" // "$ref": "#/definitions/Team"
// "404":
// "$ref": "#/responses/notFound"
listOptions := utils.GetListOptions(ctx) listOptions := utils.GetListOptions(ctx)

View File

@ -48,6 +48,8 @@ func ListPackages(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/PackageList" // "$ref": "#/responses/PackageList"
// "404":
// "$ref": "#/responses/notFound"
listOptions := utils.GetListOptions(ctx) listOptions := utils.GetListOptions(ctx)

View File

@ -38,6 +38,8 @@ func UpdateAvatar(ctx *context.APIContext) {
// responses: // responses:
// "204": // "204":
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "404":
// "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.UpdateRepoAvatarOption) form := web.GetForm(ctx).(*api.UpdateRepoAvatarOption)
content, err := base64.StdEncoding.DecodeString(form.Image) content, err := base64.StdEncoding.DecodeString(form.Image)
@ -75,6 +77,8 @@ func DeleteAvatar(ctx *context.APIContext) {
// responses: // responses:
// "204": // "204":
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "404":
// "$ref": "#/responses/notFound"
err := repo_service.DeleteAvatar(ctx, ctx.Repo.Repository) err := repo_service.DeleteAvatar(ctx, ctx.Repo.Repository)
if err != nil { if err != nil {
ctx.Error(http.StatusInternalServerError, "DeleteAvatar", err) ctx.Error(http.StatusInternalServerError, "DeleteAvatar", err)

View File

@ -38,6 +38,8 @@ func GetBlob(ctx *context.APIContext) {
// "$ref": "#/responses/GitBlobResponse" // "$ref": "#/responses/GitBlobResponse"
// "400": // "400":
// "$ref": "#/responses/error" // "$ref": "#/responses/error"
// "404":
// "$ref": "#/responses/notFound"
sha := ctx.Params("sha") sha := ctx.Params("sha")
if len(sha) == 0 { if len(sha) == 0 {

View File

@ -50,6 +50,8 @@ func ListCollaborators(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/UserList" // "$ref": "#/responses/UserList"
// "404":
// "$ref": "#/responses/notFound"
count, err := repo_model.CountCollaborators(ctx.Repo.Repository.ID) count, err := repo_model.CountCollaborators(ctx.Repo.Repository.ID)
if err != nil { if err != nil {
@ -154,6 +156,8 @@ func AddCollaborator(ctx *context.APIContext) {
// responses: // responses:
// "204": // "204":
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "404":
// "$ref": "#/responses/notFound"
// "422": // "422":
// "$ref": "#/responses/validationError" // "$ref": "#/responses/validationError"
@ -215,6 +219,8 @@ func DeleteCollaborator(ctx *context.APIContext) {
// responses: // responses:
// "204": // "204":
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "404":
// "$ref": "#/responses/notFound"
// "422": // "422":
// "$ref": "#/responses/validationError" // "$ref": "#/responses/validationError"
@ -311,6 +317,8 @@ func GetReviewers(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/UserList" // "$ref": "#/responses/UserList"
// "404":
// "$ref": "#/responses/notFound"
reviewers, err := repo_model.GetReviewers(ctx, ctx.Repo.Repository, ctx.Doer.ID, 0) reviewers, err := repo_model.GetReviewers(ctx, ctx.Repo.Repository, ctx.Doer.ID, 0)
if err != nil { if err != nil {
@ -341,6 +349,8 @@ func GetAssignees(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/UserList" // "$ref": "#/responses/UserList"
// "404":
// "$ref": "#/responses/notFound"
assignees, err := repo_model.GetRepoAssignees(ctx, ctx.Repo.Repository) assignees, err := repo_model.GetRepoAssignees(ctx, ctx.Repo.Repository)
if err != nil { if err != nil {

View File

@ -52,6 +52,8 @@ func ListForks(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/RepositoryList" // "$ref": "#/responses/RepositoryList"
// "404":
// "$ref": "#/responses/notFound"
forks, err := repo_model.GetForks(ctx.Repo.Repository, utils.GetListOptions(ctx)) forks, err := repo_model.GetForks(ctx.Repo.Repository, utils.GetListOptions(ctx))
if err != nil { if err != nil {
@ -99,6 +101,8 @@ func CreateFork(ctx *context.APIContext) {
// "$ref": "#/responses/Repository" // "$ref": "#/responses/Repository"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
// "409": // "409":
// description: The repository with the same name already exists. // description: The repository with the same name already exists.
// "422": // "422":

View File

@ -34,6 +34,8 @@ func ListGitHooks(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/GitHookList" // "$ref": "#/responses/GitHookList"
// "404":
// "$ref": "#/responses/notFound"
hooks, err := ctx.Repo.GitRepo.Hooks() hooks, err := ctx.Repo.GitRepo.Hooks()
if err != nil { if err != nil {

View File

@ -50,6 +50,8 @@ func ListHooks(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/HookList" // "$ref": "#/responses/HookList"
// "404":
// "$ref": "#/responses/notFound"
opts := &webhook.ListWebhookOptions{ opts := &webhook.ListWebhookOptions{
ListOptions: utils.GetListOptions(ctx), ListOptions: utils.GetListOptions(ctx),
@ -157,6 +159,8 @@ func TestHook(ctx *context.APIContext) {
// responses: // responses:
// "204": // "204":
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "404":
// "$ref": "#/responses/notFound"
if ctx.Repo.Commit == nil { if ctx.Repo.Commit == nil {
// if repo does not have any commits, then don't send a webhook // if repo does not have any commits, then don't send a webhook
@ -224,6 +228,8 @@ func CreateHook(ctx *context.APIContext) {
// responses: // responses:
// "201": // "201":
// "$ref": "#/responses/Hook" // "$ref": "#/responses/Hook"
// "404":
// "$ref": "#/responses/notFound"
utils.AddRepoHook(ctx, web.GetForm(ctx).(*api.CreateHookOption)) utils.AddRepoHook(ctx, web.GetForm(ctx).(*api.CreateHookOption))
} }
@ -259,6 +265,8 @@ func EditHook(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/Hook" // "$ref": "#/responses/Hook"
// "404":
// "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.EditHookOption) form := web.GetForm(ctx).(*api.EditHookOption)
hookID := ctx.ParamsInt64(":id") hookID := ctx.ParamsInt64(":id")
utils.EditRepoHook(ctx, form, hookID) utils.EditRepoHook(ctx, form, hookID)

View File

@ -388,6 +388,8 @@ func ListIssues(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/IssueList" // "$ref": "#/responses/IssueList"
// "404":
// "$ref": "#/responses/notFound"
before, since, err := context.GetQueryBeforeSince(ctx.Base) before, since, err := context.GetQueryBeforeSince(ctx.Base)
if err != nil { if err != nil {
ctx.Error(http.StatusUnprocessableEntity, "GetQueryBeforeSince", err) ctx.Error(http.StatusUnprocessableEntity, "GetQueryBeforeSince", err)
@ -623,6 +625,8 @@ func CreateIssue(ctx *context.APIContext) {
// "$ref": "#/responses/Issue" // "$ref": "#/responses/Issue"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
// "412": // "412":
// "$ref": "#/responses/error" // "$ref": "#/responses/error"
// "422": // "422":

View File

@ -58,6 +58,8 @@ func ListIssueComments(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/CommentList" // "$ref": "#/responses/CommentList"
// "404":
// "$ref": "#/responses/notFound"
before, since, err := context.GetQueryBeforeSince(ctx.Base) before, since, err := context.GetQueryBeforeSince(ctx.Base)
if err != nil { if err != nil {
@ -155,6 +157,8 @@ func ListIssueCommentsAndTimeline(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/TimelineList" // "$ref": "#/responses/TimelineList"
// "404":
// "$ref": "#/responses/notFound"
before, since, err := context.GetQueryBeforeSince(ctx.Base) before, since, err := context.GetQueryBeforeSince(ctx.Base)
if err != nil { if err != nil {
@ -258,6 +262,8 @@ func ListRepoIssueComments(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/CommentList" // "$ref": "#/responses/CommentList"
// "404":
// "$ref": "#/responses/notFound"
before, since, err := context.GetQueryBeforeSince(ctx.Base) before, since, err := context.GetQueryBeforeSince(ctx.Base)
if err != nil { if err != nil {
@ -350,6 +356,8 @@ func CreateIssueComment(ctx *context.APIContext) {
// "$ref": "#/responses/Comment" // "$ref": "#/responses/Comment"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.CreateIssueCommentOption) form := web.GetForm(ctx).(*api.CreateIssueCommentOption)
issue, err := issues_model.GetIssueByIndex(ctx, ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) issue, err := issues_model.GetIssueByIndex(ctx, ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
if err != nil { if err != nil {

View File

@ -52,6 +52,8 @@ func GetIssueDependencies(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/IssueList" // "$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 this issue's repository does not enable dependencies then there can be no dependencies by default
if !ctx.Repo.Repository.IsDependenciesEnabled(ctx) { if !ctx.Repo.Repository.IsDependenciesEnabled(ctx) {
@ -242,6 +244,8 @@ func RemoveIssueDependency(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/Issue" // "$ref": "#/responses/Issue"
// "404":
// "$ref": "#/responses/notFound"
// We want to make <:index> depend on <Form>, i.e. <:index> is the target // We want to make <:index> depend on <Form>, i.e. <:index> is the target
target := getParamsIssue(ctx) target := getParamsIssue(ctx)
@ -303,6 +307,8 @@ func GetIssueBlocks(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/IssueList" // "$ref": "#/responses/IssueList"
// "404":
// "$ref": "#/responses/notFound"
// We need to list the issues that DEPEND on this issue not the other way round // 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. // Therefore whether dependencies are enabled or not in this repository is potentially irrelevant.
@ -458,6 +464,8 @@ func RemoveIssueBlocking(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/Issue" // "$ref": "#/responses/Issue"
// "404":
// "$ref": "#/responses/notFound"
dependency := getParamsIssue(ctx) dependency := getParamsIssue(ctx)
if ctx.Written() { if ctx.Written() {

View File

@ -98,6 +98,8 @@ func AddIssueLabels(ctx *context.APIContext) {
// "$ref": "#/responses/LabelList" // "$ref": "#/responses/LabelList"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.IssueLabelsOption) form := web.GetForm(ctx).(*api.IssueLabelsOption)
issue, labels, err := prepareForReplaceOrAdd(ctx, *form) issue, labels, err := prepareForReplaceOrAdd(ctx, *form)
@ -154,6 +156,8 @@ func DeleteIssueLabel(ctx *context.APIContext) {
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
// "422": // "422":
// "$ref": "#/responses/validationError" // "$ref": "#/responses/validationError"
@ -225,6 +229,8 @@ func ReplaceIssueLabels(ctx *context.APIContext) {
// "$ref": "#/responses/LabelList" // "$ref": "#/responses/LabelList"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.IssueLabelsOption) form := web.GetForm(ctx).(*api.IssueLabelsOption)
issue, labels, err := prepareForReplaceOrAdd(ctx, *form) issue, labels, err := prepareForReplaceOrAdd(ctx, *form)
if err != nil { if err != nil {
@ -274,6 +280,8 @@ func ClearIssueLabels(ctx *context.APIContext) {
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
issue, err := issues_model.GetIssueByIndex(ctx, ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) issue, err := issues_model.GetIssueByIndex(ctx, ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
if err != nil { if err != nil {

View File

@ -199,6 +199,8 @@ func ListPinnedIssues(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/IssueList" // "$ref": "#/responses/IssueList"
// "404":
// "$ref": "#/responses/notFound"
issues, err := issues_model.GetPinnedIssues(ctx, ctx.Repo.Repository.ID, false) issues, err := issues_model.GetPinnedIssues(ctx, ctx.Repo.Repository.ID, false)
if err != nil { if err != nil {
ctx.Error(http.StatusInternalServerError, "LoadPinnedIssues", err) ctx.Error(http.StatusInternalServerError, "LoadPinnedIssues", err)
@ -229,6 +231,8 @@ func ListPinnedPullRequests(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/PullRequestList" // "$ref": "#/responses/PullRequestList"
// "404":
// "$ref": "#/responses/notFound"
issues, err := issues_model.GetPinnedIssues(ctx, ctx.Repo.Repository.ID, true) issues, err := issues_model.GetPinnedIssues(ctx, ctx.Repo.Repository.ID, true)
if err != nil { if err != nil {
ctx.Error(http.StatusInternalServerError, "LoadPinnedPullRequests", err) ctx.Error(http.StatusInternalServerError, "LoadPinnedPullRequests", err)
@ -290,6 +294,8 @@ func AreNewIssuePinsAllowed(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/RepoNewIssuePinsAllowed" // "$ref": "#/responses/RepoNewIssuePinsAllowed"
// "404":
// "$ref": "#/responses/notFound"
pinsAllowed := api.NewIssuePinsAllowed{} pinsAllowed := api.NewIssuePinsAllowed{}
var err error var err error

View File

@ -46,6 +46,8 @@ func GetIssueCommentReactions(ctx *context.APIContext) {
// "$ref": "#/responses/ReactionList" // "$ref": "#/responses/ReactionList"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
comment, err := issues_model.GetCommentByID(ctx, ctx.ParamsInt64(":id")) comment, err := issues_model.GetCommentByID(ctx, ctx.ParamsInt64(":id"))
if err != nil { if err != nil {
@ -126,6 +128,8 @@ func PostIssueCommentReaction(ctx *context.APIContext) {
// "$ref": "#/responses/Reaction" // "$ref": "#/responses/Reaction"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.EditReactionOption) form := web.GetForm(ctx).(*api.EditReactionOption)
@ -167,6 +171,8 @@ func DeleteIssueCommentReaction(ctx *context.APIContext) {
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.EditReactionOption) form := web.GetForm(ctx).(*api.EditReactionOption)
@ -268,6 +274,8 @@ func GetIssueReactions(ctx *context.APIContext) {
// "$ref": "#/responses/ReactionList" // "$ref": "#/responses/ReactionList"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
issue, err := issues_model.GetIssueWithAttrsByIndex(ctx, ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) issue, err := issues_model.GetIssueWithAttrsByIndex(ctx, ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
if err != nil { if err != nil {
@ -345,6 +353,8 @@ func PostIssueReaction(ctx *context.APIContext) {
// "$ref": "#/responses/Reaction" // "$ref": "#/responses/Reaction"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.EditReactionOption) form := web.GetForm(ctx).(*api.EditReactionOption)
changeIssueReaction(ctx, *form, true) changeIssueReaction(ctx, *form, true)
} }
@ -384,6 +394,8 @@ func DeleteIssueReaction(ctx *context.APIContext) {
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.EditReactionOption) form := web.GetForm(ctx).(*api.EditReactionOption)
changeIssueReaction(ctx, *form, false) changeIssueReaction(ctx, *form, false)
} }

View File

@ -178,6 +178,8 @@ func AddTime(ctx *context.APIContext) {
// "$ref": "#/responses/error" // "$ref": "#/responses/error"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.AddTimeOption) form := web.GetForm(ctx).(*api.AddTimeOption)
issue, err := issues_model.GetIssueByIndex(ctx, ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) issue, err := issues_model.GetIssueByIndex(ctx, ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
if err != nil { if err != nil {
@ -259,6 +261,8 @@ func ResetIssueTime(ctx *context.APIContext) {
// "$ref": "#/responses/error" // "$ref": "#/responses/error"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
issue, err := issues_model.GetIssueByIndex(ctx, ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) issue, err := issues_model.GetIssueByIndex(ctx, ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
if err != nil { if err != nil {
@ -330,6 +334,8 @@ func DeleteTime(ctx *context.APIContext) {
// "$ref": "#/responses/error" // "$ref": "#/responses/error"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
issue, err := issues_model.GetIssueByIndex(ctx, ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) issue, err := issues_model.GetIssueByIndex(ctx, ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
if err != nil { if err != nil {
@ -409,6 +415,8 @@ func ListTrackedTimesByUser(ctx *context.APIContext) {
// "$ref": "#/responses/error" // "$ref": "#/responses/error"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
if !ctx.Repo.Repository.IsTimetrackerEnabled(ctx) { if !ctx.Repo.Repository.IsTimetrackerEnabled(ctx) {
ctx.Error(http.StatusBadRequest, "", "time tracking disabled") ctx.Error(http.StatusBadRequest, "", "time tracking disabled")
@ -497,6 +505,8 @@ func ListTrackedTimesByRepository(ctx *context.APIContext) {
// "$ref": "#/responses/error" // "$ref": "#/responses/error"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
if !ctx.Repo.Repository.IsTimetrackerEnabled(ctx) { if !ctx.Repo.Repository.IsTimetrackerEnabled(ctx) {
ctx.Error(http.StatusBadRequest, "", "time tracking disabled") ctx.Error(http.StatusBadRequest, "", "time tracking disabled")

View File

@ -80,6 +80,8 @@ func ListDeployKeys(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/DeployKeyList" // "$ref": "#/responses/DeployKeyList"
// "404":
// "$ref": "#/responses/notFound"
opts := &asymkey_model.ListDeployKeysOptions{ opts := &asymkey_model.ListDeployKeysOptions{
ListOptions: utils.GetListOptions(ctx), ListOptions: utils.GetListOptions(ctx),
@ -144,6 +146,8 @@ func GetDeployKey(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/DeployKey" // "$ref": "#/responses/DeployKey"
// "404":
// "$ref": "#/responses/notFound"
key, err := asymkey_model.GetDeployKeyByID(ctx, ctx.ParamsInt64(":id")) key, err := asymkey_model.GetDeployKeyByID(ctx, ctx.ParamsInt64(":id"))
if err != nil { if err != nil {
@ -222,6 +226,8 @@ func CreateDeployKey(ctx *context.APIContext) {
// responses: // responses:
// "201": // "201":
// "$ref": "#/responses/DeployKey" // "$ref": "#/responses/DeployKey"
// "404":
// "$ref": "#/responses/notFound"
// "422": // "422":
// "$ref": "#/responses/validationError" // "$ref": "#/responses/validationError"
@ -270,6 +276,8 @@ func DeleteDeploykey(ctx *context.APIContext) {
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
if err := asymkey_service.DeleteDeployKey(ctx.Doer, ctx.ParamsInt64(":id")); err != nil { if err := asymkey_service.DeleteDeployKey(ctx.Doer, ctx.ParamsInt64(":id")); err != nil {
if asymkey_model.IsErrKeyAccessDenied(err) { if asymkey_model.IsErrKeyAccessDenied(err) {

View File

@ -46,6 +46,8 @@ func ListLabels(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/LabelList" // "$ref": "#/responses/LabelList"
// "404":
// "$ref": "#/responses/notFound"
labels, err := issues_model.GetLabelsByRepoID(ctx, ctx.Repo.Repository.ID, ctx.FormString("sort"), utils.GetListOptions(ctx)) labels, err := issues_model.GetLabelsByRepoID(ctx, ctx.Repo.Repository.ID, ctx.FormString("sort"), utils.GetListOptions(ctx))
if err != nil { if err != nil {
@ -90,6 +92,8 @@ func GetLabel(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/Label" // "$ref": "#/responses/Label"
// "404":
// "$ref": "#/responses/notFound"
var ( var (
l *issues_model.Label l *issues_model.Label
@ -140,6 +144,8 @@ func CreateLabel(ctx *context.APIContext) {
// responses: // responses:
// "201": // "201":
// "$ref": "#/responses/Label" // "$ref": "#/responses/Label"
// "404":
// "$ref": "#/responses/notFound"
// "422": // "422":
// "$ref": "#/responses/validationError" // "$ref": "#/responses/validationError"
@ -200,6 +206,8 @@ func EditLabel(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/Label" // "$ref": "#/responses/Label"
// "404":
// "$ref": "#/responses/notFound"
// "422": // "422":
// "$ref": "#/responses/validationError" // "$ref": "#/responses/validationError"
@ -265,6 +273,8 @@ func DeleteLabel(ctx *context.APIContext) {
// responses: // responses:
// "204": // "204":
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "404":
// "$ref": "#/responses/notFound"
if err := issues_model.DeleteLabel(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id")); err != nil { if err := issues_model.DeleteLabel(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id")); err != nil {
ctx.Error(http.StatusInternalServerError, "DeleteLabel", err) ctx.Error(http.StatusInternalServerError, "DeleteLabel", err)

View File

@ -55,6 +55,8 @@ func ListMilestones(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/MilestoneList" // "$ref": "#/responses/MilestoneList"
// "404":
// "$ref": "#/responses/notFound"
milestones, total, err := issues_model.GetMilestones(issues_model.GetMilestonesOption{ milestones, total, err := issues_model.GetMilestones(issues_model.GetMilestonesOption{
ListOptions: utils.GetListOptions(ctx), ListOptions: utils.GetListOptions(ctx),
@ -102,6 +104,8 @@ func GetMilestone(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/Milestone" // "$ref": "#/responses/Milestone"
// "404":
// "$ref": "#/responses/notFound"
milestone := getMilestoneByIDOrName(ctx) milestone := getMilestoneByIDOrName(ctx)
if ctx.Written() { if ctx.Written() {
@ -138,6 +142,8 @@ func CreateMilestone(ctx *context.APIContext) {
// responses: // responses:
// "201": // "201":
// "$ref": "#/responses/Milestone" // "$ref": "#/responses/Milestone"
// "404":
// "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.CreateMilestoneOption) form := web.GetForm(ctx).(*api.CreateMilestoneOption)
if form.Deadline == nil { if form.Deadline == nil {
@ -196,6 +202,8 @@ func EditMilestone(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/Milestone" // "$ref": "#/responses/Milestone"
// "404":
// "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.EditMilestoneOption) form := web.GetForm(ctx).(*api.EditMilestoneOption)
milestone := getMilestoneByIDOrName(ctx) milestone := getMilestoneByIDOrName(ctx)
if ctx.Written() { if ctx.Written() {
@ -248,6 +256,8 @@ func DeleteMilestone(ctx *context.APIContext) {
// responses: // responses:
// "204": // "204":
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "404":
// "$ref": "#/responses/notFound"
m := getMilestoneByIDOrName(ctx) m := getMilestoneByIDOrName(ctx)
if ctx.Written() { if ctx.Written() {

View File

@ -48,6 +48,8 @@ func MirrorSync(ctx *context.APIContext) {
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
repo := ctx.Repo.Repository repo := ctx.Repo.Repository
@ -99,6 +101,8 @@ func PushMirrorSync(ctx *context.APIContext) {
// "$ref": "#/responses/error" // "$ref": "#/responses/error"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
if !setting.Mirror.Enabled { if !setting.Mirror.Enabled {
ctx.Error(http.StatusBadRequest, "PushMirrorSync", "Mirror feature is disabled") ctx.Error(http.StatusBadRequest, "PushMirrorSync", "Mirror feature is disabled")
@ -154,6 +158,8 @@ func ListPushMirrors(ctx *context.APIContext) {
// "$ref": "#/responses/error" // "$ref": "#/responses/error"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
if !setting.Mirror.Enabled { if !setting.Mirror.Enabled {
ctx.Error(http.StatusBadRequest, "GetPushMirrorsByRepoID", "Mirror feature is disabled") ctx.Error(http.StatusBadRequest, "GetPushMirrorsByRepoID", "Mirror feature is disabled")
@ -211,6 +217,8 @@ func GetPushMirrorByName(ctx *context.APIContext) {
// "$ref": "#/responses/error" // "$ref": "#/responses/error"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
if !setting.Mirror.Enabled { if !setting.Mirror.Enabled {
ctx.Error(http.StatusBadRequest, "GetPushMirrorByRemoteName", "Mirror feature is disabled") ctx.Error(http.StatusBadRequest, "GetPushMirrorByRemoteName", "Mirror feature is disabled")
@ -263,6 +271,8 @@ func AddPushMirror(ctx *context.APIContext) {
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "400": // "400":
// "$ref": "#/responses/error" // "$ref": "#/responses/error"
// "404":
// "$ref": "#/responses/notFound"
if !setting.Mirror.Enabled { if !setting.Mirror.Enabled {
ctx.Error(http.StatusBadRequest, "AddPushMirror", "Mirror feature is disabled") ctx.Error(http.StatusBadRequest, "AddPushMirror", "Mirror feature is disabled")

View File

@ -45,6 +45,8 @@ func ApplyDiffPatch(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/FileResponse" // "$ref": "#/responses/FileResponse"
// "404":
// "$ref": "#/responses/notFound"
apiOpts := web.GetForm(ctx).(*api.ApplyDiffPatchFileOptions) apiOpts := web.GetForm(ctx).(*api.ApplyDiffPatchFileOptions)
opts := &files.ApplyDiffPatchOptions{ opts := &files.ApplyDiffPatchOptions{

View File

@ -92,6 +92,8 @@ func ListPullRequests(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/PullRequestList" // "$ref": "#/responses/PullRequestList"
// "404":
// "$ref": "#/responses/notFound"
listOptions := utils.GetListOptions(ctx) listOptions := utils.GetListOptions(ctx)
@ -274,6 +276,8 @@ func CreatePullRequest(ctx *context.APIContext) {
// responses: // responses:
// "201": // "201":
// "$ref": "#/responses/PullRequest" // "$ref": "#/responses/PullRequest"
// "404":
// "$ref": "#/responses/notFound"
// "409": // "409":
// "$ref": "#/responses/error" // "$ref": "#/responses/error"
// "422": // "422":
@ -463,6 +467,8 @@ func EditPullRequest(ctx *context.APIContext) {
// "$ref": "#/responses/PullRequest" // "$ref": "#/responses/PullRequest"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
// "409": // "409":
// "$ref": "#/responses/error" // "$ref": "#/responses/error"
// "412": // "412":
@ -729,6 +735,8 @@ func MergePullRequest(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "404":
// "$ref": "#/responses/notFound"
// "405": // "405":
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "409": // "409":

View File

@ -819,6 +819,8 @@ func DismissPullReview(ctx *context.APIContext) {
// "$ref": "#/responses/PullReview" // "$ref": "#/responses/PullReview"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
// "422": // "422":
// "$ref": "#/responses/validationError" // "$ref": "#/responses/validationError"
opts := web.GetForm(ctx).(*api.DismissPullReviewOptions) opts := web.GetForm(ctx).(*api.DismissPullReviewOptions)
@ -860,6 +862,8 @@ func UnDismissPullReview(ctx *context.APIContext) {
// "$ref": "#/responses/PullReview" // "$ref": "#/responses/PullReview"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
// "422": // "422":
// "$ref": "#/responses/validationError" // "$ref": "#/responses/validationError"
dismissReview(ctx, "", false, false) dismissReview(ctx, "", false, false)

View File

@ -150,6 +150,8 @@ func ListReleases(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/ReleaseList" // "$ref": "#/responses/ReleaseList"
// "404":
// "$ref": "#/responses/notFound"
listOptions := utils.GetListOptions(ctx) listOptions := utils.GetListOptions(ctx)
if listOptions.PageSize == 0 && ctx.FormInt("per_page") != 0 { if listOptions.PageSize == 0 && ctx.FormInt("per_page") != 0 {
listOptions.PageSize = ctx.FormInt("per_page") listOptions.PageSize = ctx.FormInt("per_page")

View File

@ -50,6 +50,8 @@ func GetReleaseAttachment(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/Attachment" // "$ref": "#/responses/Attachment"
// "404":
// "$ref": "#/responses/notFound"
releaseID := ctx.ParamsInt64(":id") releaseID := ctx.ParamsInt64(":id")
attachID := ctx.ParamsInt64(":attachment_id") attachID := ctx.ParamsInt64(":attachment_id")
@ -98,6 +100,8 @@ func ListReleaseAttachments(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/AttachmentList" // "$ref": "#/responses/AttachmentList"
// "404":
// "$ref": "#/responses/notFound"
releaseID := ctx.ParamsInt64(":id") releaseID := ctx.ParamsInt64(":id")
release, err := repo_model.GetReleaseByID(ctx, releaseID) release, err := repo_model.GetReleaseByID(ctx, releaseID)
@ -161,6 +165,8 @@ func CreateReleaseAttachment(ctx *context.APIContext) {
// "$ref": "#/responses/Attachment" // "$ref": "#/responses/Attachment"
// "400": // "400":
// "$ref": "#/responses/error" // "$ref": "#/responses/error"
// "404":
// "$ref": "#/responses/notFound"
// Check if attachments are enabled // Check if attachments are enabled
if !setting.Attachment.Enabled { if !setting.Attachment.Enabled {
@ -251,6 +257,8 @@ func EditReleaseAttachment(ctx *context.APIContext) {
// responses: // responses:
// "201": // "201":
// "$ref": "#/responses/Attachment" // "$ref": "#/responses/Attachment"
// "404":
// "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.EditAttachmentOptions) form := web.GetForm(ctx).(*api.EditAttachmentOptions)
@ -315,6 +323,8 @@ func DeleteReleaseAttachment(ctx *context.APIContext) {
// responses: // responses:
// "204": // "204":
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "404":
// "$ref": "#/responses/notFound"
// Check if release exists an load release // Check if release exists an load release
releaseID := ctx.ParamsInt64(":id") releaseID := ctx.ParamsInt64(":id")

View File

@ -451,6 +451,8 @@ func CreateOrgRepoDeprecated(ctx *context.APIContext) {
// "$ref": "#/responses/validationError" // "$ref": "#/responses/validationError"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
CreateOrgRepo(ctx) CreateOrgRepo(ctx)
} }
@ -533,6 +535,8 @@ func Get(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/Repository" // "$ref": "#/responses/Repository"
// "404":
// "$ref": "#/responses/notFound"
if err := ctx.Repo.Repository.LoadAttributes(ctx); err != nil { if err := ctx.Repo.Repository.LoadAttributes(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "Repository.LoadAttributes", err) ctx.Error(http.StatusInternalServerError, "Repository.LoadAttributes", err)
@ -559,6 +563,8 @@ func GetByID(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/Repository" // "$ref": "#/responses/Repository"
// "404":
// "$ref": "#/responses/notFound"
repo, err := repo_model.GetRepositoryByID(ctx, ctx.ParamsInt64(":id")) repo, err := repo_model.GetRepositoryByID(ctx, ctx.ParamsInt64(":id"))
if err != nil { if err != nil {
@ -609,6 +615,8 @@ func Edit(ctx *context.APIContext) {
// "$ref": "#/responses/Repository" // "$ref": "#/responses/Repository"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
// "422": // "422":
// "$ref": "#/responses/validationError" // "$ref": "#/responses/validationError"
@ -1100,6 +1108,8 @@ func Delete(ctx *context.APIContext) {
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
owner := ctx.Repo.Owner owner := ctx.Repo.Owner
repo := ctx.Repo.Repository repo := ctx.Repo.Repository
@ -1147,6 +1157,8 @@ func GetIssueTemplates(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/IssueTemplates" // "$ref": "#/responses/IssueTemplates"
// "404":
// "$ref": "#/responses/notFound"
ret, err := issue.GetTemplatesFromDefaultBranch(ctx.Repo.Repository, ctx.Repo.GitRepo) ret, err := issue.GetTemplatesFromDefaultBranch(ctx.Repo.Repository, ctx.Repo.GitRepo)
if err != nil { if err != nil {
ctx.Error(http.StatusInternalServerError, "GetTemplatesFromDefaultBranch", err) ctx.Error(http.StatusInternalServerError, "GetTemplatesFromDefaultBranch", err)
@ -1176,6 +1188,8 @@ func GetIssueConfig(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/RepoIssueConfig" // "$ref": "#/responses/RepoIssueConfig"
// "404":
// "$ref": "#/responses/notFound"
issueConfig, _ := issue.GetTemplateConfigFromDefaultBranch(ctx.Repo.Repository, ctx.Repo.GitRepo) issueConfig, _ := issue.GetTemplateConfigFromDefaultBranch(ctx.Repo.Repository, ctx.Repo.GitRepo)
ctx.JSON(http.StatusOK, issueConfig) ctx.JSON(http.StatusOK, issueConfig)
} }
@ -1201,6 +1215,8 @@ func ValidateIssueConfig(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/RepoIssueConfigValidation" // "$ref": "#/responses/RepoIssueConfigValidation"
// "404":
// "$ref": "#/responses/notFound"
_, err := issue.GetTemplateConfigFromDefaultBranch(ctx.Repo.Repository, ctx.Repo.GitRepo) _, err := issue.GetTemplateConfigFromDefaultBranch(ctx.Repo.Repository, ctx.Repo.GitRepo)
if err == nil { if err == nil {

View File

@ -42,6 +42,8 @@ func ListStargazers(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/UserList" // "$ref": "#/responses/UserList"
// "404":
// "$ref": "#/responses/notFound"
stargazers, err := repo_model.GetStargazers(ctx.Repo.Repository, utils.GetListOptions(ctx)) stargazers, err := repo_model.GetStargazers(ctx.Repo.Repository, utils.GetListOptions(ctx))
if err != nil { if err != nil {

View File

@ -48,6 +48,8 @@ func NewCommitStatus(ctx *context.APIContext) {
// "$ref": "#/responses/CommitStatus" // "$ref": "#/responses/CommitStatus"
// "400": // "400":
// "$ref": "#/responses/error" // "$ref": "#/responses/error"
// "404":
// "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.CreateStatusOption) form := web.GetForm(ctx).(*api.CreateStatusOption)
sha := ctx.Params("sha") sha := ctx.Params("sha")
@ -117,6 +119,8 @@ func GetCommitStatuses(ctx *context.APIContext) {
// "$ref": "#/responses/CommitStatusList" // "$ref": "#/responses/CommitStatusList"
// "400": // "400":
// "$ref": "#/responses/error" // "$ref": "#/responses/error"
// "404":
// "$ref": "#/responses/notFound"
getCommitStatuses(ctx, ctx.Params("sha")) getCommitStatuses(ctx, ctx.Params("sha"))
} }
@ -169,6 +173,8 @@ func GetCommitStatusesByRef(ctx *context.APIContext) {
// "$ref": "#/responses/CommitStatusList" // "$ref": "#/responses/CommitStatusList"
// "400": // "400":
// "$ref": "#/responses/error" // "$ref": "#/responses/error"
// "404":
// "$ref": "#/responses/notFound"
filter := utils.ResolveRefOrSha(ctx, ctx.Params("ref")) filter := utils.ResolveRefOrSha(ctx, ctx.Params("ref"))
if ctx.Written() { if ctx.Written() {
@ -245,6 +251,8 @@ func GetCombinedCommitStatusByRef(ctx *context.APIContext) {
// "$ref": "#/responses/CombinedStatus" // "$ref": "#/responses/CombinedStatus"
// "400": // "400":
// "$ref": "#/responses/error" // "$ref": "#/responses/error"
// "404":
// "$ref": "#/responses/notFound"
sha := utils.ResolveRefOrSha(ctx, ctx.Params("ref")) sha := utils.ResolveRefOrSha(ctx, ctx.Params("ref"))
if ctx.Written() { if ctx.Written() {

View File

@ -42,6 +42,8 @@ func ListSubscribers(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/UserList" // "$ref": "#/responses/UserList"
// "404":
// "$ref": "#/responses/notFound"
subscribers, err := repo_model.GetRepoWatchers(ctx.Repo.Repository.ID, utils.GetListOptions(ctx)) subscribers, err := repo_model.GetRepoWatchers(ctx.Repo.Repository.ID, utils.GetListOptions(ctx))
if err != nil { if err != nil {

View File

@ -47,6 +47,8 @@ func ListTags(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/TagList" // "$ref": "#/responses/TagList"
// "404":
// "$ref": "#/responses/notFound"
listOpts := utils.GetListOptions(ctx) listOpts := utils.GetListOptions(ctx)
@ -93,6 +95,8 @@ func GetAnnotatedTag(ctx *context.APIContext) {
// "$ref": "#/responses/AnnotatedTag" // "$ref": "#/responses/AnnotatedTag"
// "400": // "400":
// "$ref": "#/responses/error" // "$ref": "#/responses/error"
// "404":
// "$ref": "#/responses/notFound"
sha := ctx.Params("sha") sha := ctx.Params("sha")
if len(sha) == 0 { if len(sha) == 0 {

View File

@ -35,6 +35,8 @@ func ListTeams(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/TeamList" // "$ref": "#/responses/TeamList"
// "404":
// "$ref": "#/responses/notFound"
if !ctx.Repo.Owner.IsOrganization() { if !ctx.Repo.Owner.IsOrganization() {
ctx.Error(http.StatusMethodNotAllowed, "noOrg", "repo is not owned by an organization") ctx.Error(http.StatusMethodNotAllowed, "noOrg", "repo is not owned by an organization")
@ -140,6 +142,8 @@ func AddTeam(ctx *context.APIContext) {
// "$ref": "#/responses/validationError" // "$ref": "#/responses/validationError"
// "405": // "405":
// "$ref": "#/responses/error" // "$ref": "#/responses/error"
// "404":
// "$ref": "#/responses/notFound"
changeRepoTeam(ctx, true) changeRepoTeam(ctx, true)
} }
@ -174,6 +178,8 @@ func DeleteTeam(ctx *context.APIContext) {
// "$ref": "#/responses/validationError" // "$ref": "#/responses/validationError"
// "405": // "405":
// "$ref": "#/responses/error" // "$ref": "#/responses/error"
// "404":
// "$ref": "#/responses/notFound"
changeRepoTeam(ctx, false) changeRepoTeam(ctx, false)
} }

View File

@ -45,6 +45,8 @@ func ListTopics(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/TopicNames" // "$ref": "#/responses/TopicNames"
// "404":
// "$ref": "#/responses/notFound"
opts := &repo_model.FindTopicOptions{ opts := &repo_model.FindTopicOptions{
ListOptions: utils.GetListOptions(ctx), ListOptions: utils.GetListOptions(ctx),
@ -93,6 +95,8 @@ func UpdateTopics(ctx *context.APIContext) {
// responses: // responses:
// "204": // "204":
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "404":
// "$ref": "#/responses/notFound"
// "422": // "422":
// "$ref": "#/responses/invalidTopicsError" // "$ref": "#/responses/invalidTopicsError"
@ -152,6 +156,8 @@ func AddTopic(ctx *context.APIContext) {
// responses: // responses:
// "204": // "204":
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "404":
// "$ref": "#/responses/notFound"
// "422": // "422":
// "$ref": "#/responses/invalidTopicsError" // "$ref": "#/responses/invalidTopicsError"
@ -217,6 +223,8 @@ func DeleteTopic(ctx *context.APIContext) {
// responses: // responses:
// "204": // "204":
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "404":
// "$ref": "#/responses/notFound"
// "422": // "422":
// "$ref": "#/responses/invalidTopicsError" // "$ref": "#/responses/invalidTopicsError"
@ -271,6 +279,8 @@ func TopicSearch(ctx *context.APIContext) {
// "$ref": "#/responses/TopicListResponse" // "$ref": "#/responses/TopicListResponse"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
opts := &repo_model.FindTopicOptions{ opts := &repo_model.FindTopicOptions{
Keyword: ctx.FormString("q"), Keyword: ctx.FormString("q"),

View File

@ -53,6 +53,8 @@ func GetTree(ctx *context.APIContext) {
// "$ref": "#/responses/GitTreeResponse" // "$ref": "#/responses/GitTreeResponse"
// "400": // "400":
// "$ref": "#/responses/error" // "$ref": "#/responses/error"
// "404":
// "$ref": "#/responses/notFound"
sha := ctx.Params(":sha") sha := ctx.Params(":sha")
if len(sha) == 0 { if len(sha) == 0 {

View File

@ -50,6 +50,8 @@ func NewWikiPage(ctx *context.APIContext) {
// "$ref": "#/responses/error" // "$ref": "#/responses/error"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.CreateWikiPageOptions) form := web.GetForm(ctx).(*api.CreateWikiPageOptions)
@ -124,6 +126,8 @@ func EditWikiPage(ctx *context.APIContext) {
// "$ref": "#/responses/error" // "$ref": "#/responses/error"
// "403": // "403":
// "$ref": "#/responses/forbidden" // "$ref": "#/responses/forbidden"
// "404":
// "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.CreateWikiPageOptions) form := web.GetForm(ctx).(*api.CreateWikiPageOptions)

View File

@ -80,6 +80,8 @@ func ListFollowers(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/UserList" // "$ref": "#/responses/UserList"
// "404":
// "$ref": "#/responses/notFound"
listUserFollowers(ctx, ctx.ContextUser) listUserFollowers(ctx, ctx.ContextUser)
} }
@ -142,6 +144,8 @@ func ListFollowing(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/UserList" // "$ref": "#/responses/UserList"
// "404":
// "$ref": "#/responses/notFound"
listUserFollowing(ctx, ctx.ContextUser) listUserFollowing(ctx, ctx.ContextUser)
} }
@ -217,6 +221,8 @@ func Follow(ctx *context.APIContext) {
// responses: // responses:
// "204": // "204":
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "404":
// "$ref": "#/responses/notFound"
if err := user_model.FollowUser(ctx.Doer.ID, ctx.ContextUser.ID); err != nil { if err := user_model.FollowUser(ctx.Doer.ID, ctx.ContextUser.ID); err != nil {
ctx.Error(http.StatusInternalServerError, "FollowUser", err) ctx.Error(http.StatusInternalServerError, "FollowUser", err)
@ -239,6 +245,8 @@ func Unfollow(ctx *context.APIContext) {
// responses: // responses:
// "204": // "204":
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "404":
// "$ref": "#/responses/notFound"
if err := user_model.UnfollowUser(ctx.Doer.ID, ctx.ContextUser.ID); err != nil { if err := user_model.UnfollowUser(ctx.Doer.ID, ctx.ContextUser.ID); err != nil {
ctx.Error(http.StatusInternalServerError, "UnfollowUser", err) ctx.Error(http.StatusInternalServerError, "UnfollowUser", err)

View File

@ -63,6 +63,8 @@ func ListGPGKeys(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/GPGKeyList" // "$ref": "#/responses/GPGKeyList"
// "404":
// "$ref": "#/responses/notFound"
listGPGKeys(ctx, ctx.ContextUser.ID, utils.GetListOptions(ctx)) listGPGKeys(ctx, ctx.ContextUser.ID, utils.GetListOptions(ctx))
} }

View File

@ -150,6 +150,8 @@ func ListPublicKeys(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/PublicKeyList" // "$ref": "#/responses/PublicKeyList"
// "404":
// "$ref": "#/responses/notFound"
listPublicKeys(ctx, ctx.ContextUser) listPublicKeys(ctx, ctx.ContextUser)
} }

View File

@ -78,6 +78,8 @@ func ListUserRepos(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/RepositoryList" // "$ref": "#/responses/RepositoryList"
// "404":
// "$ref": "#/responses/notFound"
private := ctx.IsSigned private := ctx.IsSigned
listUserRepos(ctx, ctx.ContextUser, private) listUserRepos(ctx, ctx.ContextUser, private)
@ -160,6 +162,8 @@ func ListOrgRepos(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/RepositoryList" // "$ref": "#/responses/RepositoryList"
// "404":
// "$ref": "#/responses/notFound"
listUserRepos(ctx, ctx.Org.Organization.AsUser(), ctx.IsSigned) listUserRepos(ctx, ctx.Org.Organization.AsUser(), ctx.IsSigned)
} }

View File

@ -61,6 +61,8 @@ func GetStarredRepos(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/RepositoryList" // "$ref": "#/responses/RepositoryList"
// "404":
// "$ref": "#/responses/notFound"
private := ctx.ContextUser.ID == ctx.Doer.ID private := ctx.ContextUser.ID == ctx.Doer.ID
repos, err := getStarredRepos(ctx, ctx.ContextUser, private, utils.GetListOptions(ctx)) repos, err := getStarredRepos(ctx, ctx.ContextUser, private, utils.GetListOptions(ctx))
@ -150,6 +152,8 @@ func Star(ctx *context.APIContext) {
// responses: // responses:
// "204": // "204":
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "404":
// "$ref": "#/responses/notFound"
err := repo_model.StarRepo(ctx.Doer.ID, ctx.Repo.Repository.ID, true) err := repo_model.StarRepo(ctx.Doer.ID, ctx.Repo.Repository.ID, true)
if err != nil { if err != nil {
@ -178,6 +182,8 @@ func Unstar(ctx *context.APIContext) {
// responses: // responses:
// "204": // "204":
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "404":
// "$ref": "#/responses/notFound"
err := repo_model.StarRepo(ctx.Doer.ID, ctx.Repo.Repository.ID, false) err := repo_model.StarRepo(ctx.Doer.ID, ctx.Repo.Repository.ID, false)
if err != nil { if err != nil {

View File

@ -59,6 +59,8 @@ func GetWatchedRepos(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/RepositoryList" // "$ref": "#/responses/RepositoryList"
// "404":
// "$ref": "#/responses/notFound"
private := ctx.ContextUser.ID == ctx.Doer.ID private := ctx.ContextUser.ID == ctx.Doer.ID
repos, total, err := getWatchedRepos(ctx, ctx.ContextUser, private, utils.GetListOptions(ctx)) repos, total, err := getWatchedRepos(ctx, ctx.ContextUser, private, utils.GetListOptions(ctx))
@ -155,6 +157,8 @@ func Watch(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/WatchInfo" // "$ref": "#/responses/WatchInfo"
// "404":
// "$ref": "#/responses/notFound"
err := repo_model.WatchRepo(ctx, ctx.Doer.ID, ctx.Repo.Repository.ID, true) err := repo_model.WatchRepo(ctx, ctx.Doer.ID, ctx.Repo.Repository.ID, true)
if err != nil { if err != nil {
@ -190,6 +194,8 @@ func Unwatch(ctx *context.APIContext) {
// responses: // responses:
// "204": // "204":
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "404":
// "$ref": "#/responses/notFound"
err := repo_model.WatchRepo(ctx, ctx.Doer.ID, ctx.Repo.Repository.ID, false) err := repo_model.WatchRepo(ctx, ctx.Doer.ID, ctx.Repo.Repository.ID, false)
if err != nil { if err != nil {

File diff suppressed because it is too large Load Diff