Skip to content

Commit

Permalink
Update the [modrinth] API to v2 (#8600)
Browse files Browse the repository at this point in the history
* Update the Modrinth API to v2

* Rename the modId pattern to projectId
  • Loading branch information
Insprill authored Nov 8, 2022
1 parent a95ad6c commit 809853a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions services/modrinth/modrinth.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,28 @@ export default class Modrinth extends BaseJsonService {

static route = {
base: 'modrinth/dt',
pattern: ':modId',
pattern: ':projectId',
}

static examples = [
{
title: 'Modrinth',
namedParams: { modId: 'AANobbMI' },
namedParams: { projectId: 'AANobbMI' },
staticPreview: renderDownloadsBadge({ downloads: 120000 }),
},
]

static defaultBadgeData = { label: 'downloads' }

async fetch({ modId }) {
async fetch({ projectId }) {
return this._requestJson({
schema,
url: `https://api.modrinth.com/api/v1/mod/${modId}`,
url: `https://api.modrinth.com/v2/project/${projectId}`,
})
}

async handle({ modId }) {
const { downloads } = await this.fetch({ modId })
async handle({ projectId }) {
const { downloads } = await this.fetch({ projectId })
return renderDownloadsBadge({ downloads })
}
}

0 comments on commit 809853a

Please sign in to comment.