1 import { HTTP_ERROR_CODES } from '@proton/shared/lib/errors';
3 import { SORT_DIRECTION } from '../../constants';
4 import { DEFAULT_SORT_FIELD, DEFAULT_SORT_ORDER, FOLDER_PAGE_SIZE } from '../../drive/constants';
5 import type { AbuseReportPayload, CreateSharedURL, UpdateSharedURL } from '../../interfaces/drive/sharing';
7 export const queryInitSRPHandshake = (token: string) => {
10 url: `drive/urls/${token}/info`,
15 export const querySharedURLInformation = (token: string) => {
18 url: `drive/urls/${token}`,
23 export const querySharedURLSecurity = (token: string, Hashes: string[]) => {
26 url: `drive/urls/${token}/security`,
34 export const queryShareURLAuth = (token: string) => {
37 url: `drive/urls/${token}/auth`,
42 export const querySharedURLFileRevision = (
46 FromBlockIndex: number;
52 url: `drive/urls/${token}/files/${linkID}`,
58 silence: [HTTP_ERROR_CODES.UNAUTHORIZED],
64 export const querySharedURLChildren = (
69 PageSize = FOLDER_PAGE_SIZE,
70 Sort = DEFAULT_SORT_FIELD,
71 Desc = DEFAULT_SORT_ORDER === SORT_DIRECTION.ASC ? 0 : 1,
72 }: { Page: number; PageSize?: number; FoldersOnly?: number; Sort?: string; Desc?: 0 | 1 }
76 url: `drive/urls/${token}/folders/${linkId}/children`,
77 params: { Page, PageSize, Sort, Desc, Thumbnails: 1 },
78 silence: [HTTP_ERROR_CODES.UNAUTHORIZED],
82 export const queryCreateSharedLink = (shareId: string, data: CreateSharedURL) => {
85 url: `drive/shares/${shareId}/urls`,
90 export const querySharedLinks = (shareId: string, params: { Page: number; PageSize?: number; Recursive?: 1 | 0 }) => {
93 url: `drive/shares/${shareId}/urls`,
98 export const queryUpdateSharedLink = (shareId: string, shareUrlId: string, data: Partial<UpdateSharedURL>) => {
101 url: `drive/shares/${shareId}/urls/${shareUrlId}`,
106 export const queryDeleteSharedLink = (shareId: string, shareUrlId: string) => {
109 url: `drive/shares/${shareId}/urls/${shareUrlId}`,
113 export const queryDeleteMultipleSharedLinks = (shareId: string, shareUrlIds: string[]) => {
116 url: `drive/shares/${shareId}/urls/delete_multiple`,
118 ShareURLIDs: shareUrlIds,
123 export const querySubmitAbuseReport = (data: AbuseReportPayload) => {
126 url: 'drive/report/url',
131 export const querySharedWithMeLinks = (params?: { AnchorID?: string }) => {
134 url: 'drive/v2/sharedwithme',
139 export const querySharedByMeLinks = (volumeId: string, params?: { AnchorID?: string }) => {
142 url: `drive/v2/volumes/${volumeId}/shares`,