是否可以使用指定属性扩展 GitHub API 搜索结果?
Is it possible to extend GitHub API search result with specified properties?
我正在做用户搜索,但是 GitHub 的结果不包含我需要的所有信息。
例如,当搜索基于 New York
的用户时,请求为:
GET https://api.github.com/search/users?q=location:"New York"
我收到的回复如下:
{
"total_count": 58317,
"incomplete_results": false,
"items": [
{
"login": "ry",
"id": 80,
"node_id": "MDQ6VXNlcjgw",
"avatar_url": "https://avatars1.githubusercontent.com/u/80?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/ry",
"html_url": "https://github.com/ry",
"followers_url": "https://api.github.com/users/ry/followers",
"following_url": "https://api.github.com/users/ry/following{/other_user}",
"gists_url": "https://api.github.com/users/ry/gists{/gist_id}",
"starred_url": "https://api.github.com/users/ry/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/ry/subscriptions",
"organizations_url": "https://api.github.com/users/ry/orgs",
"repos_url": "https://api.github.com/users/ry/repos",
"events_url": "https://api.github.com/users/ry/events{/privacy}",
"received_events_url": "https://api.github.com/users/ry/received_events",
"type": "User",
"site_admin": false,
"score": 1.0
},
...
]
}
我想回来也算 public_repos
和 followers
。
发送用户查询时,此信息可用:
GET https://api.github.com/users/{login}
{
...
"public_repos": 1331,
"followers": 262,
...
}
有没有办法扩展具有指定属性的搜索结果?
您可以通过以下请求使用 GraphQL API v4:
{
search(query: "location:\"New York\"", type: USER, first: 100) {
userCount
edges {
node {
... on User {
login
followers {
totalCount
}
repositories(privacy: PUBLIC) {
totalCount
}
}
}
}
}
}
我正在做用户搜索,但是 GitHub 的结果不包含我需要的所有信息。
例如,当搜索基于 New York
的用户时,请求为:
GET https://api.github.com/search/users?q=location:"New York"
我收到的回复如下:
{
"total_count": 58317,
"incomplete_results": false,
"items": [
{
"login": "ry",
"id": 80,
"node_id": "MDQ6VXNlcjgw",
"avatar_url": "https://avatars1.githubusercontent.com/u/80?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/ry",
"html_url": "https://github.com/ry",
"followers_url": "https://api.github.com/users/ry/followers",
"following_url": "https://api.github.com/users/ry/following{/other_user}",
"gists_url": "https://api.github.com/users/ry/gists{/gist_id}",
"starred_url": "https://api.github.com/users/ry/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/ry/subscriptions",
"organizations_url": "https://api.github.com/users/ry/orgs",
"repos_url": "https://api.github.com/users/ry/repos",
"events_url": "https://api.github.com/users/ry/events{/privacy}",
"received_events_url": "https://api.github.com/users/ry/received_events",
"type": "User",
"site_admin": false,
"score": 1.0
},
...
]
}
我想回来也算 public_repos
和 followers
。
发送用户查询时,此信息可用:
GET https://api.github.com/users/{login}
{
...
"public_repos": 1331,
"followers": 262,
...
}
有没有办法扩展具有指定属性的搜索结果?
您可以通过以下请求使用 GraphQL API v4:
{
search(query: "location:\"New York\"", type: USER, first: 100) {
userCount
edges {
node {
... on User {
login
followers {
totalCount
}
repositories(privacy: PUBLIC) {
totalCount
}
}
}
}
}
}