Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/cvetdv.ru/bitrix/js/im/v2/provider/service/disk/src/ |
Upload File : |
import { RestClient } from 'rest.client'; import { runAction } from 'im.v2.lib.rest'; import { Core } from 'im.v2.application.core'; import { RestMethod } from 'im.v2.const'; type FileId = number | string; export class DiskService { #restClient: RestClient; constructor() { this.#restClient = Core.getRestClient(); } delete({ chatId, fileId }): Promise { const queryParams = { chat_id: chatId, file_id: fileId }; return this.#restClient.callMethod(RestMethod.imDiskFileDelete, queryParams) .catch((result: RestResult) => { console.error('DiskService: error deleting file', result.error()); }); } async save(fileIds: FileId[]): Promise { const normalizedIds = fileIds.map((id) => Number.parseInt(id, 10)); return runAction(RestMethod.imV2DiskFileSave, { data: { ids: normalizedIds }, }).catch(([error]) => { console.error('DiskService: error saving file on disk', error); throw error; }); } }