Files
shields/services/modrinth/modrinth-followers.service.js
chris48s 5d1ddbc3fe migrate examples to openApi part 13; affects [curseforge date fedora hsts modrinth ore] (#9499)
* migrate some services from examples to openApi

* improve and de-dupe service titles

* improve ore description
2023-12-04 12:53:21 +00:00

40 lines
919 B
JavaScript

import { pathParams } from '../index.js'
import { metric } from '../text-formatters.js'
import { BaseModrinthService, description } from './modrinth-base.js'
export default class ModrinthFollowers extends BaseModrinthService {
static category = 'social'
static route = {
base: 'modrinth/followers',
pattern: ':projectId',
}
static openApi = {
'/modrinth/followers/{projectId}': {
get: {
summary: 'Modrinth Followers',
description,
parameters: pathParams({
name: 'projectId',
example: 'AANobbMI',
}),
},
},
}
static defaultBadgeData = { label: 'followers' }
static render({ followers }) {
return {
message: metric(followers),
color: 'blue',
}
}
async handle({ projectId }) {
const { followers } = await this.fetchProject({ projectId })
return this.constructor.render({ followers })
}
}