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; |
idillon | 9e542ca | 2022-12-15 17:54:07 -0500 | [diff] [blame] | 42 | action?: 'add' | 'join' | 'remove' | 'ban' | 'unban'; |
Misha Krieger-Raynauld | 6bbdacf | 2022-11-29 21:45:40 -0500 | [diff] [blame] | 43 | body?: string; |
| 44 | duration?: string; |
| 45 | to?: string; |
| 46 | invited?: string; |
idillon | 9e542ca | 2022-12-15 17:54:07 -0500 | [diff] [blame] | 47 | fileId?: string; |
simon | 06527b0 | 2022-10-01 15:01:47 -0400 | [diff] [blame] | 48 | } |
Misha Krieger-Raynauld | cfa4430 | 2022-11-30 18:36:36 -0500 | [diff] [blame] | 49 | |
| 50 | export interface ConversationInfos { |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 51 | avatar?: string; |
| 52 | description?: string; |
Misha Krieger-Raynauld | cfa4430 | 2022-11-30 18:36:36 -0500 | [diff] [blame] | 53 | mode?: string; |
| 54 | title?: string; |
| 55 | } |
| 56 | |
| 57 | export interface NewConversationRequestBody { |
| 58 | members: string[]; |
| 59 | } |
| 60 | |
| 61 | export interface NewMessageRequestBody { |
| 62 | message: string; |
| 63 | } |
idillon | 07d31cc | 2022-12-06 22:40:14 -0500 | [diff] [blame] | 64 | |
| 65 | export interface IConversationSummary { |
| 66 | id: string; |
| 67 | avatar: ConversationInfos['avatar']; |
| 68 | title: ConversationInfos['title']; |
| 69 | membersNames: string[]; |
| 70 | lastMessage: Message; |
| 71 | } |