From ef46ac5abbf724969baba75423efd7adff0c16be Mon Sep 17 00:00:00 2001 From: Kir_Antipov Date: Thu, 4 Jan 2024 09:21:05 +0000 Subject: [PATCH] `/projects` now supports IDs **and** slugs Yay! --- src/platforms/modrinth/modrinth-api-client.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/platforms/modrinth/modrinth-api-client.ts b/src/platforms/modrinth/modrinth-api-client.ts index 342824d..2fb8eb2 100644 --- a/src/platforms/modrinth/modrinth-api-client.ts +++ b/src/platforms/modrinth/modrinth-api-client.ts @@ -115,18 +115,14 @@ export class ModrinthApiClient { } /** - * Fetches multiple projects by their IDs. + * Fetches multiple projects by their IDs and/or slugs. * - * @param ids - The project IDs. + * @param idsOrSlugs - The project IDs and/or slugs. * * @returns An array of projects. - * - * @remarks - * - * This method **DOES NOT** support slugs (for some reason). */ - async getProjects(ids: Iterable): Promise { - const response = await this._fetch("/projects", HttpRequest.get().with({ ids: JSON.stringify(asArray(ids)) })); + async getProjects(idsOrSlugs: Iterable): Promise { + const response = await this._fetch("/projects", HttpRequest.get().with({ ids: JSON.stringify(asArray(idsOrSlugs)) })); return (await response.json()) ?? []; }