UNPKG

@bitrix24/b24jssdk

Version:

Bitrix24 REST API JavaScript SDK

1 lines 5.38 kB
{"version":3,"file":"b24.mjs","sources":["../../../src/types/b24.ts"],"sourcesContent":["import type { LoggerInterface } from './logger'\nimport type { AjaxResult } from '../core/http/ajax-result'\nimport type { Result } from '../core/result'\nimport type { TypeHttp, ICallBatchOptions } from './http'\nimport type { AuthActions } from './auth'\nimport type { RestrictionParams } from './limiters'\nimport type { ActionsManager } from '../core/actions/manager'\nimport type { ToolsManager } from '../core/tools/manager'\n\n/**\n * @todo docs\n */\n\nexport enum ApiVersion {\n v3 = 'v3',\n v2 = 'v2'\n}\n\n/**\n * Options for batch calls\n */\nexport interface IB24BatchOptions extends ICallBatchOptions {\n /**\n * Api Version\n * If the option is empty, then automatic detection is performed using the specified methods.\n */\n apiVersion?: ApiVersion\n\n /**\n * Whether to return an AjaxResult object instead of data\n * @default false\n */\n returnAjaxResult?: boolean\n}\n\nexport type CallBatchResult<T>\n = Result<Record<string | number, AjaxResult<T>>>\n | Result<AjaxResult<T>[]>\n | Result<T>\n\nexport type TypeB24 = {\n /**\n * @see {https://bitrix24.github.io/b24jssdk/docs/hook/ Js SDK documentation}\n * @see {https://apidocs.bitrix24.com/sdk/bx24-js-sdk/system-functions/bx24-init.html Bitrix24 REST API documentation}\n */\n readonly isInit: boolean\n init(): Promise<void>\n destroy(): void\n\n getLogger(): LoggerInterface\n setLogger(logger: LoggerInterface): void\n\n /**\n * Returns the AuthActions interface for handling authorization.\n */\n get auth(): AuthActions\n\n /**\n * Returns the ActionsManager interface for working with Bitrix24 methods. Dependent on the REST API version.\n */\n get actions(): ActionsManager\n\n /**\n * Returns the ToolsManager interface for access to Bitrix24 utilities independent of the REST API version.\n */\n get tools(): ToolsManager\n\n /**\n * Sets the restriction parameters\n */\n setRestrictionManagerParams(params: RestrictionParams): Promise<void>\n\n /**\n * Get the account address Bitrix24 ( `https://your_domain.bitrix24.com` )\n */\n getTargetOrigin(): string\n\n /**\n * Get the account address Bitrix24 with path\n * - `restApi:v3` `https://your_domain.bitrix24.com/rest/api/`\n * - `restApi:v2` `https://your_domain.bitrix24.com/rest/`\n */\n getTargetOriginWithPath(): Map<ApiVersion, string>\n\n /**\n * Calls the Bitrix24 REST API method.\n *\n * @deprecated This method is deprecated and will be removed in version `2.0.0`\n * - for `restApi:v3` use {@link CallV3.make `b24.actions.v3.call.make(options)`}\n * - for `restApi:v2` use {@link CallV2.make `b24.actions.v2.call.make(options)`}\n *\n * @removed 2.0.0\n */\n callMethod(method: string, params?: object, start?: number): Promise<AjaxResult>\n\n /**\n * Calls a Bitrix24 REST API list method to retrieve all data.\n *\n * @deprecated This method is deprecated and will be removed in version `2.0.0`\n * - for `restApi:v3` use {@link CallListV3.make `b24.actions.v3.callList.make(options)`}\n * - for `restApi:v2` use {@link CallListV2.make `b24.actions.v2.callList.make(options)`}\n *\n * @removed 2.0.0\n */\n callListMethod(method: string, params?: object, progress?: null | ((progress: number) => void), customKeyForResult?: string | null): Promise<Result>\n\n /**\n * Calls a Bitrix24 REST API list method and returns an async generator.\n *\n * @deprecated This method is deprecated and will be removed in version `2.0.0`\n * - for `restApi:v3` use {@link FetchListV3.make `b24.actions.v3.fetchList.make(options)`}\n * - for `restApi:v2` use {@link FetchListV2.make `b24.actions.v2.fetchList.make(options)`}\n *\n * @removed 2.0.0\n */\n fetchListMethod(method: string, params?: any, idKey?: string, customKeyForResult?: string | null): AsyncGenerator<any[]>\n\n /**\n * Executes a batch request to the Bitrix24 REST API\n *\n * @deprecated This method is deprecated and will be removed in version `2.0.0`\n * - for `restApi:v3` use {@link BatchV3.make `b24.actions.v3.batch.make(options)`}\n * - for `restApi:v2` use {@link BatchV2.make `b24.actions.v2.batch.make(options)`}\n *\n * @removed 2.0.0\n */\n callBatch(calls: Array<any> | object, isHaltOnError?: boolean, returnAjaxResult?: boolean): Promise<Result>\n\n /**\n * Executes a batch request to the Bitrix24 REST API with automatic chunking for any number of commands.\n *\n * @deprecated This method is deprecated and will be removed in version `2.0.0`\n * - for `restApi:v3` use {@link BatchByChunkV3.make `b24.actions.v3.batchByChunk.make(options)`}\n * - for `restApi:v2` use {@link BatchByChunkV2.make `b24.actions.v2.batchByChunk.make(options)`}\n *\n * @removed 2.0.0\n */\n callBatchByChunk(calls: Array<any>, isHaltOnError: boolean): Promise<Result>\n\n /**\n * Returns the HTTP client to perform the request.\n */\n getHttpClient(version: ApiVersion): TypeHttp\n\n /**\n * Set HTTP client\n */\n setHttpClient(version: ApiVersion, client: TypeHttp): void\n}\n"],"names":["ApiVersion"],"mappings":";;;;;;;;AAaO,IAAK,UAAA,qBAAAA,WAAAA,KAAL;AACL,EAAAA,YAAA,IAAA,CAAA,GAAK,IAAA;AACL,EAAAA,YAAA,IAAA,CAAA,GAAK,IAAA;AAFK,EAAA,OAAAA,WAAAA;AAAA,CAAA,EAAA,UAAA,IAAA,EAAA;;;;"}