Update [amo] to use v4 API, set custom cacheLengths (#7586)

* switch to v4 API

* set custom cacheLengths on amo badges
This commit is contained in:
chris48s
2022-02-10 20:56:00 +00:00
committed by GitHub
parent 68021e16a6
commit d8aab9895c
4 changed files with 7 additions and 1 deletions

View File

@@ -21,7 +21,7 @@ class BaseAmoService extends BaseJsonService {
async fetch({ addonId }) {
return this._requestJson({
schema,
url: `https://addons.mozilla.org/api/v3/addons/addon/${addonId}/`,
url: `https://addons.mozilla.org/api/v4/addons/addon/${addonId}/`,
})
}
}

View File

@@ -24,6 +24,8 @@ class AmoWeeklyDownloads extends BaseAmoService {
},
]
static _cacheLength = 21600
static defaultBadgeData = { label: 'downloads' }
static render({ downloads }) {

View File

@@ -23,6 +23,8 @@ export default class AmoRating extends BaseAmoService {
},
]
static _cacheLength = 7200
static render({ format, rating }) {
rating = Math.round(rating)
return {

View File

@@ -14,6 +14,8 @@ export default class AmoUsers extends BaseAmoService {
},
]
static _cacheLength = 21600
static defaultBadgeData = { label: 'users' }
static render({ users: downloads }) {