bb-api-platforma 0.1.190 → 0.1.197
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.
- package/dist/BetBoosterApi.d.ts +238 -1
- package/dist/BetBoosterApi.js +392 -16
- package/dist/BetBoosterApi.min.d.ts +315 -1
- package/dist/BetBoosterApi.min.js +1 -1
- package/dist/BetBoosterApi.min.js.map +1 -1
- package/dist/BetBoosterOfficeApi.d.ts +16 -0
- package/dist/BetBoosterOfficeApi.js +83 -17
- package/dist/Types.d.ts +77 -0
- package/package.json +7 -2
package/dist/BetBoosterApi.d.ts
CHANGED
|
@@ -24,6 +24,12 @@ export declare class BetBoosterApi {
|
|
|
24
24
|
private _liveTimestampReset;
|
|
25
25
|
liveRecivedIsFullPackage?: boolean;
|
|
26
26
|
isNotActive?: boolean;
|
|
27
|
+
/** Приоритетные виды спорта для сортировки и отображения на странице [VidSportaRating]*/
|
|
28
|
+
primarySports: number[];
|
|
29
|
+
/** Приоритетные страны по видам спорта для сортировки и отображения */
|
|
30
|
+
priorityCountries: Record<string, number[]>;
|
|
31
|
+
/** Приоритетные турниры по видам спорта*/
|
|
32
|
+
priorityTournaments: Record<string, number[]>;
|
|
27
33
|
/**
|
|
28
34
|
* Represents the BetBoosterApi class.
|
|
29
35
|
* @constructor
|
|
@@ -58,6 +64,22 @@ export declare class BetBoosterApi {
|
|
|
58
64
|
status: number;
|
|
59
65
|
statusText: string;
|
|
60
66
|
};
|
|
67
|
+
/**
|
|
68
|
+
* Processes the response data and returns an object with data, error, status and status text.
|
|
69
|
+
* Same as `this.responseHandlerData` only corrects the nesting of `Data.Data`
|
|
70
|
+
*
|
|
71
|
+
* @template T - Тип данных, возвращаемых в поле `data`.
|
|
72
|
+
* @param {any} rawData - Сырые данные ответа.
|
|
73
|
+
* @param {number} status - HTTP статус ответа.
|
|
74
|
+
* @param {string} statusText - Текст статуса HTTP ответа.
|
|
75
|
+
* @returns {{ data: T, error: string | null, status: number, statusText: string }} Объект, содержащий данные ответа, ошибку, статус и текст статуса.
|
|
76
|
+
*/
|
|
77
|
+
responseHandlerDataData<T = any | null>(rawData: any, status: number, statusText: string): {
|
|
78
|
+
data: T | null;
|
|
79
|
+
error: string | null;
|
|
80
|
+
status: number;
|
|
81
|
+
statusText: string;
|
|
82
|
+
};
|
|
61
83
|
/**
|
|
62
84
|
* Converts rawData.Data.Data format to rawData.Data.data format
|
|
63
85
|
* Sometimes API returns a format that is difficult to process later.
|
|
@@ -130,6 +152,57 @@ export declare class BetBoosterApi {
|
|
|
130
152
|
* @returns URL for the specified API path and version.
|
|
131
153
|
*/
|
|
132
154
|
private url;
|
|
155
|
+
/**
|
|
156
|
+
* Сортирует данные по приоритету, указанному в массиве priorityIDs.
|
|
157
|
+
*
|
|
158
|
+
* @template T - Тип объектов в массиве данных
|
|
159
|
+
* @param {Array<T>} data - Массив объектов данных для сортировки.
|
|
160
|
+
* @param {Array<number|string>} priorityIDs - Массив приоритетных ID для сортировки.
|
|
161
|
+
* @param {keyof T} sortField - Поле объекта, по которому будет производиться сортировка.
|
|
162
|
+
* @returns {Array<T>} - Новый массив отсортированных данных.
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* ```typescript
|
|
166
|
+
* interface Tournament {
|
|
167
|
+
* Id: number;
|
|
168
|
+
* Name: string;
|
|
169
|
+
* SportID: number;
|
|
170
|
+
* }
|
|
171
|
+
*
|
|
172
|
+
* const tournaments: Tournament[] = [
|
|
173
|
+
* { Id: 1, Name: 'Premier League', SportID: 5 },
|
|
174
|
+
* { Id: 2, Name: 'La Liga', SportID: 5 },
|
|
175
|
+
* { Id: 3, Name: 'Serie A', SportID: 5 }
|
|
176
|
+
* ];
|
|
177
|
+
*
|
|
178
|
+
* const sortedTournaments = api.sortDataByPriority(
|
|
179
|
+
* tournaments,
|
|
180
|
+
* [3, 1, 2],
|
|
181
|
+
* 'Id'
|
|
182
|
+
* );
|
|
183
|
+
* // Result: [Serie A, Premier League, La Liga]
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
sortDataByPriority<T extends Record<string, any>>(data: T[], priorityIDs: Array<number | string>, sortField: keyof T): T[];
|
|
187
|
+
/**
|
|
188
|
+
* Сортирует массив значений по приоритету, указанному в массиве priorityIDs.
|
|
189
|
+
*
|
|
190
|
+
* @template T - Тип элементов массива (number | string)
|
|
191
|
+
* @param {Array<T>} array - Массив значений для сортировки.
|
|
192
|
+
* @param {Array<T>} priorityIDs - Массив приоритетных ID для сортировки.
|
|
193
|
+
* @returns {Array<T>} - Новый массив отсортированных значений.
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```typescript
|
|
197
|
+
* const sportIds = [1, 5, 3, 8, 2];
|
|
198
|
+
* const prioritySports = [5, 1, 3];
|
|
199
|
+
*
|
|
200
|
+
* const sortedSports = api.sortArrayByPriority(sportIds, prioritySports);
|
|
201
|
+
* // Result: [5, 1, 3, 8, 2]
|
|
202
|
+
* // Elements 5, 1, 3 are sorted by priority, others remain in original order
|
|
203
|
+
* ```
|
|
204
|
+
*/
|
|
205
|
+
sortArrayByPriority<T extends number | string>(array: T[], priorityIDs: T[]): T[];
|
|
133
206
|
/**
|
|
134
207
|
* Executes an HTTP request with the specified parameters.
|
|
135
208
|
* @param url - The URL to execute the request.
|
|
@@ -204,6 +277,7 @@ export declare class BetBoosterApi {
|
|
|
204
277
|
*
|
|
205
278
|
* @param minutes The number of minutes to consider for the data retrieval. Defaults to 0.
|
|
206
279
|
* @returns {Promise<Array<any>>} A promise that resolves to an array of line sports data.
|
|
280
|
+
* @deprecated - use this.getLineSportsMain();
|
|
207
281
|
*/
|
|
208
282
|
getLineSports(minutes?: number): Promise<I.ISport[]>;
|
|
209
283
|
/**
|
|
@@ -216,6 +290,7 @@ export declare class BetBoosterApi {
|
|
|
216
290
|
* @param sportId - Идентификатор спорта.
|
|
217
291
|
* @param minutes - Опциональный параметр, количество минут.
|
|
218
292
|
* @returns Промис, который разрешается в массив объектов типа ICountry.
|
|
293
|
+
* @deprecated - use this.getCountriesListMain();
|
|
219
294
|
*/
|
|
220
295
|
getCountriesList(sportId: number, minutes?: number): Promise<I.ICountry[]>;
|
|
221
296
|
/**
|
|
@@ -224,8 +299,9 @@ export declare class BetBoosterApi {
|
|
|
224
299
|
* @param countryId - The ID of the country.
|
|
225
300
|
* @param minutes - The number of minutes ago for which data is to be retrieved.
|
|
226
301
|
* @returns A promise that resolves to an array of prematch tournaments.
|
|
302
|
+
* @deprecated - use this.getPrematchTournamentsMain();
|
|
227
303
|
*/
|
|
228
|
-
getPrematchTournaments(sportId: number, countryId: number, minutes?: number): Promise<I.GetPrematchTournament[]>;
|
|
304
|
+
getPrematchTournaments(sportId: number | string, countryId: number | string, minutes?: number): Promise<I.GetPrematchTournament[]>;
|
|
229
305
|
/**
|
|
230
306
|
* Retrieves prematch tournaments based on the specified sport ID and minutes.
|
|
231
307
|
* @param sportId - The ID of the sport.
|
|
@@ -1157,6 +1233,147 @@ export declare class BetBoosterApi {
|
|
|
1157
1233
|
status: number;
|
|
1158
1234
|
statusText: string;
|
|
1159
1235
|
}>;
|
|
1236
|
+
/**
|
|
1237
|
+
* Retrieves aggregated dictionary data from Redis using FT.AGGREGATE command.
|
|
1238
|
+
* Groups and counts items by specified dictionary type (sport, country, or tournament).
|
|
1239
|
+
*
|
|
1240
|
+
* @param payload - The search parameters for dictionary aggregation
|
|
1241
|
+
* @param payload.locale - Language locale code for filtering results
|
|
1242
|
+
* @param payload.sportId - Sport ID(s) to include in search
|
|
1243
|
+
* @param payload.countryId - Country ID(s) to include in search
|
|
1244
|
+
* @param payload.tournamentId - Tournament ID(s) to include in search
|
|
1245
|
+
* @param payload.dictionary - Dictionary type to group by ('sport' | 'country' | 'tournament')
|
|
1246
|
+
* @param payload.notsport - Sport ID(s) to exclude from search
|
|
1247
|
+
* @param payload.notcountry - Country ID(s) to exclude from search
|
|
1248
|
+
* @param payload.nottournament - Tournament ID(s) to exclude from search
|
|
1249
|
+
* @param payload.LIMIT - Maximum number of results to return
|
|
1250
|
+
* @param payload.minTime - Minimum time filter for events
|
|
1251
|
+
* @param payload.maxTime - Maximum time filter for events
|
|
1252
|
+
*
|
|
1253
|
+
* @returns Promise resolving to aggregated results with total count and grouped items,
|
|
1254
|
+
* or error object with total: 0 and empty results array on failure
|
|
1255
|
+
*
|
|
1256
|
+
* @example
|
|
1257
|
+
* ```typescript
|
|
1258
|
+
* // Get sport dictionary with counts
|
|
1259
|
+
* const sportDict = await redisDb.getDictionary({
|
|
1260
|
+
* locale: 'en',
|
|
1261
|
+
* dictionary: 'sport',
|
|
1262
|
+
* LIMIT: { from: 0, size: 10 },
|
|
1263
|
+
* minTime: 1640995200,
|
|
1264
|
+
* maxTime: 1641081600
|
|
1265
|
+
* });
|
|
1266
|
+
*
|
|
1267
|
+
* // Get country dictionary excluding specific sports
|
|
1268
|
+
* const countryDict = await redisDb.getDictionary({
|
|
1269
|
+
* locale: 'ru',
|
|
1270
|
+
* dictionary: 'country',
|
|
1271
|
+
* notsport: [1, 2, 3],
|
|
1272
|
+
* LIMIT: { from: 0, size: 50 }
|
|
1273
|
+
* });
|
|
1274
|
+
*
|
|
1275
|
+
* // Get tournament dictionary for specific sport and country
|
|
1276
|
+
* const tournamentDict = await redisDb.getDictionary({
|
|
1277
|
+
* locale: 'en',
|
|
1278
|
+
* dictionary: 'tournament',
|
|
1279
|
+
* sportId: [1],
|
|
1280
|
+
* countryId: [225],
|
|
1281
|
+
* LIMIT: { from: 0, size: 100 }
|
|
1282
|
+
* });
|
|
1283
|
+
* ```
|
|
1284
|
+
*/
|
|
1285
|
+
getDictionaryNv20(payload: I.RedisDictionaryParams): Promise<{
|
|
1286
|
+
data: any;
|
|
1287
|
+
error: string | null;
|
|
1288
|
+
status: number;
|
|
1289
|
+
statusText: string;
|
|
1290
|
+
}>;
|
|
1291
|
+
/**
|
|
1292
|
+
* Retrieves a list of sports from the NV20 API endpoint with optional time filtering.
|
|
1293
|
+
*
|
|
1294
|
+
* @param {number} [minutes=0] - Optional time window in minutes to filter sports data.
|
|
1295
|
+
* If greater than 0, filters results to include only data
|
|
1296
|
+
* from the current time to the specified minutes in the future.
|
|
1297
|
+
* @param {number} [timeout=MAX_TIME_EXECUTION_MS] - Optional request timeout in milliseconds.
|
|
1298
|
+
* @returns {Promise<I.ISport[]>} A promise that resolves to an array of sports objects sorted by priority.
|
|
1299
|
+
* Each sport contains an ID, Name, and count (cnt) property.
|
|
1300
|
+
*
|
|
1301
|
+
* @example
|
|
1302
|
+
* // Get all available sports
|
|
1303
|
+
* const sports = await betBoosterApi.getLineSportsNv20();
|
|
1304
|
+
*
|
|
1305
|
+
* @example
|
|
1306
|
+
* // Get sports updated in the last 30 minutes with a custom timeout
|
|
1307
|
+
* const sports = await betBoosterApi.getLineSportsNv20(30, 5000);
|
|
1308
|
+
*/
|
|
1309
|
+
getLineSportsNv20(minutes?: number, timeout?: number): Promise<I.ISport[]>;
|
|
1310
|
+
/**
|
|
1311
|
+
* Retrieves the main line sports data with fallback mechanism.
|
|
1312
|
+
*
|
|
1313
|
+
* Attempts to fetch line sports data from the NV20 endpoint first with a 2000ms timeout.
|
|
1314
|
+
* If no sports data is returned, falls back to the standard getLineSports endpoint.
|
|
1315
|
+
*
|
|
1316
|
+
* @param minutes - Optional. The number of minutes to look back for sports data. Defaults to 0.
|
|
1317
|
+
* @param timeout - Optional. The timeout duration in milliseconds for the NV20 API request. Defaults to 1500.
|
|
1318
|
+
* @returns A promise that resolves to an array of sports objects containing line sports data.
|
|
1319
|
+
* @example
|
|
1320
|
+
* // Get current line sports
|
|
1321
|
+
* const sports = await getLineSportsMain();
|
|
1322
|
+
*
|
|
1323
|
+
* @example
|
|
1324
|
+
* // Get line sports from the last 30 minutes
|
|
1325
|
+
* const sports = await getLineSportsMain(30);
|
|
1326
|
+
*/
|
|
1327
|
+
getLineSportsMain(minutes?: number, timeout?: number): Promise<I.ISport[]>;
|
|
1328
|
+
/**
|
|
1329
|
+
* Retrieves countries for a given sport using the NV20 API.
|
|
1330
|
+
* @param sportId - The sport ID to filter countries by.
|
|
1331
|
+
* @param minutes - Optional time window in minutes for the query. Defaults to 0 (no time filter).
|
|
1332
|
+
* @returns A promise that resolves to the response data containing countries or null if the request fails.
|
|
1333
|
+
*/
|
|
1334
|
+
getCountriesBySportNv20(sportId: number, minutes?: number, timeout?: number): Promise<I.ICountry[]>;
|
|
1335
|
+
/**
|
|
1336
|
+
* Retrieves a list of countries for a given sport, with fallback behavior.
|
|
1337
|
+
*
|
|
1338
|
+
* Attempts to fetch countries using the NV20 API with a 5-second timeout.
|
|
1339
|
+
* If no results are returned, falls back to the standard countries list endpoint.
|
|
1340
|
+
*
|
|
1341
|
+
* @param sportId - The unique identifier of the sport
|
|
1342
|
+
* @param minutes - Optional. The number of minutes to use as a filter criteria. Defaults to 0.
|
|
1343
|
+
* @param timeout - Optional. The timeout duration in milliseconds for the NV20 API request. Defaults to 3000.
|
|
1344
|
+
* @returns A promise that resolves to an array of countries for the specified sport
|
|
1345
|
+
*
|
|
1346
|
+
* @example
|
|
1347
|
+
* ```typescript
|
|
1348
|
+
* const countries = await this.getCountriesListMain(1, 30);
|
|
1349
|
+
* ```
|
|
1350
|
+
*/
|
|
1351
|
+
getCountriesListMain(sportId: number, minutes?: number, timeout?: number): Promise<I.ICountry[]>;
|
|
1352
|
+
/**
|
|
1353
|
+
* Retrieves tournaments from the NV20 API for a specific sport and optional country.
|
|
1354
|
+
* @param sportId - The sport ID to filter tournaments by
|
|
1355
|
+
* @param countryId - Optional country ID to filter tournaments by
|
|
1356
|
+
* @param minutes - Optional time window in minutes for tournament data (default: 0, no time filter)
|
|
1357
|
+
* @returns A promise that resolves to the response data containing tournaments or null
|
|
1358
|
+
*/
|
|
1359
|
+
getPrematchTournamentsNv20(sportId: number | string, countryId: number | string, minutes?: number, timeout?: number): Promise<I.ITournamentShort[]>;
|
|
1360
|
+
/**
|
|
1361
|
+
* Retrieves prematch tournaments for a given sport and country.
|
|
1362
|
+
*
|
|
1363
|
+
* Attempts to fetch tournaments using the NV2.0 API first. If no tournaments are returned,
|
|
1364
|
+
* falls back to the standard API as a failover mechanism.
|
|
1365
|
+
*
|
|
1366
|
+
* @param sportId - The sport identifier (number or string)
|
|
1367
|
+
* @param countryId - The country identifier (number or string)
|
|
1368
|
+
* @param minutes - The time window in minutes for prematch tournaments (default: 0)
|
|
1369
|
+
* @param timeout - The request timeout in milliseconds (default: 3000)
|
|
1370
|
+
* @returns A promise that resolves to an array of tournament objects
|
|
1371
|
+
* @throws May throw an error if both API calls fail
|
|
1372
|
+
*
|
|
1373
|
+
* @example
|
|
1374
|
+
* const tournaments = await betBoosterApi.getPrematchTournamentsMain(1, 'US', 30, 5000);
|
|
1375
|
+
*/
|
|
1376
|
+
getPrematchTournamentsMain(sportId: number | string, countryId: number | string, minutes?: number, timeout?: number): Promise<I.ITournamentShort[]>;
|
|
1160
1377
|
searchPrematchTournametsEventsNv20(searchString: string, options?: I.RedisPrematchSearchParams): Promise<{
|
|
1161
1378
|
data: any;
|
|
1162
1379
|
error: string | null;
|
|
@@ -1227,15 +1444,35 @@ export declare class BetBoosterApi {
|
|
|
1227
1444
|
* ```
|
|
1228
1445
|
*/
|
|
1229
1446
|
getCdnSlidesData(cdnUrl: string, sites: string[], hardCodeSlides?: any[]): Promise<Record<string, any[]>>;
|
|
1447
|
+
/**
|
|
1448
|
+
* Deposits money into a bet kiosk account.
|
|
1449
|
+
* @param amount - The amount to deposit.
|
|
1450
|
+
* @returns A promise that resolves to true if the deposit was successful, otherwise false or null.
|
|
1451
|
+
* @deprecated use depositBetKioskV2 instead
|
|
1452
|
+
*/
|
|
1230
1453
|
depositBetKiosk(amount: number): Promise<{
|
|
1231
1454
|
data: boolean | null;
|
|
1232
1455
|
error: string | null;
|
|
1233
1456
|
status: number;
|
|
1234
1457
|
statusText: string;
|
|
1235
1458
|
}>;
|
|
1459
|
+
/**
|
|
1460
|
+
* Deposits money into a bet kiosk account.
|
|
1461
|
+
* @param amount - The amount to deposit.
|
|
1462
|
+
* @returns A promise that resolves to true if the deposit was successful, otherwise false or null.
|
|
1463
|
+
*/
|
|
1464
|
+
depositBetKioskV2(amount: number): Promise<{
|
|
1465
|
+
data: boolean | null;
|
|
1466
|
+
error: string | null;
|
|
1467
|
+
status: number;
|
|
1468
|
+
statusText: string;
|
|
1469
|
+
}>;
|
|
1236
1470
|
getFaq(): Promise<any>;
|
|
1237
1471
|
getFlatpagesList(): Promise<any>;
|
|
1238
1472
|
test3(): Promise<string>;
|
|
1473
|
+
/**
|
|
1474
|
+
* @deprecated sellBet - Not implemented
|
|
1475
|
+
*/
|
|
1239
1476
|
sellBet(data: any): Promise<void>;
|
|
1240
1477
|
/** Конвертирует различные представления корзины в единый формат
|
|
1241
1478
|
* @param betslipItem - элемент корзины
|