2017-11-13 12 views
1

作成した日付でリポジトリの検索結果を並べ替える必要があります。 これは簡単な作業かもしれませんが、私はしばらくの間苦労しています。 GithubのAPI Graphql V4はまだオプションである場合、あなたはthe explorerから、非常に簡単にこれを行うことができます:(Github API(v3):作成した日付で検索結果を並べ替え

+0

あなたは「日付並べ替えJavascriptのオブジェクト配列」に欠けている:https://でのstackoverflowを.com/questions/1/sort-javascript-object-array-by-date、https://stackoverflow.com/questions/19430561/how-to-sort-a-javascript-array-of-objects-by-date 、https://stackoverflow.com/questions/40965727/sort-array-of-objects-with-date-field-by-date –

答えて

1

を助けてください:

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

カール使用して:APIについて

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 
1

を(V3 )クエリにソート修飾子を含めることができます。昇順には、昇順には+sort:author-date-ascを入力します。

例:km-poonachaによって開始されたすべてのリポジトリを検索するには、次のような検索要求を行うことができます昇順にソート:

https://api.github.com/search/repositories?q=user:km-poonacha+sort:author-date-asc 

参考:Sorting Search Results

関連する問題