bb-api-platforma
Version:
API module for BetBooster Platform
1,192 lines (1,191 loc) • 48.7 kB
TypeScript
import { AxiosInstance } from 'axios';
import * as I from './Types.js';
export declare function routeNameId(id: number | string, text?: string): string;
export declare function clearPhone(draftPhoneNumber: number | string, prefix?: string, suffix?: string): string;
export declare class BetBoosterApi {
private _baseUrl;
/**
* A clean superagent instance that can be used for http requests
*/
axi: AxiosInstance;
private _locale;
private _locales;
private _languageIdsRemote;
private EXIST_LANGUAGES;
private _languageId;
private _lang;
private _TOKEN?;
private _USER_DATA;
private LANG_DEFAULT;
private LOCALE_DEFAULT;
private LANG_ID_DEFAULT;
private maxTimeExecutionMs;
liveTimestamp: string | number;
private _liveTimestampReset;
liveRecivedIsFullPackage?: boolean;
isNotActive?: boolean;
/**
* Represents the BetBoosterApi class.
* @constructor
* @param {AxiosInstance} axiosInstance - The Axios instance to be used for making HTTP requests. Aka axios.create()
* @param {string} baseUrl - The base URL of the API.
* @param {string} [lang='en'] - The language to be used for API requests. Defaults to 'en'.
* @param {number} [maxTimeExecutionMs=15000] - The maximum time allowed for API request execution in milliseconds. Defaults to 15000.
* @param {boolean} [isDev=false] - Indicates whether the API is running in development mode. Defaults to false.
*/
constructor(axiosInstance: AxiosInstance, baseUrl: string, lang?: string, maxTimeExecutionMs?: number, isDev?: boolean);
get locale(): string;
get isSinged(): boolean;
get user(): I.IUser;
get userMain(): string[];
set user(value: I.IUser);
get lang(): string;
get languageId(): number;
get token(): string | undefined;
set token(value: string | undefined);
/**
* Processes the response data and returns an object with data, error, status and status text.
*
* @template T - Тип данных, возвращаемых в поле `data`.
* @param {any} rawData - Сырые данные ответа.
* @param {number} status - HTTP статус ответа.
* @param {string} statusText - Текст статуса HTTP ответа.
* @returns {{ data: T, error: string | null, status: number, statusText: string }} Объект, содержащий данные ответа, ошибку, статус и текст статуса.
*/
responseHandlerData<T = any | null>(rawData: any, status: number, statusText: string): {
data: T | null;
error: string | null;
status: number;
statusText: string;
};
/**
* Converts rawData.Data.Data format to rawData.Data.data format
* Sometimes API returns a format that is difficult to process later.
* Therefore it is necessary to convert the format for proper data processing (responseHandlerData)
* @param rawData
* @returns
*/
private convertDataData;
setDevMode(devMode?: boolean | undefined): void;
/**
* Adds new locale keys and values to the existing locales.
* Updates the list of existing languages with any new language codes found in the provided data.
*
* @param localesData - An object mapping locale keys to their translations
* @example
* // Add new translations
* betBoosterApi.addLocalesConverters({
* 'en': 'en-US',
* 'fr': 'fr-FR'
* });
*/
addLocalesConverters(localesData: Record<string, string>): void;
checkLanguage(lang?: string): string;
/**
* Sets the language for the BetBooster API.
*
* @param {string} [lang='en'] - The language code to set. Defaults to 'en' if not provided.
* @returns {string} - The language code that was set.
* @example
* ```
* api.setLanguage('en');
* ```
* as result:
* lang='en';
* locale='en-US';
* languageId=1;
*/
setLanguage(lang?: string): string;
/**
* Sets the language and locale for the remote API.
* @param lang Language (default 'en').
* @returns Returns true if the language and locale are successfully set, otherwise returns false.
*/
setLanguageRemoteLocale(lang?: string): Promise<any>;
private setBaseUrl;
private statusHandler;
/**
* Query string handler. Replaces values
* * `null` на `'null'`
* * `false` на `'false'`
* * `true` на `'true'`
* * `undefined` на `''`
* @param queryStringData - queryString Record<string, any>
* @returns The processed data of the query string.
*/
private queryStringHandler;
private responseHandler;
/**
* Error Handler for Axios.
*
* @param error - AxiosError object.
* @returns An object with error data, including the status and text of the error.
*/
private axiosErrorHandler;
/**
* Returns the URL for the specified API path and version.
*
* @param apiPath - API Pathway.
* @param apiVersion - API Version.
* @returns URL for the specified API path and version.
*/
private url;
/**
* Executes an HTTP request with the specified parameters.
* @param url - The URL to execute the request.
* @returns An object that contains methods for configuring the request and executing the request.
*/
request(url: string): {
/**
* Executes a query with the specified parameters.
* @param queryParams - Query Parameters.
* @returns An instance of BetBoosterOfficeApi class.
*/
query(queryParams?: Record<string, unknown> | object): any;
/**
* Sets the headers of the request.Sets the headers of the request.
* @param headers - Query header object.
* @returns An instance of BetBoosterOfficeApi class.
*/
headers(headers?: Record<string, string>): any;
deleteAllHeaders(): any;
/**
* Sets the method of the GET request.
* @returns An instance of BetBoosterOfficeApi class.
*/
GET(): any;
/**
* Sets the POST request method.
* @param payload - The payload for the enquiry.
* @returns An instance of BetBoosterOfficeApi class.
*/
POST(payload?: Record<string, unknown> | object): any;
/**
* Устанавливает метод запроса PUT и устанавливает тело запроса.
* @param payload - Данные, которые будут отправлены в теле запроса.
* @returns Экземпляр класса BetBoosterOfficeApi с установленным методом запроса PUT и телом запроса.
*/
PUT(payload?: Record<string, unknown> | object): any;
/**
* Устанавливает метод запроса DELETE.
* @param payload Данные запроса в формате объекта или записи.
* @returns Экземпляр класса BetBoosterOfficeApi.
*/
DELETE(payload?: Record<string, unknown> | object): any;
/**
* Выполняет запрос к API.
*
* @returns Объект, содержащий данные, статус и текст статуса ответа.
* ```
* { data, status, statusText }
* ```
*/
exec<T>(): Promise<I.IResponseData<T>>;
/**
* Получает значение.
* @returns Промис, который разрешается с данными.
*/
value<T>(): Promise<void>;
};
/**
* Sends a GET request to the specified endpoint with optional query parameters and options.
* @param url - The endpoint to send the GET request to.
* @param queryParams - The query parameters to include in the request URL. Defaults to an empty object.
* @param headers - The options to include in the request. Defaults to an empty object.
* @returns A Promise that resolves to the response body of the GET request.
*/
GET(url: string, queryParams?: Record<string, unknown> | object, headers?: Record<string, string>): Promise<any>;
POST(url: string, payload?: Record<string, unknown> | object, queryParams?: Record<string, unknown> | object, headers?: Record<string, string>): Promise<any>;
DELETE(url: string, payload?: Record<string, unknown> | object, queryParams?: Record<string, unknown> | object, headers?: Record<string, string>): Promise<any>;
PUT(url: string, payload?: Record<string, unknown> | object, queryParams?: Record<string, unknown> | object, headers?: Record<string, string>): Promise<any>;
/**
* Returns the list of prematch sports
*
* @param minutes The number of minutes to consider for the data retrieval. Defaults to 0.
* @returns {Promise<Array<any>>} A promise that resolves to an array of line sports data.
*/
getLineSports(minutes?: number): Promise<I.ISport[]>;
/**
* Retrieves the hot prematch events
* @returns {Promise<Array<any>>} A promise that resolves to an array of hot events.
*/
getHotEvents(): Promise<any[]>;
/**
* Получает список стран для указанного идентификатора спорта.
* @param sportId - Идентификатор спорта.
* @param minutes - Опциональный параметр, количество минут.
* @returns Промис, который разрешается в массив объектов типа ICountry.
*/
getCountriesList(sportId: number, minutes?: number): Promise<I.ICountry[]>;
/**
* Retrieves prematch tournaments based on the specified sport ID, country ID, and minutes.
* @param sportId - The ID of the sport.
* @param countryId - The ID of the country.
* @param minutes - The number of minutes ago for which data is to be retrieved.
* @returns A promise that resolves to an array of prematch tournaments.
*/
getPrematchTournaments(sportId: number, countryId: number, minutes?: number): Promise<I.GetPrematchTournament[]>;
/**
* Retrieves prematch tournaments based on the specified sport ID and minutes.
* @param sportId - The ID of the sport.
* @param minutes - The number of minutes ago for which data is to be retrieved.
* @returns A filtered list of prematch tournaments.
*/
getPrematchTournamentsByMinutes(sportId?: number, minutes?: number): Promise<any>;
/**
* Retrieves the headers of prematch tournaments based on the specified sport ID and minutes.
* @param sportId The ID of the sport. Defaults to 0 if not provided.
* @param minutes - The number of minutes ago for which data is to be retrieved.
* @returns A promise that resolves to an array of tournament headers.
*/
getPrematchTournamentsHeadersByMinutes(sportId?: number, minutes?: number): Promise<any>;
/**
* Retrieves prematch events based on the specified parameters.
* @param sportId - The ID of the sport.
* @param countryId - The ID of the country.
* @param tournamentId - The ID of the tournament.
* @param minutes - The number of minutes ago for which data is to be retrieved.
* @returns A Promise that resolves to an array of prematch events.
*/
getPrematchEvents(sportId: number, countryId: number, tournamentId: number, minutes: number): Promise<any>;
/**
* Sets or resets the live timestamp reset flag.
*
* @param value - Whether to enable live timestamp reset. Defaults to true.
*/
liveTimestampReset(value?: boolean): void;
/**
* Retrieves an array of live event headers with main bets.
* @description For interval request execution, the parameter ```this.liveTimestamp```
* stored in this class is used. After the request is executed, ```this.liveTimestamp```
* is updated from the response.
* @param requestFullEventsList - Flag indicating whether to request
* the full list of events or only changes since the previous request.
* @param events - Array of live event IDs. In this case, the selected live events are returned with all bets.
* @returns A promise that resolves to an array of live event data.
*/
getLive(requestFullEventsList?: boolean, events?: (number | string)[]): Promise<I.ILiveDataResponce>;
/**
* Retrieves complete data on current live events without saving the timestamp.
* @returns A promise that resolves to an array of objects of type I.ILiveData.
*/
private getFullLiveWithoutSaveTimeStamp;
/**
* Возвращает массив из одного полного лайв события со всеми ставками по ID .
* @param eventId - ID полного live события.
* @returns Массив с информацией о событии.
*/
getLiveEventsAndFullEvent(eventId: number | string): Promise<I.ILiveData[]>;
/**
* Returns an array containing a single complete live event with all bets by ID.
* @param eventId - The ID of the complete live event.
* @returns An array with event information.
*/
getLiveEventFull(eventId: number | string): Promise<I.ILiveData>;
/**
* Retrieves a pre-match event by its ID.
* @param eventId - The event identifier.
* @returns The pre-match event object.
*/
getEventPrematch(eventId: number | string): Promise<any>;
verifyEmail(token: string): Promise<any>;
/**
* Registers a new user.
* @param payload - Data for registration.
* @returns A promise that resolves with the registered user data.
* @example
* ```
* const payload = {
* PartnerSiteUid: string;
* FirstName?: string;
* MiddleName?: string;
* EmailOrPhone: string;
* CurrencyId?: number; // <- Refer to Swagger !!!
* PointId?: number; // <- Refer to Swagger !!!
* Password: string;
* PasswordRepeat: string;
* UrlRedirect?: string;
* EmailSubject?: string;
* EmailBody?: string;
* EmailFrom?: string;
* ConfirmUrl?: string;
* Culture?: string;
* }
* ```
*/
signUp(payload: I.TSignUpPayload): Promise<any>;
/**
* Registers a new user via email.
* ! NEW METHOD
* @param payload - Data for registration.
* @returns A promise that resolves with the registered user data.
* @example
* ```
* const payload = {
* "FirstName": "string",
* "MiddleName": "string",
* "EmailOrPhone": "string",
* "PointId": 0, // <- Refer to Swagger !!!
* "CurrencyId": 0, // <- Refer to Swagger !!!
* "Password": "string",
* "PasswordRepeat": "string",
* "Culture": "string",
* "EmailSubject": "string",
* "EmailFrom": "string",
* "EmailBody": "string",
* "PartnerSiteUid": "string"
* }
*
* ```
*/
signUpViaEmail(payload: I.TSignUpPayload): Promise<any>;
/**
* Registers a new user directly in the database without confirmation.
* @param payload - Data for registration.
* @returns A promise that resolves with the registered user data.
* @deprecated use createInternetUser() method
* @example
* ```
* const payload = {
* "FirstName": "string",
* "MiddleName": "string",
* "EmailOrPhone": "string",
* "PointId": 0, // <- Refer to Swagger !!!
* "CurrencyId": 0, // <- Refer to Swagger !!!
* "Password": "string",
* "PasswordRepeat": "string",
* "Culture": "string",
* "EmailSubject": "string",
* "EmailFrom": "string",
* "EmailBody": "string",
* "PartnerSiteUid": "string"
* }
*
* ```
*/
signUpDirect(payload: I.TSignUpPayload): Promise<any>;
/**
* Creates an internet user for the cash register directly in the database.
* @param payload - User registration parameters.
* @returns An object containing information about the result of the operation.
* @example
* const SignUpPayloadDirect: I.TSignUpPayload = {
* PartnerSiteUid: "partner.win",
* EmailOrPhone: "380671110000", // phone number without "+"
* PointId: 85, // <- Refer to Swagger !!!
* CurrencyId: 85, // <- Refer to Swagger !!!
* Password: "Password",
* PasswordRepeat: "Password",
* }
*/
createInternetUser(payload: I.TSignUpPayload): Promise<{
created: boolean | null;
error: string | null;
status: number;
statusText: string;
}>;
/**
* get a list of sports for the period
* @param {string} from формат "DDMMYYYY"
* @param {string} to формат "DDMMYYYY"
* @returns
*/
getResultsSports(from: string, to: string): Promise<any>;
/**
* Retrieves tournament results by sport ID.
* @param sportId - The sport identifier.
* @param from - The start date as a string.
* @param to - The end date as a string.
* @returns A list of tournament results.
*/
getResultsTournamentsBySportId(sportId: number | string, from: string, to: string): Promise<any>;
/**
* Get results
* @param {*} sportId - The sport identifier.
* @param {*} countryId - The country identifier.
* @param {*} tournamentId - The tournament identifier.
* @param {*} from - The start date.
* @param {*} to - The end date.
* @returns The results.
*/
getResultsGrid(sportId: number | string, countryId: number | string, tournamentId: number | string, from: string, to: string): Promise<any>;
/**
* Returns all games providers for the 21st game each
*/
getGamesProvidersTopGames(): Promise<any>;
/**
* Retrieves the list of top game providers for games.
* @returns {Promise<Array<any>>} The list of top game providers.
*/
getGamesTopProviders(): Promise<Array<any>>;
/**
* Retrieves the list of slots.
* @returns {Promise<Array<any>>} The list of slots.
*/
getSlotsList(): Promise<Array<any>>;
/**
* Opens a session for Outcome slots
* @deprecated
* */
createSlotOutcome(game_id: number | string): Promise<{}>;
/**
* Creates a slotintegrator DEMO.
* @param model - The model containing the data for the slot integrator demo.
* @returns A Promise that resolves to the parsed JSON response from the server.
*/
createSlotIntegratorDemo(model: Record<string, unknown>): Promise<any>;
/**
* Initiates SlotIntegrators REAL Game
* @example
* ```javascript
const model = {
"game_uuid": "string",
"player_id": "string",
"player_name": "string",
"currency": "string",
"session_id": "string",
"language": "string",
}
* ```
*/
createSlotIntegratorReal(model: Record<string, unknown>): Promise<any>;
/** Возвращает список провайдеров с логотипами */
getSlotIntegratorProvidersHeaders(): Promise<any>;
/** Retrieves all games for a given slot integrator provider.
* @param {string} providerName - The name of the provider.
* @returns {Promise<Array>} - A promise that resolves to an array of games.
*/
getSlotIntegratorProviderAllGames(providerName: string): Promise<Array<any>>;
/** Retrieves games by the given game name.
* @param {string} gameName - The name of the provider.
* @returns {Promise<Array>} - A promise that resolves to an array of games.
*/
getSlotIntegratorFilteredGames(gameName: string): Promise<Array<any>>;
/**
* Asynchronously performs login.
* @description If the login is successful, saves the token in the class property `token`
* and saves the object representing the user in the class property `user`.
* These properties are subsequently used for processing requests.
* @param login - The user's login.
* @param password - The user's password.
* @returns An object representing the user if the login is successful. Otherwise, returns an empty object.
*/
login({ login, password }: {
login: string;
password: string;
}): Promise<I.IUser>;
/**
* Retrieves user data.
* @returns User data or null if the user is not found.
* @deprecated use this.getUserData()
*/
getUserData_OLD(): Promise<any>;
getUserData(): Promise<{
data: any;
error: string | null;
status: number;
statusText: string;
}>;
/**
* @deprecated use this.getUserData()
*/
getUserFullData(): Promise<{
data: any;
error: string | null;
status: number;
statusText: string;
}>;
/**
* Logs the user out of the system.
* @returns An object containing information about the success of the logout and the user's authorization status.
*/
logout(): Promise<{
ok: boolean;
isLogged: any;
}>;
/**
* Retrieves the user's balance.
* @returns A promise that resolves to the user's balance.
* @deprecated use this.getBalance();
*/
balance(): Promise<{
Amount: number;
} | {}>;
getBalance(): Promise<{
data: string | null;
error: string | null;
status: number;
statusText: string;
}>;
/**
* Changes the user's password.
* @param postBody - An object containing the data for changing the password.
* @returns Returns `null` if the user is not authorized.
*/
changePassword(postBody: I.IChangePassword): Promise<{
ok: boolean;
status: any;
}>;
/**
* Converts a number to a GUID string.
* It is used in the "Sslotegrator"
* @param userId - The number to convert to a GUID.
* @returns The GUID string.
*/
longToGuid(userId: number): string;
/**
* Retrieves sports events (live & prematch) based on the provided search text.
* @param searchText - The text to search for.
* @returns A promise that resolves to an array of ISearchEventsData.
*/
getSportsEventsSearch(searchText: string): Promise<I.ISearchEventsData[]>;
/**
* Retrieves the favorites from the BetBooster API.
* @returns {Promise<any[]>} A promise that resolves to an array of favorites.
*/
getFavorites(): Promise<any>;
/**
* Adds an item to the favorites list.
* @param id - The ID of the item to add.
* @param type - The type of the item to add. Types: 0 = "Tournament"; 1 = "Event"; 2 = "LiveEvent"; 3 = "LineEvent"; 4 = "None";
* @returns A promise that resolves to a boolean indicating whether the item was successfully added to the favorites list.
*/
addFavorite(id: number, type: I.EFavoriteType): Promise<boolean>;
/**
* Removes a favorite item.
* @param favoriteId - The ID of the favorite item to be removed.
* @returns A promise that resolves to a boolean indicating whether the removal was successful.
*/
removeFavorite(favoriteId: number): Promise<boolean>;
/**
* Retrieves the user's wallets.
* @param psType - The type of payment system (default is 5 - cashier).
* @returns The user's wallets.
*/ getPurses(psType?: I.EPaymentSystemTypeEnum): Promise<any>;
sendWithdrawal(apiPath: string, request: any): Promise<void>;
/**
* Sends a withdrawal request to the cashier.
* @param payload - Parameters for the withdrawal request.
* @returns An object with the result of the withdrawal operation.
*/
sendWithdrawalAgent(payload: I.IPayloadWithdrawal): Promise<{
ok: boolean;
balance: number;
userOrders: any;
status?: undefined;
} | {
ok: boolean;
status: any;
balance?: undefined;
userOrders?: undefined;
}>;
/**
* Cancels a requested withdrawal transaction.
* @param payload - Parameters for canceling the requested transaction.
* @returns An object with information about the success of the transaction cancellation and the user's balance.
*/
cancelOrderedTransaction(payload: I.IPayloadCancelOrderedTransaction): Promise<{
ok: boolean;
status: number;
balance?: undefined;
userOrders?: undefined;
} | {
ok: boolean;
balance: number;
userOrders: any;
status?: undefined;
}>;
/**
* Obtains information on cash flow.
* @param payload - Query Parameters.
* @returns An object with the result of the query.
*/
getMovementOfMoney(payload: I.IGetMovementOfMoneyPayload): Promise<I.TGetMovementOfMoney>;
/**
* Retrieves a list of ordered transactions.
*
* @returns Ordered transactions or an empty array if the user is not authorized.
*/
getOrderedTransactions(): Promise<any>;
/**
* Retrieves the content of a bet by betId.
* @param betId - The bet identifier.
* @returns The content of the bet.
*/
getBetContent(betId: number): Promise<any>;
/**
* Retrieves user bets.
* @param payload - Request parameters.
* @returns A promise that resolves with the result of the request.
* @note The page size should not exceed 20 rows per page.
* @deprecated Use the getUserBets02 method.
*/
getUserBets(payload: I.TGetUserBetsPayload): Promise<any>;
/**
* Retrieves user bets.
* @param payload - Request parameters.
* @returns A promise that resolves with the result of the request.
* @note The page size should not exceed 20 rows per page.
*/
getUserBets02(payload: I.TGetUserBetsPayload): Promise<{
data: any;
error: string | string[] | null;
status: number;
statusText: string;
}>;
/**
* Retrieves the odds data for editing based on the provided payload.
*
* @param payload - The extended bet slip information required to fetch odds for editing.
* @returns A promise that resolves to an object containing the data, any errors, and the HTTP response status information.
*/
getOddsForEdit(payload: I.TAddBetslip): Promise<{
data: any;
error: string | string[] | null;
status: number;
statusText: string;
}>;
/**
* Edits an existing coupon with the provided payload.
*
* @param payload - The coupon data to be edited, conforming to the `I.TCouponEdited` interface.
* @returns A promise that resolves to an object containing:
* - `data`: The response data from the API.
* - `error`: Any error messages returned by the API, either as a string or an array of strings. Can be `null` if no errors occurred.
* - `status`: The HTTP status code of the response.
* - `statusText`: The HTTP status text corresponding to the status code.
*/
placeCouponEdited(payload: I.TCouponEdited): Promise<{
data: any;
error: string | string[] | null;
status: number;
statusText: string;
}>;
/**
* Retrieves the cashout information for the specified user bets.
*
* @param BetIds - An array of bet IDs for which to check the cashout information.
* @returns A promise that resolves to an object containing the data, error, status, and statusText.
* - data: The response data from the API.
* - error: Any error message(s) returned by the API, or null if no errors occurred.
* - status: The HTTP status code of the response.
* - statusText: The HTTP status text of the response.
*/
getUserBetsCashout(BetIds: number[]): Promise<{
data: any;
error: string | string[] | null;
status: number;
statusText: string;
}>;
/**
* Processes a cashout return bet request.
* @param payload - The cashout bet parameters
* @param payload.betId - The ID of the bet to cash out
* @param payload.cashOutAmount - The amount to cash out
* @param payload.DoAcceptOddsChanges - Whether to accept odds changes
* @returns A promise containing response data, error information, HTTP status code and status text
* @returns {data} The response data from the API
* @returns {error} Error message(s) if any occurred, null otherwise
* @returns {status} HTTP status code
* @returns {statusText} HTTP status message
*/
returnCashoutBet(payload: {
betId: number;
cashOutAmount: number;
DoAcceptOddsChanges: boolean;
}): Promise<{
data: any;
error: string | string[] | null;
status: number;
statusText: string;
}>;
/**
* Creates a coupon for placing a bet.
* @param betslip - An array with information about the bets.
* @param amount - The bet amount.
* @param acceptChangeCoefs - A flag indicating whether to accept changes in coefficients.
* @param systemIndex - The size of the system (e.g., for 3 events with 2 combinations, pass 2). Default value: -1 (if not a system).
* @returns The created coupon for placing a bet.
*/
createCoupon(betslip: any[], amount: number, acceptCahngeCoefs: boolean, systemIndex?: number): I.TPlaceBetPayload;
/**
* Places a bet.
* @param payload - Parameters for placing the bet.
* @returns The result of placing the bet.
*/
placeCoupon(payload: I.TPlaceBetPayload): Promise<any>;
/**
* Places a bet on behalf of BetShop.
* @param payload - Parameters for placing the bet.
* @returns The result of placing the bet.
*/
placeCouponBetShop(payload: I.TPlaceBetPayload): Promise<any>;
/**
* Checks the status of a bet by coupon number.
* Used for BetShop when users try to check
* whether the bet won or lost.
* @param {string} couponCode - The coupon number.
* @returns The result of the bet.
*/
getBetShopCouponByCode(couponCode: string): Promise<{
data: any;
error: string | null;
status: number;
statusText: string;
} | undefined>;
/**
* Checks if a user with the specified login exists.
* @param login - The user's login.
* @returns A promise that resolves with the result of the check.
*/
loginIsExist(login: string): Promise<any>;
/**
* Checks if the specified email exists in the system.
* @param email - The email to check.
* @returns A promise that resolves with the result of the check.
*/
emailIsExist(email: string): Promise<any>;
/**
* Updates the user's personal data.
* @param personalData - An object containing the user's personal data.
* @returns Returns true if the data was successfully updated, otherwise returns false.
*/
changePersonalData(personalData: I.TPersonalData): Promise<boolean>;
/**
* Retrieves all messages.
* @param page - The page number.
* @param pageSize - The page size.
* @returns An array of messages.
*/
getMessagesAll({ page, pageSize }: {
page: number | string;
pageSize: number | string;
}): Promise<any>;
/**
* Retrieves a message by its identifier.
* @param id - The message identifier.
* @returns The message object or an empty object if the message is not found.
*/
getMessageById(id: number): Promise<any>;
/**
* Sends a message to a user.
* @param {Object} params - Parameters for sending the message.
* @param {number} params.ToUserId - The identifier of the user to whom the message is sent.
* @param {string} params.Text - The text of the message.
* @param {string} params.Subject - The subject of the message.
* @param {number} params.ParentId - The identifier of the parent message (if any).
* @returns {Promise<any>} - A promise that resolves with the result of sending the message or null if sending is not possible.
*/
sensMessage({ ToUserId, Text, Subject, ParentId }: {
ToUserId: number;
Text: string;
Subject: string;
ParentId: number;
}): Promise<any>;
/**
* Marks a message as read.
*
* @param {Object} params - Request parameters.
* @param {number} params.MessageId - The message identifier.
* @param {number} params.MessageTypeId - The message type identifier.
* @returns {Promise<any>} - A promise that resolves with the result of the request or null if the user is not authorized.
*/
markMessageAsRead({ MessageId, MessageTypeId }: {
MessageId: number;
MessageTypeId: number;
}): Promise<any>;
/**
* Deletes a message by the specified message ID and type.
* @param {Object} params - Parameters for deleting the message.
* @param {number} params.MessageId - The message identifier.
* @param {number} params.MessageTypeId - The message type identifier.
* @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.
*/
deleteMessage({ MessageId, MessageTypeId }: {
MessageId: number;
MessageTypeId: number;
}): Promise<{
Result: boolean;
Id: number;
} | null>;
/**
* Deletes all messages.
* @returns A promise that resolves to true, false, or null.
*/
deleteMessagesAll(): Promise<true | false | null>;
/**
* Retrieves the number of messages.
* @returns An object containing the count of all messages, mass messages, and personal messages.
* If the user is not authorized, returns null.
*/
getMessagesCount(): Promise<{
All: number;
Mass: number;
Personal: number;
} | null>;
/**
* Retrieves the number of unread messages.
* @returns The number of unread messages or null if the user is not authorized.
*/
getMessagesUnreadCount(): Promise<number | null>;
/** Checks if the user exists in the temporary table */
isUserTempExist(userName: string): Promise<boolean | null>;
/**
* Creates a user only in the temporary table.
*/
createUserTemp(payload: any): Promise<boolean | null>;
/**
* Returns a list of GoldenRace games.
*/
getGamesListGR(payload?: I.TGetGameListGoldenRacePayload): Promise<{
data: any[] | null;
error: string | null;
status: number;
statusText: string;
}>;
/**
* Asynchronous method to get the GoldenRace game frame.
*
* @param payload - An object with parameters for the request.
* @param payload.game - The game identifier. gameId is a required parameter.
* @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.
* @param payload.mode - The game mode: 0 for virtual (fun) or 1 for real. Default: 1.
* @param payload.language - The language code in ISO 639-1 alpha-2 format for loading localization. Default: "en".
* @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".
* @param payload.group - The user group. In the configuration, this is essentially the cashier number. Required parameter.
* @returns An object with response data, error (if any), status, and status text.
*/
getGameFrameUrlGR(payload: I.TGetGameFrameGoldenRacePayload): Promise<{
data: string | null;
error: string | null;
status: number;
statusText: string;
}>;
pingApi(): Promise<{
data: I.IApiResponse<any> | null;
error: string | null;
status: number;
statusText: string;
}>;
intgrGetGamesList(payload: I.IIntgrGetGamesListPayload): Promise<{
data: any[] | null;
error: string | null;
status: number;
statusText: string;
}>;
intgrGetGameTypes(groupId: number | string): Promise<{
data: any[] | null;
error: string | null;
status: number;
statusText: string;
}>;
intgrGetProvidersList(groupId: number | string): Promise<{
data: any[] | null;
error: string | null;
status: number;
statusText: string;
}>;
intgrGetTopGames(groupId: number | string): Promise<{
data: any[] | null;
error: string | null;
status: number;
statusText: string;
}>;
intgrInitGame(payload: I.IIntgrInitGamePayload): Promise<{
data: any[] | null;
error: string | null;
status: number;
statusText: string;
}>;
checkPromocode(promocode: string): Promise<void>;
activatePromocode(promocode: any): Promise<void>;
/**
* @example
* ```
const payload = {
"isphone": this.typeLogin.phone,
"login": clearLogin,
}
* ```
*/
sendSms(payload: {
isphone: string;
login: string;
}): Promise<void>;
signUpPhone(request: any): Promise<void>;
passwordRecoveryRequest(post: any): Promise<void>;
passwordRecoveryEmail(email: string): Promise<void>;
passwordSetNewByPhone(request: any): Promise<void>;
passwordSetNewByEmail(request: any): Promise<void>;
signUpEmail(request: any): Promise<void>;
getUserPersonalInfo(): Promise<void>;
sendPayment(apiPath: string, request: any): Promise<void>;
setUserPersonalInfo(request: any): Promise<void>;
getGamesToken(sToken: any): Promise<void>;
getProviderHedlines(providerHash: string): Promise<void>;
createTempSignUp({ login, password }: {
login: string;
password: string;
}): Promise<void>;
setRemoteLanguage(lang?: string): Promise<any>;
/**
* Converts bonuses to an array.
* @param bonus - An object containing bonuses.
* @returns An array of bonuses.
*/
convertBonuses(bonus: Record<string, any>): any[];
/**
* Retrieves ticket information.
* @description Requires authorization.
* @returns {Promise<Betslip | null>} An object with ticket information or null if the token is not set.
* @example
* ```typescript
{
BetslipType: 0,
Bets: [],
RecommendedAmount: 0,
bonuses: [
[ 'Koef', 9, 1.01 ],
[ 'Koef', 20, 1.02 ],
[ 'Koef', 50, 1.03 ],
[ 'Koef', 100, 1.04 ],
[ 'Koef', 200, 1.05 ],
[ 'Koef', 500, 1.06 ],
[ 'Kolvo', 5, 1.01 ],
[ 'Kolvo', 9, 1.02 ],
[ 'Kolvo', 22, 1.03 ],
[ 'Kolvo', 11, 1.04 ],
[ 'Kolvo', 13, 1.05 ],
[ 'Kolvo', 15, 1.06 ],
[ 'Perestavka', true, 1.03 ],
[ 'MinOdds', true, 1.02 ]
]
}
* ```
@deprecated
*/
getBetslip_OLD(): Promise<any>;
getBetslip(): Promise<any>;
/**
* Clears the bet slip.
* @returns A promise that resolves to a boolean indicating the success of the operation.
*/
clearBetslip(): Promise<boolean>;
/**
* Changes the type of the bet slip.
* @param betslipType - The type of the bet slip.
* @returns Returns true if the bet slip type was successfully changed, otherwise returns false.
*/
changeBetslipType(betslipType: I.EBetslipType): Promise<boolean>;
/**
* Sets the bet slip settings.
* @param betslipSettings - The bet slip settings.
* @returns An array of results or an empty array if the user is not authorized.
*/
setBetslipSettings(betslipSettings: I.TBetslipSettings): Promise<any>;
/**
* Adds a bet to the bet slip.
* @param basket - The basket containing bet information.
* @returns The result of the add operation to the bet slip or null if the operation failed.
*/
addToBetslip(basket: I.TAddBetslip): Promise<any>;
/**
* Removes a bet from the bet slip.
* @param basket - An object containing information about the bet slip.
* @returns Returns true if the item was successfully removed, otherwise returns false.
*/
removeFromBetslip(basket: I.TAddBetslip): Promise<any>;
/**
* Removes a bonus from the bet slip.
* @returns {Promise<boolean>} Returns true if the bonus was successfully removed, otherwise returns false.
*/
removeBonus(): Promise<boolean>;
/**
* Adds a bonus to the bet slip.
* @param odd - The coefficient to which the bonus is added.
* @returns The result of the operation or null if the result is undefined.
*/
addBonus(odd: number): Promise<any>;
/**
* Updates a bet in the bet slip.
* @param basket - The basket containing bet information.
* @returns Returns true if the bet was successfully updated, otherwise returns false.
*/
updateBet(basket: I.TAddBetslip): Promise<boolean>;
/**
* Retrieves bet limits.
* @returns An object with the minimum and maximum bet limits.
* @deprecated use api.getBetsLimitsNew();
*/
getBetsLimits(): Promise<any>;
/**
* Retrieves bet limits.
* @returns An object with the minimum and maximum bet limits.
*/
getBetsLimitsNew(): Promise<{
data: any;
error: string | null;
status: number;
statusText: string;
} | {
data: {
Min: number;
Max: number;
MaxOddForMulty: number;
};
status: number;
statusText: string;
}>;
/**
* Retrieves a list of available currencies (essentially a list of cash registers).
* @returns A list of available currencies.
*/
getCurrencies(): Promise<any>;
/**
* Retrieves a list of countries.
* @returns A list of countries or null if the user is not authorized.
*/
getCountries(): Promise<any>;
getAllKeys(key: string): Promise<any>;
/**
* Fetches slides data from a predefined URL.
*
* @returns {Promise<string | null>} A promise that resolves to the slides data as a string, or null if an error occurs.
*
* @throws {Error} If the request fails or the response status is not successful.
*/
getSlides(target?: string): Promise<{
data: string | null;
error: string | null;
status: number;
statusText: string;
}>;
/**
* Fetches event statistic data for a given event ID.
*
* @param {number} brEventId - The ID of the event for which to fetch statistics.
* @returns {Promise<any | null>} A promise that resolves to the event statistic data or null if an error occurs.
*/
getEventStatisticData(brEventId: number): Promise<{
data: any;
error: string | null;
status: number;
statusText: string;
}>;
/**
* Retrieves the statistics page for a specific event.
* @param brEventId - The unique identifier for the betting radar event.
* @returns {Promise<string | null>} A promise that resolves to the event statistics page content or null.
* @throws {Error} If the request fails or returns an invalid response.
*/
getEventStatisticPage(brEventId: number): Promise<{
data: string | null;
error: string | null;
status: number;
statusText: string;
}>;
/**
* Searches for prematch events using the NV20 API.
*
* @param searchString - The search string to query events.
* (Note: that all words containing cvr and words with one letter are removed from the searchString)
* @param options - Optional parameters to refine the search.
* @param options.LIMIT - Specifies the number of results to return. Defaults to `{ from: 0, size: 30 }` if not provided.
* @param options.negativeString - Excludes results containing this string.
* @param options.sportId - Filters events by the specified sport ID.
* @param options.tournamentId - Filters events by the specified tournament ID.
* @returns A promise that resolves with the search results or `null` if the request fails.
*/
searchPrematchEventsNv20(searchString: string, options?: I.RedisPrematchSearchParams): Promise<{
data: any;
error: string | null;
status: number;
statusText: string;
}>;
/**
* Searches for prematch event IDs using the NV20 API endpoint.
*
* This method performs a search for prematch events and returns their IDs based on the provided criteria.
* The search supports filtering by sport, country, tournament, teams, and includes pagination and sorting options.
*
* @param payload - The search criteria and options
* @param payload.locale - Language locale for the response (defaults to instance locale if not provided)
* @param payload.sportId - Array of sport IDs to filter by (e.g., [5, 27] for specific sports)
* @param payload.countryId - Country ID to filter by (null for no country filter)
* @param payload.tournamentId - Tournament ID to filter by (null for no tournament filter)
* @param payload.teams - Array of team identifiers in format 'sportId_categoryId_teamId' (e.g., ['5_8_282', '5_8_2493'])
* @param payload.LIMIT - Pagination settings (defaults to {from: 0, size: 30} if not provided)
* @param payload.LIMIT.from - Starting index for pagination (0-based)
* @param payload.LIMIT.size - Number of results to return per page
* @param payload.SORT - Sorting configuration
* @param payload.SORT.BY - Field to sort by (e.g., 'start' for event start time)
* @param payload.SORT.DIRECTION - Sort direction ('ASC' for ascending, 'DESC' for descending)
*
* @returns Promise resolving to search results containing event IDs with pagination metadata
*
* @example
* ```typescript
* const searchCriteria = {
* locale: 'en-US',
* sportId: [5, 27], // Football and Basketball
* countryId: null,
* tournamentId: null,
* teams: ['5_8_282', '5_8_2493', '5_3_11', '5_3_5'],
* LIMIT: { from: 0, size: 3000 },
* SORT: { BY: 'start', DIRECTION: 'ASC' }
* };
*
* const results = await api.searchPrematchEventsIdsNv20(searchCriteria);
* ```
*/
searchPrematchEventsIdsNv20(payload: I.TRedisSearchPrematchIds): Promise<{
data: any;
error: string | null;
status: number;
statusText: string;
}>;
searchPrematchTournametsEventsNv20(searchString: string, options?: I.RedisPrematchSearchParams): Promise<{
data: any;
error: string | null;
status: number;
statusText: string;
}>;
/**
* Sends error information to the specified endpoint.
*
* @param text - The error message text.
* @param code - The error code.
* @returns A promise that resolves to a string or null based on the response.
*/
sendErrInfo(text: string, code: string): Promise<{
data: boolean | null;
error: string | null;
status: number;
statusText: string;
}>;
cloneBetCoupon(payload: {
betId?: number | null;
code?: string | number | null;
culture?: string | null;
}): Promise<{
data: any;
error: string | null;
status: number;
statusText: string;
}>;
getAllBanners(): Promise<any>;
depositBetKiosk(amount: number): Promise<{
data: boolean | null;
error: string | null;
status: number;
statusText: string;
}>;
getFaq(): Promise<any>;
getFlatpagesList(): Promise<any>;
test3(): Promise<string>;
sellBet(data: any): Promise<void>;
/** Конвертирует различные представления корзины в единый формат
* @param betslipItem - элемент корзины
*/
convertBasketToPost(betslipItem: I.IBetslipItems): I.IAddToBasket;
}