blob: 851239bc63c8271960df145842e1f37f1fb38bac [file] [log] [blame]
Misha Krieger-Raynauldaddd6fe2022-10-22 12:46:04 -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 { AccountDetails, Devices, Message, VolatileDetails } from 'jami-web-common';
Misha Krieger-Raynauld99e5a702022-11-30 22:36:52 -050019import { RegisteredNameFoundState } from 'jami-web-common';
Misha Krieger-Raynauld68a9b562022-10-28 19:47:46 -040020
Misha Krieger-Raynauldcfa44302022-11-30 18:36:36 -050021import { ConversationRequestMetadata } from './conversation-request-metadata.js';
Misha Krieger-Raynauld99e5a702022-11-30 22:36:52 -050022import {
23 ConversationMemberEventType,
24 MessageState,
25 NameRegistrationEndedState,
26 RegistrationState,
27} from './state-enums.js';
Michelle Sepkap Simedd82cbf2022-11-17 23:31:49 -050028
Misha Krieger-Raynauld68a9b562022-10-28 19:47:46 -040029// These interfaces are used to hold all the parameters for signal handlers
30// These parameters' names and types can be found in daemon/bin/nodejs/callback.h
31// or in their relevant SWIG interface files (.i) in daemon/bin/nodejs
32
33export interface AccountDetailsChanged {
34 accountId: string;
35 details: AccountDetails;
36}
37
Misha Krieger-Raynauldaddd6fe2022-10-22 12:46:04 -040038export interface VolatileDetailsChanged {
39 accountId: string;
Misha Krieger-Raynauld68a9b562022-10-28 19:47:46 -040040 details: VolatileDetails;
Misha Krieger-Raynauldaddd6fe2022-10-22 12:46:04 -040041}
42
43export interface RegistrationStateChanged {
44 accountId: string;
Misha Krieger-Raynauld99e5a702022-11-30 22:36:52 -050045 state: RegistrationState;
Misha Krieger-Raynauldaddd6fe2022-10-22 12:46:04 -040046 code: number;
47 details: string;
48}
49
50export interface NameRegistrationEnded {
51 accountId: string;
Misha Krieger-Raynauld99e5a702022-11-30 22:36:52 -050052 state: NameRegistrationEndedState;
Misha Krieger-Raynauldaddd6fe2022-10-22 12:46:04 -040053 username: string;
54}
55
56export interface RegisteredNameFound {
57 accountId: string;
Misha Krieger-Raynauld99e5a702022-11-30 22:36:52 -050058 state: RegisteredNameFoundState;
Misha Krieger-Raynauldaddd6fe2022-10-22 12:46:04 -040059 address: string;
60 username: string;
61}
Charlieb62c6782022-10-30 15:14:56 -040062
Misha Krieger-Raynauld68a9b562022-10-28 19:47:46 -040063export interface KnownDevicesChanged {
64 accountId: string;
Misha Krieger-Raynauldcfa44302022-11-30 18:36:36 -050065 devices: Devices;
Misha Krieger-Raynauld68a9b562022-10-28 19:47:46 -040066}
67
Charlieb62c6782022-10-30 15:14:56 -040068export interface IncomingAccountMessage {
69 accountId: string;
70 from: string;
Misha Krieger-Raynauldcb11bba2022-11-11 18:08:33 -050071 payload: Record<string, string>;
72}
73
74export interface AccountMessageStatusChanged {
75 accountId: string;
76 messageId: string;
77 peer: string;
Misha Krieger-Raynauld99e5a702022-11-30 22:36:52 -050078 state: MessageState;
Misha Krieger-Raynauldcb11bba2022-11-11 18:08:33 -050079}
80
Michelle Sepkap Simedd82cbf2022-11-17 23:31:49 -050081export interface IncomingTrustRequest {
82 accountId: string;
83 conversationId: string;
84 from: string;
Misha Krieger-Raynauldcfa44302022-11-30 18:36:36 -050085 payload: number[];
Michelle Sepkap Simedd82cbf2022-11-17 23:31:49 -050086 received: number;
87}
88
Misha Krieger-Raynauldcb11bba2022-11-11 18:08:33 -050089export interface ContactAdded {
90 accountId: string;
91 contactId: string;
92 confirmed: boolean;
93}
94
95export interface ContactRemoved {
96 accountId: string;
97 contactId: string;
98 banned: boolean;
Charlieb62c6782022-10-30 15:14:56 -040099}
Misha Krieger-Raynauld68a9b562022-10-28 19:47:46 -0400100
Michelle Sepkap Simedd82cbf2022-11-17 23:31:49 -0500101export interface ConversationRequestReceived {
102 accountId: string;
103 conversationId: string;
Misha Krieger-Raynauldcfa44302022-11-30 18:36:36 -0500104 metadata: ConversationRequestMetadata;
Michelle Sepkap Simedd82cbf2022-11-17 23:31:49 -0500105}
106
Misha Krieger-Raynauld68a9b562022-10-28 19:47:46 -0400107export interface ConversationReady {
108 accountId: string;
109 conversationId: string;
110}
111
112export interface ConversationRemoved {
113 accountId: string;
114 conversationId: string;
115}
116
117export interface ConversationLoaded {
118 id: number;
119 accountId: string;
120 conversationId: string;
Misha Krieger-Raynauld8a381da2022-11-03 17:37:51 -0400121 messages: Message[];
Misha Krieger-Raynauld68a9b562022-10-28 19:47:46 -0400122}
123
Michelle Sepkap Simedd82cbf2022-11-17 23:31:49 -0500124export interface ConversationMemberEvent {
125 accountId: string;
126 conversationId: string;
127 memberUri: string;
Misha Krieger-Raynauld99e5a702022-11-30 22:36:52 -0500128 event: ConversationMemberEventType;
Michelle Sepkap Simedd82cbf2022-11-17 23:31:49 -0500129}
130
Misha Krieger-Raynauld68a9b562022-10-28 19:47:46 -0400131export interface MessageReceived {
132 accountId: string;
133 conversationId: string;
Misha Krieger-Raynauld8a381da2022-11-03 17:37:51 -0400134 message: Message;
Misha Krieger-Raynauld68a9b562022-10-28 19:47:46 -0400135}