另一種方法是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