simon | 26e79f7 | 2022-10-05 22:16:08 -0400 | [diff] [blame] | 1 | /* |
| 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-Raynauld | cfa4430 | 2022-11-30 18:36:36 -0500 | [diff] [blame^] | 18 | import { IContact } from './contact'; |
| 19 | |
| 20 | export interface IConversation { |
| 21 | id: string; |
| 22 | members: IConversationMember[]; |
| 23 | messages: Message[]; |
| 24 | infos: ConversationInfos; |
| 25 | } |
| 26 | |
| 27 | export interface IConversationMember { |
| 28 | role?: ConversationMemberRole; |
| 29 | contact: IContact; |
| 30 | } |
| 31 | |
| 32 | export type ConversationMemberRole = 'admin' | 'member' | 'invited' | 'banned' | 'left'; |
| 33 | |
Misha Krieger-Raynauld | 6bbdacf | 2022-11-29 21:45:40 -0500 | [diff] [blame] | 34 | export 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; |
simon | 06527b0 | 2022-10-01 15:01:47 -0400 | [diff] [blame] | 53 | } |
Misha Krieger-Raynauld | cfa4430 | 2022-11-30 18:36:36 -0500 | [diff] [blame^] | 54 | |
| 55 | export interface ConversationInfos { |
| 56 | mode?: string; |
| 57 | title?: string; |
| 58 | } |
| 59 | |
| 60 | export interface NewConversationRequestBody { |
| 61 | members: string[]; |
| 62 | } |
| 63 | |
| 64 | export interface NewMessageRequestBody { |
| 65 | message: string; |
| 66 | } |