另一种方法是list events for a given user
GET /users/:username/events
例子:https://api.github.com/users/VonC/events
{
"id": "3406063602",
"type": "PushEvent",
"actor": {
"id": 79478,
"login": "VonC",
"gravatar_id": "",
"url": "https://api.github.com/users/VonC",
"avatar_url": "https://avatars.githubusercontent.com/u/79478?"
},
"repo": {
"id": 47265668,
"name": "VonC/hello-world-go",
"url": "https://api.github.com/repos/VonC/hello-world-go"
},
"payload": {
"push_id": 889397803,
"size": 2,
"distinct_size": 2,
"ref": "refs/heads/master",
"head": "54dd9bd15fea2476bd76c7bf88bcec370d9dfc61",
"before": "64d3b59911fef0b0c2423c105c38aabf99332e28",
"commits": [
{
"sha": "ee856fa87073cf92e11baa4d36f61394de937085",
...
你将不得不筛选PushEvent
,并iterate over the pages of events直到得到一个事件比一个月前更旧。
我喜欢你的想法@vonC!这可能需要比我这样做的API请求数量更少。在这种情况下,我需要担心分页吗? –
@ZachRussell活动的限制为每页30个......这可能不足以在过去几个月中获得所有活动。在这种情况下,您将不得不迭代获取更多页面。 – VonC