bb-api-platforma 0.1.168
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/README.md +44 -0
- package/dist/BetBoosterApi.d.ts +1148 -0
- package/dist/BetBoosterApi.js +2428 -0
- package/dist/BetBoosterApi.min.d.ts +1777 -0
- package/dist/BetBoosterApi.min.js +2 -0
- package/dist/BetBoosterApi.min.js.map +1 -0
- package/dist/BetBoosterOfficeApi.d.ts +941 -0
- package/dist/BetBoosterOfficeApi.js +1879 -0
- package/dist/BetBoosterOfficeApi.test.d.ts +1 -0
- package/dist/BetBoosterOfficeApi.test.js +24 -0
- package/dist/Types.d.ts +1742 -0
- package/dist/Types.js +896 -0
- package/dist/coupon.d.ts +139 -0
- package/dist/coupon.js +491 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +14 -0
- package/package.json +57 -0
|
@@ -0,0 +1,2428 @@
|
|
|
1
|
+
import { api } from './Types.js';
|
|
2
|
+
// #region Consts -----------------------------------------------------------------------
|
|
3
|
+
const locales = {
|
|
4
|
+
/** Be careful on the backend these values may change
|
|
5
|
+
* for chek:
|
|
6
|
+
* https://front-test.restin.win/api/account/GetAvailableLanguages
|
|
7
|
+
*/
|
|
8
|
+
en: 'en-US',
|
|
9
|
+
pt: 'en-US',
|
|
10
|
+
fr: 'fr-FR',
|
|
11
|
+
ht: 'fr-FR',
|
|
12
|
+
es: 'en-US',
|
|
13
|
+
tr: 'tr-TR',
|
|
14
|
+
az: 'tr-TR',
|
|
15
|
+
uk: 'en-US',
|
|
16
|
+
cr: 'fr-FR',
|
|
17
|
+
ru: 'ru-RU',
|
|
18
|
+
};
|
|
19
|
+
// const locales: Record<string, string> = {
|
|
20
|
+
// /** Be careful on the backend these values may change
|
|
21
|
+
// * for chek:
|
|
22
|
+
// * https://front-test.restin.win/api/account/GetAvailableLanguages
|
|
23
|
+
// */
|
|
24
|
+
// en: 'en-US',
|
|
25
|
+
// pt: 'pt-PT',
|
|
26
|
+
// fr: 'fr-FR',
|
|
27
|
+
// es: 'es-ES',
|
|
28
|
+
// tr: 'tr-TR',
|
|
29
|
+
// az: 'tr-TR',
|
|
30
|
+
// uk: 'uk-UA',
|
|
31
|
+
// cr: 'cr-HA',
|
|
32
|
+
// ru: 'ru-RU',
|
|
33
|
+
// }
|
|
34
|
+
const languageIdsRemote = {
|
|
35
|
+
/** Be careful on the backend these values may change
|
|
36
|
+
* for chek:
|
|
37
|
+
* https://front-test.restin.win/api/account/GetAvailableLanguages
|
|
38
|
+
*/
|
|
39
|
+
en: 1,
|
|
40
|
+
pt: 1,
|
|
41
|
+
fr: 4,
|
|
42
|
+
es: 1,
|
|
43
|
+
tr: 5,
|
|
44
|
+
az: 5,
|
|
45
|
+
uk: 1,
|
|
46
|
+
cr: 1,
|
|
47
|
+
ru: 0,
|
|
48
|
+
};
|
|
49
|
+
// const languageIdsRemote: Record<string, number> = {
|
|
50
|
+
// /** Be careful on the backend these values may change
|
|
51
|
+
// * for chek:
|
|
52
|
+
// * https://front-test.restin.win/api/account/GetAvailableLanguages
|
|
53
|
+
// */
|
|
54
|
+
// en: 1,
|
|
55
|
+
// pt: 0,
|
|
56
|
+
// fr: 4,
|
|
57
|
+
// es: 3,
|
|
58
|
+
// tr: 5,
|
|
59
|
+
// az: 5,
|
|
60
|
+
// uk: 2,
|
|
61
|
+
// cr: 6,
|
|
62
|
+
// ru: 0,
|
|
63
|
+
// }
|
|
64
|
+
const stringify = (obj) => {
|
|
65
|
+
return JSON.stringify(obj, null, 2);
|
|
66
|
+
};
|
|
67
|
+
function convertBasketToPost(betslipItem) {
|
|
68
|
+
return {
|
|
69
|
+
a1: betslipItem.Add1,
|
|
70
|
+
a2: betslipItem.Add2,
|
|
71
|
+
bId: betslipItem.BetVarID,
|
|
72
|
+
eId: betslipItem.LinesID,
|
|
73
|
+
fs: betslipItem.HandSize,
|
|
74
|
+
isLive: betslipItem.IsLive,
|
|
75
|
+
r: betslipItem.Odds,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export function routeNameId(id, text = '') {
|
|
79
|
+
return `${text
|
|
80
|
+
.replace(/[\s\.\,\(\)\[\]\\\/\-\~\`\"\']+/g, ' ')
|
|
81
|
+
.trim()
|
|
82
|
+
.replace(/\s+/g, '-')
|
|
83
|
+
.toLowerCase()}~${id}`;
|
|
84
|
+
}
|
|
85
|
+
export function clearPhone(draftPhoneNumber, prefix = '', suffix = '') {
|
|
86
|
+
return prefix + (String(draftPhoneNumber).match(/\d+/g) || []).join('') + suffix;
|
|
87
|
+
}
|
|
88
|
+
let IS_DEV_MODE = false;
|
|
89
|
+
// #endregion Consts -----------------------------------------------------------------------
|
|
90
|
+
export class BetBoosterApi {
|
|
91
|
+
// #endregion Class Properties --------------------------------------------------------
|
|
92
|
+
/**
|
|
93
|
+
* Represents the BetBoosterApi class.
|
|
94
|
+
* @constructor
|
|
95
|
+
* @param {AxiosInstance} axiosInstance - The Axios instance to be used for making HTTP requests. Aka axios.create()
|
|
96
|
+
* @param {string} baseUrl - The base URL of the API.
|
|
97
|
+
* @param {string} [lang='en'] - The language to be used for API requests. Defaults to 'en'.
|
|
98
|
+
* @param {number} [maxTimeExecutionMs=15000] - The maximum time allowed for API request execution in milliseconds. Defaults to 15000.
|
|
99
|
+
* @param {boolean} [isDev=false] - Indicates whether the API is running in development mode. Defaults to false.
|
|
100
|
+
*/
|
|
101
|
+
constructor(axiosInstance, baseUrl, lang = 'en', maxTimeExecutionMs = 15000, isDev = false) {
|
|
102
|
+
this._locale = 'en-EN';
|
|
103
|
+
this._locales = locales;
|
|
104
|
+
this._languageIdsRemote = languageIdsRemote;
|
|
105
|
+
this.EXIST_LANGUAGES = Object.keys(locales);
|
|
106
|
+
this._languageId = 1;
|
|
107
|
+
this._lang = 'en';
|
|
108
|
+
this._USER_DATA = {};
|
|
109
|
+
this.LANG_DEFAULT = 'en';
|
|
110
|
+
this.LOCALE_DEFAULT = 'en-EN';
|
|
111
|
+
this.LANG_ID_DEFAULT = 1;
|
|
112
|
+
this.maxTimeExecutionMs = 15000;
|
|
113
|
+
this.liveTimestamp = 0;
|
|
114
|
+
this._liveTimestampReset = false;
|
|
115
|
+
this.liveRecivedIsFullPackage = false;
|
|
116
|
+
this.isNotActive = false;
|
|
117
|
+
// const uri = new URL(baseUrl)
|
|
118
|
+
IS_DEV_MODE = isDev;
|
|
119
|
+
// this._ENDPOINT_DOMAIN = uri.origin;
|
|
120
|
+
this.maxTimeExecutionMs = maxTimeExecutionMs;
|
|
121
|
+
this.axi = axiosInstance;
|
|
122
|
+
this.setBaseUrl(baseUrl);
|
|
123
|
+
this.setLanguage(lang);
|
|
124
|
+
}
|
|
125
|
+
// #region Getters & Setters -----------------------------------------------------------
|
|
126
|
+
get locale() {
|
|
127
|
+
return this._locale;
|
|
128
|
+
}
|
|
129
|
+
get isSinged() {
|
|
130
|
+
return this.user !== undefined && this.user.UserId !== undefined && this.user.UserId > 0;
|
|
131
|
+
}
|
|
132
|
+
get user() {
|
|
133
|
+
return this._USER_DATA;
|
|
134
|
+
}
|
|
135
|
+
set user(value) {
|
|
136
|
+
this._USER_DATA = value;
|
|
137
|
+
}
|
|
138
|
+
get lang() {
|
|
139
|
+
return this._lang;
|
|
140
|
+
}
|
|
141
|
+
get languageId() {
|
|
142
|
+
return this._languageId;
|
|
143
|
+
}
|
|
144
|
+
get token() {
|
|
145
|
+
var _a;
|
|
146
|
+
return (_a = this._TOKEN) !== null && _a !== void 0 ? _a : undefined;
|
|
147
|
+
}
|
|
148
|
+
set token(value) {
|
|
149
|
+
if (typeof value === 'string') {
|
|
150
|
+
this._TOKEN = value.split(/\s*,\s*/)[0];
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
this._TOKEN = undefined;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
// #endregion Getters & Setters -----------------------------------------------------------
|
|
157
|
+
// #region Handlers -----------------------------------------------------------------------
|
|
158
|
+
/**
|
|
159
|
+
* Processes the response data and returns an object with data, error, status and status text.
|
|
160
|
+
*
|
|
161
|
+
* @template T - Тип данных, возвращаемых в поле `data`.
|
|
162
|
+
* @param {any} rawData - Сырые данные ответа.
|
|
163
|
+
* @param {number} status - HTTP статус ответа.
|
|
164
|
+
* @param {string} statusText - Текст статуса HTTP ответа.
|
|
165
|
+
* @returns {{ data: T, error: string | null, status: number, statusText: string }} Объект, содержащий данные ответа, ошибку, статус и текст статуса.
|
|
166
|
+
*/
|
|
167
|
+
responseHandlerData(rawData, status, statusText) {
|
|
168
|
+
var _a, _b, _c;
|
|
169
|
+
let data = null;
|
|
170
|
+
if (((_a = rawData === null || rawData === void 0 ? void 0 : rawData.Data) === null || _a === void 0 ? void 0 : _a.Data) !== undefined) {
|
|
171
|
+
data = rawData.Data.Data;
|
|
172
|
+
}
|
|
173
|
+
else if (((_b = rawData === null || rawData === void 0 ? void 0 : rawData.Data) === null || _b === void 0 ? void 0 : _b._isSuccessful) !== undefined) {
|
|
174
|
+
data = rawData.Data._isSuccessful;
|
|
175
|
+
}
|
|
176
|
+
else if ((rawData === null || rawData === void 0 ? void 0 : rawData.Data) !== undefined) {
|
|
177
|
+
data = rawData.Data;
|
|
178
|
+
}
|
|
179
|
+
else if (rawData !== undefined) {
|
|
180
|
+
data = rawData;
|
|
181
|
+
}
|
|
182
|
+
// const data: T = rawData?.Data?.Data ?? rawData?.Data ?? rawData ?? null as T;
|
|
183
|
+
const error = ((_c = rawData === null || rawData === void 0 ? void 0 : rawData.Data) === null || _c === void 0 ? void 0 : _c.Error) || (rawData === null || rawData === void 0 ? void 0 : rawData.Error) || (status !== 200 ? statusText : null) || (!data ? 'Unknown error' : null);
|
|
184
|
+
if (error === 'Object reference not set to an instance of an object.') {
|
|
185
|
+
console.log('!!!!!!!!!!! Object reference not set to an instance of an object.');
|
|
186
|
+
}
|
|
187
|
+
return { data, error, status, statusText };
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Converts rawData.Data.Data format to rawData.Data.data format
|
|
191
|
+
* Sometimes API returns a format that is difficult to process later.
|
|
192
|
+
* Therefore it is necessary to convert the format for proper data processing (responseHandlerData)
|
|
193
|
+
* @param rawData
|
|
194
|
+
* @returns
|
|
195
|
+
*/
|
|
196
|
+
convertDataData(rawData) {
|
|
197
|
+
var _a;
|
|
198
|
+
if (((_a = rawData === null || rawData === void 0 ? void 0 : rawData.Data) === null || _a === void 0 ? void 0 : _a.Data) !== undefined) {
|
|
199
|
+
const keys = Object.keys(rawData.Data);
|
|
200
|
+
if (keys.length > 0) {
|
|
201
|
+
const data = {};
|
|
202
|
+
keys.forEach(key => {
|
|
203
|
+
var _a;
|
|
204
|
+
data[key.toLowerCase()] = (_a = rawData.Data[key]) !== null && _a !== void 0 ? _a : null;
|
|
205
|
+
});
|
|
206
|
+
return data;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return rawData;
|
|
210
|
+
}
|
|
211
|
+
setDevMode(devMode) {
|
|
212
|
+
if (devMode === undefined) {
|
|
213
|
+
IS_DEV_MODE = true;
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
IS_DEV_MODE = devMode;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Adds new locale keys and values to the existing locales.
|
|
221
|
+
* Updates the list of existing languages with any new language codes found in the provided data.
|
|
222
|
+
*
|
|
223
|
+
* @param localesData - An object mapping locale keys to their translations
|
|
224
|
+
* @example
|
|
225
|
+
* // Add new translations
|
|
226
|
+
* betBoosterApi.addLocalesConverters({
|
|
227
|
+
* 'en': 'en-US',
|
|
228
|
+
* 'fr': 'fr-FR'
|
|
229
|
+
* });
|
|
230
|
+
*/
|
|
231
|
+
addLocalesConverters(localesData) {
|
|
232
|
+
this._locales = Object.assign(Object.assign({}, this._locales), localesData);
|
|
233
|
+
const el = new Set([...this.EXIST_LANGUAGES, ...Object.keys(this._locales)]);
|
|
234
|
+
this.EXIST_LANGUAGES = Array.from(el);
|
|
235
|
+
}
|
|
236
|
+
checkLanguage(lang = 'en') {
|
|
237
|
+
try {
|
|
238
|
+
const _lang = lang.substring(0, 2) || this.LANG_DEFAULT;
|
|
239
|
+
const isExistInLanguages = this.EXIST_LANGUAGES.includes(_lang);
|
|
240
|
+
return isExistInLanguages ? _lang : this.LANG_DEFAULT;
|
|
241
|
+
}
|
|
242
|
+
catch (error) {
|
|
243
|
+
return this.LANG_DEFAULT;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Sets the language for the BetBooster API.
|
|
248
|
+
*
|
|
249
|
+
* @param {string} [lang='en'] - The language code to set. Defaults to 'en' if not provided.
|
|
250
|
+
* @returns {string} - The language code that was set.
|
|
251
|
+
* @example
|
|
252
|
+
* ```
|
|
253
|
+
* api.setLanguage('en');
|
|
254
|
+
* ```
|
|
255
|
+
* as result:
|
|
256
|
+
* lang='en';
|
|
257
|
+
* locale='en-US';
|
|
258
|
+
* languageId=1;
|
|
259
|
+
*/
|
|
260
|
+
setLanguage(lang = 'en') {
|
|
261
|
+
var _a, _b;
|
|
262
|
+
this._lang = this.checkLanguage(lang);
|
|
263
|
+
this._locale = (_a = this._locales[this._lang]) !== null && _a !== void 0 ? _a : this.LOCALE_DEFAULT;
|
|
264
|
+
this._languageId = (_b = this._languageIdsRemote[this._lang]) !== null && _b !== void 0 ? _b : this.LANG_ID_DEFAULT;
|
|
265
|
+
return this._lang;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Sets the language and locale for the remote API.
|
|
269
|
+
* @param lang Language (default 'en').
|
|
270
|
+
* @returns Returns true if the language and locale are successfully set, otherwise returns false.
|
|
271
|
+
*/
|
|
272
|
+
async setLanguageRemoteLocale(lang = 'en') {
|
|
273
|
+
this.setLanguage(lang);
|
|
274
|
+
if (this.isSinged) {
|
|
275
|
+
const url = this.url(`/account/SetLanguage`, api.LBC);
|
|
276
|
+
const res = await this.POST(url, { culture: this.locale });
|
|
277
|
+
return res || false;
|
|
278
|
+
}
|
|
279
|
+
return undefined;
|
|
280
|
+
}
|
|
281
|
+
setBaseUrl(baseUrl) {
|
|
282
|
+
if (baseUrl.endsWith('/')) {
|
|
283
|
+
baseUrl = baseUrl.slice(0, -1);
|
|
284
|
+
}
|
|
285
|
+
this._baseUrl = baseUrl;
|
|
286
|
+
return this._baseUrl;
|
|
287
|
+
}
|
|
288
|
+
statusHandler(status, statusText) {
|
|
289
|
+
if (status === 401) {
|
|
290
|
+
this.user = {};
|
|
291
|
+
this.token = undefined;
|
|
292
|
+
if (IS_DEV_MODE)
|
|
293
|
+
console.log('Status:', status, statusText);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Query string handler. Replaces values
|
|
298
|
+
* * `null` на `'null'`
|
|
299
|
+
* * `false` на `'false'`
|
|
300
|
+
* * `true` на `'true'`
|
|
301
|
+
* * `undefined` на `''`
|
|
302
|
+
* @param queryStringData - queryString Record<string, any>
|
|
303
|
+
* @returns The processed data of the query string.
|
|
304
|
+
*/
|
|
305
|
+
queryStringHandler(queryStringData = {}) {
|
|
306
|
+
const keys = Object.keys(queryStringData);
|
|
307
|
+
keys.forEach(key => {
|
|
308
|
+
if (queryStringData[key] === null) {
|
|
309
|
+
queryStringData[key] = 'null';
|
|
310
|
+
}
|
|
311
|
+
else if (queryStringData[key] === true) {
|
|
312
|
+
queryStringData[key] = 'true';
|
|
313
|
+
}
|
|
314
|
+
else if (queryStringData[key] === false) {
|
|
315
|
+
queryStringData[key] = 'false';
|
|
316
|
+
}
|
|
317
|
+
else if (queryStringData[key] === undefined) {
|
|
318
|
+
queryStringData[key] = '';
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
return queryStringData;
|
|
322
|
+
}
|
|
323
|
+
responseHandler(response) {
|
|
324
|
+
var _a, _b, _c, _d;
|
|
325
|
+
const xToken = (_b = (_a = response === null || response === void 0 ? void 0 : response.headers['x-token']) !== null && _a !== void 0 ? _a : response === null || response === void 0 ? void 0 : response.headers['X-token']) !== null && _b !== void 0 ? _b : null;
|
|
326
|
+
// console.log('x-token:', response?.headers['x-token']);
|
|
327
|
+
// console.log('X-token:', response?.headers['X-token']);
|
|
328
|
+
if (IS_DEV_MODE && ((_c = response === null || response === void 0 ? void 0 : response.request) === null || _c === void 0 ? void 0 : _c.path))
|
|
329
|
+
console.log((_d = response === null || response === void 0 ? void 0 : response.request) === null || _d === void 0 ? void 0 : _d.path);
|
|
330
|
+
if (xToken) {
|
|
331
|
+
this.token = xToken;
|
|
332
|
+
if (IS_DEV_MODE)
|
|
333
|
+
console.log('isSinged:', this.isSinged + '\nX-Token:', xToken);
|
|
334
|
+
}
|
|
335
|
+
;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Error Handler for Axios.
|
|
339
|
+
*
|
|
340
|
+
* @param error - AxiosError object.
|
|
341
|
+
* @returns An object with error data, including the status and text of the error.
|
|
342
|
+
*/
|
|
343
|
+
axiosErrorHandler(error) {
|
|
344
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
345
|
+
let errorMessage;
|
|
346
|
+
let status = (_b = (_a = error.response) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : null;
|
|
347
|
+
let statusText = (_d = (_c = error.response) === null || _c === void 0 ? void 0 : _c.statusText) !== null && _d !== void 0 ? _d : null;
|
|
348
|
+
const response = (_e = error.response) !== null && _e !== void 0 ? _e : null;
|
|
349
|
+
// const request = err.request ?? null;
|
|
350
|
+
if (response) {
|
|
351
|
+
// Server responded with a status other than 200 range
|
|
352
|
+
// console.log('err.response.request.url:', response.request.url)
|
|
353
|
+
const brMessage = [
|
|
354
|
+
...(status ? [status] : []),
|
|
355
|
+
...(statusText ? [statusText] : []),
|
|
356
|
+
...(((_f = response === null || response === void 0 ? void 0 : response.data) === null || _f === void 0 ? void 0 : _f.Message) ? [response.data.Message] : []),
|
|
357
|
+
...(((_g = response === null || response === void 0 ? void 0 : response.data) === null || _g === void 0 ? void 0 : _g.MessageDetail) ? [response.data.MessageDetail] : []),
|
|
358
|
+
].join(' > ');
|
|
359
|
+
// errorMessage = `Error: ${brMessage}`;
|
|
360
|
+
errorMessage = brMessage;
|
|
361
|
+
if (IS_DEV_MODE) {
|
|
362
|
+
const requestMethod = ((_h = response.config.method) !== null && _h !== void 0 ? _h : '').toUpperCase();
|
|
363
|
+
const fullUrl = response.config.url;
|
|
364
|
+
const requestData = response.config.data;
|
|
365
|
+
console.log('```');
|
|
366
|
+
console.log('ERROR:', requestMethod, fullUrl);
|
|
367
|
+
console.log('DATA:', requestData);
|
|
368
|
+
console.log('RESPONCE:', response === null || response === void 0 ? void 0 : response.data);
|
|
369
|
+
console.log('```');
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
else if (error.request) {
|
|
373
|
+
// Request was made but no response was received
|
|
374
|
+
errorMessage = `Error: No response received`;
|
|
375
|
+
// 503 Service Unavailable
|
|
376
|
+
status = 503;
|
|
377
|
+
statusText = 'Service Unavailable';
|
|
378
|
+
}
|
|
379
|
+
else {
|
|
380
|
+
// Something else caused the error
|
|
381
|
+
errorMessage = `Error: ${error === null || error === void 0 ? void 0 : error.message}`;
|
|
382
|
+
status = 601;
|
|
383
|
+
statusText = (error === null || error === void 0 ? void 0 : error.message) || 'Unknown error';
|
|
384
|
+
}
|
|
385
|
+
console.error('Axios request error:', errorMessage);
|
|
386
|
+
return {
|
|
387
|
+
data: null,
|
|
388
|
+
status,
|
|
389
|
+
// statusText,
|
|
390
|
+
statusText: errorMessage || statusText || 'Unknown error',
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Returns the URL for the specified API path and version.
|
|
395
|
+
*
|
|
396
|
+
* @param apiPath - API Pathway.
|
|
397
|
+
* @param apiVersion - API Version.
|
|
398
|
+
* @returns URL for the specified API path and version.
|
|
399
|
+
*/
|
|
400
|
+
url(apiPath, apiVersion) {
|
|
401
|
+
if (apiPath.toLowerCase().startsWith('http')) {
|
|
402
|
+
return apiPath;
|
|
403
|
+
}
|
|
404
|
+
switch (apiVersion) {
|
|
405
|
+
case api.V2:
|
|
406
|
+
return `${this._baseUrl}/v2/bsw/api${apiPath}`;
|
|
407
|
+
case api.NV20:
|
|
408
|
+
return `${this._baseUrl}/nv20${apiPath}`;
|
|
409
|
+
// return `${this._baseUrl}${this._APIv2}${apiPath}`
|
|
410
|
+
case api.LBC:
|
|
411
|
+
return `${this._baseUrl}/v2/lbc/api${apiPath}`;
|
|
412
|
+
// return `${this._baseUrl}${this._API_LBC}${apiPath}`
|
|
413
|
+
case api.DIRECT:
|
|
414
|
+
return `${this._baseUrl}${apiPath}`;
|
|
415
|
+
case api.V1:
|
|
416
|
+
default:
|
|
417
|
+
return `${this._baseUrl}/api${apiPath}`;
|
|
418
|
+
// return `${this._baseUrl}${this._APIv1}${apiPath}`
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
// #endregion Handlers --------------------------------------------------------------------
|
|
422
|
+
// #region AXIOS --------------------------------------------------------------------------
|
|
423
|
+
/**
|
|
424
|
+
* Executes an HTTP request with the specified parameters.
|
|
425
|
+
* @param url - The URL to execute the request.
|
|
426
|
+
* @returns An object that contains methods for configuring the request and executing the request.
|
|
427
|
+
*/
|
|
428
|
+
request(url) {
|
|
429
|
+
const queryStringHandler = this.queryStringHandler;
|
|
430
|
+
const axi = this.axi;
|
|
431
|
+
const axiosErrorHandler = this.axiosErrorHandler;
|
|
432
|
+
const statusHandler = (status, statusText) => {
|
|
433
|
+
if (status === 401) {
|
|
434
|
+
this.user = {};
|
|
435
|
+
this.token = undefined;
|
|
436
|
+
if (IS_DEV_MODE)
|
|
437
|
+
console.log('Status:', status, statusText);
|
|
438
|
+
}
|
|
439
|
+
};
|
|
440
|
+
/** Error Handler and Notification */
|
|
441
|
+
const handleError = async (errorData) => {
|
|
442
|
+
var _a, _b, _c;
|
|
443
|
+
try {
|
|
444
|
+
console.error(errorData);
|
|
445
|
+
const text = [
|
|
446
|
+
typeof window !== 'undefined' ? window.location.href : 'url: unknown',
|
|
447
|
+
(_a = errorData === null || errorData === void 0 ? void 0 : errorData.error) !== null && _a !== void 0 ? _a : null,
|
|
448
|
+
].filter(Boolean).join('\n');
|
|
449
|
+
let code = '';
|
|
450
|
+
try {
|
|
451
|
+
code = (_b = JSON.stringify(errorData, null, 2)) !== null && _b !== void 0 ? _b : 'Unknown error';
|
|
452
|
+
}
|
|
453
|
+
catch (e) {
|
|
454
|
+
code = (_c = errorData === null || errorData === void 0 ? void 0 : errorData.error) !== null && _c !== void 0 ? _c : 'Unknown error';
|
|
455
|
+
}
|
|
456
|
+
await this.sendErrInfo(text, code);
|
|
457
|
+
}
|
|
458
|
+
catch (error) { }
|
|
459
|
+
};
|
|
460
|
+
const responseHandler = (response) => {
|
|
461
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
462
|
+
// console.log('responseHandler:', response);
|
|
463
|
+
// console.log('Response body:', response.data);
|
|
464
|
+
// console.log('Response response?.config:', response?.config);
|
|
465
|
+
const xToken = (_a = response === null || response === void 0 ? void 0 : response.headers['x-token']) !== null && _a !== void 0 ? _a : null;
|
|
466
|
+
const urlPath = (_c = (_b = response === null || response === void 0 ? void 0 : response.request) === null || _b === void 0 ? void 0 : _b.path) !== null && _c !== void 0 ? _c : null;
|
|
467
|
+
// if (response?.data?.Error === 'Object reference not set to an instance of an object.') {
|
|
468
|
+
if ((_d = response === null || response === void 0 ? void 0 : response.data) === null || _d === void 0 ? void 0 : _d.Error) {
|
|
469
|
+
const Method = ((_f = (_e = response === null || response === void 0 ? void 0 : response.config) === null || _e === void 0 ? void 0 : _e.method) !== null && _f !== void 0 ? _f : '').toUpperCase();
|
|
470
|
+
const errorData = Object.assign(Object.assign(Object.assign({ method: Method, url: ((_g = response === null || response === void 0 ? void 0 : response.config) === null || _g === void 0 ? void 0 : _g.url) || '' }, (!!((_h = response === null || response === void 0 ? void 0 : response.config) === null || _h === void 0 ? void 0 : _h.params) ? { params: (_k = (_j = response === null || response === void 0 ? void 0 : response.config) === null || _j === void 0 ? void 0 : _j.params) !== null && _k !== void 0 ? _k : '' } : {})), (!!((_l = response === null || response === void 0 ? void 0 : response.config) === null || _l === void 0 ? void 0 : _l.data) ? { POST: (_o = (_m = response === null || response === void 0 ? void 0 : response.config) === null || _m === void 0 ? void 0 : _m.data) !== null && _o !== void 0 ? _o : '' } : {})), { error: (_p = response === null || response === void 0 ? void 0 : response.data) === null || _p === void 0 ? void 0 : _p.Error });
|
|
471
|
+
handleError(errorData);
|
|
472
|
+
}
|
|
473
|
+
if (IS_DEV_MODE && urlPath)
|
|
474
|
+
console.log(urlPath);
|
|
475
|
+
if (xToken) {
|
|
476
|
+
this.token = xToken;
|
|
477
|
+
if (IS_DEV_MODE)
|
|
478
|
+
console.log('isSinged:', this.isSinged + '\nX-Token:', xToken);
|
|
479
|
+
}
|
|
480
|
+
;
|
|
481
|
+
};
|
|
482
|
+
const now = Date.now();
|
|
483
|
+
const abortController = new AbortController();
|
|
484
|
+
const signal = setTimeout(() => {
|
|
485
|
+
abortController.abort();
|
|
486
|
+
}, this.maxTimeExecutionMs);
|
|
487
|
+
const requestConfig = {
|
|
488
|
+
url,
|
|
489
|
+
method: 'GET',
|
|
490
|
+
params: { _: now },
|
|
491
|
+
headers: Object.assign({}, (this.token ? { 'X-Token': this.token } : {})),
|
|
492
|
+
responseType: 'json',
|
|
493
|
+
signal: abortController.signal,
|
|
494
|
+
};
|
|
495
|
+
return {
|
|
496
|
+
/**
|
|
497
|
+
* Executes a query with the specified parameters.
|
|
498
|
+
* @param queryParams - Query Parameters.
|
|
499
|
+
* @returns An instance of BetBoosterOfficeApi class.
|
|
500
|
+
*/
|
|
501
|
+
query(queryParams = {}) {
|
|
502
|
+
const query = queryStringHandler(queryParams);
|
|
503
|
+
requestConfig.params = Object.assign(Object.assign({}, query), requestConfig.params);
|
|
504
|
+
return this;
|
|
505
|
+
},
|
|
506
|
+
/**
|
|
507
|
+
* Sets the headers of the request.Sets the headers of the request.
|
|
508
|
+
* @param headers - Query header object.
|
|
509
|
+
* @returns An instance of BetBoosterOfficeApi class.
|
|
510
|
+
*/
|
|
511
|
+
headers(headers = {}) {
|
|
512
|
+
requestConfig.headers = Object.assign(Object.assign({}, requestConfig.headers), headers);
|
|
513
|
+
return this;
|
|
514
|
+
},
|
|
515
|
+
deleteAllHeaders() {
|
|
516
|
+
delete requestConfig.headers;
|
|
517
|
+
return this;
|
|
518
|
+
},
|
|
519
|
+
/**
|
|
520
|
+
* Sets the method of the GET request.
|
|
521
|
+
* @returns An instance of BetBoosterOfficeApi class.
|
|
522
|
+
*/
|
|
523
|
+
GET() {
|
|
524
|
+
requestConfig.method = 'GET';
|
|
525
|
+
return this;
|
|
526
|
+
},
|
|
527
|
+
/**
|
|
528
|
+
* Sets the POST request method.
|
|
529
|
+
* @param payload - The payload for the enquiry.
|
|
530
|
+
* @returns An instance of BetBoosterOfficeApi class.
|
|
531
|
+
*/
|
|
532
|
+
POST(payload = {}) {
|
|
533
|
+
requestConfig.method = 'POST';
|
|
534
|
+
requestConfig.data = payload;
|
|
535
|
+
return this;
|
|
536
|
+
},
|
|
537
|
+
/**
|
|
538
|
+
* Устанавливает метод запроса PUT и устанавливает тело запроса.
|
|
539
|
+
* @param payload - Данные, которые будут отправлены в теле запроса.
|
|
540
|
+
* @returns Экземпляр класса BetBoosterOfficeApi с установленным методом запроса PUT и телом запроса.
|
|
541
|
+
*/
|
|
542
|
+
PUT(payload = {}) {
|
|
543
|
+
requestConfig.method = 'PUT';
|
|
544
|
+
requestConfig.data = payload;
|
|
545
|
+
return this;
|
|
546
|
+
},
|
|
547
|
+
/**
|
|
548
|
+
* Устанавливает метод запроса DELETE.
|
|
549
|
+
* @param payload Данные запроса в формате объекта или записи.
|
|
550
|
+
* @returns Экземпляр класса BetBoosterOfficeApi.
|
|
551
|
+
*/
|
|
552
|
+
DELETE(payload = {}) {
|
|
553
|
+
requestConfig.method = 'DELETE';
|
|
554
|
+
requestConfig.data = payload;
|
|
555
|
+
return this;
|
|
556
|
+
},
|
|
557
|
+
/**
|
|
558
|
+
* Выполняет запрос к API.
|
|
559
|
+
*
|
|
560
|
+
* @returns Объект, содержащий данные, статус и текст статуса ответа.
|
|
561
|
+
* ```
|
|
562
|
+
* { data, status, statusText }
|
|
563
|
+
* ```
|
|
564
|
+
*/
|
|
565
|
+
async exec() {
|
|
566
|
+
if (requestConfig.method !== 'GET') {
|
|
567
|
+
delete requestConfig.params._;
|
|
568
|
+
}
|
|
569
|
+
const response = axi.request(requestConfig)
|
|
570
|
+
.then(response => {
|
|
571
|
+
responseHandler(response);
|
|
572
|
+
return response;
|
|
573
|
+
})
|
|
574
|
+
.catch(axiosErrorHandler)
|
|
575
|
+
.finally(() => clearTimeout(signal));
|
|
576
|
+
const { data, status, statusText } = await response;
|
|
577
|
+
statusHandler(status, statusText);
|
|
578
|
+
return { data, status, statusText };
|
|
579
|
+
},
|
|
580
|
+
/**
|
|
581
|
+
* Получает значение.
|
|
582
|
+
* @returns Промис, который разрешается с данными.
|
|
583
|
+
*/
|
|
584
|
+
async value() {
|
|
585
|
+
const { data } = await this.exec();
|
|
586
|
+
await data;
|
|
587
|
+
}
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* Sends a GET request to the specified endpoint with optional query parameters and options.
|
|
592
|
+
* @param url - The endpoint to send the GET request to.
|
|
593
|
+
* @param queryParams - The query parameters to include in the request URL. Defaults to an empty object.
|
|
594
|
+
* @param headers - The options to include in the request. Defaults to an empty object.
|
|
595
|
+
* @returns A Promise that resolves to the response body of the GET request.
|
|
596
|
+
*/
|
|
597
|
+
async GET(url, queryParams = {}, headers = {}) {
|
|
598
|
+
const abortController = new AbortController();
|
|
599
|
+
const signal = setTimeout(() => {
|
|
600
|
+
abortController.abort();
|
|
601
|
+
}, this.maxTimeExecutionMs);
|
|
602
|
+
const requestConfig = {
|
|
603
|
+
params: this.queryStringHandler(queryParams),
|
|
604
|
+
headers: Object.assign(Object.assign({}, (this.token ? { 'X-Token': this.token } : {})), (headers !== null && headers !== void 0 ? headers : {})),
|
|
605
|
+
responseType: 'json',
|
|
606
|
+
signal: abortController.signal,
|
|
607
|
+
};
|
|
608
|
+
const response = this.axi.get(url, requestConfig)
|
|
609
|
+
.then(response => {
|
|
610
|
+
this.responseHandler(response);
|
|
611
|
+
return response;
|
|
612
|
+
})
|
|
613
|
+
.catch(this.axiosErrorHandler)
|
|
614
|
+
.finally(() => clearTimeout(signal));
|
|
615
|
+
const { data, status, statusText } = await response;
|
|
616
|
+
this.statusHandler(status, statusText);
|
|
617
|
+
return data;
|
|
618
|
+
}
|
|
619
|
+
async POST(url, payload = {}, queryParams = {}, headers = {}) {
|
|
620
|
+
const abortController = new AbortController();
|
|
621
|
+
const signal = setTimeout(() => {
|
|
622
|
+
abortController.abort();
|
|
623
|
+
}, this.maxTimeExecutionMs);
|
|
624
|
+
const requestConfig = {
|
|
625
|
+
params: this.queryStringHandler(queryParams),
|
|
626
|
+
headers: Object.assign(Object.assign({}, (this.token ? { 'X-Token': this.token } : {})), (headers !== null && headers !== void 0 ? headers : {})),
|
|
627
|
+
responseType: 'json',
|
|
628
|
+
signal: abortController.signal,
|
|
629
|
+
};
|
|
630
|
+
const response = this.axi.post(url, payload, requestConfig)
|
|
631
|
+
.then(response => {
|
|
632
|
+
this.responseHandler(response);
|
|
633
|
+
return response;
|
|
634
|
+
})
|
|
635
|
+
.catch(this.axiosErrorHandler)
|
|
636
|
+
.finally(() => clearTimeout(signal));
|
|
637
|
+
const axiData = await response;
|
|
638
|
+
// console.log(axiData);
|
|
639
|
+
const { data, status, statusText } = axiData;
|
|
640
|
+
this.statusHandler(status, statusText);
|
|
641
|
+
return data;
|
|
642
|
+
}
|
|
643
|
+
async DELETE(url, payload = {}, queryParams = {}, headers = {}) {
|
|
644
|
+
const abortController = new AbortController();
|
|
645
|
+
const signal = setTimeout(() => {
|
|
646
|
+
abortController.abort();
|
|
647
|
+
}, this.maxTimeExecutionMs);
|
|
648
|
+
const requestConfig = {
|
|
649
|
+
params: this.queryStringHandler(queryParams),
|
|
650
|
+
headers: Object.assign(Object.assign({}, (this.token ? { 'X-Token': this.token } : {})), (headers !== null && headers !== void 0 ? headers : {})),
|
|
651
|
+
responseType: 'json',
|
|
652
|
+
signal: abortController.signal,
|
|
653
|
+
data: payload,
|
|
654
|
+
};
|
|
655
|
+
const response = this.axi.delete(url, requestConfig)
|
|
656
|
+
.then(response => {
|
|
657
|
+
this.responseHandler(response);
|
|
658
|
+
return response;
|
|
659
|
+
})
|
|
660
|
+
.catch(this.axiosErrorHandler)
|
|
661
|
+
.finally(() => clearTimeout(signal));
|
|
662
|
+
const { data, status, statusText } = await response;
|
|
663
|
+
this.statusHandler(status, statusText);
|
|
664
|
+
return data;
|
|
665
|
+
}
|
|
666
|
+
async PUT(url, payload = {}, queryParams = {}, headers = {}) {
|
|
667
|
+
const abortController = new AbortController();
|
|
668
|
+
const signal = setTimeout(() => {
|
|
669
|
+
abortController.abort();
|
|
670
|
+
}, this.maxTimeExecutionMs);
|
|
671
|
+
const requestConfig = {
|
|
672
|
+
params: this.queryStringHandler(queryParams),
|
|
673
|
+
headers: Object.assign(Object.assign({}, (this.token ? { 'X-Token': this.token } : {})), (headers !== null && headers !== void 0 ? headers : {})),
|
|
674
|
+
responseType: 'json',
|
|
675
|
+
signal: abortController.signal,
|
|
676
|
+
};
|
|
677
|
+
const response = this.axi.put(url, payload, requestConfig)
|
|
678
|
+
.then(response => {
|
|
679
|
+
this.responseHandler(response);
|
|
680
|
+
return response;
|
|
681
|
+
})
|
|
682
|
+
.catch(this.axiosErrorHandler)
|
|
683
|
+
.finally(() => clearTimeout(signal));
|
|
684
|
+
const { data, status, statusText } = await response;
|
|
685
|
+
this.statusHandler(status, statusText);
|
|
686
|
+
return data;
|
|
687
|
+
}
|
|
688
|
+
// #endregion AXIOS --------------------------------------------------------------------^^^
|
|
689
|
+
/**
|
|
690
|
+
* Returns the list of prematch sports
|
|
691
|
+
*
|
|
692
|
+
* @param minutes The number of minutes to consider for the data retrieval. Defaults to 0.
|
|
693
|
+
* @returns {Promise<Array<any>>} A promise that resolves to an array of line sports data.
|
|
694
|
+
*/
|
|
695
|
+
async getLineSports(minutes = 0) {
|
|
696
|
+
var _a;
|
|
697
|
+
// const url = this.url(`/line/${this.locale}/sports/${minutes}`);
|
|
698
|
+
// +TODO Включить когда обновиться продакшен
|
|
699
|
+
const url = +minutes > 0
|
|
700
|
+
? this.url(`/line/${this.locale}/sports/${minutes}`)
|
|
701
|
+
: this.url(`/line/${this.locale}/allSports`);
|
|
702
|
+
// console.log(url)
|
|
703
|
+
const response = (_a = (await this.GET(url, {}, {}))) !== null && _a !== void 0 ? _a : [];
|
|
704
|
+
// console.log(JSON.stringify(response, null, 2));
|
|
705
|
+
return response;
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Retrieves the hot prematch events
|
|
709
|
+
* @returns {Promise<Array<any>>} A promise that resolves to an array of hot events.
|
|
710
|
+
*/
|
|
711
|
+
async getHotEvents() {
|
|
712
|
+
var _a;
|
|
713
|
+
const url = this.url(`/line/${this.locale}/hotevents`);
|
|
714
|
+
// console.log(url)
|
|
715
|
+
return (_a = (await this.GET(url, {}, {}))) !== null && _a !== void 0 ? _a : [];
|
|
716
|
+
}
|
|
717
|
+
/**
|
|
718
|
+
* Получает список стран для указанного идентификатора спорта.
|
|
719
|
+
* @param sportId - Идентификатор спорта.
|
|
720
|
+
* @param minutes - Опциональный параметр, количество минут.
|
|
721
|
+
* @returns Промис, который разрешается в массив объектов типа ICountry.
|
|
722
|
+
*/
|
|
723
|
+
async getCountriesList(sportId, minutes = 0) {
|
|
724
|
+
var _a;
|
|
725
|
+
const url = this.url(`/line/${this.locale}/countries/sport${sportId}/${minutes}`);
|
|
726
|
+
// console.log(url)
|
|
727
|
+
return (_a = (await this.GET(url, {}, {}))) !== null && _a !== void 0 ? _a : [];
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* Retrieves prematch tournaments based on the specified sport ID, country ID, and minutes.
|
|
731
|
+
* @param sportId - The ID of the sport.
|
|
732
|
+
* @param countryId - The ID of the country.
|
|
733
|
+
* @param minutes - The number of minutes ago for which data is to be retrieved.
|
|
734
|
+
* @returns A promise that resolves to an array of prematch tournaments.
|
|
735
|
+
*/
|
|
736
|
+
async getPrematchTournaments(sportId, countryId, minutes = 0) {
|
|
737
|
+
var _a;
|
|
738
|
+
const url = this.url(`/line/${this.locale}/tournaments/sport${sportId}/country${countryId}/${minutes}`);
|
|
739
|
+
// console.log(url)
|
|
740
|
+
return (_a = (await this.GET(url, {}, {}))) !== null && _a !== void 0 ? _a : [];
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* Retrieves prematch tournaments based on the specified sport ID and minutes.
|
|
744
|
+
* @param sportId - The ID of the sport.
|
|
745
|
+
* @param minutes - The number of minutes ago for which data is to be retrieved.
|
|
746
|
+
* @returns A filtered list of prematch tournaments.
|
|
747
|
+
*/
|
|
748
|
+
async getPrematchTournamentsByMinutes(sportId = 0, minutes = 0) {
|
|
749
|
+
var _a;
|
|
750
|
+
const url = this.url(`/line/${this.locale}/events/full/sport${sportId}/${minutes}`);
|
|
751
|
+
const list = (_a = (await this.GET(url, {}, {}))) !== null && _a !== void 0 ? _a : [];
|
|
752
|
+
return list.filter((item) => { var _a; return ((_a = item === null || item === void 0 ? void 0 : item.EventsHeaders) !== null && _a !== void 0 ? _a : []).length > 0; });
|
|
753
|
+
}
|
|
754
|
+
/**
|
|
755
|
+
* Retrieves the headers of prematch tournaments based on the specified sport ID and minutes.
|
|
756
|
+
* @param sportId The ID of the sport. Defaults to 0 if not provided.
|
|
757
|
+
* @param minutes - The number of minutes ago for which data is to be retrieved.
|
|
758
|
+
* @returns A promise that resolves to an array of tournament headers.
|
|
759
|
+
*/
|
|
760
|
+
async getPrematchTournamentsHeadersByMinutes(sportId = 0, minutes = 0) {
|
|
761
|
+
var _a;
|
|
762
|
+
// const hours = Math.round(minutes / 60);
|
|
763
|
+
const url = this.url(`/line/${this.locale}/tournaments/headers/sport${sportId}/${minutes}`);
|
|
764
|
+
const list = (_a = (await this.GET(url, {}, {}))) !== null && _a !== void 0 ? _a : [];
|
|
765
|
+
// console.log(list);
|
|
766
|
+
return list;
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
769
|
+
* Retrieves prematch events based on the specified parameters.
|
|
770
|
+
* @param sportId - The ID of the sport.
|
|
771
|
+
* @param countryId - The ID of the country.
|
|
772
|
+
* @param tournamentId - The ID of the tournament.
|
|
773
|
+
* @param minutes - The number of minutes ago for which data is to be retrieved.
|
|
774
|
+
* @returns A Promise that resolves to an array of prematch events.
|
|
775
|
+
*/
|
|
776
|
+
async getPrematchEvents(sportId, countryId, tournamentId, minutes) {
|
|
777
|
+
var _a;
|
|
778
|
+
// ?TODO Хорошо бы сделать фильтр по нескольким турнирам.
|
|
779
|
+
const url = this.url(`/line/${this.locale}/events/sport${sportId}/country${countryId}/tourney${tournamentId}/${minutes}`);
|
|
780
|
+
const list = (_a = (await this.GET(url, {}, {}))) !== null && _a !== void 0 ? _a : [];
|
|
781
|
+
return list;
|
|
782
|
+
}
|
|
783
|
+
/**
|
|
784
|
+
* Sets or resets the live timestamp reset flag.
|
|
785
|
+
*
|
|
786
|
+
* @param value - Whether to enable live timestamp reset. Defaults to true.
|
|
787
|
+
*/
|
|
788
|
+
liveTimestampReset(value = true) {
|
|
789
|
+
this._liveTimestampReset = value;
|
|
790
|
+
}
|
|
791
|
+
/**
|
|
792
|
+
* Retrieves an array of live event headers with main bets.
|
|
793
|
+
* @description For interval request execution, the parameter ```this.liveTimestamp```
|
|
794
|
+
* stored in this class is used. After the request is executed, ```this.liveTimestamp```
|
|
795
|
+
* is updated from the response.
|
|
796
|
+
* @param requestFullEventsList - Flag indicating whether to request
|
|
797
|
+
* the full list of events or only changes since the previous request.
|
|
798
|
+
* @param events - Array of live event IDs. In this case, the selected live events are returned with all bets.
|
|
799
|
+
* @returns A promise that resolves to an array of live event data.
|
|
800
|
+
*/
|
|
801
|
+
async getLive(requestFullEventsList = false, events = []) {
|
|
802
|
+
var _a;
|
|
803
|
+
let liveRecivedIsFullPackage = false;
|
|
804
|
+
if (requestFullEventsList || this._liveTimestampReset === true) {
|
|
805
|
+
this.liveTimestamp = 0;
|
|
806
|
+
this.liveTimestampReset(false);
|
|
807
|
+
}
|
|
808
|
+
const url = this.url(`/live/${this.locale}/full/${this.liveTimestamp}/0`);
|
|
809
|
+
const { data, status /* , statusText */ } = await this.request(url).GET().query({ events }).exec();
|
|
810
|
+
const { TimeStamp, LEvents, IsChanges } = data !== null && data !== void 0 ? data : {};
|
|
811
|
+
if (IsChanges === false) {
|
|
812
|
+
liveRecivedIsFullPackage = true;
|
|
813
|
+
}
|
|
814
|
+
else {
|
|
815
|
+
liveRecivedIsFullPackage = false;
|
|
816
|
+
}
|
|
817
|
+
if (status === 200) {
|
|
818
|
+
this.liveTimestamp = (_a = TimeStamp !== null && TimeStamp !== void 0 ? TimeStamp : this.liveTimestamp) !== null && _a !== void 0 ? _a : 0;
|
|
819
|
+
}
|
|
820
|
+
else {
|
|
821
|
+
this.liveTimestamp = 0;
|
|
822
|
+
}
|
|
823
|
+
return {
|
|
824
|
+
ts: +this.liveTimestamp,
|
|
825
|
+
events: LEvents !== null && LEvents !== void 0 ? LEvents : [],
|
|
826
|
+
isFullPackage: liveRecivedIsFullPackage,
|
|
827
|
+
};
|
|
828
|
+
}
|
|
829
|
+
/**
|
|
830
|
+
* Retrieves complete data on current live events without saving the timestamp.
|
|
831
|
+
* @returns A promise that resolves to an array of objects of type I.ILiveData.
|
|
832
|
+
*/
|
|
833
|
+
async getFullLiveWithoutSaveTimeStamp() {
|
|
834
|
+
var _a;
|
|
835
|
+
const url = this.url(`/live/${this.locale}/full/0/0`);
|
|
836
|
+
const res = (_a = await this.GET(url, {}, {})) !== null && _a !== void 0 ? _a : {};
|
|
837
|
+
const { LEvents } = res !== null && res !== void 0 ? res : {};
|
|
838
|
+
return LEvents !== null && LEvents !== void 0 ? LEvents : [];
|
|
839
|
+
}
|
|
840
|
+
/**
|
|
841
|
+
* Возвращает массив из одного полного лайв события со всеми ставками по ID .
|
|
842
|
+
* @param eventId - ID полного live события.
|
|
843
|
+
* @returns Массив с информацией о событии.
|
|
844
|
+
*/
|
|
845
|
+
async getLiveEventsAndFullEvent(eventId) {
|
|
846
|
+
var _a;
|
|
847
|
+
const url = this.url(`/live/${this.locale}/bets/${eventId}`);
|
|
848
|
+
const event = (_a = (await this.GET(url, {}, {}))) !== null && _a !== void 0 ? _a : {};
|
|
849
|
+
// console.log(list);
|
|
850
|
+
return [event];
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* Returns an array containing a single complete live event with all bets by ID.
|
|
854
|
+
* @param eventId - The ID of the complete live event.
|
|
855
|
+
* @returns An array with event information.
|
|
856
|
+
*/
|
|
857
|
+
async getLiveEventFull(eventId) {
|
|
858
|
+
const url = this.url(`/live/${this.locale}/bets/${eventId}`);
|
|
859
|
+
const { data /*, status , statusText */ } = await this.request(url).exec();
|
|
860
|
+
// console.log(data);
|
|
861
|
+
return data !== null && data !== void 0 ? data : null;
|
|
862
|
+
}
|
|
863
|
+
/**
|
|
864
|
+
* Retrieves a pre-match event by its ID.
|
|
865
|
+
* @param eventId - The event identifier.
|
|
866
|
+
* @returns The pre-match event object.
|
|
867
|
+
*/
|
|
868
|
+
async getEventPrematch(eventId) {
|
|
869
|
+
var _a;
|
|
870
|
+
const url = this.url(`/line/${this.locale}/event/${eventId}`);
|
|
871
|
+
const list = (_a = (await this.GET(url, {}, {}))) !== null && _a !== void 0 ? _a : {};
|
|
872
|
+
// console.log(list);
|
|
873
|
+
return list;
|
|
874
|
+
}
|
|
875
|
+
async verifyEmail(token) {
|
|
876
|
+
var _a;
|
|
877
|
+
// !TODO verifyEmail доделать верификацию пользователя.
|
|
878
|
+
const url = this.url(`/account/userActivationByEmail/${token}/${this.locale}`);
|
|
879
|
+
const list = (_a = (await this.GET(url, {}, {}))) !== null && _a !== void 0 ? _a : {};
|
|
880
|
+
// console.log(list);
|
|
881
|
+
return list;
|
|
882
|
+
}
|
|
883
|
+
/**
|
|
884
|
+
* Registers a new user.
|
|
885
|
+
* @param payload - Data for registration.
|
|
886
|
+
* @returns A promise that resolves with the registered user data.
|
|
887
|
+
* @example
|
|
888
|
+
* ```
|
|
889
|
+
* const payload = {
|
|
890
|
+
* PartnerSiteUid: string;
|
|
891
|
+
* FirstName?: string;
|
|
892
|
+
* MiddleName?: string;
|
|
893
|
+
* EmailOrPhone: string;
|
|
894
|
+
* CurrencyId?: number; // <- Refer to Swagger !!!
|
|
895
|
+
* PointId?: number; // <- Refer to Swagger !!!
|
|
896
|
+
* Password: string;
|
|
897
|
+
* PasswordRepeat: string;
|
|
898
|
+
* UrlRedirect?: string;
|
|
899
|
+
* EmailSubject?: string;
|
|
900
|
+
* EmailBody?: string;
|
|
901
|
+
* EmailFrom?: string;
|
|
902
|
+
* ConfirmUrl?: string;
|
|
903
|
+
* Culture?: string;
|
|
904
|
+
* }
|
|
905
|
+
* ```
|
|
906
|
+
*/
|
|
907
|
+
async signUp(payload) {
|
|
908
|
+
// !TODO signUp - Изменить. Передавать url редирикта и текст письма.
|
|
909
|
+
// ? Сделать-то сделал. Но не понятно как регистрировать без привязки к валюте. CurrencyId = null
|
|
910
|
+
Object.assign(payload, { Culture: this.locale });
|
|
911
|
+
const url = this.url(`/account/${this.locale}/registration`);
|
|
912
|
+
const list = (await this.POST(url, payload));
|
|
913
|
+
// console.log(list);
|
|
914
|
+
return list;
|
|
915
|
+
}
|
|
916
|
+
/**
|
|
917
|
+
* Registers a new user via email.
|
|
918
|
+
* ! NEW METHOD
|
|
919
|
+
* @param payload - Data for registration.
|
|
920
|
+
* @returns A promise that resolves with the registered user data.
|
|
921
|
+
* @example
|
|
922
|
+
* ```
|
|
923
|
+
* const payload = {
|
|
924
|
+
* "FirstName": "string",
|
|
925
|
+
* "MiddleName": "string",
|
|
926
|
+
* "EmailOrPhone": "string",
|
|
927
|
+
* "PointId": 0, // <- Refer to Swagger !!!
|
|
928
|
+
* "CurrencyId": 0, // <- Refer to Swagger !!!
|
|
929
|
+
* "Password": "string",
|
|
930
|
+
* "PasswordRepeat": "string",
|
|
931
|
+
* "Culture": "string",
|
|
932
|
+
* "EmailSubject": "string",
|
|
933
|
+
* "EmailFrom": "string",
|
|
934
|
+
* "EmailBody": "string",
|
|
935
|
+
* "PartnerSiteUid": "string"
|
|
936
|
+
* }
|
|
937
|
+
*
|
|
938
|
+
* ```
|
|
939
|
+
*/
|
|
940
|
+
async signUpViaEmail(payload) {
|
|
941
|
+
// !TODO - проверить работу метода
|
|
942
|
+
if (payload.CurrencyId) {
|
|
943
|
+
const clonedCurrencyId = payload.CurrencyId;
|
|
944
|
+
payload.PointId = clonedCurrencyId;
|
|
945
|
+
delete payload.CurrencyId;
|
|
946
|
+
}
|
|
947
|
+
Object.assign(payload, { Culture: this.locale });
|
|
948
|
+
const url = this.url(`/account/${this.locale}/registrationNewEmail`);
|
|
949
|
+
const res = (await this.POST(url, payload));
|
|
950
|
+
// console.log(list);
|
|
951
|
+
return res;
|
|
952
|
+
}
|
|
953
|
+
/**
|
|
954
|
+
* Registers a new user directly in the database without confirmation.
|
|
955
|
+
* @param payload - Data for registration.
|
|
956
|
+
* @returns A promise that resolves with the registered user data.
|
|
957
|
+
* @deprecated use createInternetUser() method
|
|
958
|
+
* @example
|
|
959
|
+
* ```
|
|
960
|
+
* const payload = {
|
|
961
|
+
* "FirstName": "string",
|
|
962
|
+
* "MiddleName": "string",
|
|
963
|
+
* "EmailOrPhone": "string",
|
|
964
|
+
* "PointId": 0, // <- Refer to Swagger !!!
|
|
965
|
+
* "CurrencyId": 0, // <- Refer to Swagger !!!
|
|
966
|
+
* "Password": "string",
|
|
967
|
+
* "PasswordRepeat": "string",
|
|
968
|
+
* "Culture": "string",
|
|
969
|
+
* "EmailSubject": "string",
|
|
970
|
+
* "EmailFrom": "string",
|
|
971
|
+
* "EmailBody": "string",
|
|
972
|
+
* "PartnerSiteUid": "string"
|
|
973
|
+
* }
|
|
974
|
+
*
|
|
975
|
+
* ```
|
|
976
|
+
*/
|
|
977
|
+
async signUpDirect(payload) {
|
|
978
|
+
if (payload.CurrencyId) {
|
|
979
|
+
const clonedCurrencyId = payload.CurrencyId;
|
|
980
|
+
payload.PointId = clonedCurrencyId;
|
|
981
|
+
delete payload.CurrencyId;
|
|
982
|
+
}
|
|
983
|
+
Object.assign(payload, { Culture: this.locale });
|
|
984
|
+
const url = this.url(`/account/${this.locale}/registrationNewWhithOutEmail`);
|
|
985
|
+
const res = await this.POST(url, payload);
|
|
986
|
+
return res;
|
|
987
|
+
}
|
|
988
|
+
/**
|
|
989
|
+
* Creates an internet user for the cash register directly in the database.
|
|
990
|
+
* @param payload - User registration parameters.
|
|
991
|
+
* @returns An object containing information about the result of the operation.
|
|
992
|
+
* @example
|
|
993
|
+
* const SignUpPayloadDirect: I.TSignUpPayload = {
|
|
994
|
+
* PartnerSiteUid: "partner.win",
|
|
995
|
+
* EmailOrPhone: "380671110000", // phone number without "+"
|
|
996
|
+
* PointId: 85, // <- Refer to Swagger !!!
|
|
997
|
+
* CurrencyId: 85, // <- Refer to Swagger !!!
|
|
998
|
+
* Password: "Password",
|
|
999
|
+
* PasswordRepeat: "Password",
|
|
1000
|
+
* }
|
|
1001
|
+
*/
|
|
1002
|
+
async createInternetUser(payload) {
|
|
1003
|
+
var _a, _b;
|
|
1004
|
+
if (payload.CurrencyId) {
|
|
1005
|
+
const clonedCurrencyId = payload.CurrencyId;
|
|
1006
|
+
payload.PointId = clonedCurrencyId;
|
|
1007
|
+
delete payload.CurrencyId;
|
|
1008
|
+
}
|
|
1009
|
+
payload = Object.assign({}, payload, { Culture: this.locale });
|
|
1010
|
+
/** If a regular cash register is specified, convert it to an internet cash register
|
|
1011
|
+
* by adding 10000 to the currency identifier.
|
|
1012
|
+
*/
|
|
1013
|
+
if (!(payload === null || payload === void 0 ? void 0 : payload.PointId)) {
|
|
1014
|
+
return { created: null, error: 'parametersError', status: 200, statusText: '' };
|
|
1015
|
+
}
|
|
1016
|
+
else if (payload.PointId && payload.PointId < 10000) {
|
|
1017
|
+
payload.PointId = payload.PointId + 10000;
|
|
1018
|
+
}
|
|
1019
|
+
const url = this.url(`/account/${this.locale}/registrationNewWhithOutEmail`);
|
|
1020
|
+
const { data, status, statusText } = await this.request(url).POST(payload).exec();
|
|
1021
|
+
// console.log(data);
|
|
1022
|
+
const created = (_b = (_a = data === null || data === void 0 ? void 0 : data.Data) === null || _a === void 0 ? void 0 : _a._isSuccessful) !== null && _b !== void 0 ? _b : null;
|
|
1023
|
+
const error = (data === null || data === void 0 ? void 0 : data.Error) || null;
|
|
1024
|
+
return { created, error, status, statusText };
|
|
1025
|
+
}
|
|
1026
|
+
/**
|
|
1027
|
+
* get a list of sports for the period
|
|
1028
|
+
* @param {string} from формат "DDMMYYYY"
|
|
1029
|
+
* @param {string} to формат "DDMMYYYY"
|
|
1030
|
+
* @returns
|
|
1031
|
+
*/
|
|
1032
|
+
async getResultsSports(from, to) {
|
|
1033
|
+
const url = this.url(`/results/${this.locale}/sports/0/${from}/${to}`);
|
|
1034
|
+
const list = await this.GET(url, {}, {});
|
|
1035
|
+
// console.log(list);
|
|
1036
|
+
return list;
|
|
1037
|
+
}
|
|
1038
|
+
/**
|
|
1039
|
+
* Retrieves tournament results by sport ID.
|
|
1040
|
+
* @param sportId - The sport identifier.
|
|
1041
|
+
* @param from - The start date as a string.
|
|
1042
|
+
* @param to - The end date as a string.
|
|
1043
|
+
* @returns A list of tournament results.
|
|
1044
|
+
*/
|
|
1045
|
+
async getResultsTournamentsBySportId(sportId, from, to) {
|
|
1046
|
+
const url = this.url(`/results/${this.locale}/tournaments/sport${sportId}/0/${from}/${to}`);
|
|
1047
|
+
const list = await this.GET(url, {}, {});
|
|
1048
|
+
// console.log(list);
|
|
1049
|
+
return list;
|
|
1050
|
+
}
|
|
1051
|
+
/**
|
|
1052
|
+
* Get results
|
|
1053
|
+
* @param {*} sportId - The sport identifier.
|
|
1054
|
+
* @param {*} countryId - The country identifier.
|
|
1055
|
+
* @param {*} tournamentId - The tournament identifier.
|
|
1056
|
+
* @param {*} from - The start date.
|
|
1057
|
+
* @param {*} to - The end date.
|
|
1058
|
+
* @returns The results.
|
|
1059
|
+
*/
|
|
1060
|
+
async getResultsGrid(sportId, countryId, tournamentId, from, to) {
|
|
1061
|
+
const url = this.url(`/results/${this.locale}/sport${sportId}/country${countryId}/tournament${tournamentId}/0/${from}/${to}`);
|
|
1062
|
+
const list = await this.GET(url, {}, {});
|
|
1063
|
+
// console.log(list);
|
|
1064
|
+
return list !== null && list !== void 0 ? list : [];
|
|
1065
|
+
}
|
|
1066
|
+
/**
|
|
1067
|
+
* Returns all games providers for the 21st game each
|
|
1068
|
+
*/
|
|
1069
|
+
async getGamesProvidersTopGames() {
|
|
1070
|
+
const url = this.url(`/slotintegrator-service/topGameByProvider`);
|
|
1071
|
+
const list = await this.GET(url, {}, {});
|
|
1072
|
+
return list !== null && list !== void 0 ? list : [];
|
|
1073
|
+
}
|
|
1074
|
+
/**
|
|
1075
|
+
* Retrieves the list of top game providers for games.
|
|
1076
|
+
* @returns {Promise<Array<any>>} The list of top game providers.
|
|
1077
|
+
*/
|
|
1078
|
+
async getGamesTopProviders() {
|
|
1079
|
+
const url = this.url(`/slotintegrator-service/topProviders`);
|
|
1080
|
+
const list = await this.GET(url, {}, {});
|
|
1081
|
+
// console.log(list);
|
|
1082
|
+
return list !== null && list !== void 0 ? list : [];
|
|
1083
|
+
}
|
|
1084
|
+
/**
|
|
1085
|
+
* Retrieves the list of slots.
|
|
1086
|
+
* @returns {Promise<Array<any>>} The list of slots.
|
|
1087
|
+
*/
|
|
1088
|
+
async getSlotsList() {
|
|
1089
|
+
const url = this.url(`/slotintegrator-service/gamelist`);
|
|
1090
|
+
const { items } = await this.GET(url, {}, {});
|
|
1091
|
+
// console.log(list);
|
|
1092
|
+
return items !== null && items !== void 0 ? items : [];
|
|
1093
|
+
}
|
|
1094
|
+
/**
|
|
1095
|
+
* Opens a session for Outcome slots
|
|
1096
|
+
* @deprecated
|
|
1097
|
+
* */
|
|
1098
|
+
async createSlotOutcome(game_id) {
|
|
1099
|
+
return {};
|
|
1100
|
+
}
|
|
1101
|
+
/**
|
|
1102
|
+
* Creates a slotintegrator DEMO.
|
|
1103
|
+
* @param model - The model containing the data for the slot integrator demo.
|
|
1104
|
+
* @returns A Promise that resolves to the parsed JSON response from the server.
|
|
1105
|
+
*/
|
|
1106
|
+
async createSlotIntegratorDemo(model) {
|
|
1107
|
+
const locale = this.locale || 'en';
|
|
1108
|
+
try {
|
|
1109
|
+
model.language = locale.substring(0, 2);
|
|
1110
|
+
const url = this.url(`/slotintegrator-service/InitDemoGames`);
|
|
1111
|
+
const res = await this.POST(url, model);
|
|
1112
|
+
return JSON.parse(res);
|
|
1113
|
+
}
|
|
1114
|
+
catch (error) {
|
|
1115
|
+
return {};
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
/**
|
|
1119
|
+
* Initiates SlotIntegrators REAL Game
|
|
1120
|
+
* @example
|
|
1121
|
+
* ```javascript
|
|
1122
|
+
const model = {
|
|
1123
|
+
"game_uuid": "string",
|
|
1124
|
+
"player_id": "string",
|
|
1125
|
+
"player_name": "string",
|
|
1126
|
+
"currency": "string",
|
|
1127
|
+
"session_id": "string",
|
|
1128
|
+
"language": "string",
|
|
1129
|
+
}
|
|
1130
|
+
* ```
|
|
1131
|
+
*/
|
|
1132
|
+
async createSlotIntegratorReal(model) {
|
|
1133
|
+
try {
|
|
1134
|
+
const url = this.url(`/slotintegrator-service/InitRealGames`);
|
|
1135
|
+
const res = await this.POST(url, model);
|
|
1136
|
+
return JSON.parse(res);
|
|
1137
|
+
}
|
|
1138
|
+
catch (error) {
|
|
1139
|
+
return {};
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
/** Возвращает список провайдеров с логотипами */
|
|
1143
|
+
async getSlotIntegratorProvidersHeaders() {
|
|
1144
|
+
try {
|
|
1145
|
+
const url = this.url(`/slotintegrator-service/ProviderHeaders`);
|
|
1146
|
+
const res = (await this.GET(url)) || [];
|
|
1147
|
+
const providers = res.map((v) => {
|
|
1148
|
+
return Object.assign(Object.assign({}, v), { ProviderName: v.Provider, Games: [] });
|
|
1149
|
+
});
|
|
1150
|
+
// if (process.env.DEV) console.log('getSlotIntegratorProviders:', res)
|
|
1151
|
+
return providers !== null && providers !== void 0 ? providers : [];
|
|
1152
|
+
}
|
|
1153
|
+
catch (error) {
|
|
1154
|
+
return [];
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
/** Retrieves all games for a given slot integrator provider.
|
|
1158
|
+
* @param {string} providerName - The name of the provider.
|
|
1159
|
+
* @returns {Promise<Array>} - A promise that resolves to an array of games.
|
|
1160
|
+
*/
|
|
1161
|
+
async getSlotIntegratorProviderAllGames(providerName) {
|
|
1162
|
+
const url = this.url(`/slotintegrator-service/searchGameByProvider/${providerName}`);
|
|
1163
|
+
const res = await this.GET(url);
|
|
1164
|
+
return res !== null && res !== void 0 ? res : [];
|
|
1165
|
+
}
|
|
1166
|
+
/** Retrieves games by the given game name.
|
|
1167
|
+
* @param {string} gameName - The name of the provider.
|
|
1168
|
+
* @returns {Promise<Array>} - A promise that resolves to an array of games.
|
|
1169
|
+
*/
|
|
1170
|
+
async getSlotIntegratorFilteredGames(gameName) {
|
|
1171
|
+
const url = this.url(`/slotintegrator-service/searchGameByName/${gameName}`);
|
|
1172
|
+
const res = await this.GET(url);
|
|
1173
|
+
return res !== null && res !== void 0 ? res : [];
|
|
1174
|
+
}
|
|
1175
|
+
/**
|
|
1176
|
+
* Asynchronously performs login.
|
|
1177
|
+
* @description If the login is successful, saves the token in the class property `token`
|
|
1178
|
+
* and saves the object representing the user in the class property `user`.
|
|
1179
|
+
* These properties are subsequently used for processing requests.
|
|
1180
|
+
* @param login - The user's login.
|
|
1181
|
+
* @param password - The user's password.
|
|
1182
|
+
* @returns An object representing the user if the login is successful. Otherwise, returns an empty object.
|
|
1183
|
+
*/
|
|
1184
|
+
async login({ login, password }) {
|
|
1185
|
+
this.token = undefined;
|
|
1186
|
+
const url = this.url(`/account/LogIn`, api.LBC);
|
|
1187
|
+
const post = {
|
|
1188
|
+
Login: login,
|
|
1189
|
+
Password: password,
|
|
1190
|
+
Culture: this.locale
|
|
1191
|
+
};
|
|
1192
|
+
const res = await this.POST(url, post);
|
|
1193
|
+
const { Data } = res !== null && res !== void 0 ? res : {};
|
|
1194
|
+
if (!Data && IS_DEV_MODE) {
|
|
1195
|
+
console.log("\n```\n/account/LogIn:\n", res, "\n```\n");
|
|
1196
|
+
}
|
|
1197
|
+
if (Data && Data.UserId > 0 && Data['X-Token']) {
|
|
1198
|
+
this.token = Data['X-Token'];
|
|
1199
|
+
this.user = Data;
|
|
1200
|
+
return this.user;
|
|
1201
|
+
}
|
|
1202
|
+
this.user = {};
|
|
1203
|
+
return this.user;
|
|
1204
|
+
}
|
|
1205
|
+
/**
|
|
1206
|
+
* Retrieves user data.
|
|
1207
|
+
* @returns User data or null if the user is not found.
|
|
1208
|
+
* @deprecated use this.getUserData()
|
|
1209
|
+
*/
|
|
1210
|
+
async getUserData_OLD() {
|
|
1211
|
+
const url = this.url(`/account/GetUserData`, api.LBC);
|
|
1212
|
+
const user = await this.GET(url);
|
|
1213
|
+
if ((user === null || user === void 0 ? void 0 : user.UserId) > 0) {
|
|
1214
|
+
this.user = user;
|
|
1215
|
+
return user;
|
|
1216
|
+
}
|
|
1217
|
+
this.user = {};
|
|
1218
|
+
return null;
|
|
1219
|
+
}
|
|
1220
|
+
async getUserData() {
|
|
1221
|
+
const url = this.url(`/account/GetUserData`, api.LBC);
|
|
1222
|
+
const { data, status, statusText } = await this.request(url).exec();
|
|
1223
|
+
this.user = (data === null || data === void 0 ? void 0 : data.UserId) > 0 ? data : {};
|
|
1224
|
+
return this.responseHandlerData(data, status, statusText);
|
|
1225
|
+
}
|
|
1226
|
+
/**
|
|
1227
|
+
* @deprecated use this.getUserData()
|
|
1228
|
+
*/
|
|
1229
|
+
async getUserFullData() {
|
|
1230
|
+
return await this.getUserData();
|
|
1231
|
+
// const url = this.url(`/user/GetUserFullData`, api.V2);
|
|
1232
|
+
// const res = await this.GET(url);
|
|
1233
|
+
// return res?.UserId ? res : null;
|
|
1234
|
+
}
|
|
1235
|
+
/**
|
|
1236
|
+
* Logs the user out of the system.
|
|
1237
|
+
* @returns An object containing information about the success of the logout and the user's authorization status.
|
|
1238
|
+
*/
|
|
1239
|
+
async logout() {
|
|
1240
|
+
const url = this.url(`/account/LogOut`, api.LBC);
|
|
1241
|
+
const res = await this.POST(url);
|
|
1242
|
+
const resOk = (res === false);
|
|
1243
|
+
this.user = {};
|
|
1244
|
+
this.token = undefined;
|
|
1245
|
+
return {
|
|
1246
|
+
ok: resOk,
|
|
1247
|
+
isLogged: resOk ? res : false,
|
|
1248
|
+
};
|
|
1249
|
+
}
|
|
1250
|
+
/**
|
|
1251
|
+
* Retrieves the user's balance.
|
|
1252
|
+
* @returns A promise that resolves to the user's balance.
|
|
1253
|
+
* @deprecated use this.getBalance();
|
|
1254
|
+
*/
|
|
1255
|
+
async balance() {
|
|
1256
|
+
if (this.isSinged) {
|
|
1257
|
+
const url = this.url(`/account/GetUserBalance`, api.LBC);
|
|
1258
|
+
const res = await this.GET(url);
|
|
1259
|
+
return res !== null && res !== void 0 ? res : {};
|
|
1260
|
+
}
|
|
1261
|
+
return {};
|
|
1262
|
+
}
|
|
1263
|
+
async getBalance() {
|
|
1264
|
+
const url = this.url(`/account/GetUserBalance`, api.LBC);
|
|
1265
|
+
const { data, status, statusText } = await this.request(url).exec();
|
|
1266
|
+
return this.responseHandlerData(data, status, statusText);
|
|
1267
|
+
}
|
|
1268
|
+
/**
|
|
1269
|
+
* Changes the user's password.
|
|
1270
|
+
* @param postBody - An object containing the data for changing the password.
|
|
1271
|
+
* @returns Returns `null` if the user is not authorized.
|
|
1272
|
+
*/
|
|
1273
|
+
async changePassword(postBody) {
|
|
1274
|
+
var _a;
|
|
1275
|
+
if (this.isSinged) {
|
|
1276
|
+
postBody.userData.Gmt = new Date().getTimezoneOffset() / 60;
|
|
1277
|
+
postBody.userData.Language = this.languageId;
|
|
1278
|
+
const url = this.url(`/account/ChangeUserPassword`, api.LBC);
|
|
1279
|
+
const res = await this.POST(url, postBody);
|
|
1280
|
+
console.log(res);
|
|
1281
|
+
return {
|
|
1282
|
+
ok: !res.IsError || false,
|
|
1283
|
+
status: (_a = res.ErrorCode) !== null && _a !== void 0 ? _a : 5001
|
|
1284
|
+
};
|
|
1285
|
+
}
|
|
1286
|
+
return {
|
|
1287
|
+
ok: false,
|
|
1288
|
+
status: 5001
|
|
1289
|
+
};
|
|
1290
|
+
}
|
|
1291
|
+
/**
|
|
1292
|
+
* Converts a number to a GUID string.
|
|
1293
|
+
* It is used in the "Sslotegrator"
|
|
1294
|
+
* @param userId - The number to convert to a GUID.
|
|
1295
|
+
* @returns The GUID string.
|
|
1296
|
+
*/
|
|
1297
|
+
longToGuid(userId) {
|
|
1298
|
+
const buffer = new ArrayBuffer(16);
|
|
1299
|
+
const dataView = new DataView(buffer);
|
|
1300
|
+
dataView.setUint32(0, userId, true);
|
|
1301
|
+
const bytes = Array.from(new Uint8Array(buffer));
|
|
1302
|
+
const guid = [bytes.slice(0, 4).reverse(), bytes.slice(4, 6).reverse(), bytes.slice(6, 8).reverse(), bytes.slice(8, 10), bytes.slice(10, 16)]
|
|
1303
|
+
.map((arr) => arr.map((b) => b.toString(16).padStart(2, '0')).join(''))
|
|
1304
|
+
.join('-');
|
|
1305
|
+
return guid;
|
|
1306
|
+
}
|
|
1307
|
+
/**
|
|
1308
|
+
* Retrieves sports events (live & prematch) based on the provided search text.
|
|
1309
|
+
* @param searchText - The text to search for.
|
|
1310
|
+
* @returns A promise that resolves to an array of ISearchEventsData.
|
|
1311
|
+
*/
|
|
1312
|
+
async getSportsEventsSearch(searchText) {
|
|
1313
|
+
var _a, _b;
|
|
1314
|
+
if (!searchText)
|
|
1315
|
+
return [];
|
|
1316
|
+
const url = this.url(`/line/SearchFullByCulture`, api.V2);
|
|
1317
|
+
const queryParams = {
|
|
1318
|
+
culture: this.locale,
|
|
1319
|
+
searchText: searchText,
|
|
1320
|
+
};
|
|
1321
|
+
const [preDraft, liveDraft] = await Promise.all([
|
|
1322
|
+
(_a = this.GET(url, queryParams)) !== null && _a !== void 0 ? _a : [],
|
|
1323
|
+
(_b = this.getFullLiveWithoutSaveTimeStamp()) !== null && _b !== void 0 ? _b : []
|
|
1324
|
+
]);
|
|
1325
|
+
const pre = preDraft
|
|
1326
|
+
.filter((v) => v.Type > 1)
|
|
1327
|
+
.map((v) => {
|
|
1328
|
+
var _a;
|
|
1329
|
+
const eventDate = new Date((_a = v === null || v === void 0 ? void 0 : v.Date) !== null && _a !== void 0 ? _a : '');
|
|
1330
|
+
const options = { weekday: 'short', day: '2-digit', month: 'long', hour: '2-digit', minute: '2-digit' };
|
|
1331
|
+
const formattedDate = eventDate.toLocaleDateString(this.locale, options).replace(',', '');
|
|
1332
|
+
return Object.assign(v, {
|
|
1333
|
+
Date: formattedDate,
|
|
1334
|
+
to: { name: 'eventprematch', params: { prEventId: routeNameId(v.Id, v.Name) } },
|
|
1335
|
+
t1: v.Name.split(/\s*\-\s*/)[0],
|
|
1336
|
+
t2: v.Name.split(/\s*\-\s*/)[1],
|
|
1337
|
+
});
|
|
1338
|
+
});
|
|
1339
|
+
// console.log(JSON.stringify(pre, null, 2) /* , liveDraft */);
|
|
1340
|
+
const filter = searchText.toLowerCase();
|
|
1341
|
+
const live = liveDraft
|
|
1342
|
+
.filter((v) => {
|
|
1343
|
+
return (v.Description.NameTeam1.toLowerCase().includes(filter) ||
|
|
1344
|
+
v.Description.NameTeam2.toLowerCase().includes(filter) ||
|
|
1345
|
+
v.Description.TName.toLowerCase().includes(filter));
|
|
1346
|
+
})
|
|
1347
|
+
.map((v) => {
|
|
1348
|
+
const spEvntName = `${v.Description.NameTeam1} vs ${v.Description.NameTeam2} ${v.Description.SportName}`;
|
|
1349
|
+
const eventDate = new Date(v.Description.Date);
|
|
1350
|
+
const options = { weekday: 'short', day: '2-digit', month: 'long', hour: '2-digit', minute: '2-digit' };
|
|
1351
|
+
const formattedDate = eventDate.toLocaleDateString(this.locale, options).replace(',', '');
|
|
1352
|
+
return {
|
|
1353
|
+
CountryId: v.Description.CountryId,
|
|
1354
|
+
Date: formattedDate,
|
|
1355
|
+
Id: +v.Id,
|
|
1356
|
+
Name: spEvntName,
|
|
1357
|
+
PriceNum: v.Description.PriceNum,
|
|
1358
|
+
SportId: v.Description.SportId,
|
|
1359
|
+
SportName: v.Description.SportName,
|
|
1360
|
+
TournamentId: v.Description.TournamentId,
|
|
1361
|
+
TournamentName: v.Description.TName,
|
|
1362
|
+
Type: 3,
|
|
1363
|
+
isLive: true,
|
|
1364
|
+
to: { name: 'eventinplay', params: { prEventId: routeNameId(v.Id, spEvntName) } },
|
|
1365
|
+
t1: v.Description.NameTeam1,
|
|
1366
|
+
t2: v.Description.NameTeam2,
|
|
1367
|
+
};
|
|
1368
|
+
});
|
|
1369
|
+
// console.log(JSON.stringify(live, null, 2) /* , liveDraft */);
|
|
1370
|
+
return [...live, ...pre];
|
|
1371
|
+
}
|
|
1372
|
+
/**
|
|
1373
|
+
* Retrieves the favorites from the BetBooster API.
|
|
1374
|
+
* @returns {Promise<any[]>} A promise that resolves to an array of favorites.
|
|
1375
|
+
*/
|
|
1376
|
+
async getFavorites() {
|
|
1377
|
+
if (this.isSinged) {
|
|
1378
|
+
const url = this.url(`/favorites/GetFavorites`, api.V2);
|
|
1379
|
+
const res = await this.GET(url, { culture: this.locale });
|
|
1380
|
+
return res !== null && res !== void 0 ? res : [];
|
|
1381
|
+
}
|
|
1382
|
+
return [];
|
|
1383
|
+
}
|
|
1384
|
+
/**
|
|
1385
|
+
* Adds an item to the favorites list.
|
|
1386
|
+
* @param id - The ID of the item to add.
|
|
1387
|
+
* @param type - The type of the item to add. Types: 0 = "Tournament"; 1 = "Event"; 2 = "LiveEvent"; 3 = "LineEvent"; 4 = "None";
|
|
1388
|
+
* @returns A promise that resolves to a boolean indicating whether the item was successfully added to the favorites list.
|
|
1389
|
+
*/
|
|
1390
|
+
async addFavorite(id, type) {
|
|
1391
|
+
if (this.isSinged) {
|
|
1392
|
+
const url = this.url(`/favorites/AddToFavorites`, api.V2);
|
|
1393
|
+
const res = await this.POST(url, {}, { id, type });
|
|
1394
|
+
return res !== null && res !== void 0 ? res : false;
|
|
1395
|
+
}
|
|
1396
|
+
return false;
|
|
1397
|
+
}
|
|
1398
|
+
/**
|
|
1399
|
+
* Removes a favorite item.
|
|
1400
|
+
* @param favoriteId - The ID of the favorite item to be removed.
|
|
1401
|
+
* @returns A promise that resolves to a boolean indicating whether the removal was successful.
|
|
1402
|
+
*/
|
|
1403
|
+
async removeFavorite(favoriteId) {
|
|
1404
|
+
if (this.isSinged) {
|
|
1405
|
+
const url = this.url(`/favorites/RemoveFromFavorites`, api.V2);
|
|
1406
|
+
const res = await this.POST(url, { id: favoriteId });
|
|
1407
|
+
return res !== null && res !== void 0 ? res : false;
|
|
1408
|
+
}
|
|
1409
|
+
return false;
|
|
1410
|
+
}
|
|
1411
|
+
/**
|
|
1412
|
+
* Retrieves the user's wallets.
|
|
1413
|
+
* @param psType - The type of payment system (default is 5 - cashier).
|
|
1414
|
+
* @returns The user's wallets.
|
|
1415
|
+
*/ async getPurses(psType = 5) {
|
|
1416
|
+
if (this.isSinged) {
|
|
1417
|
+
const url = this.url(`/account/GetPurses`, api.V2);
|
|
1418
|
+
const payload = {
|
|
1419
|
+
psType,
|
|
1420
|
+
};
|
|
1421
|
+
const res = await this.GET(url, payload);
|
|
1422
|
+
return res !== null && res !== void 0 ? res : [];
|
|
1423
|
+
}
|
|
1424
|
+
return [];
|
|
1425
|
+
}
|
|
1426
|
+
async sendWithdrawal(apiPath, request) {
|
|
1427
|
+
// TODO Not implemented
|
|
1428
|
+
return;
|
|
1429
|
+
}
|
|
1430
|
+
/**
|
|
1431
|
+
* Sends a withdrawal request to the cashier.
|
|
1432
|
+
* @param payload - Parameters for the withdrawal request.
|
|
1433
|
+
* @returns An object with the result of the withdrawal operation.
|
|
1434
|
+
*/
|
|
1435
|
+
async sendWithdrawalAgent(payload) {
|
|
1436
|
+
if (this.isSinged) {
|
|
1437
|
+
const PayloadWithdrawal = {
|
|
1438
|
+
"securityCode": "",
|
|
1439
|
+
"secAnswer": "",
|
|
1440
|
+
"additionalParams": {}
|
|
1441
|
+
};
|
|
1442
|
+
Object.assign(PayloadWithdrawal, payload);
|
|
1443
|
+
const url = this.url(`/payment/CreateOrderWithdraw`, api.LBC);
|
|
1444
|
+
const res = await this.POST(url, PayloadWithdrawal);
|
|
1445
|
+
if (!isNaN(parseFloat(res))) {
|
|
1446
|
+
const userOrders = await this.getOrderedTransactions();
|
|
1447
|
+
return { ok: true, balance: parseFloat(res), userOrders: userOrders };
|
|
1448
|
+
}
|
|
1449
|
+
else {
|
|
1450
|
+
return { ok: false, status: res };
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
return { ok: false, status: 10016 };
|
|
1454
|
+
}
|
|
1455
|
+
/**
|
|
1456
|
+
* Cancels a requested withdrawal transaction.
|
|
1457
|
+
* @param payload - Parameters for canceling the requested transaction.
|
|
1458
|
+
* @returns An object with information about the success of the transaction cancellation and the user's balance.
|
|
1459
|
+
*/
|
|
1460
|
+
async cancelOrderedTransaction(payload) {
|
|
1461
|
+
if (this.isSinged) {
|
|
1462
|
+
const url = this.url(`/payment/CancelOrderedTransaction`, api.LBC);
|
|
1463
|
+
const res = await this.POST(url, payload);
|
|
1464
|
+
if (res === -1) {
|
|
1465
|
+
return { ok: false, status: 103 };
|
|
1466
|
+
}
|
|
1467
|
+
else if (isNaN(parseFloat(res))) {
|
|
1468
|
+
return { ok: false, status: 103 };
|
|
1469
|
+
}
|
|
1470
|
+
else {
|
|
1471
|
+
const userOrders = await this.getOrderedTransactions();
|
|
1472
|
+
return { ok: true, balance: parseFloat(res), userOrders: userOrders };
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
return { ok: false, status: 10016 };
|
|
1476
|
+
}
|
|
1477
|
+
/**
|
|
1478
|
+
* Obtains information on cash flow.
|
|
1479
|
+
* @param payload - Query Parameters.
|
|
1480
|
+
* @returns An object with the result of the query.
|
|
1481
|
+
*/
|
|
1482
|
+
async getMovementOfMoney(payload) {
|
|
1483
|
+
var _a;
|
|
1484
|
+
if (this.isSinged) {
|
|
1485
|
+
Object.assign(payload, { culture: this.locale });
|
|
1486
|
+
const url = this.url(`/account/GetAccountTransactions`, api.V2);
|
|
1487
|
+
const res = await this.GET(url, payload);
|
|
1488
|
+
// console.log(JSON.stringify(Array.from(res.TransactionsDataList))/* .slice(0, 3) */);
|
|
1489
|
+
// console.log('TransactionsDataList.length:',res?.TransactionsDataList.length);
|
|
1490
|
+
// console.log(res);
|
|
1491
|
+
const transactionsDataList = (_a = res === null || res === void 0 ? void 0 : res.TransactionsDataList) !== null && _a !== void 0 ? _a : [];
|
|
1492
|
+
const transactions = transactionsDataList.map((v) => {
|
|
1493
|
+
var _a;
|
|
1494
|
+
return {
|
|
1495
|
+
income: (_a = v.IsAddition) !== null && _a !== void 0 ? _a : false,
|
|
1496
|
+
sign: v.IsAddition ? '+' : '-',
|
|
1497
|
+
id: v.Id,
|
|
1498
|
+
typeId: v.TransactionType,
|
|
1499
|
+
typeName: v.TransactionDescription,
|
|
1500
|
+
date: v.TransactionDate,
|
|
1501
|
+
value: v.Amount,
|
|
1502
|
+
amount: v.Amount,
|
|
1503
|
+
bonus: v.Bonus,
|
|
1504
|
+
balance: v.Balance,
|
|
1505
|
+
// statusId: number,
|
|
1506
|
+
// statusName: any,
|
|
1507
|
+
};
|
|
1508
|
+
});
|
|
1509
|
+
return {
|
|
1510
|
+
// error_message: res.error_message,
|
|
1511
|
+
// status: res.status,
|
|
1512
|
+
result: transactions,
|
|
1513
|
+
};
|
|
1514
|
+
}
|
|
1515
|
+
return {
|
|
1516
|
+
result: [],
|
|
1517
|
+
};
|
|
1518
|
+
}
|
|
1519
|
+
/**
|
|
1520
|
+
* Retrieves a list of ordered transactions.
|
|
1521
|
+
*
|
|
1522
|
+
* @returns Ordered transactions or an empty array if the user is not authorized.
|
|
1523
|
+
*/
|
|
1524
|
+
async getOrderedTransactions() {
|
|
1525
|
+
if (this.isSinged) {
|
|
1526
|
+
const url = this.url(`/account/GetOrderedTransactions`, api.V2);
|
|
1527
|
+
const res = await this.GET(url);
|
|
1528
|
+
return res;
|
|
1529
|
+
}
|
|
1530
|
+
return [];
|
|
1531
|
+
}
|
|
1532
|
+
/**
|
|
1533
|
+
* Retrieves the content of a bet by betId.
|
|
1534
|
+
* @param betId - The bet identifier.
|
|
1535
|
+
* @returns The content of the bet.
|
|
1536
|
+
*/
|
|
1537
|
+
async getBetContent(betId) {
|
|
1538
|
+
const payload = {
|
|
1539
|
+
id: betId,
|
|
1540
|
+
culture: this.locale
|
|
1541
|
+
};
|
|
1542
|
+
if (this.isSinged) {
|
|
1543
|
+
const url = this.url(`/account/GetBetContent`, api.V2);
|
|
1544
|
+
const res = await this.GET(url, payload);
|
|
1545
|
+
return res;
|
|
1546
|
+
}
|
|
1547
|
+
return {};
|
|
1548
|
+
}
|
|
1549
|
+
/**
|
|
1550
|
+
* Retrieves user bets.
|
|
1551
|
+
* @param payload - Request parameters.
|
|
1552
|
+
* @returns A promise that resolves with the result of the request.
|
|
1553
|
+
* @note The page size should not exceed 20 rows per page.
|
|
1554
|
+
* @deprecated Use the getUserBets02 method.
|
|
1555
|
+
*/
|
|
1556
|
+
async getUserBets(payload) {
|
|
1557
|
+
/**
|
|
1558
|
+
!TODO при больших значениях страниц метод зависает, потому, что требуется
|
|
1559
|
+
очень много переводов. Я ограничил страницу 20 записей.
|
|
1560
|
+
* Необходима оптимизация на сервере
|
|
1561
|
+
*/
|
|
1562
|
+
Object.assign(payload, { culture: this.locale });
|
|
1563
|
+
if (this.isSinged) {
|
|
1564
|
+
const url = this.url(`/account/GetUserBets`, api.V2);
|
|
1565
|
+
const res = await this.GET(url, payload);
|
|
1566
|
+
return res;
|
|
1567
|
+
}
|
|
1568
|
+
return;
|
|
1569
|
+
}
|
|
1570
|
+
/**
|
|
1571
|
+
* Retrieves user bets.
|
|
1572
|
+
* @param payload - Request parameters.
|
|
1573
|
+
* @returns A promise that resolves with the result of the request.
|
|
1574
|
+
* @note The page size should not exceed 20 rows per page.
|
|
1575
|
+
*/
|
|
1576
|
+
async getUserBets02(payload) {
|
|
1577
|
+
/**
|
|
1578
|
+
!TODO при больших значениях страниц метод зависает, потому, что требуется
|
|
1579
|
+
очень много переводов. Я ограничил страницу 20 записей.
|
|
1580
|
+
* Необходима оптимизация на сервере
|
|
1581
|
+
*/
|
|
1582
|
+
Object.assign(payload, { culture: this.locale });
|
|
1583
|
+
if (this.isSinged) {
|
|
1584
|
+
const url = this.url(`/account/GetUserBets`, api.V2);
|
|
1585
|
+
const { data: rawData, status, statusText } = await this.request(url).query(payload).exec();
|
|
1586
|
+
const data = rawData !== null && rawData !== void 0 ? rawData : null;
|
|
1587
|
+
const error = status !== 200 ? statusText : null;
|
|
1588
|
+
return { data, error, status, statusText };
|
|
1589
|
+
}
|
|
1590
|
+
return { data: null, error: 'Unauthorized', status: 401, statusText: 'Unauthorized' };
|
|
1591
|
+
}
|
|
1592
|
+
/**
|
|
1593
|
+
* Retrieves the odds data for editing based on the provided payload.
|
|
1594
|
+
*
|
|
1595
|
+
* @param payload - The extended bet slip information required to fetch odds for editing.
|
|
1596
|
+
* @returns A promise that resolves to an object containing the data, any errors, and the HTTP response status information.
|
|
1597
|
+
*/
|
|
1598
|
+
async getOddsForEdit(payload) {
|
|
1599
|
+
const url = this.url(`/betting/GetBetForChange`, api.LBC);
|
|
1600
|
+
const { data: rawData, status, statusText } = await this.request(url).POST(payload).exec();
|
|
1601
|
+
const data = this.convertDataData(rawData);
|
|
1602
|
+
return this.responseHandlerData(data, status, statusText);
|
|
1603
|
+
}
|
|
1604
|
+
/**
|
|
1605
|
+
* Edits an existing coupon with the provided payload.
|
|
1606
|
+
*
|
|
1607
|
+
* @param payload - The coupon data to be edited, conforming to the `I.TCouponEdited` interface.
|
|
1608
|
+
* @returns A promise that resolves to an object containing:
|
|
1609
|
+
* - `data`: The response data from the API.
|
|
1610
|
+
* - `error`: Any error messages returned by the API, either as a string or an array of strings. Can be `null` if no errors occurred.
|
|
1611
|
+
* - `status`: The HTTP status code of the response.
|
|
1612
|
+
* - `statusText`: The HTTP status text corresponding to the status code.
|
|
1613
|
+
*/
|
|
1614
|
+
async placeCouponEdited(payload) {
|
|
1615
|
+
const url = this.url(`/betting/ChangeBet`, api.LBC);
|
|
1616
|
+
const { data: rawData, status, statusText } = await this.request(url).POST(payload).exec();
|
|
1617
|
+
const data = this.convertDataData(rawData);
|
|
1618
|
+
return this.responseHandlerData(data, status, statusText);
|
|
1619
|
+
}
|
|
1620
|
+
/**
|
|
1621
|
+
* Retrieves the cashout information for the specified user bets.
|
|
1622
|
+
*
|
|
1623
|
+
* @param BetIds - An array of bet IDs for which to check the cashout information.
|
|
1624
|
+
* @returns A promise that resolves to an object containing the data, error, status, and statusText.
|
|
1625
|
+
* - data: The response data from the API.
|
|
1626
|
+
* - error: Any error message(s) returned by the API, or null if no errors occurred.
|
|
1627
|
+
* - status: The HTTP status code of the response.
|
|
1628
|
+
* - statusText: The HTTP status text of the response.
|
|
1629
|
+
*/
|
|
1630
|
+
async getUserBetsCashout(BetIds) {
|
|
1631
|
+
const url = this.url(`/betting/CheckCashoutForBets`, api.LBC);
|
|
1632
|
+
const { data, status, statusText } = await this.request(url).POST({ BetIds }).exec();
|
|
1633
|
+
return this.responseHandlerData(data, status, statusText);
|
|
1634
|
+
}
|
|
1635
|
+
/**
|
|
1636
|
+
* Processes a cashout return bet request.
|
|
1637
|
+
* @param payload - The cashout bet parameters
|
|
1638
|
+
* @param payload.betId - The ID of the bet to cash out
|
|
1639
|
+
* @param payload.cashOutAmount - The amount to cash out
|
|
1640
|
+
* @param payload.DoAcceptOddsChanges - Whether to accept odds changes
|
|
1641
|
+
* @returns A promise containing response data, error information, HTTP status code and status text
|
|
1642
|
+
* @returns {data} The response data from the API
|
|
1643
|
+
* @returns {error} Error message(s) if any occurred, null otherwise
|
|
1644
|
+
* @returns {status} HTTP status code
|
|
1645
|
+
* @returns {statusText} HTTP status message
|
|
1646
|
+
*/
|
|
1647
|
+
async returnCashoutBet(payload) {
|
|
1648
|
+
const url = this.url(`/betting/CashOutReturnBet`, api.LBC);
|
|
1649
|
+
const { data: rawData, status, statusText } = await this.request(url).POST(payload).exec();
|
|
1650
|
+
const data = this.convertDataData(rawData);
|
|
1651
|
+
return this.responseHandlerData(data, status, statusText);
|
|
1652
|
+
}
|
|
1653
|
+
/**
|
|
1654
|
+
* Creates a coupon for placing a bet.
|
|
1655
|
+
* @param betslip - An array with information about the bets.
|
|
1656
|
+
* @param amount - The bet amount.
|
|
1657
|
+
* @param acceptChangeCoefs - A flag indicating whether to accept changes in coefficients.
|
|
1658
|
+
* @param systemIndex - The size of the system (e.g., for 3 events with 2 combinations, pass 2). Default value: -1 (if not a system).
|
|
1659
|
+
* @returns The created coupon for placing a bet.
|
|
1660
|
+
*/
|
|
1661
|
+
createCoupon(betslip, amount, acceptCahngeCoefs, systemIndex = -1) {
|
|
1662
|
+
var _a, _b, _c, _d, _e;
|
|
1663
|
+
const coupon = {
|
|
1664
|
+
betAmount: amount,
|
|
1665
|
+
// "realAmount": amount,
|
|
1666
|
+
// "bonusAmount": bonusSum,
|
|
1667
|
+
// "totalCoef": totalOdds,
|
|
1668
|
+
doAcceptOddsChanges: acceptCahngeCoefs,
|
|
1669
|
+
statuses: {},
|
|
1670
|
+
systemIndex: systemIndex, // systemIndex - размер системы (например из 3-х событий по 2, значит передаем 2) -1 если не система
|
|
1671
|
+
};
|
|
1672
|
+
for (let i = 0; i < betslip.length; i++) {
|
|
1673
|
+
const v = betslip[i];
|
|
1674
|
+
const betName = [(_a = v.LinesID) !== null && _a !== void 0 ? _a : 'null', (_b = v.BetVarID) !== null && _b !== void 0 ? _b : 'null', (_c = v.HandSize) !== null && _c !== void 0 ? _c : 'null', (_d = v.Add1) !== null && _d !== void 0 ? _d : 'null', (_e = v.Add2) !== null && _e !== void 0 ? _e : 'null'].join('_');
|
|
1675
|
+
coupon.statuses[betName] = true;
|
|
1676
|
+
}
|
|
1677
|
+
return coupon;
|
|
1678
|
+
}
|
|
1679
|
+
/**
|
|
1680
|
+
* Places a bet.
|
|
1681
|
+
* @param payload - Parameters for placing the bet.
|
|
1682
|
+
* @returns The result of placing the bet.
|
|
1683
|
+
*/
|
|
1684
|
+
async placeCoupon(payload) {
|
|
1685
|
+
if (this.isSinged) {
|
|
1686
|
+
const url = this.url(`/betting/PlaceBet`, api.LBC);
|
|
1687
|
+
const res = await this.POST(url, payload);
|
|
1688
|
+
return res;
|
|
1689
|
+
}
|
|
1690
|
+
return;
|
|
1691
|
+
}
|
|
1692
|
+
/**
|
|
1693
|
+
* Places a bet on behalf of BetShop.
|
|
1694
|
+
* @param payload - Parameters for placing the bet.
|
|
1695
|
+
* @returns The result of placing the bet.
|
|
1696
|
+
*/
|
|
1697
|
+
async placeCouponBetShop(payload) {
|
|
1698
|
+
if (this.isSinged) {
|
|
1699
|
+
const url = this.url(`/betting/PlaceBetSubCashier`, api.LBC);
|
|
1700
|
+
const res = await this.POST(url, payload);
|
|
1701
|
+
return res;
|
|
1702
|
+
}
|
|
1703
|
+
return;
|
|
1704
|
+
}
|
|
1705
|
+
/**
|
|
1706
|
+
* Checks the status of a bet by coupon number.
|
|
1707
|
+
* Used for BetShop when users try to check
|
|
1708
|
+
* whether the bet won or lost.
|
|
1709
|
+
* @param {string} couponCode - The coupon number.
|
|
1710
|
+
* @returns The result of the bet.
|
|
1711
|
+
*/
|
|
1712
|
+
async getBetShopCouponByCode(couponCode) {
|
|
1713
|
+
if (this.isSinged) {
|
|
1714
|
+
const url = this.url(`/betting/GetBetSubCashier`, api.LBC);
|
|
1715
|
+
const payload = {
|
|
1716
|
+
code: couponCode,
|
|
1717
|
+
culture: this.locale,
|
|
1718
|
+
};
|
|
1719
|
+
const { data, status, statusText } = await this.request(url).query(payload).exec();
|
|
1720
|
+
return this.responseHandlerData(data, status, statusText);
|
|
1721
|
+
}
|
|
1722
|
+
return;
|
|
1723
|
+
}
|
|
1724
|
+
/**
|
|
1725
|
+
* Checks if a user with the specified login exists.
|
|
1726
|
+
* @param login - The user's login.
|
|
1727
|
+
* @returns A promise that resolves with the result of the check.
|
|
1728
|
+
*/
|
|
1729
|
+
async loginIsExist(login) {
|
|
1730
|
+
const url = this.url(`/account/IsUserExists`, api.LBC);
|
|
1731
|
+
const res = await this.GET(url, { userName: login });
|
|
1732
|
+
return res;
|
|
1733
|
+
}
|
|
1734
|
+
/**
|
|
1735
|
+
* Checks if the specified email exists in the system.
|
|
1736
|
+
* @param email - The email to check.
|
|
1737
|
+
* @returns A promise that resolves with the result of the check.
|
|
1738
|
+
*/
|
|
1739
|
+
async emailIsExist(email) {
|
|
1740
|
+
const url = this.url(`/account/IsEmailExists`, api.LBC);
|
|
1741
|
+
const res = await this.GET(url, { email });
|
|
1742
|
+
return res;
|
|
1743
|
+
}
|
|
1744
|
+
/**
|
|
1745
|
+
* Updates the user's personal data.
|
|
1746
|
+
* @param personalData - An object containing the user's personal data.
|
|
1747
|
+
* @returns Returns true if the data was successfully updated, otherwise returns false.
|
|
1748
|
+
*/
|
|
1749
|
+
async changePersonalData(personalData) {
|
|
1750
|
+
if (this.isSinged) {
|
|
1751
|
+
const url = this.url(`/account/ChangePersonalData`, api.LBC);
|
|
1752
|
+
const res = await this.POST(url, personalData);
|
|
1753
|
+
return res || false;
|
|
1754
|
+
}
|
|
1755
|
+
return false;
|
|
1756
|
+
}
|
|
1757
|
+
/**
|
|
1758
|
+
* Retrieves all messages.
|
|
1759
|
+
* @param page - The page number.
|
|
1760
|
+
* @param pageSize - The page size.
|
|
1761
|
+
* @returns An array of messages.
|
|
1762
|
+
*/
|
|
1763
|
+
async getMessagesAll({ page, pageSize }) {
|
|
1764
|
+
if (this.isSinged) {
|
|
1765
|
+
const url = this.url(`/messages/GetAllMessages`, api.LBC);
|
|
1766
|
+
const res = await this.GET(url, { page, pageSize });
|
|
1767
|
+
return res !== null && res !== void 0 ? res : [];
|
|
1768
|
+
}
|
|
1769
|
+
return [];
|
|
1770
|
+
}
|
|
1771
|
+
/**
|
|
1772
|
+
* Retrieves a message by its identifier.
|
|
1773
|
+
* @param id - The message identifier.
|
|
1774
|
+
* @returns The message object or an empty object if the message is not found.
|
|
1775
|
+
*/
|
|
1776
|
+
async getMessageById(id) {
|
|
1777
|
+
var _a;
|
|
1778
|
+
if (this.isSinged) {
|
|
1779
|
+
const url = this.url(`/messages/GetMessagesById`, api.LBC);
|
|
1780
|
+
const res = await this.GET(url, { id });
|
|
1781
|
+
return (_a = res[0]) !== null && _a !== void 0 ? _a : {};
|
|
1782
|
+
}
|
|
1783
|
+
return {};
|
|
1784
|
+
}
|
|
1785
|
+
/**
|
|
1786
|
+
* Sends a message to a user.
|
|
1787
|
+
* @param {Object} params - Parameters for sending the message.
|
|
1788
|
+
* @param {number} params.ToUserId - The identifier of the user to whom the message is sent.
|
|
1789
|
+
* @param {string} params.Text - The text of the message.
|
|
1790
|
+
* @param {string} params.Subject - The subject of the message.
|
|
1791
|
+
* @param {number} params.ParentId - The identifier of the parent message (if any).
|
|
1792
|
+
* @returns {Promise<any>} - A promise that resolves with the result of sending the message or null if sending is not possible.
|
|
1793
|
+
*/
|
|
1794
|
+
async sensMessage({ ToUserId, Text, Subject, ParentId }) {
|
|
1795
|
+
if (this.isSinged) {
|
|
1796
|
+
const url = this.url(`/messages/SendMessage`, api.LBC);
|
|
1797
|
+
const res = await this.POST(url, { ToUserId, Text, Subject, ParentId });
|
|
1798
|
+
return res !== null && res !== void 0 ? res : null;
|
|
1799
|
+
}
|
|
1800
|
+
return null;
|
|
1801
|
+
}
|
|
1802
|
+
/**
|
|
1803
|
+
* Marks a message as read.
|
|
1804
|
+
*
|
|
1805
|
+
* @param {Object} params - Request parameters.
|
|
1806
|
+
* @param {number} params.MessageId - The message identifier.
|
|
1807
|
+
* @param {number} params.MessageTypeId - The message type identifier.
|
|
1808
|
+
* @returns {Promise<any>} - A promise that resolves with the result of the request or null if the user is not authorized.
|
|
1809
|
+
*/
|
|
1810
|
+
async markMessageAsRead({ MessageId, MessageTypeId }) {
|
|
1811
|
+
if (this.isSinged) {
|
|
1812
|
+
const url = this.url(`/messages/MarkMessageAsRead`, api.LBC);
|
|
1813
|
+
const res = await this.POST(url, { MessageId, MessageTypeId });
|
|
1814
|
+
return res !== null && res !== void 0 ? res : null;
|
|
1815
|
+
}
|
|
1816
|
+
return null;
|
|
1817
|
+
}
|
|
1818
|
+
/**
|
|
1819
|
+
* Deletes a message by the specified message ID and type.
|
|
1820
|
+
* @param {Object} params - Parameters for deleting the message.
|
|
1821
|
+
* @param {number} params.MessageId - The message identifier.
|
|
1822
|
+
* @param {number} params.MessageTypeId - The message type identifier.
|
|
1823
|
+
* @returns {Promise<{ Result: boolean; Id: number } | null>} - An object containing the result of the deletion and the ID of the deleted message, or null if the deletion failed.
|
|
1824
|
+
*/
|
|
1825
|
+
async deleteMessage({ MessageId, MessageTypeId }) {
|
|
1826
|
+
if (this.isSinged) {
|
|
1827
|
+
const url = this.url(`/messages/DeleteMessage`, api.LBC);
|
|
1828
|
+
const res = await this.POST(url, { MessageId, MessageTypeId });
|
|
1829
|
+
return res !== null && res !== void 0 ? res : null;
|
|
1830
|
+
}
|
|
1831
|
+
return null;
|
|
1832
|
+
}
|
|
1833
|
+
/**
|
|
1834
|
+
* Deletes all messages.
|
|
1835
|
+
* @returns A promise that resolves to true, false, or null.
|
|
1836
|
+
*/
|
|
1837
|
+
async deleteMessagesAll() {
|
|
1838
|
+
if (this.isSinged) {
|
|
1839
|
+
const url = this.url(`/messages/DeleteAllMessages`, api.LBC);
|
|
1840
|
+
const res = await this.POST(url, {});
|
|
1841
|
+
return res !== null && res !== void 0 ? res : null;
|
|
1842
|
+
}
|
|
1843
|
+
return null;
|
|
1844
|
+
}
|
|
1845
|
+
/**
|
|
1846
|
+
* Retrieves the number of messages.
|
|
1847
|
+
* @returns An object containing the count of all messages, mass messages, and personal messages.
|
|
1848
|
+
* If the user is not authorized, returns null.
|
|
1849
|
+
*/
|
|
1850
|
+
async getMessagesCount() {
|
|
1851
|
+
if (this.isSinged) {
|
|
1852
|
+
const url = this.url(`/messages/GetMessagesCount`, api.LBC);
|
|
1853
|
+
const res = await this.GET(url, {});
|
|
1854
|
+
return res !== null && res !== void 0 ? res : null;
|
|
1855
|
+
}
|
|
1856
|
+
return null;
|
|
1857
|
+
}
|
|
1858
|
+
/**
|
|
1859
|
+
* Retrieves the number of unread messages.
|
|
1860
|
+
* @returns The number of unread messages or null if the user is not authorized.
|
|
1861
|
+
*/
|
|
1862
|
+
async getMessagesUnreadCount() {
|
|
1863
|
+
if (this.isSinged) {
|
|
1864
|
+
const url = this.url(`/messages/GetCountUnreadMessages`, api.LBC);
|
|
1865
|
+
const res = await this.GET(url, {});
|
|
1866
|
+
return res !== null && res !== void 0 ? res : null;
|
|
1867
|
+
}
|
|
1868
|
+
return null;
|
|
1869
|
+
}
|
|
1870
|
+
/** Checks if the user exists in the temporary table */
|
|
1871
|
+
async isUserTempExist(userName) {
|
|
1872
|
+
const url = this.url(`/account/IsUserExistsInTemp`, api.LBC);
|
|
1873
|
+
const { data /*, status , statusText */ } = await this.request(url).query({ userName }).exec();
|
|
1874
|
+
return data !== null && data !== void 0 ? data : null;
|
|
1875
|
+
}
|
|
1876
|
+
/**
|
|
1877
|
+
* Creates a user only in the temporary table.
|
|
1878
|
+
*/
|
|
1879
|
+
async createUserTemp(payload) {
|
|
1880
|
+
var _a, _b;
|
|
1881
|
+
const url = this.url(`/account/${this.locale}/UserRegistrationOnlyInTepm`);
|
|
1882
|
+
const { data: rawData /*, status , statusText */ } = await this.request(url).POST(payload).exec();
|
|
1883
|
+
const data = (_b = (_a = rawData === null || rawData === void 0 ? void 0 : rawData.Data) === null || _a === void 0 ? void 0 : _a._isSuccessful) !== null && _b !== void 0 ? _b : null;
|
|
1884
|
+
return data !== null && data !== void 0 ? data : null;
|
|
1885
|
+
}
|
|
1886
|
+
/**
|
|
1887
|
+
* Returns a list of GoldenRace games.
|
|
1888
|
+
*/
|
|
1889
|
+
async getGamesListGR(payload = { platforms: 'desktop' }) {
|
|
1890
|
+
const url = this.url(`/Softquo/GetGamesList`, api.DIRECT);
|
|
1891
|
+
const { data, status, statusText } = await this.request(url).POST(payload).exec();
|
|
1892
|
+
return this.responseHandlerData(data, status, statusText);
|
|
1893
|
+
}
|
|
1894
|
+
/**
|
|
1895
|
+
* Asynchronous method to get the GoldenRace game frame.
|
|
1896
|
+
*
|
|
1897
|
+
* @param payload - An object with parameters for the request.
|
|
1898
|
+
* @param payload.game - The game identifier. gameId is a required parameter.
|
|
1899
|
+
* @param payload.backurl - The URL to which the game redirects in case of an unexpected error or is used for client configurations such as the lobby URL for mobile games. Required parameter.
|
|
1900
|
+
* @param payload.mode - The game mode: 0 for virtual (fun) or 1 for real. Default: 1.
|
|
1901
|
+
* @param payload.language - The language code in ISO 639-1 alpha-2 format for loading localization. Default: "en".
|
|
1902
|
+
* @param payload.clientPlatform - The platform from which the game was launched: "desktop" or "mobile". Specify "mobile" if you want to open the mobile client of the game. Default: "desktop".
|
|
1903
|
+
* @param payload.group - The user group. In the configuration, this is essentially the cashier number. Required parameter.
|
|
1904
|
+
* @returns An object with response data, error (if any), status, and status text.
|
|
1905
|
+
*/
|
|
1906
|
+
async getGameFrameUrlGR(payload) {
|
|
1907
|
+
const url = this.url(`/Softquo/InitGame`, api.DIRECT);
|
|
1908
|
+
const { data, status, statusText } = await this.request(url).query(payload).exec();
|
|
1909
|
+
return this.responseHandlerData(data, status, statusText);
|
|
1910
|
+
}
|
|
1911
|
+
async pingApi() {
|
|
1912
|
+
const url = this.url(`/account/Ping`, api.LBC);
|
|
1913
|
+
const { data, status, statusText } = await this.request(url).exec();
|
|
1914
|
+
// console.log('!!! pingApi:', data , status , statusText);
|
|
1915
|
+
return this.responseHandlerData(data, status, statusText);
|
|
1916
|
+
}
|
|
1917
|
+
async intgrGetGamesList(payload) {
|
|
1918
|
+
const url = this.url(`/Games/GetGamesList`, api.DIRECT);
|
|
1919
|
+
const { data, status, statusText } = await this.request(url).POST(payload).exec();
|
|
1920
|
+
return this.responseHandlerData(data, status, statusText);
|
|
1921
|
+
}
|
|
1922
|
+
async intgrGetGameTypes(groupId) {
|
|
1923
|
+
const url = this.url(`/Games/GetGameTypes`, api.DIRECT);
|
|
1924
|
+
const { data, status, statusText } = await this.request(url).POST().query({ groupId }).exec();
|
|
1925
|
+
return this.responseHandlerData(data, status, statusText);
|
|
1926
|
+
}
|
|
1927
|
+
async intgrGetProvidersList(groupId) {
|
|
1928
|
+
const url = this.url(`/Games/GetGameProviders`, api.DIRECT);
|
|
1929
|
+
const { data, status, statusText } = await this.request(url).POST().query({ groupId }).exec();
|
|
1930
|
+
return this.responseHandlerData(data, status, statusText);
|
|
1931
|
+
}
|
|
1932
|
+
async intgrGetTopGames(groupId) {
|
|
1933
|
+
const url = this.url(`/Games/GetTopGames`, api.DIRECT);
|
|
1934
|
+
const { data, status, statusText } = await this.request(url).POST().query({ groupId }).exec();
|
|
1935
|
+
return this.responseHandlerData(data, status, statusText);
|
|
1936
|
+
}
|
|
1937
|
+
async intgrInitGame(payload) {
|
|
1938
|
+
const url = this.url(`/Games/InitGame`, api.DIRECT);
|
|
1939
|
+
const { data, status, statusText } = await this.request(url).query(payload).exec();
|
|
1940
|
+
return this.responseHandlerData(data, status, statusText);
|
|
1941
|
+
}
|
|
1942
|
+
async checkPromocode(promocode) {
|
|
1943
|
+
// TODO Not implemented
|
|
1944
|
+
return;
|
|
1945
|
+
}
|
|
1946
|
+
async activatePromocode(promocode) {
|
|
1947
|
+
// TODO Not implemented
|
|
1948
|
+
return;
|
|
1949
|
+
}
|
|
1950
|
+
/**
|
|
1951
|
+
* @example
|
|
1952
|
+
* ```
|
|
1953
|
+
const payload = {
|
|
1954
|
+
"isphone": this.typeLogin.phone,
|
|
1955
|
+
"login": clearLogin,
|
|
1956
|
+
}
|
|
1957
|
+
* ```
|
|
1958
|
+
*/
|
|
1959
|
+
async sendSms(payload) {
|
|
1960
|
+
// TODO Not implemented
|
|
1961
|
+
return;
|
|
1962
|
+
}
|
|
1963
|
+
async signUpPhone(request) {
|
|
1964
|
+
// TODO Not implemented
|
|
1965
|
+
return;
|
|
1966
|
+
}
|
|
1967
|
+
async passwordRecoveryRequest(post) {
|
|
1968
|
+
// TODO Not implemented
|
|
1969
|
+
return;
|
|
1970
|
+
}
|
|
1971
|
+
async passwordRecoveryEmail(email) {
|
|
1972
|
+
// TODO Not implemented
|
|
1973
|
+
return;
|
|
1974
|
+
}
|
|
1975
|
+
async passwordSetNewByPhone(request) {
|
|
1976
|
+
// TODO Not implemented
|
|
1977
|
+
return;
|
|
1978
|
+
}
|
|
1979
|
+
async passwordSetNewByEmail(request) {
|
|
1980
|
+
// TODO Not implemented
|
|
1981
|
+
return;
|
|
1982
|
+
}
|
|
1983
|
+
async signUpEmail(request) {
|
|
1984
|
+
// TODO Not implemented
|
|
1985
|
+
return;
|
|
1986
|
+
}
|
|
1987
|
+
async getUserPersonalInfo() {
|
|
1988
|
+
// TODO Not implemented
|
|
1989
|
+
return;
|
|
1990
|
+
}
|
|
1991
|
+
async sendPayment(apiPath, request) {
|
|
1992
|
+
// TODO Not implemented
|
|
1993
|
+
return;
|
|
1994
|
+
}
|
|
1995
|
+
async setUserPersonalInfo(request) {
|
|
1996
|
+
// TODO Not implemented
|
|
1997
|
+
return;
|
|
1998
|
+
}
|
|
1999
|
+
async getGamesToken(sToken) {
|
|
2000
|
+
// TODO Not implemented
|
|
2001
|
+
return;
|
|
2002
|
+
}
|
|
2003
|
+
async getProviderHedlines(providerHash) {
|
|
2004
|
+
// TODO Not implemented
|
|
2005
|
+
return;
|
|
2006
|
+
}
|
|
2007
|
+
async createTempSignUp({ login, password }) {
|
|
2008
|
+
// TODO Not implemented
|
|
2009
|
+
return;
|
|
2010
|
+
}
|
|
2011
|
+
async setRemoteLanguage(lang) {
|
|
2012
|
+
lang !== null && lang !== void 0 ? lang : (lang = this.lang);
|
|
2013
|
+
return await this.setLanguageRemoteLocale(lang);
|
|
2014
|
+
}
|
|
2015
|
+
/**
|
|
2016
|
+
* Converts bonuses to an array.
|
|
2017
|
+
* @param bonus - An object containing bonuses.
|
|
2018
|
+
* @returns An array of bonuses.
|
|
2019
|
+
*/
|
|
2020
|
+
convertBonuses(bonus) {
|
|
2021
|
+
let bonuses = [];
|
|
2022
|
+
Object.keys(bonus).forEach(k => {
|
|
2023
|
+
const koefMatch = k.match(/B_Koef(\d)_Value/);
|
|
2024
|
+
if (koefMatch) {
|
|
2025
|
+
const num = koefMatch[1];
|
|
2026
|
+
bonuses.push(['Koef', bonus[`B_Koef${num}`], bonus[`B_Koef${num}_Value`]]);
|
|
2027
|
+
}
|
|
2028
|
+
const kolvoMatch = k.match(/B_Kolvo(\d)_Value/);
|
|
2029
|
+
if (kolvoMatch) {
|
|
2030
|
+
const num = kolvoMatch[1];
|
|
2031
|
+
bonuses.push(['Kolvo', bonus[`B_Kolvo${num}`], bonus[`B_Kolvo${num}_Value`]]);
|
|
2032
|
+
}
|
|
2033
|
+
if (k === 'B_Perestavka_Value') {
|
|
2034
|
+
bonuses.push(['Perestavka', true, bonus[`B_Perestavka_Value`]]);
|
|
2035
|
+
}
|
|
2036
|
+
if (k === 'B_MinOdds') {
|
|
2037
|
+
bonuses.push(['MinOdds', true, bonus[`B_MinOdds`]]);
|
|
2038
|
+
}
|
|
2039
|
+
});
|
|
2040
|
+
return bonuses;
|
|
2041
|
+
}
|
|
2042
|
+
/**
|
|
2043
|
+
* Retrieves ticket information.
|
|
2044
|
+
* @description Requires authorization.
|
|
2045
|
+
* @returns {Promise<Betslip | null>} An object with ticket information or null if the token is not set.
|
|
2046
|
+
* @example
|
|
2047
|
+
* ```typescript
|
|
2048
|
+
{
|
|
2049
|
+
BetslipType: 0,
|
|
2050
|
+
Bets: [],
|
|
2051
|
+
RecommendedAmount: 0,
|
|
2052
|
+
bonuses: [
|
|
2053
|
+
[ 'Koef', 9, 1.01 ],
|
|
2054
|
+
[ 'Koef', 20, 1.02 ],
|
|
2055
|
+
[ 'Koef', 50, 1.03 ],
|
|
2056
|
+
[ 'Koef', 100, 1.04 ],
|
|
2057
|
+
[ 'Koef', 200, 1.05 ],
|
|
2058
|
+
[ 'Koef', 500, 1.06 ],
|
|
2059
|
+
[ 'Kolvo', 5, 1.01 ],
|
|
2060
|
+
[ 'Kolvo', 9, 1.02 ],
|
|
2061
|
+
[ 'Kolvo', 22, 1.03 ],
|
|
2062
|
+
[ 'Kolvo', 11, 1.04 ],
|
|
2063
|
+
[ 'Kolvo', 13, 1.05 ],
|
|
2064
|
+
[ 'Kolvo', 15, 1.06 ],
|
|
2065
|
+
[ 'Perestavka', true, 1.03 ],
|
|
2066
|
+
[ 'MinOdds', true, 1.02 ]
|
|
2067
|
+
]
|
|
2068
|
+
}
|
|
2069
|
+
* ```
|
|
2070
|
+
@deprecated
|
|
2071
|
+
*/
|
|
2072
|
+
async getBetslip_OLD() {
|
|
2073
|
+
var _a, _b;
|
|
2074
|
+
const url = this.url(`/betting/GetBetslip`, api.LBC);
|
|
2075
|
+
const res = await this.GET(url, {});
|
|
2076
|
+
// console.log('getBetslip res:', res);
|
|
2077
|
+
res['bonuses'] = this.convertBonuses((_a = res === null || res === void 0 ? void 0 : res.Bonus) !== null && _a !== void 0 ? _a : {});
|
|
2078
|
+
(_b = res.Bets) !== null && _b !== void 0 ? _b : (res.Bets = []);
|
|
2079
|
+
delete res.Bonus;
|
|
2080
|
+
return res !== null && res !== void 0 ? res : {};
|
|
2081
|
+
}
|
|
2082
|
+
async getBetslip() {
|
|
2083
|
+
var _a, _b;
|
|
2084
|
+
const url = this.url(`/betting/GetBetslip`, api.LBC);
|
|
2085
|
+
let { data, status, statusText } = await this.request(url).exec();
|
|
2086
|
+
data !== null && data !== void 0 ? data : (data = {});
|
|
2087
|
+
data['bonuses'] = this.convertBonuses((_a = data === null || data === void 0 ? void 0 : data.Bonus) !== null && _a !== void 0 ? _a : {});
|
|
2088
|
+
(_b = data.Bets) !== null && _b !== void 0 ? _b : (data.Bets = []);
|
|
2089
|
+
delete data.Bonus;
|
|
2090
|
+
return data;
|
|
2091
|
+
}
|
|
2092
|
+
/**
|
|
2093
|
+
* Clears the bet slip.
|
|
2094
|
+
* @returns A promise that resolves to a boolean indicating the success of the operation.
|
|
2095
|
+
*/
|
|
2096
|
+
async clearBetslip() {
|
|
2097
|
+
const url = this.url(`/betting/ClearBetslip`, api.LBC);
|
|
2098
|
+
const res = await this.POST(url);
|
|
2099
|
+
return res !== null && res !== void 0 ? res : false;
|
|
2100
|
+
}
|
|
2101
|
+
/**
|
|
2102
|
+
* Changes the type of the bet slip.
|
|
2103
|
+
* @param betslipType - The type of the bet slip.
|
|
2104
|
+
* @returns Returns true if the bet slip type was successfully changed, otherwise returns false.
|
|
2105
|
+
*/
|
|
2106
|
+
async changeBetslipType(betslipType) {
|
|
2107
|
+
const url = this.url(`/betting/ChangeBetslipType`, api.LBC);
|
|
2108
|
+
const res = await this.POST(url, {}, { betslipType });
|
|
2109
|
+
return res !== null && res !== void 0 ? res : false;
|
|
2110
|
+
}
|
|
2111
|
+
/**
|
|
2112
|
+
* Sets the bet slip settings.
|
|
2113
|
+
* @param betslipSettings - The bet slip settings.
|
|
2114
|
+
* @returns An array of results or an empty array if the user is not authorized.
|
|
2115
|
+
*/
|
|
2116
|
+
async setBetslipSettings(betslipSettings) {
|
|
2117
|
+
if (this.isSinged) {
|
|
2118
|
+
const url = this.url(`/betting/SetBetslipSettings`, api.LBC);
|
|
2119
|
+
const res = await this.POST(url, betslipSettings);
|
|
2120
|
+
return res !== null && res !== void 0 ? res : [];
|
|
2121
|
+
}
|
|
2122
|
+
return [];
|
|
2123
|
+
}
|
|
2124
|
+
/**
|
|
2125
|
+
* Adds a bet to the bet slip.
|
|
2126
|
+
* @param basket - The basket containing bet information.
|
|
2127
|
+
* @returns The result of the add operation to the bet slip or null if the operation failed.
|
|
2128
|
+
*/
|
|
2129
|
+
async addToBetslip(basket) {
|
|
2130
|
+
basket.culture = this.locale;
|
|
2131
|
+
const url = this.url(`/betting/AddToBetslip`, api.LBC);
|
|
2132
|
+
const res = await this.POST(url, basket);
|
|
2133
|
+
return res !== null && res !== void 0 ? res : null;
|
|
2134
|
+
}
|
|
2135
|
+
/**
|
|
2136
|
+
* Removes a bet from the bet slip.
|
|
2137
|
+
* @param basket - An object containing information about the bet slip.
|
|
2138
|
+
* @returns Returns true if the item was successfully removed, otherwise returns false.
|
|
2139
|
+
*/
|
|
2140
|
+
async removeFromBetslip(basket) {
|
|
2141
|
+
basket.culture = this.locale;
|
|
2142
|
+
const url = this.url(`/betting/RemoveFromBetslip`, api.LBC);
|
|
2143
|
+
const res = await this.POST(url, basket /* , this.queryStringHandler(basket) */);
|
|
2144
|
+
return res || false;
|
|
2145
|
+
}
|
|
2146
|
+
/**
|
|
2147
|
+
* Removes a bonus from the bet slip.
|
|
2148
|
+
* @returns {Promise<boolean>} Returns true if the bonus was successfully removed, otherwise returns false.
|
|
2149
|
+
*/
|
|
2150
|
+
async removeBonus() {
|
|
2151
|
+
const url = this.url(`/betting/DeleteBonus`, api.LBC);
|
|
2152
|
+
const res = await this.POST(url);
|
|
2153
|
+
return res !== null && res !== void 0 ? res : false;
|
|
2154
|
+
}
|
|
2155
|
+
/**
|
|
2156
|
+
* Adds a bonus to the bet slip.
|
|
2157
|
+
* @param odd - The coefficient to which the bonus is added.
|
|
2158
|
+
* @returns The result of the operation or null if the result is undefined.
|
|
2159
|
+
*/
|
|
2160
|
+
async addBonus(odd) {
|
|
2161
|
+
const url = this.url(`/betting/AddBonus`, api.LBC);
|
|
2162
|
+
const res = await this.POST(url, {}, { odd });
|
|
2163
|
+
return res !== null && res !== void 0 ? res : null;
|
|
2164
|
+
}
|
|
2165
|
+
/**
|
|
2166
|
+
* Updates a bet in the bet slip.
|
|
2167
|
+
* @param basket - The basket containing bet information.
|
|
2168
|
+
* @returns Returns true if the bet was successfully updated, otherwise returns false.
|
|
2169
|
+
*/
|
|
2170
|
+
async updateBet(basket) {
|
|
2171
|
+
basket.culture = this.locale;
|
|
2172
|
+
const url = this.url(`/betting/UpdateBet`, api.LBC);
|
|
2173
|
+
const res = await this.POST(url, basket);
|
|
2174
|
+
return res === null;
|
|
2175
|
+
}
|
|
2176
|
+
/**
|
|
2177
|
+
* Retrieves bet limits.
|
|
2178
|
+
* @returns An object with the minimum and maximum bet limits.
|
|
2179
|
+
* @deprecated use api.getBetsLimitsNew();
|
|
2180
|
+
*/
|
|
2181
|
+
async getBetsLimits() {
|
|
2182
|
+
if (this.isSinged) {
|
|
2183
|
+
const url = this.url(`/betting/GetLimitations`, api.LBC);
|
|
2184
|
+
const res = await this.GET(url);
|
|
2185
|
+
// return res ?? { Min: -Infinity, Max: Infinity };
|
|
2186
|
+
return res !== null && res !== void 0 ? res : { Min: 0, Max: 0 };
|
|
2187
|
+
}
|
|
2188
|
+
return { Min: 0, Max: 0 };
|
|
2189
|
+
}
|
|
2190
|
+
/**
|
|
2191
|
+
* Retrieves bet limits.
|
|
2192
|
+
* @returns An object with the minimum and maximum bet limits.
|
|
2193
|
+
*/
|
|
2194
|
+
async getBetsLimitsNew() {
|
|
2195
|
+
var _a, _b, _c;
|
|
2196
|
+
if (this.isSinged) {
|
|
2197
|
+
const url = this.url(`/betting/GetLimitations`, api.LBC);
|
|
2198
|
+
const { data, status, statusText } = await this.request(url).exec();
|
|
2199
|
+
const handledData = {
|
|
2200
|
+
Min: (_a = data === null || data === void 0 ? void 0 : data.Min) !== null && _a !== void 0 ? _a : 0,
|
|
2201
|
+
Max: (_b = data === null || data === void 0 ? void 0 : data.Max) !== null && _b !== void 0 ? _b : 0,
|
|
2202
|
+
MaxOddForMulty: (_c = data === null || data === void 0 ? void 0 : data.MaxOddForMulty) !== null && _c !== void 0 ? _c : 250,
|
|
2203
|
+
};
|
|
2204
|
+
return this.responseHandlerData(handledData, status, statusText);
|
|
2205
|
+
}
|
|
2206
|
+
return { data: { Min: 0, Max: 0, MaxOddForMulty: 250 }, status: 200, statusText: 'OK' };
|
|
2207
|
+
}
|
|
2208
|
+
/**
|
|
2209
|
+
* Retrieves a list of available currencies (essentially a list of cash registers).
|
|
2210
|
+
* @returns A list of available currencies.
|
|
2211
|
+
*/
|
|
2212
|
+
async getCurrencies() {
|
|
2213
|
+
if (this.isSinged) {
|
|
2214
|
+
const url = this.url(`/location/GetCurrencies`, api.V2);
|
|
2215
|
+
const res = await this.GET(url);
|
|
2216
|
+
return res !== null && res !== void 0 ? res : [];
|
|
2217
|
+
}
|
|
2218
|
+
return null;
|
|
2219
|
+
}
|
|
2220
|
+
/**
|
|
2221
|
+
* Retrieves a list of countries.
|
|
2222
|
+
* @returns A list of countries or null if the user is not authorized.
|
|
2223
|
+
*/
|
|
2224
|
+
async getCountries() {
|
|
2225
|
+
if (this.isSinged) {
|
|
2226
|
+
const url = this.url(`/location/GetCountries`, api.V2);
|
|
2227
|
+
const res = await this.GET(url);
|
|
2228
|
+
return res !== null && res !== void 0 ? res : [];
|
|
2229
|
+
}
|
|
2230
|
+
return null;
|
|
2231
|
+
}
|
|
2232
|
+
async getAllKeys(key) {
|
|
2233
|
+
// !TODO getAllKeys - разобраться (какой key передавать? Что возвращает?)
|
|
2234
|
+
const url = this.url(`/info/GetAllKeys`, api.LBC);
|
|
2235
|
+
const res = await this.GET(url, { key, culture: this.locale });
|
|
2236
|
+
return res !== null && res !== void 0 ? res : [];
|
|
2237
|
+
}
|
|
2238
|
+
/**
|
|
2239
|
+
* Fetches slides data from a predefined URL.
|
|
2240
|
+
*
|
|
2241
|
+
* @returns {Promise<string | null>} A promise that resolves to the slides data as a string, or null if an error occurs.
|
|
2242
|
+
*
|
|
2243
|
+
* @throws {Error} If the request fails or the response status is not successful.
|
|
2244
|
+
*/
|
|
2245
|
+
async getSlides(target) {
|
|
2246
|
+
target !== null && target !== void 0 ? target : (target = `https://f004.backblazeb2.com/file/betroute/slides.json`);
|
|
2247
|
+
const url = this.url(target);
|
|
2248
|
+
const { data, status, statusText } = await this.request(url).deleteAllHeaders().exec();
|
|
2249
|
+
return this.responseHandlerData(data, status, statusText);
|
|
2250
|
+
}
|
|
2251
|
+
/**
|
|
2252
|
+
* Fetches event statistic data for a given event ID.
|
|
2253
|
+
*
|
|
2254
|
+
* @param {number} brEventId - The ID of the event for which to fetch statistics.
|
|
2255
|
+
* @returns {Promise<any | null>} A promise that resolves to the event statistic data or null if an error occurs.
|
|
2256
|
+
*/
|
|
2257
|
+
async getEventStatisticData(brEventId) {
|
|
2258
|
+
const url = this.url(`/stats/data/${brEventId}/${this.locale}`, api.NV20);
|
|
2259
|
+
const { data, status, statusText } = await this.request(url).exec();
|
|
2260
|
+
return this.responseHandlerData(data, status, statusText);
|
|
2261
|
+
}
|
|
2262
|
+
/**
|
|
2263
|
+
* Retrieves the statistics page for a specific event.
|
|
2264
|
+
* @param brEventId - The unique identifier for the betting radar event.
|
|
2265
|
+
* @returns {Promise<string | null>} A promise that resolves to the event statistics page content or null.
|
|
2266
|
+
* @throws {Error} If the request fails or returns an invalid response.
|
|
2267
|
+
*/
|
|
2268
|
+
async getEventStatisticPage(brEventId) {
|
|
2269
|
+
const url = this.url(`/stats/page/${brEventId}/${this.locale}`, api.NV20);
|
|
2270
|
+
const { data, status, statusText } = await this.request(url).exec();
|
|
2271
|
+
return this.responseHandlerData(data, status, statusText);
|
|
2272
|
+
}
|
|
2273
|
+
/**
|
|
2274
|
+
* Searches for prematch events using the NV20 API.
|
|
2275
|
+
*
|
|
2276
|
+
* @param searchString - The search string to query events.
|
|
2277
|
+
* (Note: that all words containing cvr and words with one letter are removed from the searchString)
|
|
2278
|
+
* @param options - Optional parameters to refine the search.
|
|
2279
|
+
* @param options.LIMIT - Specifies the number of results to return. Defaults to `{ from: 0, size: 30 }` if not provided.
|
|
2280
|
+
* @param options.negativeString - Excludes results containing this string.
|
|
2281
|
+
* @param options.sportId - Filters events by the specified sport ID.
|
|
2282
|
+
* @param options.tournamentId - Filters events by the specified tournament ID.
|
|
2283
|
+
* @returns A promise that resolves with the search results or `null` if the request fails.
|
|
2284
|
+
*/
|
|
2285
|
+
async searchPrematchEventsNv20(searchString, options = {}) {
|
|
2286
|
+
var _a;
|
|
2287
|
+
const removeOneSymbolAndDigit = (text) => {
|
|
2288
|
+
return text.split(/\s+/).filter(i => { return /\d/.test(i) !== true && i.length > 1; }).join(' ').trim();
|
|
2289
|
+
};
|
|
2290
|
+
const url = this.url(`/stats/pm/search`, api.NV20);
|
|
2291
|
+
// const url = this.url(`/stats/page/${brEventId}/${this.locale}`, api.NV20);
|
|
2292
|
+
searchString = (_a = options === null || options === void 0 ? void 0 : options.searchString) !== null && _a !== void 0 ? _a : removeOneSymbolAndDigit(searchString);
|
|
2293
|
+
const payload = Object.assign(Object.assign(Object.assign(Object.assign({ locale: this.locale, searchString }, ((options === null || options === void 0 ? void 0 : options.LIMIT) ? { LIMIT: options.LIMIT } : { LIMIT: { from: 0, size: 30 } })), ((options === null || options === void 0 ? void 0 : options.negativeString) ? { negativeString: options.negativeString } : {})), ((options === null || options === void 0 ? void 0 : options.sportId) ? { sportId: options.sportId } : {})), ((options === null || options === void 0 ? void 0 : options.tournamentId) ? { tournamentId: options.tournamentId } : {}));
|
|
2294
|
+
const { data: rawData, status, statusText } = await this.request(url).POST(payload).exec();
|
|
2295
|
+
rawData.searchString = searchString;
|
|
2296
|
+
rawData.from = payload.LIMIT.from;
|
|
2297
|
+
rawData.size = payload.LIMIT.size;
|
|
2298
|
+
return this.responseHandlerData(rawData, status, statusText);
|
|
2299
|
+
}
|
|
2300
|
+
async searchPrematchTournametsEventsNv20(searchString, options = {}) {
|
|
2301
|
+
var _a, _b, _c;
|
|
2302
|
+
const { data, status, statusText } = await this.searchPrematchEventsNv20(searchString, options);
|
|
2303
|
+
const documents = (_a = data === null || data === void 0 ? void 0 : data.documents) !== null && _a !== void 0 ? _a : [];
|
|
2304
|
+
const grouped = documents.reduce((acc, doc) => {
|
|
2305
|
+
const key = doc.EventKeys.TurnirID;
|
|
2306
|
+
if (!acc[key]) {
|
|
2307
|
+
acc[key] = [];
|
|
2308
|
+
}
|
|
2309
|
+
acc[key].push(doc);
|
|
2310
|
+
return acc;
|
|
2311
|
+
}, {});
|
|
2312
|
+
const tournaments = Object.entries(grouped).map(([id, events]) => ({
|
|
2313
|
+
Id: id,
|
|
2314
|
+
Name: events[0].TourneyName.trim(),
|
|
2315
|
+
SportName: events[0].SportName,
|
|
2316
|
+
SportID: events[0].EventKeys.SportID,
|
|
2317
|
+
EventsHeaders: events,
|
|
2318
|
+
}));
|
|
2319
|
+
const ret = {
|
|
2320
|
+
tournaments,
|
|
2321
|
+
total: (_b = data === null || data === void 0 ? void 0 : data.total) !== null && _b !== void 0 ? _b : 0,
|
|
2322
|
+
searchString: (_c = data === null || data === void 0 ? void 0 : data.searchString) !== null && _c !== void 0 ? _c : '',
|
|
2323
|
+
};
|
|
2324
|
+
return this.responseHandlerData(ret, status, statusText);
|
|
2325
|
+
}
|
|
2326
|
+
/**
|
|
2327
|
+
* Sends error information to the specified endpoint.
|
|
2328
|
+
*
|
|
2329
|
+
* @param text - The error message text.
|
|
2330
|
+
* @param code - The error code.
|
|
2331
|
+
* @returns A promise that resolves to a string or null based on the response.
|
|
2332
|
+
*/
|
|
2333
|
+
async sendErrInfo(text, code) {
|
|
2334
|
+
const url = this.url(`/err/send/front`, api.NV20);
|
|
2335
|
+
const { data, status, statusText } = await this.request(url).POST({ text, code }).exec();
|
|
2336
|
+
return this.responseHandlerData(data === null || data === void 0 ? void 0 : data.ok, status, statusText);
|
|
2337
|
+
}
|
|
2338
|
+
async cloneBetCoupon(payload) {
|
|
2339
|
+
var _a, _b;
|
|
2340
|
+
const url = this.url(`/betting/TryGetBetCopy`, api.LBC);
|
|
2341
|
+
(_a = payload.betId) !== null && _a !== void 0 ? _a : (payload.betId = null);
|
|
2342
|
+
(_b = payload.code) !== null && _b !== void 0 ? _b : (payload.code = null);
|
|
2343
|
+
payload.culture = this.locale;
|
|
2344
|
+
const { data, status, statusText } = await this.request(url).query(payload).exec();
|
|
2345
|
+
return this.responseHandlerData(data, status, statusText);
|
|
2346
|
+
}
|
|
2347
|
+
async getAllBanners() {
|
|
2348
|
+
// !TODO getAllBanners - возвращает непонятный список (для разных сайтов должен быть разный набор баннеров)
|
|
2349
|
+
const url = this.url(`/info/GetAllBanners`, api.LBC);
|
|
2350
|
+
const res = await this.GET(url, { culture: this.locale });
|
|
2351
|
+
return res !== null && res !== void 0 ? res : [];
|
|
2352
|
+
}
|
|
2353
|
+
async depositBetKiosk(amount) {
|
|
2354
|
+
const url = this.url(`/betting/DepositMoneyBetshopPlayer`, api.LBC);
|
|
2355
|
+
const { data, status, statusText } = await this.request(url).query({ sum: amount }).exec();
|
|
2356
|
+
return this.responseHandlerData(data, status, statusText);
|
|
2357
|
+
}
|
|
2358
|
+
async getFaq() {
|
|
2359
|
+
// !TODO getFaq - приходит пустым (для разных сайтов должен быть разный набор Faq)
|
|
2360
|
+
const url = this.url(`/info/GetFaq`, api.LBC);
|
|
2361
|
+
const res = await this.GET(url, { culture: this.locale });
|
|
2362
|
+
return res !== null && res !== void 0 ? res : [];
|
|
2363
|
+
}
|
|
2364
|
+
async getFlatpagesList() {
|
|
2365
|
+
// !TODO getFlatpagesList - Not implemented
|
|
2366
|
+
return [];
|
|
2367
|
+
const url = this.url(`/info/XXXXXXX`, api.LBC);
|
|
2368
|
+
const res = await this.GET(url, { culture: this.locale });
|
|
2369
|
+
return res !== null && res !== void 0 ? res : [];
|
|
2370
|
+
}
|
|
2371
|
+
async test3() {
|
|
2372
|
+
return 'test3 Ok';
|
|
2373
|
+
}
|
|
2374
|
+
async sellBet(data) {
|
|
2375
|
+
// !TODO sellBet - Not implemented
|
|
2376
|
+
// ! Нет реализации в BC
|
|
2377
|
+
}
|
|
2378
|
+
/** Конвертирует различные представления корзины в единый формат
|
|
2379
|
+
* @param betslipItem - элемент корзины
|
|
2380
|
+
*/
|
|
2381
|
+
convertBasketToPost(betslipItem) {
|
|
2382
|
+
return {
|
|
2383
|
+
a1: betslipItem.Add1,
|
|
2384
|
+
a2: betslipItem.Add2,
|
|
2385
|
+
bId: betslipItem.BetVarID,
|
|
2386
|
+
eId: betslipItem.LinesID,
|
|
2387
|
+
fs: betslipItem.HandSize,
|
|
2388
|
+
isLive: betslipItem.IsLive,
|
|
2389
|
+
r: betslipItem.Odds,
|
|
2390
|
+
};
|
|
2391
|
+
}
|
|
2392
|
+
}
|
|
2393
|
+
// getPrematchEvents
|
|
2394
|
+
// https://front-test.restin.win/api/line/en-US/events/sport5/country8/tourney2042/720
|
|
2395
|
+
// #region HelperAPi
|
|
2396
|
+
// LbcV2Account
|
|
2397
|
+
// POST /v2/lbc/api/account/SetLanguage +
|
|
2398
|
+
// GET /v2/lbc/api/account/GetAccountTransactions +
|
|
2399
|
+
// - POST /v2/lbc/api/account/SetTimeZone
|
|
2400
|
+
// - POST /v2/lbc/api/account/SetBetsFormat
|
|
2401
|
+
// - GET /v2/lbc/api/account/GetUserTokenBetgames
|
|
2402
|
+
// GET /v2/lbc/api/account/GetUserBalance +
|
|
2403
|
+
// GET /v2/lbc/api/account/GetUserData +
|
|
2404
|
+
// POST /v2/lbc/api/account/LogIn +
|
|
2405
|
+
// DELETE /v2/lbc/api/account/LogOut +
|
|
2406
|
+
// GET /v2/lbc/api/account/IsUserExists +
|
|
2407
|
+
// GET /v2/lbc/api/account/IsEmailExists +
|
|
2408
|
+
// - POST /v2/lbc/api/account/Register
|
|
2409
|
+
// - GET /v2/lbc/api/account/GetSecretQuestion
|
|
2410
|
+
// - POST /v2/lbc/api/account/RecoverPassword
|
|
2411
|
+
// POST /v2/lbc/api/account/ChangeUserPassword +
|
|
2412
|
+
// POST /v2/lbc/api/account/ChangePersonalData +
|
|
2413
|
+
// - GET /v2/lbc/api/account/GetImage
|
|
2414
|
+
// GET /v2/lbc/api/account/GetUserBets +
|
|
2415
|
+
// GET /v2/lbc/api/account/GetBetContent +
|
|
2416
|
+
// LbcV2Betting
|
|
2417
|
+
// GET /v2/lbc/api/betting/GetLimitations +
|
|
2418
|
+
// POST /v2/lbc/api/betting/AddToBetslip +
|
|
2419
|
+
// POST /v2/lbc/api/betting/AddBonus +
|
|
2420
|
+
// DELETE /v2/lbc/api/betting/DeleteBonus +
|
|
2421
|
+
// DELETE /v2/lbc/api/betting/RemoveFromBetslip +
|
|
2422
|
+
// POST /v2/lbc/api/betting/UpdateBet +
|
|
2423
|
+
// GET /v2/lbc/api/betting/GetBetslip +
|
|
2424
|
+
// DELETE /v2/lbc/api/betting/ClearBetslip +
|
|
2425
|
+
// POST /v2/lbc/api/betting/ChangeBetslipType +
|
|
2426
|
+
// POST /v2/lbc/api/betting/PlaceBet +
|
|
2427
|
+
// POST /v2/lbc/api/betting/SetBetslipSettings +
|
|
2428
|
+
// #endregion HelperAPi
|