@@ -8,25 +8,10 @@ const { metric } = require('../text-formatters')
|
||||
const schema = Joi.object({ activity_total: nonNegativeInteger })
|
||||
|
||||
module.exports = class Bountysource extends BaseJsonService {
|
||||
async fetch({ team }) {
|
||||
const url = `https://api.bountysource.com/teams/${team}`
|
||||
return this._requestJson({
|
||||
schema,
|
||||
url,
|
||||
options: {
|
||||
headers: { Accept: 'application/vnd.bountysource+json; version=2' },
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
static get category() {
|
||||
return 'funding'
|
||||
}
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return { label: 'bounties' }
|
||||
}
|
||||
|
||||
static get route() {
|
||||
return {
|
||||
base: 'bountysource/team',
|
||||
@@ -44,6 +29,10 @@ module.exports = class Bountysource extends BaseJsonService {
|
||||
]
|
||||
}
|
||||
|
||||
static get defaultBadgeData() {
|
||||
return { label: 'bounties' }
|
||||
}
|
||||
|
||||
static render({ total }) {
|
||||
return {
|
||||
message: metric(total),
|
||||
@@ -51,6 +40,17 @@ module.exports = class Bountysource extends BaseJsonService {
|
||||
}
|
||||
}
|
||||
|
||||
async fetch({ team }) {
|
||||
const url = `https://api.bountysource.com/teams/${team}`
|
||||
return this._requestJson({
|
||||
schema,
|
||||
url,
|
||||
options: {
|
||||
headers: { Accept: 'application/vnd.bountysource+json; version=2' },
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
async handle({ team }) {
|
||||
const json = await this.fetch({ team })
|
||||
return this.constructor.render({ total: json.activity_total })
|
||||
|
||||
Reference in New Issue
Block a user