Exemplo n.º 1
0
func listUserFollowing(ctx *context.APIContext, u *models.User) {
	users, err := u.GetFollowing(ctx.QueryInt("page"))
	if err != nil {
		ctx.Error(500, "GetFollowing", err)
		return
	}
	responseApiUsers(ctx, users)
}
Exemplo n.º 2
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)
}