1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
/// Chat service RPC message container
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Chat {
    /// message type
    #[prost(oneof="chat::Message", tags="3, 4, 5")]
    pub message: ::core::option::Option<chat::Message>,
}
/// Nested message and enum types in `Chat`.
pub mod chat {
    /// message type
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Message {
        /// request a specific conversation
        #[prost(message, tag="3")]
        ConversationRequest(super::ChatConversationRequest),
        /// list of a chat conversation
        #[prost(message, tag="4")]
        ConversationList(super::ChatConversationList),
        /// send a new chat message
        #[prost(message, tag="5")]
        Send(super::ChatMessageSend),
    }
}
/// request messages of a specific chat conversation
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ChatConversationRequest {
    /// group id
    #[prost(bytes="vec", tag="1")]
    pub group_id: ::prost::alloc::vec::Vec<u8>,
    /// send only changes that are newer than the last received
    #[prost(uint64, tag="2")]
    pub last_index: u64,
}
/// list of chat messages of a specific conversation
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ChatConversationList {
    /// group id
    #[prost(bytes="vec", tag="1")]
    pub group_id: ::prost::alloc::vec::Vec<u8>,
    /// several messages
    #[prost(message, repeated, tag="2")]
    pub message_list: ::prost::alloc::vec::Vec<ChatMessage>,
}
/// a single chat message
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ChatMessage {
    /// index
    #[prost(uint64, tag="1")]
    pub index: u64,
    /// id of the sending user
    #[prost(bytes="vec", tag="2")]
    pub sender_id: ::prost::alloc::vec::Vec<u8>,
    /// message id or member id
    #[prost(bytes="vec", tag="3")]
    pub message_id: ::prost::alloc::vec::Vec<u8>,
    /// message status
    #[prost(enumeration="MessageStatus", tag="4")]
    pub status: i32,
    /// message reception confirmed
    ///
    /// When a user receives a message, sent by us,
    /// the user is confirming the reception of this message.
    /// We are only getting this confirmation if we are the sender of this
    /// message.
    #[prost(message, repeated, tag="10")]
    pub message_reception_confirmed: ::prost::alloc::vec::Vec<MessageReceptionConfirmed>,
    /// group id
    #[prost(bytes="vec", tag="5")]
    pub group_id: ::prost::alloc::vec::Vec<u8>,
    /// time when the message was sent
    #[prost(uint64, tag="6")]
    pub sent_at: u64,
    /// time when the message was received
    #[prost(uint64, tag="7")]
    pub received_at: u64,
    /// chat content message
    #[prost(bytes="vec", tag="8")]
    pub content: ::prost::alloc::vec::Vec<u8>,
}
/// message reception confirmed
#[derive(serde::Serialize, serde::Deserialize)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MessageReceptionConfirmed {
    /// user id
    #[prost(bytes="vec", tag="1")]
    pub user_id: ::prost::alloc::vec::Vec<u8>,
    /// time of confirmation
    #[prost(uint64, tag="2")]
    pub confirmed_at: u64,
}
/// chat content message
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ChatContentMessage {
    #[prost(oneof="chat_content_message::Message", tags="1, 2, 3")]
    pub message: ::core::option::Option<chat_content_message::Message>,
}
/// Nested message and enum types in `ChatContentMessage`.
pub mod chat_content_message {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Message {
        /// a chat content message
        #[prost(message, tag="1")]
        ChatContent(super::ChatContent),
        /// a file content message
        #[prost(message, tag="2")]
        FileContent(super::FileContent),
        /// a group event information
        #[prost(message, tag="3")]
        GroupEvent(super::GroupEvent),
    }
}
/// chat content
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ChatContent {
    /// message text
    #[prost(string, tag="1")]
    pub text: ::prost::alloc::string::String,
}
/// file content
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FileContent {
    /// file id
    #[prost(uint64, tag="1")]
    pub file_id: u64,
    /// file name
    #[prost(string, tag="2")]
    pub file_name: ::prost::alloc::string::String,
    /// file extension
    #[prost(string, tag="3")]
    pub file_extension: ::prost::alloc::string::String,
    /// file size
    #[prost(uint32, tag="4")]
    pub file_size: u32,
    /// file description
    #[prost(string, tag="5")]
    pub file_description: ::prost::alloc::string::String,
}
/// Group event information
/// this message is purely informational
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GroupEvent {
    /// group event type
    #[prost(enumeration="GroupEventType", tag="1")]
    pub event_type: i32,
    /// user ID of user joined or left
    #[prost(bytes="vec", tag="2")]
    pub user_id: ::prost::alloc::vec::Vec<u8>,
}
/// send chat message
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ChatMessageSend {
    /// group id to which this message is sent
    #[prost(bytes="vec", tag="1")]
    pub group_id: ::prost::alloc::vec::Vec<u8>,
    /// content of the message
    #[prost(string, tag="2")]
    pub content: ::prost::alloc::string::String,
}
/// Sending status of sent messages
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum MessageStatus {
    /// message not sent yet
    ///
    /// this state is used for receiving files too
    Sending = 0,
    /// message successfully sent to another node
    Sent = 1,
    /// reciption has been confirmed
    Confirmed = 2,
    /// all group members confirmed that they received
    /// the message
    ConfirmedByAll = 3,
    /// message receiving
    Receiving = 4,
    /// message received
    Received = 5,
}
impl MessageStatus {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            MessageStatus::Sending => "SENDING",
            MessageStatus::Sent => "SENT",
            MessageStatus::Confirmed => "CONFIRMED",
            MessageStatus::ConfirmedByAll => "CONFIRMED_BY_ALL",
            MessageStatus::Receiving => "RECEIVING",
            MessageStatus::Received => "RECEIVED",
        }
    }
}
/// Group info type definition
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum GroupEventType {
    /// default value, undefined message
    /// ignore this message
    Default = 0,
    /// user invited to group
    Invited = 1,
    /// user joined group
    Joined = 2,
    /// user left group
    Left = 3,
    /// your user was removed
    Removed = 4,
    /// group was closed
    Closed = 5,
    /// group was created
    Created = 6,
    /// group invite was accepted
    ///
    /// this state indicates, that we accepted
    /// an invite, but that we haven't received
    /// the group update from the administrator yet,
    /// and are therefore not yet an official member of the group.
    InviteAccepted = 7,
}
impl GroupEventType {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            GroupEventType::Default => "DEFAULT",
            GroupEventType::Invited => "INVITED",
            GroupEventType::Joined => "JOINED",
            GroupEventType::Left => "LEFT",
            GroupEventType::Removed => "REMOVED",
            GroupEventType::Closed => "CLOSED",
            GroupEventType::Created => "CREATED",
            GroupEventType::InviteAccepted => "INVITE_ACCEPTED",
        }
    }
}