Skip to content

Commit

Permalink
Update [amo] to use v4 API, set custom cacheLengths (#7586)
Browse files Browse the repository at this point in the history
* switch to v4 API

* set custom cacheLengths on amo badges
  • Loading branch information
chris48s authored Feb 10, 2022
1 parent 68021e1 commit d8aab98
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion services/amo/amo-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}/`,
})
}
}
Expand Down
2 changes: 2 additions & 0 deletions services/amo/amo-downloads.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class AmoWeeklyDownloads extends BaseAmoService {
},
]

static _cacheLength = 21600

static defaultBadgeData = { label: 'downloads' }

static render({ downloads }) {
Expand Down
2 changes: 2 additions & 0 deletions services/amo/amo-rating.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export default class AmoRating extends BaseAmoService {
},
]

static _cacheLength = 7200

static render({ format, rating }) {
rating = Math.round(rating)
return {
Expand Down
2 changes: 2 additions & 0 deletions services/amo/amo-users.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ export default class AmoUsers extends BaseAmoService {
},
]

static _cacheLength = 21600

static defaultBadgeData = { label: 'users' }

static render({ users: downloads }) {
Expand Down

0 comments on commit d8aab98

Please sign in to comment.