如何使用 GitHub API 获取 GitHub 问题的数量? [英] How can I get the number of GitHub issues using the GitHub API?

查看:46
本文介绍了如何使用 GitHub API 获取 GitHub 问题的数量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 angular 和 Github Rest API 获取存储库的问题数量,但问题是即使该存储库中存在更多问题,我也只得到 30 个问题.请帮我出主意.我使用以下 REST Api 来解决问题.

Hi I am trying to get the number of issues of a repo using angular and Github Rest API, But the problem is that I get only 30 issues even though more issues are there in that repo. Please help me with the idea. I use the below REST Api to get the issues.

https://api.github.com/repos/vmg/redcarpet/issues?state=all

推荐答案

更新回复

如果您只想要数量 的问题,我认为最接近的是 获取 repo 端点:

Updated response

If you just want the number of issues I think the closest you'll get is with the get repo endpoint:

获取/repos/:owner/:repo

GET /repos/:owner/:repo

来自该端点的 JSON 响应包括两个相关的键:

The JSON response from this endpoint includes two relevant keys:

  • has_issues,将是 truefalse,以及
  • open_issues_count,它应该为您提供未解决问题的数量.
  • has_issues, which will be true or false, and
  • open_issues_count, which should give you the number of open issues.

我不确定有什么方法可以获取问题的数量,包括未打开的问题.

I'm not sure of any way to get the number of issues including ones that aren't open.

您需要分页:

返回多个项目的请求将默认分页为 30 个项目.您可以使用 ?page 参数指定更多页面.对于某些资源,您还可以使用 ?per_page 参数将自定义页面大小设置为最多 100.请注意,由于技术原因,并非所有端点都遵守 ?per_page 参数,请参阅 事件例如.

Requests that return multiple items will be paginated to 30 items by default. You can specify further pages with the ?page parameter. For some resources, you can also set a custom page size up to 100 with the ?per_page parameter. Note that for technical reasons not all endpoints respect the ?per_page parameter, see events for example.

$ curl 'https://api.github.com/user/repos?page=2&per_page=100'

这篇关于如何使用 GitHub API 获取 GitHub 问题的数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆