1 import { UPLOAD_TIMEOUT } from '../../drive/constants';
2 import type { CreateDriveFile, Thumbnail, UpdateFileRevision } from '../../interfaces/drive/file';
4 export const queryCreateFile = (shareId: string, data: CreateDriveFile) => {
7 timeout: UPLOAD_TIMEOUT,
8 url: `drive/shares/${shareId}/files`,
14 export const queryFileRevisions = (shareId: string, linkId: string) => {
17 url: `drive/shares/${shareId}/files/${linkId}/revisions`,
21 export const queryFileRevision = (
25 pagination?: { FromBlockIndex: number; PageSize: number }
29 url: `drive/shares/${shareId}/files/${linkId}/revisions/${revisionId}`,
43 export const queryFileRevisionThumbnail = (
47 thumbnailType: 1 | 2 | 3 = 1
51 url: `drive/shares/${shareId}/files/${linkId}/revisions/${revisionId}/thumbnail?Type=${thumbnailType}`,
57 * This route should never be called without also instanciating a verifier.
58 * See the file uploader in the Drive app.
60 export const queryVerificationData = (shareId: string, linkId: string, revisionId: string) => {
63 url: `drive/shares/${shareId}/links/${linkId}/revisions/${revisionId}/verification`,
68 export const queryRequestUpload = (data: {
78 ThumbnailList?: Omit<Thumbnail, 'ThumbnailID'>[];
84 ThumbnailHash?: string;
85 ThumbnailSize?: number;
94 export const queryFileBlock = (url: string) => {
103 export const queryUploadFileBlock = (url: string, chunk: Uint8Array) => {
107 data: new Blob([chunk]),
112 export const queryCreateFileRevision = (
115 currentRevisionId: string,
120 timeout: UPLOAD_TIMEOUT,
121 url: `drive/shares/${shareId}/files/${linkId}/revisions`,
124 CurrentRevisionID: currentRevisionId,
125 ClientUID: clientUID,
130 export const queryUpdateFileRevision = (
134 data: UpdateFileRevision
138 timeout: UPLOAD_TIMEOUT,
139 url: `drive/shares/${shareID}/files/${linkID}/revisions/${revisionId}`,
144 export const queryDeleteFileRevision = (shareId: string, linkId: string, revisionId: string) => {
147 url: `drive/shares/${shareId}/files/${linkId}/revisions/${revisionId}`,
151 export const queryRestoreFileRevision = (shareId: string, linkId: string, revisionId: string) => {
154 url: `drive/shares/${shareId}/files/${linkId}/revisions/${revisionId}/restore`,