Пример #1
0
func ListIssues(ctx *context.APIContext) {
	issues, err := models.Issues(&models.IssuesOptions{
		RepoID: ctx.Repo.Repository.ID,
		Page:   ctx.QueryInt("page"),
	})
	if err != nil {
		ctx.Error(500, "Issues", err)
		return
	}

	apiIssues := make([]*api.Issue, len(issues))
	for i := range issues {
		apiIssues[i] = convert.ToIssue(issues[i])
	}

	ctx.SetLinkHeader(ctx.Repo.Repository.NumIssues, setting.IssuePagingNum)
	ctx.JSON(200, &apiIssues)
}