1 | /**
|
2 | * -------------------------------------------------------------------------------------------
|
3 | * Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
|
4 | * See License in the project root for license information.
|
5 | * -------------------------------------------------------------------------------------------
|
6 | */
|
7 | import { Client } from "../index";
|
8 | import { UploadEventHandlers } from "./FileUploadTask/Interfaces/IUploadEventHandlers";
|
9 | import { FileObject, LargeFileUploadSession, LargeFileUploadTask, LargeFileUploadTaskOptions } from "./LargeFileUploadTask";
|
10 | /**
|
11 | * @interface
|
12 | * Signature to define options when creating an upload task
|
13 | * @property {string} fileName - Specifies the name of a file to be uploaded (with extension)
|
14 | * @property {string} [fileDescription] - Specifies the description of the file to be uploaded
|
15 | * @property {string} [path] - The path to which the file needs to be uploaded
|
16 | * @property {number} [rangeSize] - Specifies the range chunk size
|
17 | * @property {string} [conflictBehavior] - Conflict behaviour option
|
18 | * @property {UploadEventHandlers} [uploadEventHandlers] - UploadEventHandlers attached to an upload task
|
19 | */
|
20 | export interface OneDriveLargeFileUploadOptions {
|
21 | fileName: string;
|
22 | fileDescription?: string;
|
23 | path?: string;
|
24 | rangeSize?: number;
|
25 | conflictBehavior?: string;
|
26 | uploadEventHandlers?: UploadEventHandlers;
|
27 | uploadSessionURL?: string;
|
28 | }
|
29 | /**
|
30 | * @interface
|
31 | * Signature to define options when creating an upload task
|
32 | * @property {string} fileName - Specifies the name of a file to be uploaded (with extension)
|
33 | * @property {string} [fileDescription] - Specifies the description of the file to be uploaded
|
34 | * @property {string} [conflictBehavior] - Conflict behaviour option
|
35 | */
|
36 | interface OneDriveFileUploadSessionPayLoad {
|
37 | fileName: string;
|
38 | fileDescription?: string;
|
39 | conflictBehavior?: string;
|
40 | }
|
41 | /**
|
42 | * @class
|
43 | * Class representing OneDriveLargeFileUploadTask
|
44 | */
|
45 | export declare class OneDriveLargeFileUploadTask<T> extends LargeFileUploadTask<T> {
|
46 | /**
|
47 | * @private
|
48 | * @static
|
49 | * Default path for the file being uploaded
|
50 | */
|
51 | private static DEFAULT_UPLOAD_PATH;
|
52 | /**
|
53 | * @private
|
54 | * @static
|
55 | * Constructs the create session url for Onedrive
|
56 | * @param {string} fileName - The name of the file
|
57 | * @param {path} [path = OneDriveLargeFileUploadTask.DEFAULT_UPLOAD_PATH] - The path for the upload
|
58 | * @returns The constructed create session url
|
59 | */
|
60 | private static constructCreateSessionUrl;
|
61 | /**
|
62 | * @private
|
63 | * @static
|
64 | * Get file information
|
65 | * @param {Blob | Uint8Array | File} file - The file entity
|
66 | * @param {string} fileName - The file name
|
67 | * @returns {FileInfo} The file information
|
68 | */
|
69 | private static getFileInfo;
|
70 | /**
|
71 | * @public
|
72 | * @static
|
73 | * @async
|
74 | * Creates a OneDriveLargeFileUploadTask
|
75 | * @param {Client} client - The GraphClient instance
|
76 | * @param {Blob | Uint8Array | File} file - File represented as Blob, Uint8Array or File
|
77 | * @param {OneDriveLargeFileUploadOptions} options - The options for upload task
|
78 | * @returns The promise that will be resolves to OneDriveLargeFileUploadTask instance
|
79 | */
|
80 | static create(client: Client, file: Blob | Uint8Array | File, options: OneDriveLargeFileUploadOptions): Promise<OneDriveLargeFileUploadTask<Blob | ArrayBuffer | Uint8Array>>;
|
81 | /**
|
82 | * @public
|
83 | * @static
|
84 | * @async
|
85 | * Creates a OneDriveLargeFileUploadTask
|
86 | * @param {Client} client - The GraphClient instance
|
87 | * @param {FileObject} fileObject - FileObject instance
|
88 | * @param {OneDriveLargeFileUploadOptions} options - The options for upload task
|
89 | * @returns The promise that will be resolves to OneDriveLargeFileUploadTask instance
|
90 | */
|
91 | static createTaskWithFileObject<T>(client: Client, fileObject: FileObject<T>, options: OneDriveLargeFileUploadOptions): Promise<OneDriveLargeFileUploadTask<T>>;
|
92 | /**
|
93 | * @public
|
94 | * @static
|
95 | * @async
|
96 | * Makes request to the server to create an upload session
|
97 | * @param {Client} client - The GraphClient instance
|
98 | * @param {string} requestUrl - The URL to create the upload session
|
99 | * @param {string} payloadOptions - The payload option. Default conflictBehavior is 'rename'
|
100 | * @returns The promise that resolves to LargeFileUploadSession
|
101 | */
|
102 | static createUploadSession(client: Client, requestUrl: string, payloadOptions: OneDriveFileUploadSessionPayLoad): Promise<LargeFileUploadSession>;
|
103 | /**
|
104 | * @public
|
105 | * @constructor
|
106 | * Constructs a OneDriveLargeFileUploadTask
|
107 | * @param {Client} client - The GraphClient instance
|
108 | * @param {FileObject} file - The FileObject holding details of a file that needs to be uploaded
|
109 | * @param {LargeFileUploadSession} uploadSession - The upload session to which the upload has to be done
|
110 | * @param {LargeFileUploadTaskOptions} options - The upload task options
|
111 | * @returns An instance of OneDriveLargeFileUploadTask
|
112 | */
|
113 | constructor(client: Client, file: FileObject<T>, uploadSession: LargeFileUploadSession, options: LargeFileUploadTaskOptions);
|
114 | /**
|
115 | * @public
|
116 | * Commits upload session to end uploading
|
117 | * @param {string} requestUrl - The URL to commit the upload session
|
118 | * string} conflictBehavior - Conflict behaviour option. Default is 'rename'
{ |
119 | * The promise resolves to committed response
|
120 | */
|
121 | commit(requestUrl: string, conflictBehavior?: string): Promise<unknown>;
|
122 | }
|
123 | export {};
|