Github API(v3):按创建日期对搜索结果进行排序
问题描述:
我想按存储库的创建日期对存储库搜索结果进行排序. 这可能是一个容易的任务,但是我已经挣扎了一段时间. 请帮助:(
I want to sort my repositories search result by the date they are created. This might be an easy task but I have been struggling for a while. Please help :(
答
如果仍然可以选择Github API Graphql v4,则可以通过
If Github API Graphql v4 is still an option, you can do this very easily, from the explorer :
{
user(login: "bertrandmartel") {
repositories(first: 100, orderBy: {field: CREATED_AT, direction: DESC}) {
nodes {
createdAt
name
}
}
}
}
使用curl:
curl -H "Authorization: bearer token" -d '
{
"query": "query { user(login: \"bertrandmartel\") { repositories(first: 100, orderBy: {field: CREATED_AT, direction: DESC}) { nodes { createdAt name } } } }"
}
' https://api.github.com/graphql