TypeB24
import { type TypeB24 } from '@bitrix24/b24jssdk'Implementation:
Getters
isInit
get isInit(): booleanIndicates whether the data is initialized. Similar function
auth
get auth(): AuthActionsReturns the AuthActions interface for handling authorization.
Methods
init
init(): Promise<void>Used to initialize data.
destroy
destroy(): voidUsed to destroy or clean up resources.
getLogger
getLogger(): LoggerBrowserReturns the current logger.
setLogger
setLogger(
logger: LoggerBrowser
): voidSets the logger.
getTargetOrigin
getTargetOrigin(): stringReturns the Bitrix24 address (e.g., https://name.bitrix24.com). Similar function
getTargetOriginWithPath
getTargetOriginWithPath(): stringReturns the Bitrix24 REST API address (e.g., https://name.bitrix24.com/rest). Similar function
callMethod
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.
callListMethod
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.
| Parameter | Type | Description |
|---|---|---|
method | string | Request method. |
params | object | Request parameters. |
progress | null|((progress: number) => void) | Progress handler. |
customKeyForResult | string|null | Custom field for grouping results. |
Returns a Promise that resolves to a Result.
fetchListMethod
fetchListMethod(
method: string,
params ? : any,
idKey ? : string,
customKeyForResult ? : string | null
): AsyncGenerator<any[]>Calls a REST API list method and returns a generator object.
| Parameter | Type | Description |
|---|---|---|
method | string | Request method. |
params | any | Request parameters. |
idKey | string | Entity ID field name ('ID' or 'id'). |
customKeyForResult | string|null | Custom field for grouping results. |
callBatch
callBatch(
calls: Array<any> | object,
isHaltOnError ? : boolean,
returnAjaxResult ? : boolean
): Promise<Result>Executes a batch request with a maximum of 50 commands.
| Parameter | Type | Description |
|---|---|---|
calls | Array<any>|object | Batch of requests. |
isHaltOnError | boolean | Halt execution on error. |
returnAjaxResult | boolean | Return Record<string | number, AjaxResult> | AjaxResult[] in response. |
Returns a Promise that resolves to an AjaxResult.
callBatchByChunk
callBatchByChunk(
calls: Array<any>,
isHaltOnError: boolean
): Promise<Result>Executes a batch request with any number of commands.
| Parameter | Type | Description |
|---|---|---|
calls | Array<any> | Batch of requests. |
isHaltOnError | boolean | Halt execution on error. |
Returns a Promise that resolves to an AjaxResult.
getHttpClient
getHttpClient(): TypeHttpReturns an HTTP client implementing the TypeHttp interface for requests.