forked from binance/binance-connector-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrest-api.ts
More file actions
122 lines (113 loc) · 4.56 KB
/
rest-api.ts
File metadata and controls
122 lines (113 loc) · 4.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/**
* Binance Copy Trading REST API
*
* OpenAPI Specification for the Binance Copy Trading REST API
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { ConfigurationRestAPI, RestApiResponse, sendRequest } from '@binance/common';
import { FutureCopyTradingApi } from './modules/future-copy-trading-api';
import type {
GetFuturesLeadTraderStatusRequest,
GetFuturesLeadTradingSymbolWhitelistRequest,
} from './modules/future-copy-trading-api';
import type {
GetFuturesLeadTraderStatusResponse,
GetFuturesLeadTradingSymbolWhitelistResponse,
} from './types';
export class RestAPI {
private configuration: ConfigurationRestAPI;
private futureCopyTradingApi: FutureCopyTradingApi;
constructor(configuration: ConfigurationRestAPI) {
this.configuration = configuration;
this.futureCopyTradingApi = new FutureCopyTradingApi(configuration);
}
/**
* Generic function to send a request.
* @param endpoint - The API endpoint to call.
* @param method - HTTP method to use (GET, POST, DELETE, etc.).
* @param queryParams - Query parameters for the request.
* @param bodyParams - Body parameters for the request.
*
* @returns A promise resolving to the response data object.
*/
sendRequest<T>(
endpoint: string,
method: 'GET' | 'POST' | 'DELETE' | 'PUT' | 'PATCH',
queryParams: Record<string, unknown> = {},
bodyParams: Record<string, unknown> = {}
): Promise<RestApiResponse<T>> {
return sendRequest<T>(
this.configuration,
endpoint,
method,
queryParams,
bodyParams,
undefined
);
}
/**
* Generic function to send a signed request.
* @param endpoint - The API endpoint to call.
* @param method - HTTP method to use (GET, POST, DELETE, etc.).
* @param queryParams - Query parameters for the request.
* @param bodyParams - Body parameters for the request.
*
* @returns A promise resolving to the response data object.
*/
sendSignedRequest<T>(
endpoint: string,
method: 'GET' | 'POST' | 'DELETE' | 'PUT' | 'PATCH',
queryParams: Record<string, unknown> = {},
bodyParams: Record<string, unknown> = {}
): Promise<RestApiResponse<T>> {
return sendRequest<T>(
this.configuration,
endpoint,
method,
queryParams,
bodyParams,
undefined,
{ isSigned: true }
);
}
/**
* Get Futures Lead Trader Status
*
* Weight: 20
*
* @summary Get Futures Lead Trader Status(TRADE)
* @param {GetFuturesLeadTraderStatusRequest} requestParameters Request parameters.
*
* @returns {Promise<RestApiResponse<GetFuturesLeadTraderStatusResponse>>}
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
* @see {@link https://developers.binance.com/docs/copy_trading/future-copy-trading/Get-Futures-Lead-Trader-Status Binance API Documentation}
*/
getFuturesLeadTraderStatus(
requestParameters: GetFuturesLeadTraderStatusRequest = {}
): Promise<RestApiResponse<GetFuturesLeadTraderStatusResponse>> {
return this.futureCopyTradingApi.getFuturesLeadTraderStatus(requestParameters);
}
/**
* Get Futures Lead Trading Symbol Whitelist
*
* Weight: 20
*
* @summary Get Futures Lead Trading Symbol Whitelist(USER_DATA)
* @param {GetFuturesLeadTradingSymbolWhitelistRequest} requestParameters Request parameters.
*
* @returns {Promise<RestApiResponse<GetFuturesLeadTradingSymbolWhitelistResponse>>}
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
* @see {@link https://developers.binance.com/docs/copy_trading/future-copy-trading/Get-Futures-Lead-Trading-Symbol-Whitelist Binance API Documentation}
*/
getFuturesLeadTradingSymbolWhitelist(
requestParameters: GetFuturesLeadTradingSymbolWhitelistRequest = {}
): Promise<RestApiResponse<GetFuturesLeadTradingSymbolWhitelistResponse>> {
return this.futureCopyTradingApi.getFuturesLeadTradingSymbolWhitelist(requestParameters);
}
}