Skip to content

Commit b8ce6c1

Browse files
committed
Add #getTeams api
1 parent bc5542a commit b8ce6c1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

nodejs/src/index.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export type HistoryItem = {
5353
*/
5454
class API {
5555
public readonly serverUrl: string
56-
private readonly enterprise: boolean
56+
public readonly enterprise: boolean
5757
private readonly _fetch: nodeFetchType
5858

5959
constructor(config: Partial<APIOptions> = {}) {
@@ -181,6 +181,17 @@ class API {
181181
return res.body
182182
}
183183

184+
async getTeams () {
185+
let data
186+
try {
187+
data = await this.getMe()
188+
} catch (err) {
189+
return []
190+
}
191+
192+
return data.teams || []
193+
}
194+
184195
get fetch() {
185196
return this._fetch
186197
}

0 commit comments

Comments
 (0)