{"version":3,"file":"call.mjs","sources":["../../../../../src/core/actions/v3/call.ts"],"sourcesContent":["import type { ActionOptions } from '../abstract-action'\nimport type { TypeCallParams } from '../../../types/http'\nimport type { AjaxResult } from '../../http/ajax-result'\nimport { AbstractAction } from '../abstract-action'\nimport { versionManager } from '../../version-manager'\nimport { ApiVersion } from '../../../types/b24'\nimport { SdkError } from '../../sdk-error'\n\nexport type ActionCallV3 = ActionOptions & {\n  method: string\n  params?: TypeCallParams\n  requestId?: string\n}\n\n/**\n * Calls the Bitrix24 REST API method `restApi:v3`\n *\n * @todo add docs\n */\nexport class CallV3 extends AbstractAction {\n  /**\n   * Calls the Bitrix24 REST API method.\n   *\n   * @template T - The expected data type in the response (default is `unknown`).\n   *\n   * @param {ActionCallV3} options - parameters for executing the request.\n   *     - `method: string` - REST API method name (eg: `crm.item.get`)\n   *     - `params?: TypeCallParams` - Parameters for calling the method.\n   *     - `requestId?: string` - Unique request identifier for tracking. Used for query deduplication and debugging.\n   *\n   * @returns {Promise<AjaxResult<T>>} A promise that resolves to the result of an REST API call.\n   *\n   * @example\n   * interface TaskItem { id: number, title: string }\n   * const response = await b24.actions.v3.call.make<{ item: TaskItem }>({\n   *   method: 'tasks.task.get',\n   *   params: { id: 123, select: ['id', 'title'] },\n   *   requestId: 'task-123'\n   * })\n   * if (!response.isSuccess) {\n   *   throw new Error(`Problem: ${response.getErrorMessages().join('; ')}`)\n   * }\n   * console.log(response.getData().result.item.title)\n   */\n  public override async make<T = unknown>(options: ActionCallV3): Promise<AjaxResult<T>> {\n    if (!versionManager.isSupport(ApiVersion.v3, options.method)) {\n      throw new SdkError({\n        code: 'JSSDK_CORE_METHOD_NOT_SUPPORT_IN_API_V3',\n        description: `restApi:v3 not support method ${options.method}`,\n        status: 500\n      })\n    }\n    const params = options.params || {}\n    return this._b24.getHttpClient(ApiVersion.v3).call<T>(options.method, params, options.requestId)\n  }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAmBO,MAAM,eAAe,cAAA,CAAe;AAAA,EAnB3C;AAmB2C,IAAA,MAAA,CAAA,IAAA,EAAA,QAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAyBzC,MAAsB,KAAkB,OAAA,EAA+C;AACrF,IAAA,IAAI,CAAC,cAAA,CAAe,SAAA,CAAU,WAAW,EAAA,EAAI,OAAA,CAAQ,MAAM,CAAA,EAAG;AAC5D,MAAA,MAAM,IAAI,QAAA,CAAS;AAAA,QACjB,IAAA,EAAM,yCAAA;AAAA,QACN,WAAA,EAAa,CAAA,8BAAA,EAAiC,OAAA,CAAQ,MAAM,CAAA,CAAA;AAAA,QAC5D,MAAA,EAAQ;AAAA,OACT,CAAA;AAAA,IACH;AACA,IAAA,MAAM,MAAA,GAAS,OAAA,CAAQ,MAAA,IAAU,EAAC;AAClC,IAAA,OAAO,IAAA,CAAK,IAAA,CAAK,aAAA,CAAc,UAAA,CAAW,EAAE,CAAA,CAAE,IAAA,CAAQ,OAAA,CAAQ,MAAA,EAAQ,MAAA,EAAQ,OAAA,CAAQ,SAAS,CAAA;AAAA,EACjG;AACF;;;;"}