From 02c17eb894fb64c5e679266896b998adf0f84301 Mon Sep 17 00:00:00 2001 From: Yang Luo Date: Sun, 21 Apr 2024 22:05:27 +0800 Subject: [PATCH] feat: add getGroups(withTree?: boolean) API --- src/group.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/group.ts b/src/group.ts index 9d2955c..740da01 100644 --- a/src/group.ts +++ b/src/group.ts @@ -47,15 +47,18 @@ export class GroupSDK { this.request = request } - public async getGroups() { + public async getGroups(withTree?: boolean) { if (!this.request) { throw new Error('request init failed') } + const params: any = { owner: this.config.orgName } + if (withTree) { + params.withTree = 'true' + } + return (await this.request.get('/get-groups', { - params: { - owner: this.config.orgName, - }, + params, })) as unknown as Promise> }