Skip to content

Commit

Permalink
v3.9.6: feat(#322) add nextPageCursor type via generic
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagosiebler committed Mar 4, 2024
1 parent 5837dd6 commit 50d8993
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bybit-api",
"version": "3.9.5",
"version": "3.9.6",
"description": "Complete & robust Node.js SDK for Bybit's REST APIs and WebSockets, with TypeScript & strong end to end tests.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down
5 changes: 3 additions & 2 deletions src/rest-client-v5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {
CreateSubMemberParamsV5,
CreateSubMemberResultV5,
CursorListV5,
CursorRowsV5,
DeleteSubMemberParamsV5,
DeliveryPriceV5,
DeliveryRecordV5,
Expand Down Expand Up @@ -1206,7 +1207,7 @@ export class RestClientV5 extends BaseRestClient {
*/
getWithdrawalRecords(
params?: GetWithdrawalRecordsParamsV5,
): Promise<APIResponseV3<{ rows: WithdrawalRecordV5[] }>> {
): Promise<CursorRowsV5<WithdrawalRecordV5[]>> {
return this.getPrivate('/v5/asset/withdraw/query-record', params);
}

Expand Down Expand Up @@ -1358,7 +1359,7 @@ export class RestClientV5 extends BaseRestClient {

/**
* Delete a sub UID. Before deleting the UID, please make sure there are no assets.
*
*
* TIP:
* The API key must have one of the permissions to be allowed to call the following API endpoint.
* - master API key: "Account Transfer", "Subaccount Transfer", "Withdrawal"
Expand Down
10 changes: 10 additions & 0 deletions src/types/v5-shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,16 @@ export interface CursorListV5<T extends unknown[]> {
list: T;
}

/**
* A wrapper type for any responses that have a "nextPageCursor" property, and a "rows" property with an array of elements
*
* ```{ nextPageCursor: "something", rows: someData[] }```
*/
export interface CursorRowsV5<T extends unknown[]> {
nextPageCursor: string;
rows: T;
}

export interface CategoryListV5<
T extends unknown[],
TCategory extends CategoryV5,
Expand Down

0 comments on commit 50d8993

Please sign in to comment.