import { AxiosInstance } from 'axios'; declare const SMSBOWER_DEFAULT_BASE_URL = "https://smsbower.app/stubs/handler_api.php"; declare const SMSBOWER_DEFAULT_TIMEOUT_MS = 10000; declare const SMSBOWER_DEFAULT_USER_AGENT = "smsbower-node-sdk/0.1.0"; type ActionParamValue = string | number | boolean; type ActionParams = Record; interface SmsBowerClientConfig { apiKey: string; baseUrl?: string; timeoutMs?: number; userAgent?: string; } interface ResolvedSmsBowerClientConfig { apiKey: string; baseUrl: string; timeoutMs: number; userAgent: string; } interface HttpRequest { url: string; method: "GET"; headers: Record; } interface HttpResponse { status: number; bodyText: string; } declare const resolveClientConfig: (config: SmsBowerClientConfig) => ResolvedSmsBowerClientConfig; type TransportErrorCode = "TIMEOUT" | "NETWORK" | "HTTP_STATUS"; interface SmsBowerTransportErrorOptions { cause?: unknown; status?: number; responseBody?: string; } declare class SmsBowerTransportError extends Error { readonly name = "SmsBowerTransportError"; readonly code: TransportErrorCode; readonly status?: number; readonly responseBody?: string; constructor(message: string, code: TransportErrorCode, options?: SmsBowerTransportErrorOptions); } declare const SMSBOWER_API_ERROR_CODES: readonly ["BAD_KEY", "BAD_ACTION", "BAD_SERVICE", "BAD_STATUS", "NO_ACTIVATION", "NO_NUMBERS", "EARLY_CANCEL_DENIED", "BAD_COUNTRY", "NO_BALANCE"]; type SmsBowerApiErrorCode = (typeof SMSBOWER_API_ERROR_CODES)[number]; type SmsBowerParseErrorCode = "UNKNOWN_TOKEN" | "MALFORMED_JSON"; interface SmsBowerResponseErrorOptions { cause?: unknown; token?: string; } declare class SmsBowerApiError extends Error { readonly name = "SmsBowerApiError"; readonly code: SmsBowerApiErrorCode; readonly token: string; readonly rawResponse: string; constructor(code: SmsBowerApiErrorCode, rawResponse: string, options?: SmsBowerResponseErrorOptions); } declare class SmsBowerParseError extends Error { readonly name = "SmsBowerParseError"; readonly code: SmsBowerParseErrorCode; readonly token?: string; readonly rawResponse: string; constructor(code: SmsBowerParseErrorCode, message: string, rawResponse: string, options?: SmsBowerResponseErrorOptions); } interface SmsBowerTokenResponseBase { format: "token"; token: string; rawResponse: string; } interface AccessBalanceResponse extends SmsBowerTokenResponseBase { token: "ACCESS_BALANCE"; balance: string; } interface AccessNumberResponse extends SmsBowerTokenResponseBase { token: "ACCESS_NUMBER"; activationId: string; phoneNumber: string; } interface StatusWaitCodeResponse extends SmsBowerTokenResponseBase { token: "STATUS_WAIT_CODE"; } interface StatusWaitRetryResponse extends SmsBowerTokenResponseBase { token: "STATUS_WAIT_RETRY"; code: string; } interface StatusOkResponse extends SmsBowerTokenResponseBase { token: "STATUS_OK"; code: string; } interface StatusCancelResponse extends SmsBowerTokenResponseBase { token: "STATUS_CANCEL"; } interface AccessReadyResponse extends SmsBowerTokenResponseBase { token: "ACCESS_READY"; } interface AccessRetryGetResponse extends SmsBowerTokenResponseBase { token: "ACCESS_RETRY_GET"; } interface AccessActivationResponse extends SmsBowerTokenResponseBase { token: "ACCESS_ACTIVATION"; } interface AccessCancelResponse extends SmsBowerTokenResponseBase { token: "ACCESS_CANCEL"; } type SmsBowerTokenResponse = AccessBalanceResponse | AccessNumberResponse | StatusWaitCodeResponse | StatusWaitRetryResponse | StatusOkResponse | StatusCancelResponse | AccessReadyResponse | AccessRetryGetResponse | AccessActivationResponse | AccessCancelResponse; interface SmsBowerJsonResponse { format: "json"; rawResponse: string; value: unknown; } type SmsBowerParsedResponse = SmsBowerTokenResponse | SmsBowerJsonResponse; declare const parseSmsBowerResponse: (responseBody: string) => SmsBowerParsedResponse; type SmsBowerNoParams = { readonly [key: string]: never; }; type SmsBowerCountryCode = number | `${number}`; type SmsBowerActivationId = number | `${number}`; type SmsBowerProviderId = number | `${number}`; type SmsBowerProviderIds = readonly SmsBowerProviderId[] | string; interface ServiceCountryParams { service: string; country: SmsBowerCountryCode; } interface ProviderFilterParams { providerIds?: SmsBowerProviderIds; } type GetBalanceParams = SmsBowerNoParams; type GetServicesListParams = SmsBowerNoParams; type GetCountriesParams = SmsBowerNoParams; interface GetPricesParams { service?: string; country?: SmsBowerCountryCode; } interface GetPricesV2Params { service?: string; country?: SmsBowerCountryCode; } interface GetPricesV3Params extends ProviderFilterParams { country: SmsBowerCountryCode; service?: string; } interface NumberRequestBaseParams { maxPrice?: number | `${number}`; minPrice?: number | `${number}`; exceptProviderIds?: SmsBowerProviderIds; phoneException?: string; ref?: string; userID?: string; } interface NumberRequestV2Filters { operator?: string; verification?: boolean | 0 | 1; forward?: boolean | 0 | 1; } interface GetNumberParams extends ServiceCountryParams, ProviderFilterParams, NumberRequestBaseParams { } interface GetNumberV2Params extends GetNumberParams, NumberRequestV2Filters { } interface GetStatusParams { activationId: SmsBowerActivationId; } type ActivationLifecycleStatus = 1 | 3 | 6 | 8; interface SetStatusParams extends GetStatusParams { status: ActivationLifecycleStatus; } interface SmsBowerJsonContract extends Omit { value: TValue; } type ServicesListValue = Record; interface CountryCatalogEntry { id: string; rus: string; eng: string; [field: string]: string | number | boolean | undefined; } type CountriesListValue = Record; type PriceQuoteBase = { count: number | `${number}`; [field: string]: string | number | boolean | undefined; }; type PriceQuote = (PriceQuoteBase & { cost: string | `${number}`; price?: string | `${number}`; }) | (PriceQuoteBase & { price: string | `${number}`; cost?: string | `${number}`; }); type PricesV1Value = Record>; type PricesV2LegacyValue = Record>; type PricesV2BucketsValue = Record>>; type PricesV2Value = PricesV2LegacyValue | PricesV2BucketsValue; type PricesV3ServiceValue = Record; type PricesV3ProviderValue = Record; type PricesV3Value = Record; type GetBalanceResponse = AccessBalanceResponse; type GetServicesListCanonicalResponse = SmsBowerJsonContract; type GetServicesListResponse = GetServicesListCanonicalResponse; type GetCountriesResponse = SmsBowerJsonContract; type GetPricesResponse = SmsBowerJsonContract; type GetPricesV2Response = SmsBowerJsonContract; type GetPricesV3Response = SmsBowerJsonContract; type GetNumberResponse = AccessNumberResponse; interface GetNumberV2JsonResponse { format: "json"; activationId: string; phoneNumber: string; activationCost?: string; countryCode?: string; canGetAnotherSms?: boolean | number; activationTime?: string; activationOperator?: string; rawResponse: string; } type GetNumberV2Response = AccessNumberResponse | GetNumberV2JsonResponse; type ActivationLifecycleResponse = StatusWaitCodeResponse | StatusWaitRetryResponse | StatusOkResponse | StatusCancelResponse; type ActivationSetStatusResponse = ActivationLifecycleResponse | AccessReadyResponse | AccessRetryGetResponse | AccessActivationResponse | AccessCancelResponse; type GetStatusResponse = ActivationLifecycleResponse; type SetStatusResponse = ActivationSetStatusResponse; interface SmsBowerAccountEndpointContracts { getBalance(params?: GetBalanceParams): Promise; } interface SmsBowerCatalogEndpointContracts { getServicesList(params?: GetServicesListParams): Promise; getCountries(params?: GetCountriesParams): Promise; } interface SmsBowerPriceEndpointContracts { getPrices(params?: GetPricesParams): Promise; getPricesV2(params?: GetPricesV2Params): Promise; getPricesV3(params: GetPricesV3Params): Promise; } interface SmsBowerNumberEndpointContracts { getNumber(params: GetNumberParams): Promise; getNumberV2(params: GetNumberV2Params): Promise; } interface SmsBowerLifecycleEndpointContracts { getStatus(params: GetStatusParams): Promise; setStatus(params: SetStatusParams): Promise; } interface SmsBowerEndpointContracts extends SmsBowerAccountEndpointContracts, SmsBowerCatalogEndpointContracts, SmsBowerPriceEndpointContracts, SmsBowerNumberEndpointContracts, SmsBowerLifecycleEndpointContracts { } interface SmsBowerActionParamsMap { getBalance: GetBalanceParams; getServicesList: GetServicesListParams; getCountries: GetCountriesParams; getPrices: GetPricesParams; getPricesV2: GetPricesV2Params; getPricesV3: { country: SmsBowerCountryCode; service?: string; providerIds?: string; }; getNumber: { service: string; country: SmsBowerCountryCode; providerIds?: string; exceptProviderIds?: string; maxPrice?: number | `${number}`; minPrice?: number | `${number}`; phoneException?: string; ref?: string; userID?: string; }; getNumberV2: { service: string; country: SmsBowerCountryCode; providerIds?: string; exceptProviderIds?: string; maxPrice?: number | `${number}`; minPrice?: number | `${number}`; phoneException?: string; ref?: string; userID?: string; operator?: string; verification?: 0 | 1; forward?: 0 | 1; }; getStatus: { id: SmsBowerActivationId; }; setStatus: { id: SmsBowerActivationId; status: ActivationLifecycleStatus; }; } interface SmsBowerActionContractMap { getBalance: { params: GetBalanceParams; response: GetBalanceResponse; }; getServicesList: { params: GetServicesListParams; response: GetServicesListCanonicalResponse; }; getCountries: { params: GetCountriesParams; response: GetCountriesResponse; }; getPrices: { params: GetPricesParams; response: GetPricesResponse; }; getPricesV2: { params: GetPricesV2Params; response: GetPricesV2Response; }; getPricesV3: { params: GetPricesV3Params; response: GetPricesV3Response; }; getNumber: { params: GetNumberParams; response: GetNumberResponse; }; getNumberV2: { params: GetNumberV2Params; response: GetNumberV2Response; }; getStatus: { params: GetStatusParams; response: GetStatusResponse; }; setStatus: { params: SetStatusParams; response: SetStatusResponse; }; } type SmsBowerEndpointAction = keyof SmsBowerActionContractMap; declare const buildActionRequest: (config: ResolvedSmsBowerClientConfig, action: TAction, params: SmsBowerActionParamsMap[TAction]) => HttpRequest; interface SendHttpRequestOptions { timeoutMs: number; axios?: AxiosInstance; } declare const sendHttpRequest: (request: HttpRequest, options: SendHttpRequestOptions) => Promise; interface CreateSmsBowerClientOptions { axios?: AxiosInstance; } type ActionParamsFor = SmsBowerActionParamsMap[TAction]; type RequestActionArgs = ActionParamsFor extends SmsBowerNoParams ? [params?: ActionParamsFor] : [params: ActionParamsFor]; interface SmsBowerCoreClient extends SmsBowerAccountEndpointContracts, SmsBowerCatalogEndpointContracts, SmsBowerPriceEndpointContracts { readonly config: ResolvedSmsBowerClientConfig; requestAction(action: TAction, ...[params]: RequestActionArgs): Promise; } declare const createSmsBowerClient: (config: SmsBowerClientConfig, options?: CreateSmsBowerClientOptions) => SmsBowerCoreClient; type SmsBowerActivationEndpoints = SmsBowerNumberEndpointContracts & SmsBowerLifecycleEndpointContracts; declare const createSmsBowerActivationEndpoints: (client: SmsBowerCoreClient) => SmsBowerActivationEndpoints; export { type AccessBalanceResponse, type AccessNumberResponse, type ActionParamValue, type ActionParams, type ActivationLifecycleResponse, type ActivationLifecycleStatus, type CountriesListValue, type CountryCatalogEntry, type GetBalanceParams, type GetBalanceResponse, type GetCountriesParams, type GetCountriesResponse, type GetNumberParams, type GetNumberResponse, type GetNumberV2JsonResponse, type GetNumberV2Params, type GetNumberV2Response, type GetPricesParams, type GetPricesResponse, type GetPricesV2Params, type GetPricesV2Response, type GetPricesV3Params, type GetPricesV3Response, type GetServicesListParams, type GetServicesListResponse, type GetStatusParams, type GetStatusResponse, type HttpRequest, type HttpResponse, type NumberRequestBaseParams, type NumberRequestV2Filters, type PriceQuote, type PricesV1Value, type PricesV2Value, type PricesV3ProviderValue, type PricesV3ServiceValue, type PricesV3Value, type ProviderFilterParams, type ResolvedSmsBowerClientConfig, SMSBOWER_DEFAULT_BASE_URL, SMSBOWER_DEFAULT_TIMEOUT_MS, SMSBOWER_DEFAULT_USER_AGENT, type ServiceCountryParams, type ServicesListValue, type SetStatusParams, type SetStatusResponse, type SmsBowerAccountEndpointContracts, type SmsBowerActionContractMap, type SmsBowerActivationEndpoints, type SmsBowerActivationId, SmsBowerApiError, type SmsBowerApiErrorCode, type SmsBowerCatalogEndpointContracts, type SmsBowerClientConfig, type SmsBowerCoreClient, type SmsBowerCountryCode, type SmsBowerEndpointAction, type SmsBowerEndpointContracts, type SmsBowerJsonContract, type SmsBowerJsonResponse, type SmsBowerLifecycleEndpointContracts, type SmsBowerNoParams, type SmsBowerNumberEndpointContracts, SmsBowerParseError, type SmsBowerParseErrorCode, type SmsBowerParsedResponse, type SmsBowerPriceEndpointContracts, type SmsBowerProviderId, type SmsBowerProviderIds, type SmsBowerTokenResponse, SmsBowerTransportError, type StatusCancelResponse, type StatusOkResponse, type StatusWaitCodeResponse, type StatusWaitRetryResponse, type TransportErrorCode, buildActionRequest, createSmsBowerActivationEndpoints, createSmsBowerClient, parseSmsBowerResponse, resolveClientConfig, sendHttpRequest };