Files
shields/services/chrome-web-store/chrome-web-store-users.service.js
dependabot-preview[bot] 294aa1e1df Build(deps-dev): bump eslint-plugin-import from 2.17.3 to 2.18.0; autofixes (#3671)
* 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
2019-07-08 12:13:46 -04:00

63 lines
1.4 KiB
JavaScript

'use strict'
const { metric } = require('../text-formatters')
const { downloadCount } = require('../color-formatters')
const BaseChromeWebStoreService = require('./chrome-web-store-base')
const { redirector } = require('..')
class ChromeWebStoreUsers extends BaseChromeWebStoreService {
static get category() {
return 'downloads'
}
static get route() {
return {
base: 'chrome-web-store/users',
pattern: ':storeId',
}
}
static get examples() {
return [
{
title: 'Chrome Web Store',
namedParams: { storeId: 'ogffaloegjglncjfehdfplabnoondfjo' },
staticPreview: this.render({ downloads: 573 }),
},
]
}
static get defaultBadgeData() {
return { label: 'users' }
}
static render({ downloads }) {
return {
message: `${metric(downloads)}`,
color: downloadCount(downloads),
}
}
async handle({ storeId }) {
const data = await this.fetch({ storeId })
return this.constructor.render({
downloads: data.interactionCount.UserDownloads,
})
}
}
const ChromeWebStoreDownloads = redirector({
category: 'downloads',
route: {
base: 'chrome-web-store/d',
pattern: ':storeId',
},
transformPath: ({ storeId }) => `/chrome-web-store/users/${storeId}`,
dateAdded: new Date('2019-02-27'),
})
module.exports = {
ChromeWebStoreDownloads,
ChromeWebStoreUsers,
}