1 import type { SHARE_MEMBER_PERMISSIONS } from '../../drive/permissions';
2 import { API_CUSTOM_ERROR_CODES } from '../../errors';
3 import type { InviteExternalUserPayload, InviteProtonUserPayload } from '../../interfaces/drive/invitation';
5 export const queryInviteProtonUser = (shareID: string, { Invitation, EmailDetails }: InviteProtonUserPayload) => ({
7 url: `drive/v2/shares/${shareID}/invitations`,
14 export const queryResendInvitation = (shareID: string, invitationID: string) => ({
16 url: `drive/v2/shares/${shareID}/invitations/${invitationID}/sendemail`,
19 export const queryInvitationList = (shareID: string) => ({
21 url: `drive/v2/shares/${shareID}/invitations`,
24 export const queryInvitationDetails = (invitationID: string) => ({
26 url: `drive/v2/shares/invitations/${invitationID}`,
27 silence: [API_CUSTOM_ERROR_CODES.NOT_FOUND],
30 export const queryAcceptShareInvite = (
32 { SessionKeySignature }: { SessionKeySignature: string }
35 url: `drive/v2/shares/invitations/${invitationID}/accept`,
41 export const queryRejectShareInvite = (invitationID: string) => ({
43 url: `drive/v2/shares/invitations/${invitationID}/reject`,
46 export const queryDeleteInvitation = (shareID: string, invitationID: string) => ({
48 url: `drive/v2/shares/${shareID}/invitations/${invitationID}`,
51 //TODO: Add pagination
52 export const queryShareInvitationsListing = (volumeId: string, shareId: string) => ({
54 url: `drive/v2/volumes/${volumeId}/shares/${shareId}/invitations`,
57 //TODO: Add pagination
58 export const queryShareInvitationDetails = (
61 { InvitationIDs }: { InvitationIDs: string[] }
64 url: `drive/v2/volumes/${volumeId}/shares/${shareId}/invitations`,
70 export const queryUpdateInvitationPermissions = (
73 Permissions: SHARE_MEMBER_PERMISSIONS
76 url: `drive/v2/shares/${shareId}/invitations/${invitationId}`,
82 /** External invitations **/
83 export const queryInviteExternalUser = (
85 { ExternalInvitation, EmailDetails }: InviteExternalUserPayload
88 url: `drive/v2/shares/${shareID}/external-invitations`,
95 export const queryResendExternalInvitation = (shareID: string, externalInvitationId: string) => ({
97 url: `drive/v2/shares/${shareID}/external-invitations/${externalInvitationId}/sendemail`,
100 export const queryExternalInvitationList = (shareID: string) => ({
102 url: `drive/v2/shares/${shareID}/external-invitations`,
105 export const queryDeleteExternalInvitation = (shareID: string, externalInvitationId: string) => ({
107 url: `drive/v2/shares/${shareID}/external-invitations/${externalInvitationId}`,
110 export const queryUpdateExternalInvitationPermissions = (
112 externalInvitationId: string,
113 Permissions: SHARE_MEMBER_PERMISSIONS
116 url: `drive/v2/shares/${shareId}/external-invitations/${externalInvitationId}`,
122 export const queryListPendingInvitations = (params?: { AnchorID?: string }) => ({
124 url: `drive/v2/shares/invitations`,
128 export const queryListPendingExternalInvitations = (params?: { AnchorID?: string }) => ({
130 url: `drive/v2/shares/external-invitations`,