blob: 5fe2145708a6cef23de9f7928c5d72b6f572d906 [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
20export interface IConversation {
21 id: string;
22 members: IConversationMember[];
23 messages: Message[];
24 infos: ConversationInfos;
25}
26
27export interface IConversationMember {
28 role?: ConversationMemberRole;
29 contact: IContact;
30}
31
32export type ConversationMemberRole = 'admin' | 'member' | 'invited' | 'banned' | 'left';
33
Misha Krieger-Raynauld6bbdacf2022-11-29 21:45:40 -050034export interface Message {
35 id: string;
36 author: string;
37 timestamp: string;
38 type:
39 | 'application/call-history+json'
40 | 'application/data-transfer+json'
41 | 'application/update-profile'
42 | 'initial'
43 | 'member'
44 | 'merge'
45 | 'text/plain'
46 | 'vote';
47 linearizedParent: string;
48 parents: string;
49 body?: string;
50 duration?: string;
51 to?: string;
52 invited?: string;
simon06527b02022-10-01 15:01:47 -040053}
Misha Krieger-Raynauldcfa44302022-11-30 18:36:36 -050054
55export interface ConversationInfos {
56 mode?: string;
57 title?: string;
58}
59
60export interface NewConversationRequestBody {
61 members: string[];
62}
63
64export interface NewMessageRequestBody {
65 message: string;
66}