@microsoft/teams-js
Version:
Microsoft Client SDK for building app for Microsoft hosts
119 lines (118 loc) • 3.47 kB
TypeScript
/**
* Extended files API 3P storage providers, features like sending Blob from Teams to 3P app on user
* actions like drag and drop to compose
* @beta
* @module
*/
import { SdkError } from './interfaces';
/**
* Interface to assemble file chunks
* @beta
*/
export interface AssembleAttachment {
/** A number representing the sequence of the attachment in the file chunks. */
sequence: number;
/** A Blob object representing the data of the file chunks. */
file: Blob;
}
/**
* Object used to represent a file
* @beta
*
*/
export interface FilesFor3PStorage extends Blob {
/**
* A number that represents the number of milliseconds since the Unix epoch
*/
lastModified: number;
/**
* Name of the file
*/
name: string;
/**
* file type
*/
type: string;
/**
* A string containing the path of the file relative to the ancestor directory the user selected
*/
webkitRelativePath?: string;
}
/**
* File chunks an output of getDragAndDropFiles API from platform
* @beta
*/
export interface FileChunk {
/**
* Base 64 data for the requested uri
*/
chunk: string;
/**
* chunk sequence number
*/
chunkSequence: number;
/**
* Indicates whether this chunk is the final segment of a file
*/
endOfFile: boolean;
}
/**
* Output of getDragAndDropFiles API from platform
* @beta
*/
export interface FileResult {
/**
* Error encountered in getDragAndDropFiles API
*/
error?: SdkError;
/**
* File chunk which will be assemebled and converted into a blob
*/
fileChunk: FileChunk;
/**
* File index of the file for which chunk data is getting recieved
*/
fileIndex: number;
/**
* File type/MIME type which is getting recieved
*/
fileType: string;
/**
* Indicates whether this file is the last one in a sequence.
*/
isLastFile: boolean;
/**
* The name of the file.
*/
fileName: string;
}
/**
* Defines the callback function received from Third Party App
* @beta
*/
export interface DragAndDropFileCallback {
/**
* Definition of the callback which is received from third party app when calling {@link thirdPartyCloudStorage.getDragAndDropFiles}
* An array of drag and dropped files {@link thirdPartyCloudStorage.FilesFor3PStorage}
* Error encountered during the API call {@link SdkError}
*/
(files: FilesFor3PStorage[], error?: SdkError): void;
}
/**
* Get drag-and-drop files using a callback.
*
* @param {string} dragAndDropInput - unique id which is a combination of replyToId + threadId of teams chat and channel.
* Both replyToId and threadId can be fetched from application context.
* @param {DragAndDropFileCallback} dragAndDropFileCallback - callback
* A callback function to handle the result of the operation
* @beta
*/
export declare function getDragAndDropFiles(dragAndDropInput: string, dragAndDropFileCallback: DragAndDropFileCallback): void;
/**
* Checks if the thirdPartyCloudStorage capability is supported by the host
* @returns boolean to represent whether the thirdPartyCloudStorage capability is supported
*
* @throws Error if {@linkcode app.initialize} has not successfully completed
* @beta
*/
export declare function isSupported(): boolean;