如何获得“我的请求"从github api? [英] how to get "my pull requests" from github api?

查看:64
本文介绍了如何获得“我的请求"从github api?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您查看以下内容: http://developer.github.com/v3/pulls/它向您展示如何获取给定存储库的拉取请求.

If you look at: http://developer.github.com/v3/pulls/ it shows you how to get pull requests for a given repository.

我们如何获得我的拉取请求"来自GitHub API的信息,类似于GitHub仪表板上显示的数据?

How do we get "my pull requests" from the GitHub API similar to the data displayed on the GitHub dashboard?

推荐答案

首先,您必须认识到必须使用基本身份验证或令牌进行身份验证.接下来,您必须意识到没有简单的方法可以做到这一点,因此您将必须变得聪明.

First you have to realize that you must authenticate using either Basic Authentication or a token. Next you have to realize that there is no simple way to do this so you will have to be clever.

具体来说,如果您探查 https://api.github.com/issues ,您会注意到那里的问题有一个名为 pull_request 的哈希应该有3个网址:html,diff和patch.如果问题也是拉取请求",则所有这三个将都不为空.(提示:就GitHub而言,它们是同一件事…….)

To be specific, if you probe https://api.github.com/issues, you'll notice that the issues there have a hash called pull_request which should have 3 URLs: html, diff, and patch. All three will be non-null if the issue is also a Pull Request. (Pro-tip: They're the same thing as far as GitHub is concerned…sort of.)

如果您遍历问题并筛选出那些属性不为null的问题,那么您将拥有拉取请求.

If you iterate over your issues and filter for ones where those attributes are not null, then you'll have your pull requests.

这篇关于如何获得“我的请求"从github api?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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