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 | |
Misha Krieger-Raynauld | cfa4430 | 2022-11-30 18:36:36 -0500 | [diff] [blame] | 20 | export interface IConversationMember { |
| 21 | role?: ConversationMemberRole; |
| 22 | contact: IContact; |
| 23 | } |
| 24 | |
| 25 | export type ConversationMemberRole = 'admin' | 'member' | 'invited' | 'banned' | 'left'; |
| 26 | |
Misha Krieger-Raynauld | 6bbdacf | 2022-11-29 21:45:40 -0500 | [diff] [blame] | 27 | export 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; |
| 42 | body?: string; |
| 43 | duration?: string; |
| 44 | to?: string; |
| 45 | invited?: string; |
simon | 06527b0 | 2022-10-01 15:01:47 -0400 | [diff] [blame] | 46 | } |
Misha Krieger-Raynauld | cfa4430 | 2022-11-30 18:36:36 -0500 | [diff] [blame] | 47 | |
| 48 | export interface ConversationInfos { |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 49 | avatar?: string; |
| 50 | description?: string; |
Misha Krieger-Raynauld | cfa4430 | 2022-11-30 18:36:36 -0500 | [diff] [blame] | 51 | mode?: string; |
| 52 | title?: string; |
| 53 | } |
| 54 | |
| 55 | export interface NewConversationRequestBody { |
| 56 | members: string[]; |
| 57 | } |
| 58 | |
| 59 | export interface NewMessageRequestBody { |
| 60 | message: string; |
| 61 | } |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 62 | |
| 63 | export interface IConversationSummary { |
| 64 | id: string; |
| 65 | avatar: ConversationInfos['avatar']; |
| 66 | title: ConversationInfos['title']; |
| 67 | membersNames: string[]; |
| 68 | lastMessage: Message; |
| 69 | } |