2017-11-13 1 views
1

작성한 날짜별로 내 저장소 검색 결과를 정렬하고 싶습니다. 이것은 쉬운 작업 일지 모르지만 당분간은 고심하고 있습니다. 도와주세요 :(Github API (v3) : 만든 날짜별로 검색 결과를 정렬

+0

: https : //로 유래는 다음 검색 요청을 할 수 오름차순 소트 km-poonacha 시작한 모든 REPOS를 검색하려면 .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

Github의 API Graphql v4에이 옵션이 여전히 경우 the explorer에서, 아주 쉽게이 작업을 수행 할 수 있습니다

{ 
    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-desc, 오름차순의 경우 +sort:author-date-asc).

예 :

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

참조 : 당신은 "날짜 별 정렬 자바 스크립트 객체 배열"하고자하는 Sorting Search Results