* Build(deps-dev): bump eslint-plugin-import from 2.17.3 to 2.18.0 Bumps [eslint-plugin-import](https://github.com/benmosher/eslint-plugin-import) from 2.17.3 to 2.18.0. - [Release notes](https://github.com/benmosher/eslint-plugin-import/releases) - [Changelog](https://github.com/benmosher/eslint-plugin-import/blob/master/CHANGELOG.md) - [Commits](https://github.com/benmosher/eslint-plugin-import/compare/v2.17.3...v2.18.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> * Autofixes
34 lines
806 B
JavaScript
34 lines
806 B
JavaScript
'use strict'
|
|
|
|
const Joi = require('@hapi/joi')
|
|
const { nonNegativeInteger } = require('../validators')
|
|
const { BaseJsonService } = require('..')
|
|
|
|
const keywords = ['amo', 'firefox']
|
|
|
|
const schema = Joi.object({
|
|
average_daily_users: nonNegativeInteger,
|
|
current_version: Joi.object({
|
|
version: Joi.string().required(),
|
|
}).required(),
|
|
ratings: Joi.object({
|
|
average: Joi.number().required(),
|
|
}).required(),
|
|
weekly_downloads: nonNegativeInteger,
|
|
}).required()
|
|
|
|
class BaseAmoService extends BaseJsonService {
|
|
static get defaultBadgeData() {
|
|
return { label: 'mozilla add-on' }
|
|
}
|
|
|
|
async fetch({ addonId }) {
|
|
return this._requestJson({
|
|
schema,
|
|
url: `https://addons.mozilla.org/api/v3/addons/addon/${addonId}`,
|
|
})
|
|
}
|
|
}
|
|
|
|
module.exports = { BaseAmoService, keywords }
|