mirror of
https://github.com/koodiklinikka/koodiklinikka.fi-api.git
synced 2026-02-11 05:51:27 +00:00
Added GitHub event feed data fetching
This commit is contained in:
25
feeds/github.js
Normal file
25
feeds/github.js
Normal file
@@ -0,0 +1,25 @@
|
||||
'use strict';
|
||||
|
||||
var request = require('superagent');
|
||||
var config = require('../lib/config');
|
||||
var Promise = require('bluebird');
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
* Fetch five latest events from GitHub organization
|
||||
*/
|
||||
getEvents: function() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
request
|
||||
.get('https://api.github.com/orgs/koodiklinikka/events?per_page=5')
|
||||
.set('Authorization', 'token ' + config.github.token)
|
||||
.end(function(error, response){
|
||||
if(error) {
|
||||
reject(error);
|
||||
}
|
||||
|
||||
resolve(response.body);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user