1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-11-04 08:17:24 -05:00

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:
// "200":
// "$ref": "#/responses/SecretList"
// "404":
// "$ref": "#/responses/notFound"
opts := &secret_model.FindSecretsOptions{
OwnerID: ctx.Org.Organization.ID,

View File

@ -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)

View File

@ -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,

View File

@ -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)

View File

@ -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() {

View File

@ -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)

View File

@ -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)

View File

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

View File

@ -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)

View File

@ -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 {

View File

@ -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 {

View File

@ -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":

View File

@ -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 {

View File

@ -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)

View File

@ -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":

View File

@ -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 {

View File

@ -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 <Form>, i.e. <:index> is the target
target := getParamsIssue(ctx)
@ -303,6 +307,8 @@ func GetIssueBlocks(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/IssueList"
// "404":
// "$ref": "#/responses/notFound"
// 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.
@ -458,6 +464,8 @@ func RemoveIssueBlocking(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/Issue"
// "404":
// "$ref": "#/responses/notFound"
dependency := getParamsIssue(ctx)
if ctx.Written() {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff