1 import { UPLOAD_TIMEOUT } from '../../drive/constants';
7 } from '../../interfaces/drive/file';
9 export const queryCreateFile = (shareId: string, data: CreateDriveFile) => {
12 timeout: UPLOAD_TIMEOUT,
13 url: `drive/shares/${shareId}/files`,
19 export const queryFileRevisions = (shareId: string, linkId: string) => {
22 url: `drive/shares/${shareId}/files/${linkId}/revisions`,
26 export const queryFileRevision = (
30 pagination?: { FromBlockIndex: number; PageSize: number }
34 url: `drive/shares/${shareId}/files/${linkId}/revisions/${revisionId}`,
48 export const queryFileRevisionThumbnail = (
52 thumbnailType: 1 | 2 | 3 = 1
56 url: `drive/shares/${shareId}/files/${linkId}/revisions/${revisionId}/thumbnail?Type=${thumbnailType}`,
62 * This route should never be called without also instanciating a verifier.
63 * See the file uploader in the Drive app.
65 export const queryVerificationData = (shareId: string, linkId: string, revisionId: string) => {
68 url: `drive/shares/${shareId}/links/${linkId}/revisions/${revisionId}/verification`,
73 export const queryRequestUpload = (data: {
83 ThumbnailList?: Omit<Thumbnail, 'ThumbnailID'>[];
89 ThumbnailHash?: string;
90 ThumbnailSize?: number;
99 export const queryFileBlock = (url: string) => {
108 export const queryUploadFileBlock = (url: string, chunk: Uint8Array) => {
112 data: new Blob([chunk]),
117 export const queryCreateFileRevision = (
120 currentRevisionId: string,
125 timeout: UPLOAD_TIMEOUT,
126 url: `drive/shares/${shareId}/files/${linkId}/revisions`,
129 CurrentRevisionID: currentRevisionId,
130 ClientUID: clientUID,
135 export const queryUpdateFileRevision = (
139 data: UpdateFileRevision
143 timeout: UPLOAD_TIMEOUT,
144 url: `drive/shares/${shareID}/files/${linkID}/revisions/${revisionId}`,
149 export const queryDeleteFileRevision = (shareId: string, linkId: string, revisionId: string) => {
152 url: `drive/shares/${shareId}/files/${linkId}/revisions/${revisionId}`,
156 export const queryRestoreFileRevision = (shareId: string, linkId: string, revisionId: string) => {
159 url: `drive/shares/${shareId}/files/${linkId}/revisions/${revisionId}/restore`,
164 export const queryPublicCreateFile = (token: string, data: PublicCreateDriveFile) => {
167 timeout: UPLOAD_TIMEOUT,
168 url: `drive/urls/${token}/files`,
174 export const queryPublicRequestUpload = (
179 EncSignature?: string;
186 ThumbnailList?: Omit<Thumbnail, 'ThumbnailID'>[];
187 SignatureEmail?: string;
191 ThumbnailHash?: string;
192 ThumbnailSize?: number;
197 url: `drive/urls/${token}/blocks`,
203 * This route should never be called without also instanciating a verifier.
204 * See the file uploader in the Drive app.
206 export const queryPublicVerificationData = (token: string, linkId: string, revisionId: string) => {
209 url: `drive/urls/${token}/links/${linkId}/revisions/${revisionId}/verification`,
214 export const queryPublicUpdateFileRevision = (
218 data: Omit<UpdateFileRevision, 'SignatureAddress'> & {
219 SignatureEmail?: string;
224 timeout: UPLOAD_TIMEOUT,
225 url: `drive/urls/${token}/files/${linkID}/revisions/${revisionId}`,