Skip to content

Commit

Permalink
Added offset and limit to getAllAccounts
Browse files Browse the repository at this point in the history
Added offset and limit to getAccounts
  • Loading branch information
james-pre committed Nov 7, 2023
1 parent 8c15874 commit e7d0aef
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ export async function getAccount(key: string, value?: string): Promise<Account>
* @param value the value of the key (e.g. the accounts role)
* @returns The accounts
*/
export async function getAccounts(key: string, value?: string): Promise<Account[]> {
export async function getAccounts(key: string, value?: string, offset = 0, limit = 1000): Promise<Account[]> {

Check warning on line 349 in src/account.ts

View workflow job for this annotation

GitHub Actions / ubuntu-latest

'offset' is assigned a value but never used

Check warning on line 349 in src/account.ts

View workflow job for this annotation

GitHub Actions / ubuntu-latest

'limit' is assigned a value but never used

Check warning on line 349 in src/account.ts

View workflow job for this annotation

GitHub Actions / macos-latest

'offset' is assigned a value but never used

Check warning on line 349 in src/account.ts

View workflow job for this annotation

GitHub Actions / macos-latest

'limit' is assigned a value but never used

Check warning on line 349 in src/account.ts

View workflow job for this annotation

GitHub Actions / windows-latest

'offset' is assigned a value but never used

Check warning on line 349 in src/account.ts

View workflow job for this annotation

GitHub Actions / windows-latest

'limit' is assigned a value but never used
checkAccountAttribute(key as keyof FullAccount, value);
const results = await request<AccountResult[]>('POST', 'account/info', { key, value, multiple: true });
return results.map(result => parseAccount(result));
Expand All @@ -356,8 +356,8 @@ export async function getAccounts(key: string, value?: string): Promise<Account[
* Gets info about all account (Requires authorization: Mod)
* @returns The accounts
*/
export async function getAllAccounts(): Promise<Account[]> {
const results = await request<AccountResult[]>('POST', 'account/info', { multiple: true, all: true });
export async function getAllAccounts(offset = 0, limit = 1000): Promise<Account[]> {
const results = await request<AccountResult[]>('POST', 'account/info', { multiple: true, all: true, offset, limit });
return results.map(result => parseAccount(result));
}

Expand Down

0 comments on commit e7d0aef

Please sign in to comment.