mirror of
https://github.com/Kir-Antipov/mc-publish.git
synced 2025-02-23 17:21:00 -05:00
/projects
now supports IDs **and** slugs
Yay!
This commit is contained in:
parent
940eefb550
commit
ef46ac5abb
1 changed files with 4 additions and 8 deletions
|
@ -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.
|
* @returns An array of projects.
|
||||||
*
|
|
||||||
* @remarks
|
|
||||||
*
|
|
||||||
* This method **DOES NOT** support slugs (for some reason).
|
|
||||||
*/
|
*/
|
||||||
async getProjects(ids: Iterable<string>): Promise<ModrinthProject[]> {
|
async getProjects(idsOrSlugs: Iterable<string>): Promise<ModrinthProject[]> {
|
||||||
const response = await this._fetch("/projects", HttpRequest.get().with({ ids: JSON.stringify(asArray(ids)) }));
|
const response = await this._fetch("/projects", HttpRequest.get().with({ ids: JSON.stringify(asArray(idsOrSlugs)) }));
|
||||||
return (await response.json()) ?? [];
|
return (await response.json()) ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue