1
0
mirror of https://github.com/badges/shields.git synced 2025-04-18 19:44:04 +03:00

Deprecate [Bountysource] service (#10371)

This commit is contained in:
Pierre-Yves Bigourdan 2024-07-22 19:53:58 +02:00 committed by GitHub
parent 47229ecc07
commit 852d02d662
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 60 deletions

View File

@ -1,47 +1,11 @@
import Joi from 'joi'
import { metric } from '../text-formatters.js'
import { BaseJsonService, pathParams } from '../index.js'
import { deprecatedService } from '../index.js'
const schema = Joi.object({ activity_total: Joi.number().required() })
export default class Bountysource extends BaseJsonService {
static category = 'funding'
static route = { base: 'bountysource/team', pattern: ':team/activity' }
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 })
}
}
export const Bountysource = deprecatedService({
category: 'funding',
route: {
base: 'bountysource/team',
pattern: ':team/activity',
},
label: 'bountysource',
dateAdded: new Date('2024-07-18'),
})

View File

@ -1,4 +1,3 @@
import { isMetric } from '../test-validators.js'
import { ServiceTester } from '../tester.js'
export const t = new ServiceTester({
@ -6,16 +5,7 @@ export const t = new ServiceTester({
title: 'Bountysource',
})
t.create('bounties (valid)')
.get('/team/mozilla-core/activity.json')
.expectBadge({
label: 'bounties',
message: isMetric,
})
t.create('bounties (invalid team)')
.get('/team/not-a-real-team/activity.json')
.expectBadge({
label: 'bounties',
message: 'not found',
})
t.create('bounties').get('/team/mozilla-core/activity.json').expectBadge({
label: 'bountysource',
message: 'no longer available',
})