mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
feat(api): ✨ Add support for batch account data API
This commit is contained in:
parent
287f428a83
commit
7bd07801f2
6 changed files with 141 additions and 8 deletions
|
|
@ -703,6 +703,28 @@ export class Client extends BaseClient {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /api/v1/accounts
|
||||
*
|
||||
* @param ids The account IDs.
|
||||
* @return An array of accounts.
|
||||
*/
|
||||
public getAccounts(
|
||||
ids: string[],
|
||||
extra?: RequestInit,
|
||||
): Promise<Output<z.infer<typeof Account>[]>> {
|
||||
const params = new URLSearchParams();
|
||||
|
||||
for (const id of ids) {
|
||||
params.append("id[]", id);
|
||||
}
|
||||
|
||||
return this.get<z.infer<typeof Account>[]>(
|
||||
`/api/v1/accounts?${params.toString()}`,
|
||||
extra,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /api/v1/accounts/id
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue