1
0
mirror of https://github.com/bigchaindb/github-projects.git synced 2024-11-23 02:10:02 +01:00

Merge pull request #9 from bigchaindb/feature/topics

Add topics
This commit is contained in:
Matthias Kretschmann 2017-06-29 17:07:46 +02:00 committed by GitHub
commit a543ae037e
2 changed files with 20 additions and 11 deletions

View File

@ -6,7 +6,7 @@ let data = []
let dataRepos = [] let dataRepos = []
let dataReleases = [] let dataReleases = []
const username = 'bigchaindb' const orgname = 'bigchaindb'
const reponame = 'bigchaindb' // Used for fetching specific release const reponame = 'bigchaindb' // Used for fetching specific release
const log = text => console.log(text) const log = text => console.log(text)
@ -20,21 +20,23 @@ const handleResponse = res => {
return res.json() return res.json()
} }
// Request headers for all fetch calls // Request options for all fetch calls
const headers = [{ const options = {
headers: { headers: {
Accept: 'application/vnd.github.preview' // For getting topics, see note on https://developer.github.com/v3/search/
Accept: 'application/vnd.github.mercy-preview+json'
// Accept: 'application/vnd.github.preview'
} }
}] }
// //
// Fetch all public GitHub repos // Fetch all public GitHub repos
// //
const fetchRepos = () => { const fetchRepos = () => {
const start = Date.now() const start = Date.now()
const url = 'https://api.github.com/users/' + username + '/repos' const url = 'https://api.github.com/orgs/' + orgname + '/repos'
fetch(url, headers) fetch(url, options)
.then(res => { .then(res => {
return handleResponse(res) return handleResponse(res)
}) })
@ -49,14 +51,16 @@ const fetchRepos = () => {
html_url, html_url,
stargazers_count, stargazers_count,
forks_count, forks_count,
fork fork,
topics
}) => ({ }) => ({
name, name,
description, description,
url: html_url, url: html_url,
stars: stargazers_count, stars: stargazers_count,
forks: forks_count, forks: forks_count,
is_fork: fork is_fork: fork,
topics
})).sort((p1, p2) => })).sort((p1, p2) =>
p2.stars - p1.stars p2.stars - p1.stars
) )
@ -79,7 +83,7 @@ const fetchReleases = () => {
const start = Date.now() const start = Date.now()
const url = 'https://api.github.com/repos/bigchaindb/' + reponame + '/releases/latest' const url = 'https://api.github.com/repos/bigchaindb/' + reponame + '/releases/latest'
fetch(url, headers) fetch(url, options)
.then(res => { .then(res => {
return handleResponse(res) return handleResponse(res)
}) })

View File

@ -26,7 +26,12 @@ Endpoint: [`https://bigchaindb-github.now.sh`](https://bigchaindb-github.now.sh)
"forks": 293, "forks": 293,
"is_fork": false, "is_fork": false,
"release": "v0.10.0", "release": "v0.10.0",
"url": "https://github.com/bigchaindb/project" "url": "https://github.com/bigchaindb/project",
"topics": [
"bigchaindb",
"bigchaindb-driver",
"python"
]
} }
] ]
``` ```