@binance/rebate 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,362 @@
1
+ import { RestApiResponse, ConfigurationRestAPI } from '@binance/common';
2
+ export { BadRequestError, ConnectorClientError, ForbiddenError, NetworkError, NotFoundError, REBATE_REST_API_PROD_URL, REBATE_REST_API_TESTNET_URL, RateLimitBanError, RequiredError, ServerError, TooManyRequestsError, UnauthorizedError } from '@binance/common';
3
+
4
+ /**
5
+ * Binance Public Rebate REST API
6
+ *
7
+ * OpenAPI Specification for the Binance Public Rebate REST API
8
+ *
9
+ * The version of the OpenAPI document: 1.0.0
10
+ *
11
+ *
12
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
13
+ * https://openapi-generator.tech
14
+ * Do not edit the class manually.
15
+ */
16
+ /**
17
+ *
18
+ * @export
19
+ * @interface BadRequest
20
+ */
21
+ interface BadRequest {
22
+ /**
23
+ *
24
+ * @type {number}
25
+ * @memberof BadRequest
26
+ */
27
+ code: number;
28
+ /**
29
+ *
30
+ * @type {string}
31
+ * @memberof BadRequest
32
+ */
33
+ message: string;
34
+ }
35
+
36
+ /**
37
+ * Binance Public Rebate REST API
38
+ *
39
+ * OpenAPI Specification for the Binance Public Rebate REST API
40
+ *
41
+ * The version of the OpenAPI document: 1.0.0
42
+ *
43
+ *
44
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
45
+ * https://openapi-generator.tech
46
+ * Do not edit the class manually.
47
+ */
48
+ /**
49
+ *
50
+ * @export
51
+ * @interface GetSpotRebateHistoryRecordsResponseDataDataInner
52
+ */
53
+ interface GetSpotRebateHistoryRecordsResponseDataDataInner {
54
+ /**
55
+ *
56
+ * @type {string}
57
+ * @memberof GetSpotRebateHistoryRecordsResponseDataDataInner
58
+ */
59
+ asset?: string;
60
+ /**
61
+ *
62
+ * @type {number}
63
+ * @memberof GetSpotRebateHistoryRecordsResponseDataDataInner
64
+ */
65
+ type?: number;
66
+ /**
67
+ *
68
+ * @type {string}
69
+ * @memberof GetSpotRebateHistoryRecordsResponseDataDataInner
70
+ */
71
+ amount?: string;
72
+ /**
73
+ *
74
+ * @type {number}
75
+ * @memberof GetSpotRebateHistoryRecordsResponseDataDataInner
76
+ */
77
+ updateTime?: number;
78
+ }
79
+
80
+ /**
81
+ * Binance Public Rebate REST API
82
+ *
83
+ * OpenAPI Specification for the Binance Public Rebate REST API
84
+ *
85
+ * The version of the OpenAPI document: 1.0.0
86
+ *
87
+ *
88
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
89
+ * https://openapi-generator.tech
90
+ * Do not edit the class manually.
91
+ */
92
+
93
+ /**
94
+ *
95
+ * @export
96
+ * @interface GetSpotRebateHistoryRecordsResponseData
97
+ */
98
+ interface GetSpotRebateHistoryRecordsResponseData {
99
+ /**
100
+ *
101
+ * @type {number}
102
+ * @memberof GetSpotRebateHistoryRecordsResponseData
103
+ */
104
+ page?: number;
105
+ /**
106
+ *
107
+ * @type {number}
108
+ * @memberof GetSpotRebateHistoryRecordsResponseData
109
+ */
110
+ totalRecords?: number;
111
+ /**
112
+ *
113
+ * @type {number}
114
+ * @memberof GetSpotRebateHistoryRecordsResponseData
115
+ */
116
+ totalPageNum?: number;
117
+ /**
118
+ *
119
+ * @type {Array<GetSpotRebateHistoryRecordsResponseDataDataInner>}
120
+ * @memberof GetSpotRebateHistoryRecordsResponseData
121
+ */
122
+ data?: Array<GetSpotRebateHistoryRecordsResponseDataDataInner>;
123
+ }
124
+
125
+ /**
126
+ * Binance Public Rebate REST API
127
+ *
128
+ * OpenAPI Specification for the Binance Public Rebate REST API
129
+ *
130
+ * The version of the OpenAPI document: 1.0.0
131
+ *
132
+ *
133
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
134
+ * https://openapi-generator.tech
135
+ * Do not edit the class manually.
136
+ */
137
+
138
+ /**
139
+ *
140
+ * @export
141
+ * @interface GetSpotRebateHistoryRecordsResponse
142
+ */
143
+ interface GetSpotRebateHistoryRecordsResponse {
144
+ /**
145
+ *
146
+ * @type {string}
147
+ * @memberof GetSpotRebateHistoryRecordsResponse
148
+ */
149
+ status?: string;
150
+ /**
151
+ *
152
+ * @type {string}
153
+ * @memberof GetSpotRebateHistoryRecordsResponse
154
+ */
155
+ type?: string;
156
+ /**
157
+ *
158
+ * @type {string}
159
+ * @memberof GetSpotRebateHistoryRecordsResponse
160
+ */
161
+ code?: string;
162
+ /**
163
+ *
164
+ * @type {GetSpotRebateHistoryRecordsResponseData}
165
+ * @memberof GetSpotRebateHistoryRecordsResponse
166
+ */
167
+ data?: GetSpotRebateHistoryRecordsResponseData;
168
+ }
169
+
170
+ /**
171
+ * Binance Public Rebate REST API
172
+ *
173
+ * OpenAPI Specification for the Binance Public Rebate REST API
174
+ *
175
+ * The version of the OpenAPI document: 1.0.0
176
+ *
177
+ *
178
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
179
+ * https://openapi-generator.tech
180
+ * Do not edit the class manually.
181
+ */
182
+
183
+ /**
184
+ * RebateApi - interface
185
+ * @interface RebateApi
186
+ */
187
+ interface RebateApiInterface {
188
+ /**
189
+ * Get Spot Rebate History Records
190
+ *
191
+ * The max interval between startTime and endTime is 30 days.
192
+ * If startTime and endTime are not sent, the recent 7 days' data will be returned.
193
+ * The earliest startTime is supported on June 10, 2020
194
+ * Return up to 200 records per request.
195
+ *
196
+ * Weight: 12000
197
+ *
198
+ * @summary Get Spot Rebate History Records (USER_DATA)
199
+ * @param {GetSpotRebateHistoryRecordsRequest} requestParameters Request parameters.
200
+ *
201
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
202
+ * @memberof RebateApiInterface
203
+ */
204
+ getSpotRebateHistoryRecords(requestParameters?: GetSpotRebateHistoryRecordsRequest): Promise<RestApiResponse<GetSpotRebateHistoryRecordsResponse>>;
205
+ }
206
+ /**
207
+ * Request parameters for getSpotRebateHistoryRecords operation in RebateApi.
208
+ * @interface GetSpotRebateHistoryRecordsRequest
209
+ */
210
+ interface GetSpotRebateHistoryRecordsRequest {
211
+ /**
212
+ *
213
+ * @type {number}
214
+ * @memberof RebateApiGetSpotRebateHistoryRecords
215
+ */
216
+ readonly startTime?: number;
217
+ /**
218
+ *
219
+ * @type {number}
220
+ * @memberof RebateApiGetSpotRebateHistoryRecords
221
+ */
222
+ readonly endTime?: number;
223
+ /**
224
+ * Default 1
225
+ * @type {number}
226
+ * @memberof RebateApiGetSpotRebateHistoryRecords
227
+ */
228
+ readonly page?: number;
229
+ /**
230
+ *
231
+ * @type {number}
232
+ * @memberof RebateApiGetSpotRebateHistoryRecords
233
+ */
234
+ readonly recvWindow?: number;
235
+ }
236
+ /**
237
+ * RebateApi - object-oriented interface
238
+ * @class RebateApi
239
+ */
240
+ declare class RebateApi implements RebateApiInterface {
241
+ private readonly configuration;
242
+ private localVarAxiosParamCreator;
243
+ constructor(configuration: ConfigurationRestAPI);
244
+ /**
245
+ * Get Spot Rebate History Records
246
+ *
247
+ * The max interval between startTime and endTime is 30 days.
248
+ * If startTime and endTime are not sent, the recent 7 days' data will be returned.
249
+ * The earliest startTime is supported on June 10, 2020
250
+ * Return up to 200 records per request.
251
+ *
252
+ * Weight: 12000
253
+ *
254
+ * @summary Get Spot Rebate History Records (USER_DATA)
255
+ * @param {GetSpotRebateHistoryRecordsRequest} requestParameters Request parameters.
256
+ * @returns {Promise<RestApiResponse<GetSpotRebateHistoryRecordsResponse>>}
257
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
258
+ * @memberof RebateApi
259
+ * @see {@link https://developers.binance.com/docs/rebate/rest-api/Get-Spot-Rebate-History-Records Binance API Documentation}
260
+ */
261
+ getSpotRebateHistoryRecords(requestParameters?: GetSpotRebateHistoryRecordsRequest): Promise<RestApiResponse<GetSpotRebateHistoryRecordsResponse>>;
262
+ }
263
+
264
+ /**
265
+ * Binance Public Rebate REST API
266
+ *
267
+ * OpenAPI Specification for the Binance Public Rebate REST API
268
+ *
269
+ * The version of the OpenAPI document: 1.0.0
270
+ *
271
+ *
272
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
273
+ * https://openapi-generator.tech
274
+ * Do not edit the class manually.
275
+ */
276
+
277
+ declare class RestAPI {
278
+ private configuration;
279
+ private rebateApi;
280
+ constructor(configuration: ConfigurationRestAPI);
281
+ /**
282
+ * Generic function to send a request.
283
+ * @param endpoint - The API endpoint to call.
284
+ * @param method - HTTP method to use (GET, POST, DELETE, etc.).
285
+ * @param params - Query parameters for the request.
286
+ *
287
+ * @returns A promise resolving to the response data object.
288
+ */
289
+ sendRequest<T>(endpoint: string, method: 'GET' | 'POST' | 'DELETE' | 'PUT' | 'PATCH', params?: Record<string, unknown>): Promise<RestApiResponse<T>>;
290
+ /**
291
+ * Generic function to send a signed request.
292
+ * @param endpoint - The API endpoint to call.
293
+ * @param method - HTTP method to use (GET, POST, DELETE, etc.).
294
+ * @param params - Query parameters for the request.
295
+ *
296
+ * @returns A promise resolving to the response data object.
297
+ */
298
+ sendSignedRequest<T>(endpoint: string, method: 'GET' | 'POST' | 'DELETE' | 'PUT' | 'PATCH', params?: Record<string, unknown>): Promise<RestApiResponse<T>>;
299
+ /**
300
+ * Get Spot Rebate History Records
301
+ *
302
+ * The max interval between startTime and endTime is 30 days.
303
+ * If startTime and endTime are not sent, the recent 7 days' data will be returned.
304
+ * The earliest startTime is supported on June 10, 2020
305
+ * Return up to 200 records per request.
306
+ *
307
+ * Weight: 12000
308
+ *
309
+ * @summary Get Spot Rebate History Records (USER_DATA)
310
+ * @param {GetSpotRebateHistoryRecordsRequest} requestParameters Request parameters.
311
+ * @returns {Promise<RestApiResponse<GetSpotRebateHistoryRecordsResponse>>}
312
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
313
+ * @see {@link https://developers.binance.com/docs/rebate/rest-api/Get-Spot-Rebate-History-Records Binance API Documentation}
314
+ */
315
+ getSpotRebateHistoryRecords(requestParameters?: GetSpotRebateHistoryRecordsRequest): Promise<RestApiResponse<GetSpotRebateHistoryRecordsResponse>>;
316
+ }
317
+
318
+ /**
319
+ * Binance Public Rebate REST API
320
+ *
321
+ * OpenAPI Specification for the Binance Public Rebate REST API
322
+ *
323
+ * The version of the OpenAPI document: 1.0.0
324
+ *
325
+ *
326
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
327
+ * https://openapi-generator.tech
328
+ * Do not edit the class manually.
329
+ */
330
+
331
+ type index_BadRequest = BadRequest;
332
+ type index_GetSpotRebateHistoryRecordsRequest = GetSpotRebateHistoryRecordsRequest;
333
+ type index_GetSpotRebateHistoryRecordsResponse = GetSpotRebateHistoryRecordsResponse;
334
+ type index_GetSpotRebateHistoryRecordsResponseData = GetSpotRebateHistoryRecordsResponseData;
335
+ type index_GetSpotRebateHistoryRecordsResponseDataDataInner = GetSpotRebateHistoryRecordsResponseDataDataInner;
336
+ type index_RebateApi = RebateApi;
337
+ declare const index_RebateApi: typeof RebateApi;
338
+ type index_RebateApiInterface = RebateApiInterface;
339
+ type index_RestAPI = RestAPI;
340
+ declare const index_RestAPI: typeof RestAPI;
341
+ declare namespace index {
342
+ export {
343
+ index_BadRequest as BadRequest,
344
+ index_GetSpotRebateHistoryRecordsRequest as GetSpotRebateHistoryRecordsRequest,
345
+ index_GetSpotRebateHistoryRecordsResponse as GetSpotRebateHistoryRecordsResponse,
346
+ index_GetSpotRebateHistoryRecordsResponseData as GetSpotRebateHistoryRecordsResponseData,
347
+ index_GetSpotRebateHistoryRecordsResponseDataDataInner as GetSpotRebateHistoryRecordsResponseDataDataInner,
348
+ index_RebateApi as RebateApi,
349
+ index_RebateApiInterface as RebateApiInterface,
350
+ index_RestAPI as RestAPI,
351
+ };
352
+ }
353
+
354
+ interface ConfigurationRebate {
355
+ configurationRestAPI?: ConfigurationRestAPI;
356
+ }
357
+ declare class Rebate {
358
+ restAPI: RestAPI;
359
+ constructor(config: ConfigurationRebate);
360
+ }
361
+
362
+ export { ConfigurationRebate, Rebate, index as RebateRestAPI };
package/dist/index.js ADDED
@@ -0,0 +1,230 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name2 in all)
8
+ __defProp(target, name2, { get: all[name2], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ BadRequestError: () => import_common4.BadRequestError,
24
+ ConnectorClientError: () => import_common4.ConnectorClientError,
25
+ ForbiddenError: () => import_common4.ForbiddenError,
26
+ NetworkError: () => import_common4.NetworkError,
27
+ NotFoundError: () => import_common4.NotFoundError,
28
+ REBATE_REST_API_PROD_URL: () => import_common4.REBATE_REST_API_PROD_URL,
29
+ REBATE_REST_API_TESTNET_URL: () => import_common4.REBATE_REST_API_TESTNET_URL,
30
+ RateLimitBanError: () => import_common4.RateLimitBanError,
31
+ Rebate: () => Rebate,
32
+ RebateRestAPI: () => rest_api_exports,
33
+ RequiredError: () => import_common4.RequiredError,
34
+ ServerError: () => import_common4.ServerError,
35
+ TooManyRequestsError: () => import_common4.TooManyRequestsError,
36
+ UnauthorizedError: () => import_common4.UnauthorizedError
37
+ });
38
+ module.exports = __toCommonJS(src_exports);
39
+
40
+ // src/rebate.ts
41
+ var import_os = require("os");
42
+ var import_common3 = require("@binance/common");
43
+
44
+ // package.json
45
+ var name = "@binance/rebate";
46
+ var version = "1.0.0";
47
+
48
+ // src/rest-api/index.ts
49
+ var rest_api_exports = {};
50
+ __export(rest_api_exports, {
51
+ RebateApi: () => RebateApi,
52
+ RestAPI: () => RestAPI
53
+ });
54
+
55
+ // src/rest-api/modules/rebate-api.ts
56
+ var import_common = require("@binance/common");
57
+ var RebateApiAxiosParamCreator = function(configuration) {
58
+ return {
59
+ /**
60
+ * Get Spot Rebate History Records
61
+ *
62
+ * The max interval between startTime and endTime is 30 days.
63
+ * If startTime and endTime are not sent, the recent 7 days' data will be returned.
64
+ * The earliest startTime is supported on June 10, 2020
65
+ * Return up to 200 records per request.
66
+ *
67
+ * Weight: 12000
68
+ *
69
+ * @summary Get Spot Rebate History Records (USER_DATA)
70
+ * @param {number} [startTime]
71
+ * @param {number} [endTime]
72
+ * @param {number} [page] Default 1
73
+ * @param {number} [recvWindow]
74
+ *
75
+ * @throws {RequiredError}
76
+ */
77
+ getSpotRebateHistoryRecords: async (startTime, endTime, page, recvWindow) => {
78
+ const localVarQueryParameter = {};
79
+ if (startTime !== void 0 && startTime !== null) {
80
+ localVarQueryParameter["startTime"] = startTime;
81
+ }
82
+ if (endTime !== void 0 && endTime !== null) {
83
+ localVarQueryParameter["endTime"] = endTime;
84
+ }
85
+ if (page !== void 0 && page !== null) {
86
+ localVarQueryParameter["page"] = page;
87
+ }
88
+ if (recvWindow !== void 0 && recvWindow !== null) {
89
+ localVarQueryParameter["recvWindow"] = recvWindow;
90
+ }
91
+ let _timeUnit;
92
+ if ("timeUnit" in configuration)
93
+ _timeUnit = configuration.timeUnit;
94
+ return {
95
+ endpoint: "/sapi/v1/rebate/taxQuery",
96
+ method: "GET",
97
+ params: localVarQueryParameter,
98
+ timeUnit: _timeUnit
99
+ };
100
+ }
101
+ };
102
+ };
103
+ var RebateApi = class {
104
+ constructor(configuration) {
105
+ this.configuration = configuration;
106
+ this.localVarAxiosParamCreator = RebateApiAxiosParamCreator(configuration);
107
+ }
108
+ /**
109
+ * Get Spot Rebate History Records
110
+ *
111
+ * The max interval between startTime and endTime is 30 days.
112
+ * If startTime and endTime are not sent, the recent 7 days' data will be returned.
113
+ * The earliest startTime is supported on June 10, 2020
114
+ * Return up to 200 records per request.
115
+ *
116
+ * Weight: 12000
117
+ *
118
+ * @summary Get Spot Rebate History Records (USER_DATA)
119
+ * @param {GetSpotRebateHistoryRecordsRequest} requestParameters Request parameters.
120
+ * @returns {Promise<RestApiResponse<GetSpotRebateHistoryRecordsResponse>>}
121
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
122
+ * @memberof RebateApi
123
+ * @see {@link https://developers.binance.com/docs/rebate/rest-api/Get-Spot-Rebate-History-Records Binance API Documentation}
124
+ */
125
+ async getSpotRebateHistoryRecords(requestParameters = {}) {
126
+ const localVarAxiosArgs = await this.localVarAxiosParamCreator.getSpotRebateHistoryRecords(
127
+ requestParameters?.startTime,
128
+ requestParameters?.endTime,
129
+ requestParameters?.page,
130
+ requestParameters?.recvWindow
131
+ );
132
+ return (0, import_common.sendRequest)(
133
+ this.configuration,
134
+ localVarAxiosArgs.endpoint,
135
+ localVarAxiosArgs.method,
136
+ localVarAxiosArgs.params,
137
+ localVarAxiosArgs?.timeUnit,
138
+ { isSigned: true }
139
+ );
140
+ }
141
+ };
142
+
143
+ // src/rest-api/rest-api.ts
144
+ var import_common2 = require("@binance/common");
145
+ var RestAPI = class {
146
+ constructor(configuration) {
147
+ this.configuration = configuration;
148
+ this.rebateApi = new RebateApi(configuration);
149
+ }
150
+ /**
151
+ * Generic function to send a request.
152
+ * @param endpoint - The API endpoint to call.
153
+ * @param method - HTTP method to use (GET, POST, DELETE, etc.).
154
+ * @param params - Query parameters for the request.
155
+ *
156
+ * @returns A promise resolving to the response data object.
157
+ */
158
+ sendRequest(endpoint, method, params = {}) {
159
+ return (0, import_common2.sendRequest)(this.configuration, endpoint, method, params, void 0);
160
+ }
161
+ /**
162
+ * Generic function to send a signed request.
163
+ * @param endpoint - The API endpoint to call.
164
+ * @param method - HTTP method to use (GET, POST, DELETE, etc.).
165
+ * @param params - Query parameters for the request.
166
+ *
167
+ * @returns A promise resolving to the response data object.
168
+ */
169
+ sendSignedRequest(endpoint, method, params = {}) {
170
+ return (0, import_common2.sendRequest)(this.configuration, endpoint, method, params, void 0, {
171
+ isSigned: true
172
+ });
173
+ }
174
+ /**
175
+ * Get Spot Rebate History Records
176
+ *
177
+ * The max interval between startTime and endTime is 30 days.
178
+ * If startTime and endTime are not sent, the recent 7 days' data will be returned.
179
+ * The earliest startTime is supported on June 10, 2020
180
+ * Return up to 200 records per request.
181
+ *
182
+ * Weight: 12000
183
+ *
184
+ * @summary Get Spot Rebate History Records (USER_DATA)
185
+ * @param {GetSpotRebateHistoryRecordsRequest} requestParameters Request parameters.
186
+ * @returns {Promise<RestApiResponse<GetSpotRebateHistoryRecordsResponse>>}
187
+ * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
188
+ * @see {@link https://developers.binance.com/docs/rebate/rest-api/Get-Spot-Rebate-History-Records Binance API Documentation}
189
+ */
190
+ getSpotRebateHistoryRecords(requestParameters = {}) {
191
+ return this.rebateApi.getSpotRebateHistoryRecords(requestParameters);
192
+ }
193
+ };
194
+
195
+ // src/rebate.ts
196
+ var Rebate = class {
197
+ constructor(config) {
198
+ if (config?.configurationRestAPI) {
199
+ const configRestAPI = new import_common3.ConfigurationRestAPI(config.configurationRestAPI);
200
+ configRestAPI.basePath = configRestAPI.basePath || import_common3.REBATE_REST_API_PROD_URL;
201
+ configRestAPI.baseOptions = configRestAPI.baseOptions || {};
202
+ configRestAPI.baseOptions.headers = {
203
+ ...configRestAPI.baseOptions.headers || {},
204
+ "User-Agent": `${name}/${version} (Node.js/${process.version}; ${(0, import_os.platform)()}; ${(0, import_os.arch)()})`
205
+ };
206
+ this.restAPI = new RestAPI(configRestAPI);
207
+ }
208
+ }
209
+ };
210
+
211
+ // src/index.ts
212
+ var import_common4 = require("@binance/common");
213
+ // Annotate the CommonJS export names for ESM import in node:
214
+ 0 && (module.exports = {
215
+ BadRequestError,
216
+ ConnectorClientError,
217
+ ForbiddenError,
218
+ NetworkError,
219
+ NotFoundError,
220
+ REBATE_REST_API_PROD_URL,
221
+ REBATE_REST_API_TESTNET_URL,
222
+ RateLimitBanError,
223
+ Rebate,
224
+ RebateRestAPI,
225
+ RequiredError,
226
+ ServerError,
227
+ TooManyRequestsError,
228
+ UnauthorizedError
229
+ });
230
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/rebate.ts","../package.json","../src/rest-api/index.ts","../src/rest-api/modules/rebate-api.ts","../src/rest-api/rest-api.ts"],"sourcesContent":["export { Rebate, ConfigurationRebate } from './rebate';\nexport * as RebateRestAPI from './rest-api';\n\nexport {\n REBATE_REST_API_PROD_URL,\n REBATE_REST_API_TESTNET_URL,\n ConnectorClientError,\n RequiredError,\n UnauthorizedError,\n ForbiddenError,\n TooManyRequestsError,\n RateLimitBanError,\n ServerError,\n NetworkError,\n NotFoundError,\n BadRequestError,\n} from '@binance/common';\n","import { platform, arch } from 'os';\nimport { ConfigurationRestAPI, REBATE_REST_API_PROD_URL } from '@binance/common';\nimport { name, version } from '../package.json';\nimport { RestAPI } from './rest-api';\n\nexport interface ConfigurationRebate {\n configurationRestAPI?: ConfigurationRestAPI;\n}\n\nexport class Rebate {\n public restAPI!: RestAPI;\n\n constructor(config: ConfigurationRebate) {\n if (config?.configurationRestAPI) {\n const configRestAPI = new ConfigurationRestAPI(config.configurationRestAPI);\n configRestAPI.basePath = configRestAPI.basePath || REBATE_REST_API_PROD_URL;\n configRestAPI.baseOptions = configRestAPI.baseOptions || {};\n configRestAPI.baseOptions.headers = {\n ...(configRestAPI.baseOptions.headers || {}),\n 'User-Agent': `${name}/${version} (Node.js/${process.version}; ${platform()}; ${arch()})`,\n };\n this.restAPI = new RestAPI(configRestAPI);\n }\n }\n}\n","{\n \"name\": \"@binance/rebate\",\n \"description\": \"Official Binance Rebate Connector - A lightweight library that provides a convenient interface to Binance's Rebate REST API.\",\n \"version\": \"1.0.0\",\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"types\": \"./dist/index.d.ts\",\n \"scripts\": {\n \"prepublishOnly\": \"npm run build\",\n \"build\": \"tsup\",\n \"typecheck\": \"tsc --noEmit\",\n \"clean\": \"rm -rf dist\",\n \"test\": \"npx jest --maxWorkers=4 --bail\",\n \"test:watch\": \"npx jest --watch\",\n \"format\": \"npx prettier --ignore-path .prettierignore --write .\",\n \"lint\": \"npx eslint '**/*.ts' --fix\"\n },\n \"keywords\": [\n \"Binance\",\n \"API\",\n \"Rebate\",\n \"Connector\",\n \"REST\",\n \"Trading\"\n ],\n \"author\": \"Binance\",\n \"license\": \"MIT\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/binance/binance-connector-js.git\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/binance/binance-connector-js/issues\"\n },\n \"homepage\": \"https://github.com/binance/binance-connector-js#readme\",\n \"files\": [\n \"dist\"\n ],\n \"devDependencies\": {\n \"@types/jest\": \"^29.5.4\",\n \"@types/node\": \"^20.17.24\",\n \"eslint\": \"8.57.0\",\n \"jest\": \"^29.6.4\",\n \"prettier\": \"^3.3.3\",\n \"ts-jest\": \"^29.1.1\",\n \"ts-node\": \"^10.9.1\",\n \"tsup\": \"^7.2.0\",\n \"typescript\": \"^5.7.2\",\n \"typescript-eslint\": \"^8.24.0\"\n },\n \"dependencies\": {\n \"@binance/common\": \"1.0.0\",\n \"axios\": \"^1.7.4\"\n }\n}\n","/**\n * Binance Public Rebate REST API\n *\n * OpenAPI Specification for the Binance Public Rebate REST API\n *\n * The version of the OpenAPI document: 1.0.0\n *\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\nexport * from './types';\nexport * from './modules';\nexport * from './rest-api';\n","/**\n * Binance Public Rebate REST API\n *\n * OpenAPI Specification for the Binance Public Rebate REST API\n *\n * The version of the OpenAPI document: 1.0.0\n *\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\nimport {\n ConfigurationRestAPI,\n TimeUnit,\n RestApiResponse,\n sendRequest,\n type RequestArgs,\n} from '@binance/common';\nimport type { GetSpotRebateHistoryRecordsResponse } from '../types';\n\n/**\n * RebateApi - axios parameter creator\n */\nconst RebateApiAxiosParamCreator = function (configuration: ConfigurationRestAPI) {\n return {\n /**\n * Get Spot Rebate History Records\n *\n * The max interval between startTime and endTime is 30 days.\n * If startTime and endTime are not sent, the recent 7 days' data will be returned.\n * The earliest startTime is supported on June 10, 2020\n * Return up to 200 records per request.\n *\n * Weight: 12000\n *\n * @summary Get Spot Rebate History Records (USER_DATA)\n * @param {number} [startTime]\n * @param {number} [endTime]\n * @param {number} [page] Default 1\n * @param {number} [recvWindow]\n *\n * @throws {RequiredError}\n */\n getSpotRebateHistoryRecords: async (\n startTime?: number,\n endTime?: number,\n page?: number,\n recvWindow?: number\n ): Promise<RequestArgs> => {\n const localVarQueryParameter: Record<string, unknown> = {};\n\n if (startTime !== undefined && startTime !== null) {\n localVarQueryParameter['startTime'] = startTime;\n }\n\n if (endTime !== undefined && endTime !== null) {\n localVarQueryParameter['endTime'] = endTime;\n }\n\n if (page !== undefined && page !== null) {\n localVarQueryParameter['page'] = page;\n }\n\n if (recvWindow !== undefined && recvWindow !== null) {\n localVarQueryParameter['recvWindow'] = recvWindow;\n }\n\n let _timeUnit: TimeUnit | undefined;\n if ('timeUnit' in configuration) _timeUnit = configuration.timeUnit as TimeUnit;\n\n return {\n endpoint: '/sapi/v1/rebate/taxQuery',\n method: 'GET',\n params: localVarQueryParameter,\n timeUnit: _timeUnit,\n };\n },\n };\n};\n\n/**\n * RebateApi - interface\n * @interface RebateApi\n */\nexport interface RebateApiInterface {\n /**\n * Get Spot Rebate History Records\n *\n * The max interval between startTime and endTime is 30 days.\n * If startTime and endTime are not sent, the recent 7 days' data will be returned.\n * The earliest startTime is supported on June 10, 2020\n * Return up to 200 records per request.\n *\n * Weight: 12000\n *\n * @summary Get Spot Rebate History Records (USER_DATA)\n * @param {GetSpotRebateHistoryRecordsRequest} requestParameters Request parameters.\n *\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof RebateApiInterface\n */\n getSpotRebateHistoryRecords(\n requestParameters?: GetSpotRebateHistoryRecordsRequest\n ): Promise<RestApiResponse<GetSpotRebateHistoryRecordsResponse>>;\n}\n\n/**\n * Request parameters for getSpotRebateHistoryRecords operation in RebateApi.\n * @interface GetSpotRebateHistoryRecordsRequest\n */\nexport interface GetSpotRebateHistoryRecordsRequest {\n /**\n *\n * @type {number}\n * @memberof RebateApiGetSpotRebateHistoryRecords\n */\n readonly startTime?: number;\n\n /**\n *\n * @type {number}\n * @memberof RebateApiGetSpotRebateHistoryRecords\n */\n readonly endTime?: number;\n\n /**\n * Default 1\n * @type {number}\n * @memberof RebateApiGetSpotRebateHistoryRecords\n */\n readonly page?: number;\n\n /**\n *\n * @type {number}\n * @memberof RebateApiGetSpotRebateHistoryRecords\n */\n readonly recvWindow?: number;\n}\n\n/**\n * RebateApi - object-oriented interface\n * @class RebateApi\n */\nexport class RebateApi implements RebateApiInterface {\n private readonly configuration: ConfigurationRestAPI;\n private localVarAxiosParamCreator;\n\n constructor(configuration: ConfigurationRestAPI) {\n this.configuration = configuration;\n this.localVarAxiosParamCreator = RebateApiAxiosParamCreator(configuration);\n }\n\n /**\n * Get Spot Rebate History Records\n *\n * The max interval between startTime and endTime is 30 days.\n * If startTime and endTime are not sent, the recent 7 days' data will be returned.\n * The earliest startTime is supported on June 10, 2020\n * Return up to 200 records per request.\n *\n * Weight: 12000\n *\n * @summary Get Spot Rebate History Records (USER_DATA)\n * @param {GetSpotRebateHistoryRecordsRequest} requestParameters Request parameters.\n * @returns {Promise<RestApiResponse<GetSpotRebateHistoryRecordsResponse>>}\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @memberof RebateApi\n * @see {@link https://developers.binance.com/docs/rebate/rest-api/Get-Spot-Rebate-History-Records Binance API Documentation}\n */\n public async getSpotRebateHistoryRecords(\n requestParameters: GetSpotRebateHistoryRecordsRequest = {}\n ): Promise<RestApiResponse<GetSpotRebateHistoryRecordsResponse>> {\n const localVarAxiosArgs = await this.localVarAxiosParamCreator.getSpotRebateHistoryRecords(\n requestParameters?.startTime,\n requestParameters?.endTime,\n requestParameters?.page,\n requestParameters?.recvWindow\n );\n return sendRequest<GetSpotRebateHistoryRecordsResponse>(\n this.configuration,\n localVarAxiosArgs.endpoint,\n localVarAxiosArgs.method,\n localVarAxiosArgs.params,\n localVarAxiosArgs?.timeUnit,\n { isSigned: true }\n );\n }\n}\n","/**\n * Binance Public Rebate REST API\n *\n * OpenAPI Specification for the Binance Public Rebate REST API\n *\n * The version of the OpenAPI document: 1.0.0\n *\n *\n * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).\n * https://openapi-generator.tech\n * Do not edit the class manually.\n */\n\nimport { ConfigurationRestAPI, RestApiResponse, sendRequest } from '@binance/common';\nimport { RebateApi } from './modules/rebate-api';\n\nimport type { GetSpotRebateHistoryRecordsRequest } from './modules/rebate-api';\n\nimport type { GetSpotRebateHistoryRecordsResponse } from './types';\n\nexport class RestAPI {\n private configuration: ConfigurationRestAPI;\n private rebateApi: RebateApi;\n\n constructor(configuration: ConfigurationRestAPI) {\n this.configuration = configuration;\n this.rebateApi = new RebateApi(configuration);\n }\n\n /**\n * Generic function to send a request.\n * @param endpoint - The API endpoint to call.\n * @param method - HTTP method to use (GET, POST, DELETE, etc.).\n * @param params - Query parameters for the request.\n *\n * @returns A promise resolving to the response data object.\n */\n sendRequest<T>(\n endpoint: string,\n method: 'GET' | 'POST' | 'DELETE' | 'PUT' | 'PATCH',\n params: Record<string, unknown> = {}\n ): Promise<RestApiResponse<T>> {\n return sendRequest<T>(this.configuration, endpoint, method, params, undefined);\n }\n\n /**\n * Generic function to send a signed request.\n * @param endpoint - The API endpoint to call.\n * @param method - HTTP method to use (GET, POST, DELETE, etc.).\n * @param params - Query parameters for the request.\n *\n * @returns A promise resolving to the response data object.\n */\n sendSignedRequest<T>(\n endpoint: string,\n method: 'GET' | 'POST' | 'DELETE' | 'PUT' | 'PATCH',\n params: Record<string, unknown> = {}\n ): Promise<RestApiResponse<T>> {\n return sendRequest<T>(this.configuration, endpoint, method, params, undefined, {\n isSigned: true,\n });\n }\n\n /**\n * Get Spot Rebate History Records\n *\n * The max interval between startTime and endTime is 30 days.\n * If startTime and endTime are not sent, the recent 7 days' data will be returned.\n * The earliest startTime is supported on June 10, 2020\n * Return up to 200 records per request.\n *\n * Weight: 12000\n *\n * @summary Get Spot Rebate History Records (USER_DATA)\n * @param {GetSpotRebateHistoryRecordsRequest} requestParameters Request parameters.\n * @returns {Promise<RestApiResponse<GetSpotRebateHistoryRecordsResponse>>}\n * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}\n * @see {@link https://developers.binance.com/docs/rebate/rest-api/Get-Spot-Rebate-History-Records Binance API Documentation}\n */\n getSpotRebateHistoryRecords(\n requestParameters: GetSpotRebateHistoryRecordsRequest = {}\n ): Promise<RestApiResponse<GetSpotRebateHistoryRecordsResponse>> {\n return this.rebateApi.getSpotRebateHistoryRecords(requestParameters);\n }\n}\n"],"mappings":"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","names":["import_common","import_common","import_common"]}