From 852d02d6628d3892b037dd7be77945c9c3077843 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Bigourdan <10694593+PyvesB@users.noreply.github.com> Date: Mon, 22 Jul 2024 19:53:58 +0200 Subject: [PATCH] Deprecate [Bountysource] service (#10371) --- services/bountysource/bountysource.service.js | 58 ++++--------------- services/bountysource/bountysource.tester.js | 18 ++---- 2 files changed, 15 insertions(+), 61 deletions(-) diff --git a/services/bountysource/bountysource.service.js b/services/bountysource/bountysource.service.js index 36aaa46d23..1aface5c49 100644 --- a/services/bountysource/bountysource.service.js +++ b/services/bountysource/bountysource.service.js @@ -1,47 +1,11 @@ -import Joi from 'joi' -import { metric } from '../text-formatters.js' -import { BaseJsonService, pathParams } 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 }) - } -} +import { deprecatedService } from '../index.js' + +export const Bountysource = deprecatedService({ + category: 'funding', + route: { + base: 'bountysource/team', + pattern: ':team/activity', + }, + label: 'bountysource', + dateAdded: new Date('2024-07-18'), +}) diff --git a/services/bountysource/bountysource.tester.js b/services/bountysource/bountysource.tester.js index cec68a500c..53d27dc1e4 100644 --- a/services/bountysource/bountysource.tester.js +++ b/services/bountysource/bountysource.tester.js @@ -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', +}) -- GitLab