Skip to content

Commit 754bbb5

Browse files
committed
add custom endpoint to billing
1 parent 0a443f9 commit 754bbb5

1 file changed

Lines changed: 19 additions & 8 deletions

File tree

src/billing.ts

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,42 @@ export class Billing {
1212

1313
/**
1414
* Retrieves list of balance info of the specified project.
15-
* @param projectId Unique identifier of the project
15+
* @param projectId string
16+
* @param endpoint string
17+
* @returns Promise<BalanceList>
1618
*/
17-
async listBalances(projectId: string): Promise<BalanceList> {
19+
async listBalances(
20+
projectId: string,
21+
endpoint = "v1/listen"
22+
): Promise<BalanceList> {
1823
return this._request(
1924
"GET",
2025
this._credentials,
2126
this._apiUrl,
2227
this._requireSSL,
23-
`${this.apiPath}/${projectId}/balances`
28+
`/${endpoint}/${projectId}/balances`
2429
);
2530
}
2631

2732
/**
33+
*
2834
* Retrieves balance info of a specified balance_id in the specified project.
29-
* @param projectId Unique identifier of the project
30-
* @param balanceId Unique identifier of the balance
35+
* @param projectId string
36+
* @param balanceId string
37+
* @param endpoint string
38+
* @returns Promise<Balance>
3139
*/
32-
33-
async getBalance(projectId: string, balanceId: string): Promise<Balance> {
40+
async getBalance(
41+
projectId: string,
42+
balanceId: string,
43+
endpoint = "v1/listen"
44+
): Promise<Balance> {
3445
return this._request(
3546
"GET",
3647
this._credentials,
3748
this._apiUrl,
3849
this._requireSSL,
39-
`${this.apiPath}/${projectId}/balances/${balanceId}`
50+
`/${endpoint}/${projectId}/balances/${balanceId}`
4051
);
4152
}
4253
}

0 commit comments

Comments
 (0)