是否可以像GitHub GraphQL API v4一样列出所有使用REST API v3的github组织?
按照有限的样本电话:
$ curl https://api.github.com/organizations?since=32358551
[
{
"login": "NxtReader",
"id": 32358576,
"url": "https://api.github.com/orgs/NxtReader",
"repos_url": "https://api.github.com/orgs/NxtReader/repos",
"events_url": "https://api.github.com/orgs/NxtReader/events",
"hooks_url": "https://api.github.com/orgs/NxtReader/hooks",
"issues_url": "https://api.github.com/orgs/NxtReader/issues",
"members_url": "https://api.github.com/orgs/NxtReader/members{/member}",
"public_members_url": "https://api.github.com/orgs/NxtReader/public_members{/member}",
"avatar_url": "https://avatars3.githubusercontent.com/u/32358576?v=4",
"description": null
},
{
"login": "fokkmandag",
"id": 32358602,
"url": "https://api.github.com/orgs/fokkmandag",
"repos_url": "https://api.github.com/orgs/fokkmandag/repos",
"events_url": "https://api.github.com/orgs/fokkmandag/events",
"hooks_url": "https://api.github.com/orgs/fokkmandag/hooks",
"issues_url": "https://api.github.com/orgs/fokkmandag/issues",
"members_url": "https://api.github.com/orgs/fokkmandag/members{/member}",
"public_members_url": "https://api.github.com/orgs/fokkmandag/public_members{/member}",
"avatar_url": "https://avatars2.githubusercontent.com/u/32358602?v=4",
"description": null
}
]
答案 0 :(得分:2)
您可以将搜索查询与type:org
一起使用,因为SearchResultItem
可以容纳Organization
个对象:
{
search(first: 100, type: USER, query: "type:org") {
userCount
pageInfo {
hasNextPage
endCursor
}
edges {
node {
... on Organization {
login
name
description
}
}
}
}
}
对于分页,如果after
为endCursor
,您可以使用hasNextPage
参数作为最后true
值获取下一个请求,例如:
search(after: "Y3Vyc29yOjEwMA==", first: 100, type: USER, query: "type:org")