UNPKG

@microsoft/omnichannel-chat-sdk

Version:
77 lines (76 loc) 2.4 kB
import FramedClient from "@microsoft/omnichannel-amsclient/lib/FramedClient"; import { ACSAdapterLogger } from "../../utils/loggers"; type FileMetadata = Record<string, string>; declare enum FilePermission { READ = 0, WRITE = 1 } interface IUploadedFile { fileId: string; metadata?: FileMetadata; } interface IAttachment { name: string; contentType: string; contentUrl: string; thumbnailUrl?: string; } interface IFileUploadRequest extends IAttachment { permissions?: PermissionsOptions; } interface PermissionsOptions { users: string[]; permission: FilePermission; } interface AmsReferenceContent { uniqueId: string; } interface BotAttachment { name: string; contentType: string; content: AmsReferenceContent; } export declare enum AMSViewScanStatus { PASSED = "passed", MALWARE = "malware", INPROGRESS = "in progress" } declare class AMSFileManager { private logger; private amsClient; private options; private supportedImagesMimeTypes; private omnichannelChatToken; fileScanner: any; constructor(amsClient: FramedClient, logger?: ACSAdapterLogger | null, options?: any); uploadFiles(files: IFileUploadRequest[]): Promise<IUploadedFile[]>; downloadFiles(files: IUploadedFile[]): Promise<File[]>; updatePermissions(): Promise<void>; getFileIds(metadata?: Record<string, string>): string[] | undefined; /** * Creates property for the reference of the attachments to be sent to ACS as metadata after successful upload. * * @param fileIds List of fileIds * @returns */ createFileIdProperty(fileIds: string[]): Record<string, string> | undefined; getFileMetadata(metadata?: Record<string, string>): FileMetadata[] | undefined; /** * * Creates property for the metadata of the attachments to be sent to ACS as metadata after successful upload. * * @param metadata List of file metadata * @returns */ createFileMetadataProperty(metadata: FileMetadata[]): Record<string, string> | undefined; /** * Creates content to be sent to ACS after successful upload. * * @param metadata List of file metadata * @returns */ createBotAttachment(metadata: Record<string, string>): BotAttachment | null; private uploadFileToAMS; private downloadFileFromAMS; } export default AMSFileManager;