kopia lustrzana https://github.com/badgen/badgen.net
feat(pub): add monthly downloads endpoint
- Introduced a new endpoint for monthly downloads under '/pub/dm/:pkg'. - Updated the apiHandler to handle the new 'dm' topic for fetching download counts.pull/689/head
rodzic
ca169cfa98
commit
bedbe94159
|
@ -15,13 +15,14 @@ export default createBadgenHandler({
|
|||
'/pub/likes/firebase_core': 'likes',
|
||||
'/pub/points/rxdart': 'pub points',
|
||||
'/pub/popularity/mobx': 'popularity',
|
||||
'/pub/dm/riverpod': 'monthly downloads',
|
||||
'/pub/sdk-version/uuid': 'sdk-version',
|
||||
'/pub/dart-platform/rxdart': 'dart-platform',
|
||||
'/pub/dart-platform/google_sign_in': 'dart-platform',
|
||||
'/pub/flutter-platform/xml': 'flutter-platform'
|
||||
},
|
||||
handlers: {
|
||||
'/pub/:topic<v|version|sdk-version|likes|points|popularity|dart-platform|flutter-platform>/:pkg': apiHandler,
|
||||
'/pub/:topic<v|version|sdk-version|likes|points|popularity|dm|dart-platform|flutter-platform>/:pkg': apiHandler,
|
||||
'/pub/:topic<license>/:pkg': licenseHandler
|
||||
}
|
||||
})
|
||||
|
@ -76,6 +77,14 @@ async function apiHandler ({ topic, pkg }: PathArgs) {
|
|||
color: 'green'
|
||||
}
|
||||
}
|
||||
case 'dm': {
|
||||
const { downloadCount30Days } = await client.get(`packages/${pkg}/score`).json<any>()
|
||||
return {
|
||||
subject: 'downloads',
|
||||
status: millify(downloadCount30Days) + '/month',
|
||||
color: 'green'
|
||||
}
|
||||
}
|
||||
case 'dart-platform': {
|
||||
const { scorecard: pubScores } = await client.get(`packages/${pkg}/metrics`).json<any>()
|
||||
const sdk = parseTags(pubScores.panaReport.derivedTags, 'sdk').join(' | ')
|
||||
|
|
Ładowanie…
Reference in New Issue