bb-api-platforma 0.1.212 → 0.1.214
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BetBoosterOfficeApi.d.ts +11 -1
- package/dist/BetBoosterOfficeApi.js +25 -17
- package/package.json +1 -1
|
@@ -1108,5 +1108,15 @@ export declare class BetBoosterOfficeApi {
|
|
|
1108
1108
|
start?: string;
|
|
1109
1109
|
finish?: string;
|
|
1110
1110
|
code?: string;
|
|
1111
|
-
}): Promise<
|
|
1111
|
+
}): Promise<{
|
|
1112
|
+
data: I.IApiResponse<any> | null;
|
|
1113
|
+
error: string | null;
|
|
1114
|
+
status: number;
|
|
1115
|
+
statusText: string;
|
|
1116
|
+
} | {
|
|
1117
|
+
data: {};
|
|
1118
|
+
error: string;
|
|
1119
|
+
status: number;
|
|
1120
|
+
statusText: string;
|
|
1121
|
+
}>;
|
|
1112
1122
|
}
|
|
@@ -32,6 +32,10 @@ const languageIdsRemote = {
|
|
|
32
32
|
const stringify = (obj) => {
|
|
33
33
|
return JSON.stringify(obj, null, 2);
|
|
34
34
|
};
|
|
35
|
+
const IsDateIsoString = (dateStr) => {
|
|
36
|
+
const isoRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;
|
|
37
|
+
return isoRegex.test(dateStr || '');
|
|
38
|
+
};
|
|
35
39
|
export function routeNameId(id, text = '') {
|
|
36
40
|
text !== null && text !== void 0 ? text : (text = '');
|
|
37
41
|
return `${text
|
|
@@ -348,23 +352,23 @@ export class BetBoosterOfficeApi {
|
|
|
348
352
|
}
|
|
349
353
|
switch (apiVersion) {
|
|
350
354
|
case api.OFFICE:
|
|
351
|
-
return `${this.
|
|
355
|
+
return `${this._baseUrl}/api/v1/office/${this.locale}${apiPath}`;
|
|
352
356
|
case api.V1:
|
|
353
|
-
return `${this.
|
|
357
|
+
return `${this._baseUrl}/api/v1${apiPath}`;
|
|
354
358
|
case api.V2:
|
|
355
|
-
return `${this.
|
|
359
|
+
return `${this._baseUrl}/api/v2${apiPath}`;
|
|
356
360
|
case api.LINE:
|
|
357
|
-
return `${this.
|
|
361
|
+
return `${this._baseUrl}/api/line/${this.locale}${apiPath}`;
|
|
358
362
|
case api.LIVE:
|
|
359
|
-
return `${this.
|
|
363
|
+
return `${this._baseUrl}/api/live/${this.locale}${apiPath}`;
|
|
360
364
|
case api.BASE:
|
|
361
|
-
return `${this.
|
|
365
|
+
return `${this._baseUrl}`;
|
|
362
366
|
case api.NV20:
|
|
363
|
-
return `${this.
|
|
367
|
+
return `${this._baseUrl}/nv20${apiPath}`;
|
|
364
368
|
case api.NV30:
|
|
365
|
-
return `${this.
|
|
369
|
+
return `${this._baseUrl}/nv30${apiPath}`;
|
|
366
370
|
default:
|
|
367
|
-
return `${this.
|
|
371
|
+
return `${this._baseUrl}/api${apiPath}`;
|
|
368
372
|
}
|
|
369
373
|
}
|
|
370
374
|
// #endregion Handlers --------------------------------------------------------------------
|
|
@@ -2118,15 +2122,19 @@ export class BetBoosterOfficeApi {
|
|
|
2118
2122
|
* @throws {Error} May throw an error if the API request fails
|
|
2119
2123
|
*/
|
|
2120
2124
|
async getBonuses({ start, finish, code }) {
|
|
2121
|
-
const IsDateIsoString = (dateStr) => {
|
|
2122
|
-
const isoRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;
|
|
2123
|
-
return isoRegex.test(dateStr || '');
|
|
2124
|
-
};
|
|
2125
2125
|
const url = this.url(`/bonus/GetBonuses`);
|
|
2126
|
-
const query = Object.assign(Object.assign({}, (code ? { 'getBonusesBody.code': code } : {})), (IsDateIsoString(start) && IsDateIsoString(finish) ? { 'getBonusesBody.startDate': start, 'getBonusesBody.endDate': finish } : {}));
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2126
|
+
const query = Object.assign(Object.assign({}, (code ? { 'getBonusesBody.code': code } : {})), (!code && IsDateIsoString(start) && IsDateIsoString(finish) ? { 'getBonusesBody.startDate': start, 'getBonusesBody.endDate': finish } : {}));
|
|
2127
|
+
if (Object.keys(query).length === 0) {
|
|
2128
|
+
return {
|
|
2129
|
+
data: {},
|
|
2130
|
+
error: "No valid parameters provided",
|
|
2131
|
+
status: 200,
|
|
2132
|
+
statusText: 'OK'
|
|
2133
|
+
};
|
|
2134
|
+
}
|
|
2135
|
+
// console.log(url, query, IsDateIsoString(start), IsDateIsoString(finish));
|
|
2136
|
+
const { data, status, statusText } = await this.request(url).GET().query(query).exec();
|
|
2137
|
+
return this.responseHandlerDataData(data, status, statusText);
|
|
2130
2138
|
}
|
|
2131
2139
|
}
|
|
2132
2140
|
// @workspace /doc в комментарии приведи полный пример payload из I.IConfirmWithdrawalOrderPayload
|