3 GROUP_MEMBER_PERMISSIONS,
8 } from '../interfaces';
10 interface GroupParameters {
19 export const createGroup = (groupParams: GroupParameters) => ({
21 url: 'core/v4/groups',
27 export const editGroup = (groupID: string, groupParams: Partial<GroupParameters>) => ({
29 url: `core/v4/groups/${groupID}`,
35 export const deleteGroup = (groupID: string) => ({
37 url: `core/v4/groups/${groupID}`,
40 export interface GroupResult {
46 Permissions: GroupPermissions;
50 export const getGroups = () => ({
52 url: 'core/v4/groups',
55 export const getGroupMembers = (groupID: string) => ({
57 url: `core/v4/groups/${groupID}/members`,
60 export interface GroupMemberParameters {
61 Type: GroupMemberType;
62 GroupID: string; // encrypted
64 AddressSignaturePacket: string;
65 GroupMemberAddressPrivateKey?: string; // Only for internal E2EE member
66 ActivationToken?: string; // Only for internal E2EE member
67 ProxyInstances?: ProxyInstances[]; // Only for E2EE member
70 Permissions?: GROUP_MEMBER_PERMISSIONS;
73 export const addGroupMember = (addMemberParams: GroupMemberParameters) => ({
75 url: 'core/v4/groups/members',
81 export const updateGroupMember = (groupMemberID: string, groupMemberParams: Partial<GroupMemberParameters>) => ({
83 url: `core/v4/groups/members/${groupMemberID}`,
89 export const deleteGroupMember = (groupMemberID: string) => ({
91 url: `core/v4/groups/members/${groupMemberID}`,
94 export const resumeGroupMember = (groupMemberID: string) => ({
96 url: `core/v4/groups/members/${groupMemberID}/resume`,
99 export const reinviteGroupMember = (groupMemberID: string) => ({
101 url: `core/v4/groups/${groupMemberID}/reinvite`,
104 export const deleteAllGroupMembers = (groupID: string) => ({
106 url: `core/v4/groups/members/${groupID}`,
109 export const resendGroupInvitation = (groupMemberID: string) => ({
111 url: `core/v4/groups/members/${groupMemberID}/reinvite`,
114 export const getGroupMembership = () => ({
116 url: `core/v4/groups/members/internal`,
119 export const getExternalGroupMemberships = (jwt: string) => ({
121 url: `core/v4/groups/members/external/${jwt}`,
124 export const acceptExternalGroupMembership = (jwt: string, groupID: string | null = null) => ({
126 url: `core/v4/groups/external/${jwt}`,
127 params: groupID ? { GroupID: groupID } : {},
130 export const declineExternalGroupMembership = (jwt: string, groupID: string | null = null) => ({
132 url: `core/v4/groups/external/${jwt}`,
133 params: groupID ? { GroupID: groupID } : {},