1 import { HTTP_STATUS_CODE } from '@proton/shared/lib/constants';
3 import { EXPENSIVE_REQUEST_TIMEOUT } from '../../drive/constants';
4 import type { MoveLink } from '../../interfaces/drive/link';
5 import type { CreateDrivePhotosShare, CreateDriveShare } from '../../interfaces/drive/share';
7 export const queryCreateShare = (volumeID: string, data: CreateDriveShare) => ({
9 url: `drive/volumes/${volumeID}/shares`,
12 export const queryCreatePhotosShare = (volumeID: string, data: CreateDrivePhotosShare) => ({
14 url: `drive/volumes/${volumeID}/photos/share`,
18 export const queryUserShares = (ShowAll = 1) => ({
25 export const queryShareMeta = (shareID: string) => ({
27 url: `drive/shares/${shareID}`,
30 export const queryRenameLink = (
33 data: { Name: string; MIMEType?: string; Hash: string; SignatureAddress: string; OriginalHash: string }
36 url: `drive/shares/${shareID}/links/${linkID}/rename`,
40 export const queryMoveLink = (shareID: string, linkID: string, data: MoveLink) => ({
42 url: `drive/shares/${shareID}/links/${linkID}/move`,
46 export const queryEvents = (shareID: string, eventID: string) => ({
47 timeout: EXPENSIVE_REQUEST_TIMEOUT,
48 url: `drive/shares/${shareID}/events/${eventID}`,
52 export const queryLatestEvents = (shareID: string) => ({
53 url: `drive/shares/${shareID}/events/latest`,
57 export const queryDeleteShare = (
59 { Force, silence }: { Force?: 0 | 1; silence?: boolean } = { Force: 0 }
61 url: `drive/shares/${shareID}`,
68 export const queryShareMembers = (shareID: string) => ({
69 url: `drive/shares/${shareID}/members`,
73 export const queryRemoveShareMember = (shareID: string, memberID: string) => ({
75 url: `drive/shares/${shareID}/members/${memberID}`,
78 export const queryAcceptShareInvite = (
88 SessionKeySignature: string;
92 url: `drive/shares/${shareID}/members/invitations/${memberID}`,
100 /* Shares migration */
101 export const queryUnmigratedShares = () => ({
102 url: 'drive/migrations/shareaccesswithnode/unmigrated',
104 silence: [HTTP_STATUS_CODE.NOT_FOUND],
107 export const queryMigrateLegacyShares = (data: {
108 PassphraseNodeKeyPackets: { PassphraseNodeKeyPacket: string; ShareID: string }[];
109 UnreadableShareIDs?: string[];
111 url: 'drive/migrations/shareaccesswithnode',
114 silence: [HTTP_STATUS_CODE.NOT_FOUND],
117 export const queryResolveContextShare = ({ volumeId, linkId }: { volumeId: string; linkId: string }) => ({
118 url: `drive/volumes/${volumeId}/links/${linkId}/context`,