Github API(v3):按创建日期对搜索结果进行排序 [英] Github API(v3): Sort search result by date created

查看:294
本文介绍了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

这篇关于Github API(v3):按创建日期对搜索结果进行排序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆