From d09f175ccd14b7a15b33299a13ea41b65f7b6687 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 28 Jun 2017 19:53:52 +0200 Subject: [PATCH 1/4] switch to /orgs/ endpoint --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index a02fd12..e3dd864 100755 --- a/index.js +++ b/index.js @@ -6,7 +6,7 @@ let data = [] let dataRepos = [] let dataReleases = [] -const username = 'bigchaindb' +const orgname = 'bigchaindb' const reponame = 'bigchaindb' // Used for fetching specific release const log = text => console.log(text) @@ -32,7 +32,7 @@ const headers = [{ // const fetchRepos = () => { 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) .then(res => { From 074de3aca089ef58160005f934f1c0d251a67a1b Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 28 Jun 2017 20:14:43 +0200 Subject: [PATCH 2/4] fix request options --- index.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index e3dd864..48f02b0 100755 --- a/index.js +++ b/index.js @@ -20,12 +20,12 @@ const handleResponse = res => { return res.json() } -// Request headers for all fetch calls -const headers = [{ +// Request options for all fetch calls +const options = { headers: { Accept: 'application/vnd.github.preview' } -}] +} // // Fetch all public GitHub repos @@ -34,7 +34,7 @@ const fetchRepos = () => { const start = Date.now() const url = 'https://api.github.com/orgs/' + orgname + '/repos' - fetch(url, headers) + fetch(url, options) .then(res => { return handleResponse(res) }) @@ -79,7 +79,7 @@ const fetchReleases = () => { const start = Date.now() const url = 'https://api.github.com/repos/bigchaindb/' + reponame + '/releases/latest' - fetch(url, headers) + fetch(url, options) .then(res => { return handleResponse(res) }) From 5e05f69ba36a764b169ef719645c2039093af6fd Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 28 Jun 2017 20:15:45 +0200 Subject: [PATCH 3/4] include topics * closes #8 --- index.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 48f02b0..a971496 100755 --- a/index.js +++ b/index.js @@ -23,7 +23,9 @@ const handleResponse = res => { // Request options for all fetch calls const options = { 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' } } @@ -49,14 +51,16 @@ const fetchRepos = () => { html_url, stargazers_count, forks_count, - fork + fork, + topics }) => ({ name, description, url: html_url, stars: stargazers_count, forks: forks_count, - is_fork: fork + is_fork: fork, + topics })).sort((p1, p2) => p2.stars - p1.stars ) From 941aa61f2b787c16fec669f00915f05a3e3b2612 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Wed, 28 Jun 2017 20:19:42 +0200 Subject: [PATCH 4/4] add topics to example --- readme.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 5d67cb8..7d52b26 100644 --- a/readme.md +++ b/readme.md @@ -26,7 +26,12 @@ Endpoint: [`https://bigchaindb-github.now.sh`](https://bigchaindb-github.now.sh) "forks": 293, "is_fork": false, "release": "v0.10.0", - "url": "https://github.com/bigchaindb/project" + "url": "https://github.com/bigchaindb/project", + "topics": [ + "bigchaindb", + "bigchaindb-driver", + "python" + ] } ] ```