Github API(v3):按创建日期对搜索结果进行排序

Hoà*_*Côn 4 github github-api

我想按存储库的创建日期对存储库搜索结果进行排序。这可能是一项简单的任务,但我已经挣扎了一段时间。请帮忙 :(

Ber*_*tel 5

如果 Github API Graphql v4 仍然是一个选项,您可以从资源管理器轻松完成此操作:

{
  user(login: "bertrandmartel") {
    repositories(first: 100, orderBy: {field: CREATED_AT, direction: DESC}) {
      nodes {
        createdAt
        name
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

使用卷曲:

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
Run Code Online (Sandbox Code Playgroud)