blob: f49f72e12dd25e79e73b833741ea726dced781d3 [file] [log] [blame]
simon26e79f72022-10-05 22:16:08 -04001/*
2 * Copyright (C) 2022 Savoir-faire Linux Inc.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Affero General Public License as
6 * published by the Free Software Foundation; either version 3 of the
7 * License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Affero General Public License for more details.
13 *
14 * You should have received a copy of the GNU Affero General Public
15 * License along with this program. If not, see
16 * <https://www.gnu.org/licenses/>.
17 */
Misha Krieger-Raynauldcfa44302022-11-30 18:36:36 -050018import { IContact } from './contact';
19
Misha Krieger-Raynauldcfa44302022-11-30 18:36:36 -050020export interface IConversationMember {
21 role?: ConversationMemberRole;
22 contact: IContact;
23}
24
25export type ConversationMemberRole = 'admin' | 'member' | 'invited' | 'banned' | 'left';
26
Misha Krieger-Raynauld6bbdacf2022-11-29 21:45:40 -050027export interface Message {
28 id: string;
29 author: string;
30 timestamp: string;
31 type:
32 | 'application/call-history+json'
33 | 'application/data-transfer+json'
34 | 'application/update-profile'
35 | 'initial'
36 | 'member'
37 | 'merge'
38 | 'text/plain'
39 | 'vote';
40 linearizedParent: string;
41 parents: string;
idillon9e542ca2022-12-15 17:54:07 -050042 action?: 'add' | 'join' | 'remove' | 'ban' | 'unban';
Misha Krieger-Raynauld6bbdacf2022-11-29 21:45:40 -050043 body?: string;
44 duration?: string;
45 to?: string;
46 invited?: string;
idillon9e542ca2022-12-15 17:54:07 -050047 fileId?: string;
simon06527b02022-10-01 15:01:47 -040048}
Misha Krieger-Raynauldcfa44302022-11-30 18:36:36 -050049
50export interface ConversationInfos {
idillon07d31cc2022-12-06 22:40:14 -050051 avatar?: string;
52 description?: string;
Misha Krieger-Raynauldcfa44302022-11-30 18:36:36 -050053 mode?: string;
54 title?: string;
55}
56
57export interface NewConversationRequestBody {
58 members: string[];
59}
60
61export interface NewMessageRequestBody {
62 message: string;
63}
idillon07d31cc2022-12-06 22:40:14 -050064
65export interface IConversationSummary {
66 id: string;
67 avatar: ConversationInfos['avatar'];
68 title: ConversationInfos['title'];
69 membersNames: string[];
70 lastMessage: Message;
71}