The term “url” is overloaded in services, to refer to the Shields route and also the API URL. Calling the Shields URL a “route” is on the whole more descriptive, and makes it clearer and more obvious which one of these we’re talking about. It’s a small thing, though seems like an improvement. We have a few functions called `buildUrl`. I’ve renamed them to `buildRoute` when they refer to routes, and left them as `buildUrl` when they refer to API URLs. I included a minor style tweak and some formatting cleanup in `TUTORIAL.md`.
32 lines
575 B
JavaScript
32 lines
575 B
JavaScript
'use strict'
|
|
|
|
const BaseService = require('./base')
|
|
const { Deprecated } = require('./errors')
|
|
|
|
// Only `url` is required.
|
|
function deprecatedService({ url, label, category, examples = [] }) {
|
|
return class DeprecatedService extends BaseService {
|
|
static get category() {
|
|
return category
|
|
}
|
|
|
|
static get route() {
|
|
return url
|
|
}
|
|
|
|
static get defaultBadgeData() {
|
|
return { label }
|
|
}
|
|
|
|
static get examples() {
|
|
return examples
|
|
}
|
|
|
|
async handle() {
|
|
throw new Deprecated()
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = deprecatedService
|