Skip to content
Snippets Groups Projects
Unverified Commit 852d02d6 authored by Pierre-Yves Bigourdan's avatar Pierre-Yves Bigourdan Committed by GitHub
Browse files

Deprecate [Bountysource] service (#10371)

parent 47229ecc
No related branches found
No related tags found
No related merge requests found
import Joi from 'joi' import { deprecatedService } from '../index.js'
import { metric } from '../text-formatters.js'
import { BaseJsonService, pathParams } from '../index.js' export const Bountysource = deprecatedService({
category: 'funding',
const schema = Joi.object({ activity_total: Joi.number().required() }) route: {
base: 'bountysource/team',
export default class Bountysource extends BaseJsonService { pattern: ':team/activity',
static category = 'funding' },
static route = { base: 'bountysource/team', pattern: ':team/activity' } label: 'bountysource',
dateAdded: new Date('2024-07-18'),
static openApi = { })
'/bountysource/team/{team}/activity': {
get: {
summary: 'Bountysource',
parameters: pathParams({
name: 'team',
example: 'mozilla-core',
}),
},
},
}
static defaultBadgeData = { label: 'bounties' }
static render({ total }) {
return {
message: metric(total),
color: 'brightgreen',
}
}
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 })
}
}
import { isMetric } from '../test-validators.js'
import { ServiceTester } from '../tester.js' import { ServiceTester } from '../tester.js'
export const t = new ServiceTester({ export const t = new ServiceTester({
...@@ -6,16 +5,7 @@ export const t = new ServiceTester({ ...@@ -6,16 +5,7 @@ export const t = new ServiceTester({
title: 'Bountysource', title: 'Bountysource',
}) })
t.create('bounties (valid)') t.create('bounties').get('/team/mozilla-core/activity.json').expectBadge({
.get('/team/mozilla-core/activity.json') label: 'bountysource',
.expectBadge({ message: 'no longer available',
label: 'bounties', })
message: isMetric,
})
t.create('bounties (invalid team)')
.get('/team/not-a-real-team/activity.json')
.expectBadge({
label: 'bounties',
message: 'not found',
})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment