Skip to content

TypeB24

ts
import { type TypeB24 } from '@bitrix24/b24jssdk'

Implementation:

Getters

isInit

ts
get isInit(): boolean

Indicates whether the data is initialized. Similar function

auth

ts
get auth(): AuthActions

Returns the AuthActions interface for handling authorization.

Methods

init

ts
init(): Promise<void>

Used to initialize data.

destroy

ts
destroy(): void

Used to destroy or clean up resources.

getLogger

ts
getLogger(): LoggerBrowser

Returns the current logger.

setLogger

ts
setLogger(
	logger: LoggerBrowser
): void

Sets the logger.

getTargetOrigin

ts
getTargetOrigin(): string

Returns the Bitrix24 address (e.g., https://name.bitrix24.com). Similar function

getTargetOriginWithPath

ts
getTargetOriginWithPath(): string

Returns the Bitrix24 REST API address (e.g., https://name.bitrix24.com/rest). Similar function

callMethod

ts
callMethod(
	method: string,
    params?: object,
    start?: number
): Promise<AjaxResult>

Calls a REST API method with the specified parameters.

Returns a Promise that resolves to an AjaxResult.

Similar function

callListMethod

ts
callListMethod(
    method: string,
    params?: object,
    progress?: null|((progress: number) => void),
    customKeyForResult?: string|null
): Promise<Result>

Calls a REST API list method with the specified parameters.

ParameterTypeDescription
methodstringRequest method.
paramsobjectRequest parameters.
progressnull|((progress: number) => void)Progress handler.
customKeyForResultstring|nullCustom field for grouping results.

Returns a Promise that resolves to a Result.

fetchListMethod

ts
fetchListMethod(
	method: string,
    params?: any,
    idKey?: string,
    customKeyForResult?: string|null
): AsyncGenerator<any[]>

Calls a REST API list method and returns a generator object.

ParameterTypeDescription
methodstringRequest method.
paramsanyRequest parameters.
idKeystringEntity ID field name ('ID' or 'id').
customKeyForResultstring|nullCustom field for grouping results.

callBatch

ts
callBatch(
	calls: Array<any>|object,
    isHaltOnError?: boolean
): Promise<Result>

Executes a batch request with a maximum of 50 commands.

ParameterTypeDescription
callsArray<any>|objectBatch of requests.
isHaltOnErrorbooleanHalt execution on error.

Returns a Promise that resolves to an AjaxResult.

Similar function

callBatchByChunk

ts
callBatchByChunk(
	calls: Array<any>,
    isHaltOnError: boolean
): Promise<Result>

Executes a batch request with any number of commands.

ParameterTypeDescription
callsArray<any>Batch of requests.
isHaltOnErrorbooleanHalt execution on error.

Returns a Promise that resolves to an AjaxResult.

getHttpClient

ts
getHttpClient(): TypeHttp

Returns an HTTP client implementing the TypeHttp interface for requests.

Released under the MIT License.