TypeB24 is the unified type implemented by B24Frame, B24Hook, and B24OAuth. Use it as a parameter type when your code shouldn't care which transport it talks to.
import type { TypeB24 } from '@bitrix24/b24jssdk'
async function listAdminTasks($b24: TypeB24): Promise<unknown[]> {
const response = await $b24.actions.v2.callList.make<{ id: number, title: string }>({
method: 'tasks.task.list',
params: { filter: { '!=STATUS': '5' }, select: ['ID', 'TITLE'] },
idKey: 'id', // tasks return lowercase id
cursorIdKey: 'ID', // ...but sort / filter by uppercase ID
customKeyForResult: 'tasks',
requestId: 'admin-tasks'
})
return response.isSuccess ? response.getData()! : []
}
Shape
type TypeB24 = {
readonly isInit: boolean
init(): Promise<void>
destroy(): void
getLogger(): LoggerInterface
setLogger(logger: LoggerInterface): void
get auth(): AuthActions
get actions(): ActionsManager
get tools(): ToolsManager
setRestrictionManagerParams(params: RestrictionParams): Promise<void>
getTargetOrigin(): string
getTargetOriginWithPath(): Map<ApiVersion, string>
getHttpClient(version: ApiVersion): TypeHttp
setHttpClient(version: ApiVersion, client: TypeHttp): void
}
Five members left this interface in 3.0.0.
callMethod, callListMethod,
fetchListMethod, callBatch and callBatchByChunk were shortcuts that ignored
the restApi:v2 / restApi:v3 split; they are replaced by
actions.v{2,3}.{call,callList,fetchList,batch,batchByChunk}.make(options). Four
of the five are a mechanical swap; callListMethod is not — see the
migration guide.Related Types
AuthActions— returned byauth.ActionsManager— returned byactions. Housesv2.*andv3.*.ToolsManager— returned bytools. HouseshealthCheckandping.TypeHttp— returned bygetHttpClient(version).RestrictionParams— argument tosetRestrictionManagerParams.ApiVersion—'v2'or'v3'.