mirror of
https://github.com/Kir-Antipov/mc-publish.git
synced 2024-11-22 00:11:02 -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.
|
||||
*
|
||||
* @remarks
|
||||
*
|
||||
* This method **DOES NOT** support slugs (for some reason).
|
||||
*/
|
||||
async getProjects(ids: Iterable<string>): Promise<ModrinthProject[]> {
|
||||
const response = await this._fetch("/projects", HttpRequest.get().with({ ids: JSON.stringify(asArray(ids)) }));
|
||||
async getProjects(idsOrSlugs: Iterable<string>): Promise<ModrinthProject[]> {
|
||||
const response = await this._fetch("/projects", HttpRequest.get().with({ ids: JSON.stringify(asArray(idsOrSlugs)) }));
|
||||
return (await response.json()) ?? [];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue