1#![allow(clippy::large_enum_variant)]
4#![allow(clippy::new_without_default)]
5#![allow(clippy::should_implement_trait)]
6#![allow(clippy::unnecessary_to_owned)]
7
8pub mod client_api;
9pub mod commands;
10pub mod errors;
11pub mod events;
12pub mod responses;
13pub mod utils;
14
15use errors::*;
16use serde::{Deserialize, Serialize};
17use serde_aux::field_attributes::{
18 deserialize_number_from_string, deserialize_option_number_from_string,
19};
20use std::{collections::BTreeMap, fmt::Write as _, sync::Arc};
21use utils::CommandSyntax;
22
23pub type UtcTime = String;
24pub type JsonObject = serde_json::Value;
25
26#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
27#[cfg_attr(feature = "bon", derive(::bon::Builder))]
28#[cfg_attr(feature = "bon", builder(on(String, into)))]
29pub struct ACIReaction {
30 #[serde(rename = "chatInfo")]
31 pub chat_info: ChatInfo,
32
33 #[serde(rename = "chatReaction")]
34 pub chat_reaction: CIReaction,
35
36 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
37 #[cfg_attr(feature = "bon", builder(default))]
38 pub undocumented: JsonObject,
39}
40
41#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
42#[cfg_attr(feature = "bon", derive(::bon::Builder))]
43#[cfg_attr(feature = "bon", builder(on(String, into)))]
44pub struct AChat {
45 #[serde(rename = "chatInfo")]
46 pub chat_info: ChatInfo,
47
48 #[serde(rename = "chatItems")]
49 pub chat_items: Vec<ChatItem>,
50
51 #[serde(rename = "chatStats")]
52 pub chat_stats: ChatStats,
53
54 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
55 #[cfg_attr(feature = "bon", builder(default))]
56 pub undocumented: JsonObject,
57}
58
59#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
60#[cfg_attr(feature = "bon", derive(::bon::Builder))]
61#[cfg_attr(feature = "bon", builder(on(String, into)))]
62pub struct AChatItem {
63 #[serde(rename = "chatInfo")]
64 pub chat_info: ChatInfo,
65
66 #[serde(rename = "chatItem")]
67 pub chat_item: ChatItem,
68
69 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
70 #[cfg_attr(feature = "bon", builder(default))]
71 pub undocumented: JsonObject,
72}
73
74#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
75#[cfg_attr(feature = "bon", derive(::bon::Builder))]
76#[cfg_attr(feature = "bon", builder(on(String, into)))]
77pub struct AddRelayResult {
78 #[serde(rename = "relay")]
79 pub relay: UserChatRelay,
80
81 #[serde(rename = "relayError", skip_serializing_if = "Option::is_none")]
82 pub relay_error: Option<ChatError>,
83
84 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
85 #[cfg_attr(feature = "bon", builder(default))]
86 pub undocumented: JsonObject,
87}
88
89#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
90#[cfg_attr(feature = "bon", derive(::bon::Builder))]
91#[cfg_attr(feature = "bon", builder(on(String, into)))]
92pub struct AddressSettings {
93 #[serde(rename = "businessAddress", default)]
94 pub business_address: bool,
95
96 #[serde(rename = "autoAccept", skip_serializing_if = "Option::is_none")]
97 pub auto_accept: Option<AutoAccept>,
98
99 #[serde(rename = "autoReply", skip_serializing_if = "Option::is_none")]
100 pub auto_reply: Option<MsgContent>,
101
102 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
103 #[cfg_attr(feature = "bon", builder(default))]
104 pub undocumented: JsonObject,
105}
106
107#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
108#[cfg_attr(feature = "bon", derive(::bon::Builder))]
109#[cfg_attr(feature = "bon", builder(on(String, into)))]
110pub struct AutoAccept {
111 #[serde(rename = "acceptIncognito", default)]
112 pub accept_incognito: bool,
113
114 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
115 #[cfg_attr(feature = "bon", builder(default))]
116 pub undocumented: JsonObject,
117}
118
119#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
120#[cfg_attr(feature = "bon", derive(::bon::Builder))]
121#[cfg_attr(feature = "bon", builder(on(String, into)))]
122pub struct BadgeInfo {
123 #[serde(rename = "badgeType")]
124 pub badge_type: BadgeType,
125
126 #[serde(rename = "badgeExpiry", skip_serializing_if = "Option::is_none")]
127 pub badge_expiry: Option<UtcTime>,
128
129 #[serde(rename = "badgeExtra")]
130 pub badge_extra: String,
131
132 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
133 #[cfg_attr(feature = "bon", builder(default))]
134 pub undocumented: JsonObject,
135}
136
137#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
138#[cfg_attr(feature = "bon", derive(::bon::Builder))]
139#[cfg_attr(feature = "bon", builder(on(String, into)))]
140pub struct BadgeProof {
141 #[serde(
142 rename = "badgeKeyIdx",
143 deserialize_with = "deserialize_number_from_string"
144 )]
145 pub badge_key_idx: i32,
146
147 #[serde(rename = "presHeader")]
148 pub pres_header: String,
149
150 #[serde(rename = "proof")]
151 pub proof: String,
152
153 #[serde(rename = "badgeInfo")]
154 pub badge_info: BadgeInfo,
155
156 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
157 #[cfg_attr(feature = "bon", builder(default))]
158 pub undocumented: JsonObject,
159}
160
161#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
162#[non_exhaustive]
163pub enum BadgeStatus {
164 #[default]
165 #[serde(rename = "active")]
166 Active,
167 #[serde(rename = "expired")]
168 Expired,
169 #[serde(rename = "expiredOld")]
170 ExpiredOld,
171 #[serde(rename = "failed")]
172 Failed,
173 #[serde(rename = "unknownKey")]
174 UnknownKey,
175}
176
177#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
178#[non_exhaustive]
179pub enum BadgeType {
180 #[default]
181 #[serde(rename = "supporter")]
182 Supporter,
183 #[serde(rename = "legend")]
184 Legend,
185 #[serde(rename = "investor")]
186 Investor,
187}
188
189#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
190#[cfg_attr(feature = "bon", derive(::bon::Builder))]
191#[cfg_attr(feature = "bon", builder(on(String, into)))]
192pub struct BlockingInfo {
193 #[serde(rename = "reason")]
194 pub reason: BlockingReason,
195
196 #[serde(rename = "notice", skip_serializing_if = "Option::is_none")]
197 pub notice: Option<ClientNotice>,
198
199 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
200 #[cfg_attr(feature = "bon", builder(default))]
201 pub undocumented: JsonObject,
202}
203
204#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
205#[non_exhaustive]
206pub enum BlockingReason {
207 #[default]
208 #[serde(rename = "spam")]
209 Spam,
210 #[serde(rename = "content")]
211 Content,
212}
213
214#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
215#[cfg_attr(feature = "bon", derive(::bon::Builder))]
216#[cfg_attr(feature = "bon", builder(on(String, into)))]
217pub struct BusinessChatInfo {
218 #[serde(rename = "chatType")]
219 pub chat_type: BusinessChatType,
220
221 #[serde(rename = "businessId")]
222 pub business_id: String,
223
224 #[serde(rename = "customerId")]
225 pub customer_id: String,
226
227 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
228 #[cfg_attr(feature = "bon", builder(default))]
229 pub undocumented: JsonObject,
230}
231
232#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
233#[non_exhaustive]
234pub enum BusinessChatType {
235 #[default]
236 #[serde(rename = "business")]
237 Business,
238 #[serde(rename = "customer")]
239 Customer,
240}
241
242#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
243#[non_exhaustive]
244pub enum CICallStatus {
245 #[default]
246 #[serde(rename = "pending")]
247 Pending,
248 #[serde(rename = "missed")]
249 Missed,
250 #[serde(rename = "rejected")]
251 Rejected,
252 #[serde(rename = "accepted")]
253 Accepted,
254 #[serde(rename = "negotiated")]
255 Negotiated,
256 #[serde(rename = "progress")]
257 Progress,
258 #[serde(rename = "ended")]
259 Ended,
260 #[serde(rename = "error")]
261 Error,
262}
263
264#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
265#[serde(tag = "type")]
266#[non_exhaustive]
267pub enum CIContent {
268 #[serde(rename = "sndMsgContent")]
269 SndMsgContent {
270 #[serde(rename = "msgContent")]
271 msg_content: MsgContent,
272
273 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
274 undocumented: JsonObject,
275 },
276 #[serde(rename = "rcvMsgContent")]
277 RcvMsgContent {
278 #[serde(rename = "msgContent")]
279 msg_content: MsgContent,
280
281 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
282 undocumented: JsonObject,
283 },
284 #[serde(rename = "sndDeleted")]
285 SndDeleted {
286 #[serde(rename = "deleteMode")]
287 delete_mode: CIDeleteMode,
288
289 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
290 undocumented: JsonObject,
291 },
292 #[serde(rename = "rcvDeleted")]
293 RcvDeleted {
294 #[serde(rename = "deleteMode")]
295 delete_mode: CIDeleteMode,
296
297 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
298 undocumented: JsonObject,
299 },
300 #[serde(rename = "sndCall")]
301 SndCall {
302 #[serde(rename = "status")]
303 status: CICallStatus,
304
305 #[serde(
306 rename = "duration",
307 deserialize_with = "deserialize_number_from_string"
308 )]
309 duration: i32,
310
311 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
312 undocumented: JsonObject,
313 },
314 #[serde(rename = "rcvCall")]
315 RcvCall {
316 #[serde(rename = "status")]
317 status: CICallStatus,
318
319 #[serde(
320 rename = "duration",
321 deserialize_with = "deserialize_number_from_string"
322 )]
323 duration: i32,
324
325 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
326 undocumented: JsonObject,
327 },
328 #[serde(rename = "rcvIntegrityError")]
329 RcvIntegrityError {
330 #[serde(rename = "msgError")]
331 msg_error: MsgErrorType,
332
333 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
334 undocumented: JsonObject,
335 },
336 #[serde(rename = "rcvDecryptionError")]
337 RcvDecryptionError {
338 #[serde(rename = "msgDecryptError")]
339 msg_decrypt_error: MsgDecryptError,
340
341 #[serde(
342 rename = "msgCount",
343 deserialize_with = "deserialize_number_from_string"
344 )]
345 msg_count: u32,
346
347 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
348 undocumented: JsonObject,
349 },
350 #[serde(rename = "rcvMsgError")]
351 RcvMsgError {
352 #[serde(rename = "rcvMsgError")]
353 rcv_msg_error: RcvMsgError,
354
355 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
356 undocumented: JsonObject,
357 },
358 #[serde(rename = "rcvGroupInvitation")]
359 RcvGroupInvitation {
360 #[serde(rename = "groupInvitation")]
361 group_invitation: CIGroupInvitation,
362
363 #[serde(rename = "memberRole")]
364 member_role: GroupMemberRole,
365
366 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
367 undocumented: JsonObject,
368 },
369 #[serde(rename = "sndGroupInvitation")]
370 SndGroupInvitation {
371 #[serde(rename = "groupInvitation")]
372 group_invitation: CIGroupInvitation,
373
374 #[serde(rename = "memberRole")]
375 member_role: GroupMemberRole,
376
377 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
378 undocumented: JsonObject,
379 },
380 #[serde(rename = "rcvDirectEvent")]
381 RcvDirectEvent {
382 #[serde(rename = "rcvDirectEvent")]
383 rcv_direct_event: RcvDirectEvent,
384
385 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
386 undocumented: JsonObject,
387 },
388 #[serde(rename = "rcvGroupEvent")]
389 RcvGroupEvent {
390 #[serde(rename = "rcvGroupEvent")]
391 rcv_group_event: RcvGroupEvent,
392
393 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
394 undocumented: JsonObject,
395 },
396 #[serde(rename = "sndGroupEvent")]
397 SndGroupEvent {
398 #[serde(rename = "sndGroupEvent")]
399 snd_group_event: SndGroupEvent,
400
401 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
402 undocumented: JsonObject,
403 },
404 #[serde(rename = "rcvConnEvent")]
405 RcvConnEvent {
406 #[serde(rename = "rcvConnEvent")]
407 rcv_conn_event: RcvConnEvent,
408
409 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
410 undocumented: JsonObject,
411 },
412 #[serde(rename = "sndConnEvent")]
413 SndConnEvent {
414 #[serde(rename = "sndConnEvent")]
415 snd_conn_event: SndConnEvent,
416
417 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
418 undocumented: JsonObject,
419 },
420 #[serde(rename = "rcvChatFeature")]
421 RcvChatFeature {
422 #[serde(rename = "feature")]
423 feature: ChatFeature,
424
425 #[serde(rename = "enabled")]
426 enabled: PrefEnabled,
427
428 #[serde(
429 rename = "param",
430 skip_serializing_if = "Option::is_none",
431 deserialize_with = "deserialize_option_number_from_string",
432 default
433 )]
434 param: Option<i32>,
435
436 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
437 undocumented: JsonObject,
438 },
439 #[serde(rename = "sndChatFeature")]
440 SndChatFeature {
441 #[serde(rename = "feature")]
442 feature: ChatFeature,
443
444 #[serde(rename = "enabled")]
445 enabled: PrefEnabled,
446
447 #[serde(
448 rename = "param",
449 skip_serializing_if = "Option::is_none",
450 deserialize_with = "deserialize_option_number_from_string",
451 default
452 )]
453 param: Option<i32>,
454
455 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
456 undocumented: JsonObject,
457 },
458 #[serde(rename = "rcvChatPreference")]
459 RcvChatPreference {
460 #[serde(rename = "feature")]
461 feature: ChatFeature,
462
463 #[serde(rename = "allowed")]
464 allowed: FeatureAllowed,
465
466 #[serde(
467 rename = "param",
468 skip_serializing_if = "Option::is_none",
469 deserialize_with = "deserialize_option_number_from_string",
470 default
471 )]
472 param: Option<i32>,
473
474 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
475 undocumented: JsonObject,
476 },
477 #[serde(rename = "sndChatPreference")]
478 SndChatPreference {
479 #[serde(rename = "feature")]
480 feature: ChatFeature,
481
482 #[serde(rename = "allowed")]
483 allowed: FeatureAllowed,
484
485 #[serde(
486 rename = "param",
487 skip_serializing_if = "Option::is_none",
488 deserialize_with = "deserialize_option_number_from_string",
489 default
490 )]
491 param: Option<i32>,
492
493 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
494 undocumented: JsonObject,
495 },
496 #[serde(rename = "rcvGroupFeature")]
497 RcvGroupFeature {
498 #[serde(rename = "groupFeature")]
499 group_feature: GroupFeature,
500
501 #[serde(rename = "preference")]
502 preference: GroupPreference,
503
504 #[serde(
505 rename = "param",
506 skip_serializing_if = "Option::is_none",
507 deserialize_with = "deserialize_option_number_from_string",
508 default
509 )]
510 param: Option<i32>,
511
512 #[serde(rename = "memberRole_", skip_serializing_if = "Option::is_none")]
513 member_role: Option<GroupMemberRole>,
514
515 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
516 undocumented: JsonObject,
517 },
518 #[serde(rename = "sndGroupFeature")]
519 SndGroupFeature {
520 #[serde(rename = "groupFeature")]
521 group_feature: GroupFeature,
522
523 #[serde(rename = "preference")]
524 preference: GroupPreference,
525
526 #[serde(
527 rename = "param",
528 skip_serializing_if = "Option::is_none",
529 deserialize_with = "deserialize_option_number_from_string",
530 default
531 )]
532 param: Option<i32>,
533
534 #[serde(rename = "memberRole_", skip_serializing_if = "Option::is_none")]
535 member_role: Option<GroupMemberRole>,
536
537 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
538 undocumented: JsonObject,
539 },
540 #[serde(rename = "rcvChatFeatureRejected")]
541 RcvChatFeatureRejected {
542 #[serde(rename = "feature")]
543 feature: ChatFeature,
544
545 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
546 undocumented: JsonObject,
547 },
548 #[serde(rename = "rcvGroupFeatureRejected")]
549 RcvGroupFeatureRejected {
550 #[serde(rename = "groupFeature")]
551 group_feature: GroupFeature,
552
553 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
554 undocumented: JsonObject,
555 },
556 #[serde(rename = "sndModerated")]
557 SndModerated,
558 #[serde(rename = "rcvModerated")]
559 RcvModerated,
560 #[serde(rename = "rcvBlocked")]
561 RcvBlocked,
562 #[serde(rename = "sndDirectE2EEInfo")]
563 SndDirectE2EeInfo {
564 #[serde(rename = "e2eeInfo")]
565 e_2_ee_info: E2EInfo,
566
567 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
568 undocumented: JsonObject,
569 },
570 #[serde(rename = "rcvDirectE2EEInfo")]
571 RcvDirectE2EeInfo {
572 #[serde(rename = "e2eeInfo")]
573 e_2_ee_info: E2EInfo,
574
575 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
576 undocumented: JsonObject,
577 },
578 #[serde(rename = "sndGroupE2EEInfo")]
579 SndGroupE2EeInfo {
580 #[serde(rename = "e2eeInfo")]
581 e_2_ee_info: E2EInfo,
582
583 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
584 undocumented: JsonObject,
585 },
586 #[serde(rename = "rcvGroupE2EEInfo")]
587 RcvGroupE2EeInfo {
588 #[serde(rename = "e2eeInfo")]
589 e_2_ee_info: E2EInfo,
590
591 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
592 undocumented: JsonObject,
593 },
594 #[serde(rename = "chatBanner")]
595 ChatBanner,
596 #[serde(untagged)]
597 Undocumented(JsonObject),
598}
599
600impl CIContent {
601 pub fn make_snd_msg_content(msg_content: MsgContent) -> Self {
602 Self::SndMsgContent {
603 msg_content,
604 undocumented: Default::default(),
605 }
606 }
607
608 pub fn make_rcv_msg_content(msg_content: MsgContent) -> Self {
609 Self::RcvMsgContent {
610 msg_content,
611 undocumented: Default::default(),
612 }
613 }
614
615 pub fn make_snd_deleted(delete_mode: CIDeleteMode) -> Self {
616 Self::SndDeleted {
617 delete_mode,
618 undocumented: Default::default(),
619 }
620 }
621
622 pub fn make_rcv_deleted(delete_mode: CIDeleteMode) -> Self {
623 Self::RcvDeleted {
624 delete_mode,
625 undocumented: Default::default(),
626 }
627 }
628
629 pub fn make_snd_call(status: CICallStatus, duration: i32) -> Self {
630 Self::SndCall {
631 status,
632 duration,
633 undocumented: Default::default(),
634 }
635 }
636
637 pub fn make_rcv_call(status: CICallStatus, duration: i32) -> Self {
638 Self::RcvCall {
639 status,
640 duration,
641 undocumented: Default::default(),
642 }
643 }
644
645 pub fn make_rcv_integrity_error(msg_error: MsgErrorType) -> Self {
646 Self::RcvIntegrityError {
647 msg_error,
648 undocumented: Default::default(),
649 }
650 }
651
652 pub fn make_rcv_decryption_error(msg_decrypt_error: MsgDecryptError, msg_count: u32) -> Self {
653 Self::RcvDecryptionError {
654 msg_decrypt_error,
655 msg_count,
656 undocumented: Default::default(),
657 }
658 }
659
660 pub fn make_rcv_msg_error(rcv_msg_error: RcvMsgError) -> Self {
661 Self::RcvMsgError {
662 rcv_msg_error,
663 undocumented: Default::default(),
664 }
665 }
666
667 pub fn make_rcv_group_invitation(
668 group_invitation: CIGroupInvitation,
669 member_role: GroupMemberRole,
670 ) -> Self {
671 Self::RcvGroupInvitation {
672 group_invitation,
673 member_role,
674 undocumented: Default::default(),
675 }
676 }
677
678 pub fn make_snd_group_invitation(
679 group_invitation: CIGroupInvitation,
680 member_role: GroupMemberRole,
681 ) -> Self {
682 Self::SndGroupInvitation {
683 group_invitation,
684 member_role,
685 undocumented: Default::default(),
686 }
687 }
688
689 pub fn make_rcv_direct_event(rcv_direct_event: RcvDirectEvent) -> Self {
690 Self::RcvDirectEvent {
691 rcv_direct_event,
692 undocumented: Default::default(),
693 }
694 }
695
696 pub fn make_rcv_group_event(rcv_group_event: RcvGroupEvent) -> Self {
697 Self::RcvGroupEvent {
698 rcv_group_event,
699 undocumented: Default::default(),
700 }
701 }
702
703 pub fn make_snd_group_event(snd_group_event: SndGroupEvent) -> Self {
704 Self::SndGroupEvent {
705 snd_group_event,
706 undocumented: Default::default(),
707 }
708 }
709
710 pub fn make_rcv_conn_event(rcv_conn_event: RcvConnEvent) -> Self {
711 Self::RcvConnEvent {
712 rcv_conn_event,
713 undocumented: Default::default(),
714 }
715 }
716
717 pub fn make_snd_conn_event(snd_conn_event: SndConnEvent) -> Self {
718 Self::SndConnEvent {
719 snd_conn_event,
720 undocumented: Default::default(),
721 }
722 }
723
724 pub fn make_rcv_chat_feature(
725 feature: ChatFeature,
726 enabled: PrefEnabled,
727 param: Option<i32>,
728 ) -> Self {
729 Self::RcvChatFeature {
730 feature,
731 enabled,
732 param,
733 undocumented: Default::default(),
734 }
735 }
736
737 pub fn make_snd_chat_feature(
738 feature: ChatFeature,
739 enabled: PrefEnabled,
740 param: Option<i32>,
741 ) -> Self {
742 Self::SndChatFeature {
743 feature,
744 enabled,
745 param,
746 undocumented: Default::default(),
747 }
748 }
749
750 pub fn make_rcv_chat_preference(
751 feature: ChatFeature,
752 allowed: FeatureAllowed,
753 param: Option<i32>,
754 ) -> Self {
755 Self::RcvChatPreference {
756 feature,
757 allowed,
758 param,
759 undocumented: Default::default(),
760 }
761 }
762
763 pub fn make_snd_chat_preference(
764 feature: ChatFeature,
765 allowed: FeatureAllowed,
766 param: Option<i32>,
767 ) -> Self {
768 Self::SndChatPreference {
769 feature,
770 allowed,
771 param,
772 undocumented: Default::default(),
773 }
774 }
775
776 pub fn make_rcv_group_feature(
777 group_feature: GroupFeature,
778 preference: GroupPreference,
779 param: Option<i32>,
780 member_role: Option<GroupMemberRole>,
781 ) -> Self {
782 Self::RcvGroupFeature {
783 group_feature,
784 preference,
785 param,
786 member_role,
787 undocumented: Default::default(),
788 }
789 }
790
791 pub fn make_snd_group_feature(
792 group_feature: GroupFeature,
793 preference: GroupPreference,
794 param: Option<i32>,
795 member_role: Option<GroupMemberRole>,
796 ) -> Self {
797 Self::SndGroupFeature {
798 group_feature,
799 preference,
800 param,
801 member_role,
802 undocumented: Default::default(),
803 }
804 }
805
806 pub fn make_rcv_chat_feature_rejected(feature: ChatFeature) -> Self {
807 Self::RcvChatFeatureRejected {
808 feature,
809 undocumented: Default::default(),
810 }
811 }
812
813 pub fn make_rcv_group_feature_rejected(group_feature: GroupFeature) -> Self {
814 Self::RcvGroupFeatureRejected {
815 group_feature,
816 undocumented: Default::default(),
817 }
818 }
819
820 pub fn make_snd_moderated() -> Self {
821 Self::SndModerated
822 }
823
824 pub fn make_rcv_moderated() -> Self {
825 Self::RcvModerated
826 }
827
828 pub fn make_rcv_blocked() -> Self {
829 Self::RcvBlocked
830 }
831
832 pub fn make_snd_direct_e_2_ee_info(e_2_ee_info: E2EInfo) -> Self {
833 Self::SndDirectE2EeInfo {
834 e_2_ee_info,
835 undocumented: Default::default(),
836 }
837 }
838
839 pub fn make_rcv_direct_e_2_ee_info(e_2_ee_info: E2EInfo) -> Self {
840 Self::RcvDirectE2EeInfo {
841 e_2_ee_info,
842 undocumented: Default::default(),
843 }
844 }
845
846 pub fn make_snd_group_e_2_ee_info(e_2_ee_info: E2EInfo) -> Self {
847 Self::SndGroupE2EeInfo {
848 e_2_ee_info,
849 undocumented: Default::default(),
850 }
851 }
852
853 pub fn make_rcv_group_e_2_ee_info(e_2_ee_info: E2EInfo) -> Self {
854 Self::RcvGroupE2EeInfo {
855 e_2_ee_info,
856 undocumented: Default::default(),
857 }
858 }
859
860 pub fn make_chat_banner() -> Self {
861 Self::ChatBanner
862 }
863}
864
865impl CIContent {
866 pub fn snd_msg_content(&self) -> Option<&MsgContent> {
867 if let Self::SndMsgContent { msg_content, .. } = self {
868 Some(msg_content)
869 } else {
870 None
871 }
872 }
873 pub fn rcv_msg_content(&self) -> Option<&MsgContent> {
874 if let Self::RcvMsgContent { msg_content, .. } = self {
875 Some(msg_content)
876 } else {
877 None
878 }
879 }
880 pub fn snd_deleted(&self) -> Option<&CIDeleteMode> {
881 if let Self::SndDeleted { delete_mode, .. } = self {
882 Some(delete_mode)
883 } else {
884 None
885 }
886 }
887 pub fn rcv_deleted(&self) -> Option<&CIDeleteMode> {
888 if let Self::RcvDeleted { delete_mode, .. } = self {
889 Some(delete_mode)
890 } else {
891 None
892 }
893 }
894 pub fn snd_call(&self) -> Option<CIContentSndCallRef<'_>> {
895 if let Self::SndCall {
896 status, duration, ..
897 } = self
898 {
899 Some(CIContentSndCallRef { status, duration })
900 } else {
901 None
902 }
903 }
904 pub fn rcv_call(&self) -> Option<CIContentRcvCallRef<'_>> {
905 if let Self::RcvCall {
906 status, duration, ..
907 } = self
908 {
909 Some(CIContentRcvCallRef { status, duration })
910 } else {
911 None
912 }
913 }
914 pub fn rcv_integrity_error(&self) -> Option<&MsgErrorType> {
915 if let Self::RcvIntegrityError { msg_error, .. } = self {
916 Some(msg_error)
917 } else {
918 None
919 }
920 }
921 pub fn rcv_decryption_error(&self) -> Option<CIContentRcvDecryptionErrorRef<'_>> {
922 if let Self::RcvDecryptionError {
923 msg_decrypt_error,
924 msg_count,
925 ..
926 } = self
927 {
928 Some(CIContentRcvDecryptionErrorRef {
929 msg_decrypt_error,
930 msg_count,
931 })
932 } else {
933 None
934 }
935 }
936 pub fn rcv_msg_error(&self) -> Option<&RcvMsgError> {
937 if let Self::RcvMsgError { rcv_msg_error, .. } = self {
938 Some(rcv_msg_error)
939 } else {
940 None
941 }
942 }
943 pub fn rcv_group_invitation(&self) -> Option<CIContentRcvGroupInvitationRef<'_>> {
944 if let Self::RcvGroupInvitation {
945 group_invitation,
946 member_role,
947 ..
948 } = self
949 {
950 Some(CIContentRcvGroupInvitationRef {
951 group_invitation,
952 member_role,
953 })
954 } else {
955 None
956 }
957 }
958 pub fn snd_group_invitation(&self) -> Option<CIContentSndGroupInvitationRef<'_>> {
959 if let Self::SndGroupInvitation {
960 group_invitation,
961 member_role,
962 ..
963 } = self
964 {
965 Some(CIContentSndGroupInvitationRef {
966 group_invitation,
967 member_role,
968 })
969 } else {
970 None
971 }
972 }
973 pub fn rcv_direct_event(&self) -> Option<&RcvDirectEvent> {
974 if let Self::RcvDirectEvent {
975 rcv_direct_event, ..
976 } = self
977 {
978 Some(rcv_direct_event)
979 } else {
980 None
981 }
982 }
983 pub fn rcv_group_event(&self) -> Option<&RcvGroupEvent> {
984 if let Self::RcvGroupEvent {
985 rcv_group_event, ..
986 } = self
987 {
988 Some(rcv_group_event)
989 } else {
990 None
991 }
992 }
993 pub fn snd_group_event(&self) -> Option<&SndGroupEvent> {
994 if let Self::SndGroupEvent {
995 snd_group_event, ..
996 } = self
997 {
998 Some(snd_group_event)
999 } else {
1000 None
1001 }
1002 }
1003 pub fn rcv_conn_event(&self) -> Option<&RcvConnEvent> {
1004 if let Self::RcvConnEvent { rcv_conn_event, .. } = self {
1005 Some(rcv_conn_event)
1006 } else {
1007 None
1008 }
1009 }
1010 pub fn snd_conn_event(&self) -> Option<&SndConnEvent> {
1011 if let Self::SndConnEvent { snd_conn_event, .. } = self {
1012 Some(snd_conn_event)
1013 } else {
1014 None
1015 }
1016 }
1017 pub fn rcv_chat_feature(&self) -> Option<CIContentRcvChatFeatureRef<'_>> {
1018 if let Self::RcvChatFeature {
1019 feature,
1020 enabled,
1021 param,
1022 ..
1023 } = self
1024 {
1025 Some(CIContentRcvChatFeatureRef {
1026 feature,
1027 enabled,
1028 param,
1029 })
1030 } else {
1031 None
1032 }
1033 }
1034 pub fn snd_chat_feature(&self) -> Option<CIContentSndChatFeatureRef<'_>> {
1035 if let Self::SndChatFeature {
1036 feature,
1037 enabled,
1038 param,
1039 ..
1040 } = self
1041 {
1042 Some(CIContentSndChatFeatureRef {
1043 feature,
1044 enabled,
1045 param,
1046 })
1047 } else {
1048 None
1049 }
1050 }
1051 pub fn rcv_chat_preference(&self) -> Option<CIContentRcvChatPreferenceRef<'_>> {
1052 if let Self::RcvChatPreference {
1053 feature,
1054 allowed,
1055 param,
1056 ..
1057 } = self
1058 {
1059 Some(CIContentRcvChatPreferenceRef {
1060 feature,
1061 allowed,
1062 param,
1063 })
1064 } else {
1065 None
1066 }
1067 }
1068 pub fn snd_chat_preference(&self) -> Option<CIContentSndChatPreferenceRef<'_>> {
1069 if let Self::SndChatPreference {
1070 feature,
1071 allowed,
1072 param,
1073 ..
1074 } = self
1075 {
1076 Some(CIContentSndChatPreferenceRef {
1077 feature,
1078 allowed,
1079 param,
1080 })
1081 } else {
1082 None
1083 }
1084 }
1085 pub fn rcv_group_feature(&self) -> Option<CIContentRcvGroupFeatureRef<'_>> {
1086 if let Self::RcvGroupFeature {
1087 group_feature,
1088 preference,
1089 param,
1090 member_role,
1091 ..
1092 } = self
1093 {
1094 Some(CIContentRcvGroupFeatureRef {
1095 group_feature,
1096 preference,
1097 param,
1098 member_role,
1099 })
1100 } else {
1101 None
1102 }
1103 }
1104 pub fn snd_group_feature(&self) -> Option<CIContentSndGroupFeatureRef<'_>> {
1105 if let Self::SndGroupFeature {
1106 group_feature,
1107 preference,
1108 param,
1109 member_role,
1110 ..
1111 } = self
1112 {
1113 Some(CIContentSndGroupFeatureRef {
1114 group_feature,
1115 preference,
1116 param,
1117 member_role,
1118 })
1119 } else {
1120 None
1121 }
1122 }
1123 pub fn rcv_chat_feature_rejected(&self) -> Option<&ChatFeature> {
1124 if let Self::RcvChatFeatureRejected { feature, .. } = self {
1125 Some(feature)
1126 } else {
1127 None
1128 }
1129 }
1130 pub fn rcv_group_feature_rejected(&self) -> Option<&GroupFeature> {
1131 if let Self::RcvGroupFeatureRejected { group_feature, .. } = self {
1132 Some(group_feature)
1133 } else {
1134 None
1135 }
1136 }
1137 pub fn is_snd_moderated(&self) -> bool {
1138 matches!(self, Self::SndModerated)
1139 }
1140 pub fn is_rcv_moderated(&self) -> bool {
1141 matches!(self, Self::RcvModerated)
1142 }
1143 pub fn is_rcv_blocked(&self) -> bool {
1144 matches!(self, Self::RcvBlocked)
1145 }
1146 pub fn snd_direct_e_2_ee_info(&self) -> Option<&E2EInfo> {
1147 if let Self::SndDirectE2EeInfo { e_2_ee_info, .. } = self {
1148 Some(e_2_ee_info)
1149 } else {
1150 None
1151 }
1152 }
1153 pub fn rcv_direct_e_2_ee_info(&self) -> Option<&E2EInfo> {
1154 if let Self::RcvDirectE2EeInfo { e_2_ee_info, .. } = self {
1155 Some(e_2_ee_info)
1156 } else {
1157 None
1158 }
1159 }
1160 pub fn snd_group_e_2_ee_info(&self) -> Option<&E2EInfo> {
1161 if let Self::SndGroupE2EeInfo { e_2_ee_info, .. } = self {
1162 Some(e_2_ee_info)
1163 } else {
1164 None
1165 }
1166 }
1167 pub fn rcv_group_e_2_ee_info(&self) -> Option<&E2EInfo> {
1168 if let Self::RcvGroupE2EeInfo { e_2_ee_info, .. } = self {
1169 Some(e_2_ee_info)
1170 } else {
1171 None
1172 }
1173 }
1174 pub fn is_chat_banner(&self) -> bool {
1175 matches!(self, Self::ChatBanner)
1176 }
1177}
1178#[derive(Clone, Copy)]
1179pub struct CIContentSndCallRef<'a> {
1180 pub status: &'a CICallStatus,
1181 pub duration: &'a i32,
1182}
1183#[derive(Clone, Copy)]
1184pub struct CIContentRcvCallRef<'a> {
1185 pub status: &'a CICallStatus,
1186 pub duration: &'a i32,
1187}
1188#[derive(Clone, Copy)]
1189pub struct CIContentRcvDecryptionErrorRef<'a> {
1190 pub msg_decrypt_error: &'a MsgDecryptError,
1191 pub msg_count: &'a u32,
1192}
1193#[derive(Clone, Copy)]
1194pub struct CIContentRcvGroupInvitationRef<'a> {
1195 pub group_invitation: &'a CIGroupInvitation,
1196 pub member_role: &'a GroupMemberRole,
1197}
1198#[derive(Clone, Copy)]
1199pub struct CIContentSndGroupInvitationRef<'a> {
1200 pub group_invitation: &'a CIGroupInvitation,
1201 pub member_role: &'a GroupMemberRole,
1202}
1203#[derive(Clone, Copy)]
1204pub struct CIContentRcvChatFeatureRef<'a> {
1205 pub feature: &'a ChatFeature,
1206 pub enabled: &'a PrefEnabled,
1207 pub param: &'a Option<i32>,
1208}
1209#[derive(Clone, Copy)]
1210pub struct CIContentSndChatFeatureRef<'a> {
1211 pub feature: &'a ChatFeature,
1212 pub enabled: &'a PrefEnabled,
1213 pub param: &'a Option<i32>,
1214}
1215#[derive(Clone, Copy)]
1216pub struct CIContentRcvChatPreferenceRef<'a> {
1217 pub feature: &'a ChatFeature,
1218 pub allowed: &'a FeatureAllowed,
1219 pub param: &'a Option<i32>,
1220}
1221#[derive(Clone, Copy)]
1222pub struct CIContentSndChatPreferenceRef<'a> {
1223 pub feature: &'a ChatFeature,
1224 pub allowed: &'a FeatureAllowed,
1225 pub param: &'a Option<i32>,
1226}
1227#[derive(Clone, Copy)]
1228pub struct CIContentRcvGroupFeatureRef<'a> {
1229 pub group_feature: &'a GroupFeature,
1230 pub preference: &'a GroupPreference,
1231 pub param: &'a Option<i32>,
1232 pub member_role: &'a Option<GroupMemberRole>,
1233}
1234#[derive(Clone, Copy)]
1235pub struct CIContentSndGroupFeatureRef<'a> {
1236 pub group_feature: &'a GroupFeature,
1237 pub preference: &'a GroupPreference,
1238 pub param: &'a Option<i32>,
1239 pub member_role: &'a Option<GroupMemberRole>,
1240}
1241
1242#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
1243#[non_exhaustive]
1244pub enum CIDeleteMode {
1245 #[default]
1246 #[serde(rename = "broadcast")]
1247 Broadcast,
1248 #[serde(rename = "internal")]
1249 Internal,
1250 #[serde(rename = "internalMark")]
1251 InternalMark,
1252 #[serde(rename = "history")]
1253 History,
1254}
1255
1256#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1257#[serde(tag = "type")]
1258#[non_exhaustive]
1259pub enum CIDeleted {
1260 #[serde(rename = "deleted")]
1261 Deleted {
1262 #[serde(rename = "deletedTs", skip_serializing_if = "Option::is_none")]
1263 deleted_ts: Option<UtcTime>,
1264
1265 #[serde(rename = "chatType")]
1266 chat_type: ChatType,
1267
1268 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1269 undocumented: JsonObject,
1270 },
1271 #[serde(rename = "blocked")]
1272 Blocked {
1273 #[serde(rename = "deletedTs", skip_serializing_if = "Option::is_none")]
1274 deleted_ts: Option<UtcTime>,
1275
1276 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1277 undocumented: JsonObject,
1278 },
1279 #[serde(rename = "blockedByAdmin")]
1280 BlockedByAdmin {
1281 #[serde(rename = "deletedTs", skip_serializing_if = "Option::is_none")]
1282 deleted_ts: Option<UtcTime>,
1283
1284 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1285 undocumented: JsonObject,
1286 },
1287 #[serde(rename = "moderated")]
1288 Moderated {
1289 #[serde(rename = "deletedTs", skip_serializing_if = "Option::is_none")]
1290 deleted_ts: Option<UtcTime>,
1291
1292 #[serde(rename = "byGroupMember")]
1293 by_group_member: GroupMember,
1294
1295 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1296 undocumented: JsonObject,
1297 },
1298 #[serde(untagged)]
1299 Undocumented(JsonObject),
1300}
1301
1302impl CIDeleted {
1303 pub fn make_deleted(deleted_ts: Option<UtcTime>, chat_type: ChatType) -> Self {
1304 Self::Deleted {
1305 deleted_ts,
1306 chat_type,
1307 undocumented: Default::default(),
1308 }
1309 }
1310
1311 pub fn make_blocked(deleted_ts: Option<UtcTime>) -> Self {
1312 Self::Blocked {
1313 deleted_ts,
1314 undocumented: Default::default(),
1315 }
1316 }
1317
1318 pub fn make_blocked_by_admin(deleted_ts: Option<UtcTime>) -> Self {
1319 Self::BlockedByAdmin {
1320 deleted_ts,
1321 undocumented: Default::default(),
1322 }
1323 }
1324
1325 pub fn make_moderated(deleted_ts: Option<UtcTime>, by_group_member: GroupMember) -> Self {
1326 Self::Moderated {
1327 deleted_ts,
1328 by_group_member,
1329 undocumented: Default::default(),
1330 }
1331 }
1332}
1333
1334impl CIDeleted {
1335 pub fn deleted(&self) -> Option<CIDeletedDeletedRef<'_>> {
1336 if let Self::Deleted {
1337 deleted_ts,
1338 chat_type,
1339 ..
1340 } = self
1341 {
1342 Some(CIDeletedDeletedRef {
1343 deleted_ts,
1344 chat_type,
1345 })
1346 } else {
1347 None
1348 }
1349 }
1350 pub fn blocked(&self) -> Option<&Option<UtcTime>> {
1351 if let Self::Blocked { deleted_ts, .. } = self {
1352 Some(deleted_ts)
1353 } else {
1354 None
1355 }
1356 }
1357 pub fn blocked_by_admin(&self) -> Option<&Option<UtcTime>> {
1358 if let Self::BlockedByAdmin { deleted_ts, .. } = self {
1359 Some(deleted_ts)
1360 } else {
1361 None
1362 }
1363 }
1364 pub fn moderated(&self) -> Option<CIDeletedModeratedRef<'_>> {
1365 if let Self::Moderated {
1366 deleted_ts,
1367 by_group_member,
1368 ..
1369 } = self
1370 {
1371 Some(CIDeletedModeratedRef {
1372 deleted_ts,
1373 by_group_member,
1374 })
1375 } else {
1376 None
1377 }
1378 }
1379}
1380#[derive(Clone, Copy)]
1381pub struct CIDeletedDeletedRef<'a> {
1382 pub deleted_ts: &'a Option<UtcTime>,
1383 pub chat_type: &'a ChatType,
1384}
1385#[derive(Clone, Copy)]
1386pub struct CIDeletedModeratedRef<'a> {
1387 pub deleted_ts: &'a Option<UtcTime>,
1388 pub by_group_member: &'a GroupMember,
1389}
1390
1391#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1392#[serde(tag = "type")]
1393#[non_exhaustive]
1394pub enum CIDirection {
1395 #[serde(rename = "directSnd")]
1396 DirectSnd,
1397 #[serde(rename = "directRcv")]
1398 DirectRcv,
1399 #[serde(rename = "groupSnd")]
1400 GroupSnd,
1401 #[serde(rename = "groupRcv")]
1402 GroupRcv {
1403 #[serde(rename = "groupMember")]
1404 group_member: GroupMember,
1405
1406 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1407 undocumented: JsonObject,
1408 },
1409 #[serde(rename = "channelRcv")]
1410 ChannelRcv,
1411 #[serde(rename = "localSnd")]
1412 LocalSnd,
1413 #[serde(rename = "localRcv")]
1414 LocalRcv,
1415 #[serde(untagged)]
1416 Undocumented(JsonObject),
1417}
1418
1419impl CIDirection {
1420 pub fn make_direct_snd() -> Self {
1421 Self::DirectSnd
1422 }
1423
1424 pub fn make_direct_rcv() -> Self {
1425 Self::DirectRcv
1426 }
1427
1428 pub fn make_group_snd() -> Self {
1429 Self::GroupSnd
1430 }
1431
1432 pub fn make_group_rcv(group_member: GroupMember) -> Self {
1433 Self::GroupRcv {
1434 group_member,
1435 undocumented: Default::default(),
1436 }
1437 }
1438
1439 pub fn make_channel_rcv() -> Self {
1440 Self::ChannelRcv
1441 }
1442
1443 pub fn make_local_snd() -> Self {
1444 Self::LocalSnd
1445 }
1446
1447 pub fn make_local_rcv() -> Self {
1448 Self::LocalRcv
1449 }
1450}
1451
1452impl CIDirection {
1453 pub fn is_direct_snd(&self) -> bool {
1454 matches!(self, Self::DirectSnd)
1455 }
1456 pub fn is_direct_rcv(&self) -> bool {
1457 matches!(self, Self::DirectRcv)
1458 }
1459 pub fn is_group_snd(&self) -> bool {
1460 matches!(self, Self::GroupSnd)
1461 }
1462 pub fn group_rcv(&self) -> Option<&GroupMember> {
1463 if let Self::GroupRcv { group_member, .. } = self {
1464 Some(group_member)
1465 } else {
1466 None
1467 }
1468 }
1469 pub fn is_channel_rcv(&self) -> bool {
1470 matches!(self, Self::ChannelRcv)
1471 }
1472 pub fn is_local_snd(&self) -> bool {
1473 matches!(self, Self::LocalSnd)
1474 }
1475 pub fn is_local_rcv(&self) -> bool {
1476 matches!(self, Self::LocalRcv)
1477 }
1478}
1479
1480#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1481#[cfg_attr(feature = "bon", derive(::bon::Builder))]
1482#[cfg_attr(feature = "bon", builder(on(String, into)))]
1483pub struct CIFile {
1484 #[serde(rename = "fileId", deserialize_with = "deserialize_number_from_string")]
1485 pub file_id: i64,
1486
1487 #[serde(rename = "fileName")]
1488 pub file_name: String,
1489
1490 #[serde(
1491 rename = "fileSize",
1492 deserialize_with = "deserialize_number_from_string"
1493 )]
1494 pub file_size: i64,
1495
1496 #[serde(rename = "fileSource", skip_serializing_if = "Option::is_none")]
1497 pub file_source: Option<CryptoFile>,
1498
1499 #[serde(rename = "fileStatus")]
1500 pub file_status: CIFileStatus,
1501
1502 #[serde(rename = "fileProtocol")]
1503 pub file_protocol: FileProtocol,
1504
1505 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1506 #[cfg_attr(feature = "bon", builder(default))]
1507 pub undocumented: JsonObject,
1508}
1509
1510#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1511#[serde(tag = "type")]
1512#[non_exhaustive]
1513pub enum CIFileStatus {
1514 #[serde(rename = "sndStored")]
1515 SndStored,
1516 #[serde(rename = "sndTransfer")]
1517 SndTransfer {
1518 #[serde(
1519 rename = "sndProgress",
1520 deserialize_with = "deserialize_number_from_string"
1521 )]
1522 snd_progress: i64,
1523
1524 #[serde(
1525 rename = "sndTotal",
1526 deserialize_with = "deserialize_number_from_string"
1527 )]
1528 snd_total: i64,
1529
1530 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1531 undocumented: JsonObject,
1532 },
1533 #[serde(rename = "sndCancelled")]
1534 SndCancelled,
1535 #[serde(rename = "sndComplete")]
1536 SndComplete,
1537 #[serde(rename = "sndError")]
1538 SndError {
1539 #[serde(rename = "sndFileError")]
1540 snd_file_error: FileError,
1541
1542 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1543 undocumented: JsonObject,
1544 },
1545 #[serde(rename = "sndWarning")]
1546 SndWarning {
1547 #[serde(rename = "sndFileError")]
1548 snd_file_error: FileError,
1549
1550 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1551 undocumented: JsonObject,
1552 },
1553 #[serde(rename = "rcvInvitation")]
1554 RcvInvitation,
1555 #[serde(rename = "rcvAccepted")]
1556 RcvAccepted,
1557 #[serde(rename = "rcvTransfer")]
1558 RcvTransfer {
1559 #[serde(
1560 rename = "rcvProgress",
1561 deserialize_with = "deserialize_number_from_string"
1562 )]
1563 rcv_progress: i64,
1564
1565 #[serde(
1566 rename = "rcvTotal",
1567 deserialize_with = "deserialize_number_from_string"
1568 )]
1569 rcv_total: i64,
1570
1571 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1572 undocumented: JsonObject,
1573 },
1574 #[serde(rename = "rcvAborted")]
1575 RcvAborted,
1576 #[serde(rename = "rcvComplete")]
1577 RcvComplete,
1578 #[serde(rename = "rcvCancelled")]
1579 RcvCancelled,
1580 #[serde(rename = "rcvError")]
1581 RcvError {
1582 #[serde(rename = "rcvFileError")]
1583 rcv_file_error: FileError,
1584
1585 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1586 undocumented: JsonObject,
1587 },
1588 #[serde(rename = "rcvWarning")]
1589 RcvWarning {
1590 #[serde(rename = "rcvFileError")]
1591 rcv_file_error: FileError,
1592
1593 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1594 undocumented: JsonObject,
1595 },
1596 #[serde(rename = "invalid")]
1597 Invalid {
1598 #[serde(rename = "text")]
1599 text: String,
1600
1601 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1602 undocumented: JsonObject,
1603 },
1604 #[serde(untagged)]
1605 Undocumented(JsonObject),
1606}
1607
1608impl CIFileStatus {
1609 pub fn make_snd_stored() -> Self {
1610 Self::SndStored
1611 }
1612
1613 pub fn make_snd_transfer(snd_progress: i64, snd_total: i64) -> Self {
1614 Self::SndTransfer {
1615 snd_progress,
1616 snd_total,
1617 undocumented: Default::default(),
1618 }
1619 }
1620
1621 pub fn make_snd_cancelled() -> Self {
1622 Self::SndCancelled
1623 }
1624
1625 pub fn make_snd_complete() -> Self {
1626 Self::SndComplete
1627 }
1628
1629 pub fn make_snd_error(snd_file_error: FileError) -> Self {
1630 Self::SndError {
1631 snd_file_error,
1632 undocumented: Default::default(),
1633 }
1634 }
1635
1636 pub fn make_snd_warning(snd_file_error: FileError) -> Self {
1637 Self::SndWarning {
1638 snd_file_error,
1639 undocumented: Default::default(),
1640 }
1641 }
1642
1643 pub fn make_rcv_invitation() -> Self {
1644 Self::RcvInvitation
1645 }
1646
1647 pub fn make_rcv_accepted() -> Self {
1648 Self::RcvAccepted
1649 }
1650
1651 pub fn make_rcv_transfer(rcv_progress: i64, rcv_total: i64) -> Self {
1652 Self::RcvTransfer {
1653 rcv_progress,
1654 rcv_total,
1655 undocumented: Default::default(),
1656 }
1657 }
1658
1659 pub fn make_rcv_aborted() -> Self {
1660 Self::RcvAborted
1661 }
1662
1663 pub fn make_rcv_complete() -> Self {
1664 Self::RcvComplete
1665 }
1666
1667 pub fn make_rcv_cancelled() -> Self {
1668 Self::RcvCancelled
1669 }
1670
1671 pub fn make_rcv_error(rcv_file_error: FileError) -> Self {
1672 Self::RcvError {
1673 rcv_file_error,
1674 undocumented: Default::default(),
1675 }
1676 }
1677
1678 pub fn make_rcv_warning(rcv_file_error: FileError) -> Self {
1679 Self::RcvWarning {
1680 rcv_file_error,
1681 undocumented: Default::default(),
1682 }
1683 }
1684
1685 pub fn make_invalid(text: String) -> Self {
1686 Self::Invalid {
1687 text,
1688 undocumented: Default::default(),
1689 }
1690 }
1691}
1692
1693impl CIFileStatus {
1694 pub fn is_snd_stored(&self) -> bool {
1695 matches!(self, Self::SndStored)
1696 }
1697 pub fn snd_transfer(&self) -> Option<CIFileStatusSndTransferRef<'_>> {
1698 if let Self::SndTransfer {
1699 snd_progress,
1700 snd_total,
1701 ..
1702 } = self
1703 {
1704 Some(CIFileStatusSndTransferRef {
1705 snd_progress,
1706 snd_total,
1707 })
1708 } else {
1709 None
1710 }
1711 }
1712 pub fn is_snd_cancelled(&self) -> bool {
1713 matches!(self, Self::SndCancelled)
1714 }
1715 pub fn is_snd_complete(&self) -> bool {
1716 matches!(self, Self::SndComplete)
1717 }
1718 pub fn snd_error(&self) -> Option<&FileError> {
1719 if let Self::SndError { snd_file_error, .. } = self {
1720 Some(snd_file_error)
1721 } else {
1722 None
1723 }
1724 }
1725 pub fn snd_warning(&self) -> Option<&FileError> {
1726 if let Self::SndWarning { snd_file_error, .. } = self {
1727 Some(snd_file_error)
1728 } else {
1729 None
1730 }
1731 }
1732 pub fn is_rcv_invitation(&self) -> bool {
1733 matches!(self, Self::RcvInvitation)
1734 }
1735 pub fn is_rcv_accepted(&self) -> bool {
1736 matches!(self, Self::RcvAccepted)
1737 }
1738 pub fn rcv_transfer(&self) -> Option<CIFileStatusRcvTransferRef<'_>> {
1739 if let Self::RcvTransfer {
1740 rcv_progress,
1741 rcv_total,
1742 ..
1743 } = self
1744 {
1745 Some(CIFileStatusRcvTransferRef {
1746 rcv_progress,
1747 rcv_total,
1748 })
1749 } else {
1750 None
1751 }
1752 }
1753 pub fn is_rcv_aborted(&self) -> bool {
1754 matches!(self, Self::RcvAborted)
1755 }
1756 pub fn is_rcv_complete(&self) -> bool {
1757 matches!(self, Self::RcvComplete)
1758 }
1759 pub fn is_rcv_cancelled(&self) -> bool {
1760 matches!(self, Self::RcvCancelled)
1761 }
1762 pub fn rcv_error(&self) -> Option<&FileError> {
1763 if let Self::RcvError { rcv_file_error, .. } = self {
1764 Some(rcv_file_error)
1765 } else {
1766 None
1767 }
1768 }
1769 pub fn rcv_warning(&self) -> Option<&FileError> {
1770 if let Self::RcvWarning { rcv_file_error, .. } = self {
1771 Some(rcv_file_error)
1772 } else {
1773 None
1774 }
1775 }
1776 pub fn invalid(&self) -> Option<&String> {
1777 if let Self::Invalid { text, .. } = self {
1778 Some(text)
1779 } else {
1780 None
1781 }
1782 }
1783}
1784#[derive(Clone, Copy)]
1785pub struct CIFileStatusSndTransferRef<'a> {
1786 pub snd_progress: &'a i64,
1787 pub snd_total: &'a i64,
1788}
1789#[derive(Clone, Copy)]
1790pub struct CIFileStatusRcvTransferRef<'a> {
1791 pub rcv_progress: &'a i64,
1792 pub rcv_total: &'a i64,
1793}
1794
1795#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1796#[serde(tag = "type")]
1797#[non_exhaustive]
1798pub enum CIForwardedFrom {
1799 #[serde(rename = "unknown")]
1800 Unknown,
1801 #[serde(rename = "contact")]
1802 Contact {
1803 #[serde(rename = "chatName")]
1804 chat_name: String,
1805
1806 #[serde(rename = "msgDir")]
1807 msg_dir: MsgDirection,
1808
1809 #[serde(
1810 rename = "contactId",
1811 skip_serializing_if = "Option::is_none",
1812 deserialize_with = "deserialize_option_number_from_string",
1813 default
1814 )]
1815 contact_id: Option<i64>,
1816
1817 #[serde(
1818 rename = "chatItemId",
1819 skip_serializing_if = "Option::is_none",
1820 deserialize_with = "deserialize_option_number_from_string",
1821 default
1822 )]
1823 chat_item_id: Option<i64>,
1824
1825 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1826 undocumented: JsonObject,
1827 },
1828 #[serde(rename = "group")]
1829 Group {
1830 #[serde(rename = "chatName")]
1831 chat_name: String,
1832
1833 #[serde(rename = "msgDir")]
1834 msg_dir: MsgDirection,
1835
1836 #[serde(
1837 rename = "groupId",
1838 skip_serializing_if = "Option::is_none",
1839 deserialize_with = "deserialize_option_number_from_string",
1840 default
1841 )]
1842 group_id: Option<i64>,
1843
1844 #[serde(
1845 rename = "chatItemId",
1846 skip_serializing_if = "Option::is_none",
1847 deserialize_with = "deserialize_option_number_from_string",
1848 default
1849 )]
1850 chat_item_id: Option<i64>,
1851
1852 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1853 undocumented: JsonObject,
1854 },
1855 #[serde(untagged)]
1856 Undocumented(JsonObject),
1857}
1858
1859impl CIForwardedFrom {
1860 pub fn make_unknown() -> Self {
1861 Self::Unknown
1862 }
1863
1864 pub fn make_contact(
1865 chat_name: String,
1866 msg_dir: MsgDirection,
1867 contact_id: Option<i64>,
1868 chat_item_id: Option<i64>,
1869 ) -> Self {
1870 Self::Contact {
1871 chat_name,
1872 msg_dir,
1873 contact_id,
1874 chat_item_id,
1875 undocumented: Default::default(),
1876 }
1877 }
1878
1879 pub fn make_group(
1880 chat_name: String,
1881 msg_dir: MsgDirection,
1882 group_id: Option<i64>,
1883 chat_item_id: Option<i64>,
1884 ) -> Self {
1885 Self::Group {
1886 chat_name,
1887 msg_dir,
1888 group_id,
1889 chat_item_id,
1890 undocumented: Default::default(),
1891 }
1892 }
1893}
1894
1895impl CIForwardedFrom {
1896 pub fn is_unknown(&self) -> bool {
1897 matches!(self, Self::Unknown)
1898 }
1899 pub fn contact(&self) -> Option<CIForwardedFromContactRef<'_>> {
1900 if let Self::Contact {
1901 chat_name,
1902 msg_dir,
1903 contact_id,
1904 chat_item_id,
1905 ..
1906 } = self
1907 {
1908 Some(CIForwardedFromContactRef {
1909 chat_name,
1910 msg_dir,
1911 contact_id,
1912 chat_item_id,
1913 })
1914 } else {
1915 None
1916 }
1917 }
1918 pub fn group(&self) -> Option<CIForwardedFromGroupRef<'_>> {
1919 if let Self::Group {
1920 chat_name,
1921 msg_dir,
1922 group_id,
1923 chat_item_id,
1924 ..
1925 } = self
1926 {
1927 Some(CIForwardedFromGroupRef {
1928 chat_name,
1929 msg_dir,
1930 group_id,
1931 chat_item_id,
1932 })
1933 } else {
1934 None
1935 }
1936 }
1937}
1938#[derive(Clone, Copy)]
1939pub struct CIForwardedFromContactRef<'a> {
1940 pub chat_name: &'a String,
1941 pub msg_dir: &'a MsgDirection,
1942 pub contact_id: &'a Option<i64>,
1943 pub chat_item_id: &'a Option<i64>,
1944}
1945#[derive(Clone, Copy)]
1946pub struct CIForwardedFromGroupRef<'a> {
1947 pub chat_name: &'a String,
1948 pub msg_dir: &'a MsgDirection,
1949 pub group_id: &'a Option<i64>,
1950 pub chat_item_id: &'a Option<i64>,
1951}
1952
1953#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1954#[cfg_attr(feature = "bon", derive(::bon::Builder))]
1955#[cfg_attr(feature = "bon", builder(on(String, into)))]
1956pub struct CIGroupInvitation {
1957 #[serde(
1958 rename = "groupId",
1959 deserialize_with = "deserialize_number_from_string"
1960 )]
1961 pub group_id: i64,
1962
1963 #[serde(
1964 rename = "groupMemberId",
1965 deserialize_with = "deserialize_number_from_string"
1966 )]
1967 pub group_member_id: i64,
1968
1969 #[serde(rename = "localDisplayName")]
1970 pub local_display_name: String,
1971
1972 #[serde(rename = "groupProfile")]
1973 pub group_profile: GroupProfile,
1974
1975 #[serde(rename = "status")]
1976 pub status: CIGroupInvitationStatus,
1977
1978 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
1979 #[cfg_attr(feature = "bon", builder(default))]
1980 pub undocumented: JsonObject,
1981}
1982
1983#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
1984#[non_exhaustive]
1985pub enum CIGroupInvitationStatus {
1986 #[default]
1987 #[serde(rename = "pending")]
1988 Pending,
1989 #[serde(rename = "accepted")]
1990 Accepted,
1991 #[serde(rename = "rejected")]
1992 Rejected,
1993 #[serde(rename = "expired")]
1994 Expired,
1995}
1996
1997#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
1998#[cfg_attr(feature = "bon", derive(::bon::Builder))]
1999#[cfg_attr(feature = "bon", builder(on(String, into)))]
2000pub struct CIMention {
2001 #[serde(rename = "memberId")]
2002 pub member_id: String,
2003
2004 #[serde(rename = "memberRef", skip_serializing_if = "Option::is_none")]
2005 pub member_ref: Option<CIMentionMember>,
2006
2007 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2008 #[cfg_attr(feature = "bon", builder(default))]
2009 pub undocumented: JsonObject,
2010}
2011
2012#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2013#[cfg_attr(feature = "bon", derive(::bon::Builder))]
2014#[cfg_attr(feature = "bon", builder(on(String, into)))]
2015pub struct CIMentionMember {
2016 #[serde(
2017 rename = "groupMemberId",
2018 deserialize_with = "deserialize_number_from_string"
2019 )]
2020 pub group_member_id: i64,
2021
2022 #[serde(rename = "displayName")]
2023 pub display_name: String,
2024
2025 #[serde(rename = "localAlias", skip_serializing_if = "Option::is_none")]
2026 pub local_alias: Option<String>,
2027
2028 #[serde(rename = "memberRole")]
2029 pub member_role: GroupMemberRole,
2030
2031 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2032 #[cfg_attr(feature = "bon", builder(default))]
2033 pub undocumented: JsonObject,
2034}
2035
2036#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2037#[cfg_attr(feature = "bon", derive(::bon::Builder))]
2038#[cfg_attr(feature = "bon", builder(on(String, into)))]
2039pub struct CIMeta {
2040 #[serde(rename = "itemId", deserialize_with = "deserialize_number_from_string")]
2041 pub item_id: i64,
2042
2043 #[serde(rename = "itemTs")]
2044 pub item_ts: UtcTime,
2045
2046 #[serde(rename = "itemText")]
2047 pub item_text: String,
2048
2049 #[serde(rename = "itemStatus")]
2050 pub item_status: CIStatus,
2051
2052 #[serde(rename = "sentViaProxy", skip_serializing_if = "Option::is_none")]
2053 pub sent_via_proxy: Option<bool>,
2054
2055 #[serde(rename = "itemSharedMsgId", skip_serializing_if = "Option::is_none")]
2056 pub item_shared_msg_id: Option<String>,
2057
2058 #[serde(rename = "itemForwarded", skip_serializing_if = "Option::is_none")]
2059 pub item_forwarded: Option<CIForwardedFrom>,
2060
2061 #[serde(rename = "itemDeleted", skip_serializing_if = "Option::is_none")]
2062 pub item_deleted: Option<CIDeleted>,
2063
2064 #[serde(rename = "itemEdited", default)]
2065 pub item_edited: bool,
2066
2067 #[serde(rename = "itemTimed", skip_serializing_if = "Option::is_none")]
2068 pub item_timed: Option<CITimed>,
2069
2070 #[serde(rename = "itemLive", skip_serializing_if = "Option::is_none")]
2071 pub item_live: Option<bool>,
2072
2073 #[serde(rename = "userMention", default)]
2074 pub user_mention: bool,
2075
2076 #[serde(rename = "hasLink", default)]
2077 pub has_link: bool,
2078
2079 #[serde(rename = "deletable", default)]
2080 pub deletable: bool,
2081
2082 #[serde(rename = "editable", default)]
2083 pub editable: bool,
2084
2085 #[serde(
2086 rename = "forwardedByMember",
2087 skip_serializing_if = "Option::is_none",
2088 deserialize_with = "deserialize_option_number_from_string",
2089 default
2090 )]
2091 pub forwarded_by_member: Option<i64>,
2092
2093 #[serde(rename = "showGroupAsSender", default)]
2094 pub show_group_as_sender: bool,
2095
2096 #[serde(rename = "msgSigned", skip_serializing_if = "Option::is_none")]
2097 pub msg_signed: Option<MsgSigStatus>,
2098
2099 #[serde(rename = "createdAt")]
2100 pub created_at: UtcTime,
2101
2102 #[serde(rename = "updatedAt")]
2103 pub updated_at: UtcTime,
2104
2105 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2106 #[cfg_attr(feature = "bon", builder(default))]
2107 pub undocumented: JsonObject,
2108}
2109
2110#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2111#[cfg_attr(feature = "bon", derive(::bon::Builder))]
2112#[cfg_attr(feature = "bon", builder(on(String, into)))]
2113pub struct CIQuote {
2114 #[serde(rename = "chatDir", skip_serializing_if = "Option::is_none")]
2115 pub chat_dir: Option<CIDirection>,
2116
2117 #[serde(
2118 rename = "itemId",
2119 skip_serializing_if = "Option::is_none",
2120 deserialize_with = "deserialize_option_number_from_string",
2121 default
2122 )]
2123 pub item_id: Option<i64>,
2124
2125 #[serde(rename = "sharedMsgId", skip_serializing_if = "Option::is_none")]
2126 pub shared_msg_id: Option<String>,
2127
2128 #[serde(rename = "sentAt")]
2129 pub sent_at: UtcTime,
2130
2131 #[serde(rename = "content")]
2132 pub content: MsgContent,
2133
2134 #[serde(rename = "formattedText", skip_serializing_if = "Option::is_none")]
2135 pub formatted_text: Option<Vec<FormattedText>>,
2136
2137 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2138 #[cfg_attr(feature = "bon", builder(default))]
2139 pub undocumented: JsonObject,
2140}
2141
2142#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2143#[cfg_attr(feature = "bon", derive(::bon::Builder))]
2144#[cfg_attr(feature = "bon", builder(on(String, into)))]
2145pub struct CIReaction {
2146 #[serde(rename = "chatDir")]
2147 pub chat_dir: CIDirection,
2148
2149 #[serde(rename = "chatItem")]
2150 pub chat_item: ChatItem,
2151
2152 #[serde(rename = "sentAt")]
2153 pub sent_at: UtcTime,
2154
2155 #[serde(rename = "reaction")]
2156 pub reaction: MsgReaction,
2157
2158 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2159 #[cfg_attr(feature = "bon", builder(default))]
2160 pub undocumented: JsonObject,
2161}
2162
2163#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2164#[cfg_attr(feature = "bon", derive(::bon::Builder))]
2165#[cfg_attr(feature = "bon", builder(on(String, into)))]
2166pub struct CIReactionCount {
2167 #[serde(rename = "reaction")]
2168 pub reaction: MsgReaction,
2169
2170 #[serde(rename = "userReacted", default)]
2171 pub user_reacted: bool,
2172
2173 #[serde(
2174 rename = "totalReacted",
2175 deserialize_with = "deserialize_number_from_string"
2176 )]
2177 pub total_reacted: i32,
2178
2179 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2180 #[cfg_attr(feature = "bon", builder(default))]
2181 pub undocumented: JsonObject,
2182}
2183
2184#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2185#[serde(tag = "type")]
2186#[non_exhaustive]
2187pub enum CIStatus {
2188 #[serde(rename = "sndNew")]
2189 SndNew,
2190 #[serde(rename = "sndSent")]
2191 SndSent {
2192 #[serde(rename = "sndProgress")]
2193 snd_progress: SndCIStatusProgress,
2194
2195 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2196 undocumented: JsonObject,
2197 },
2198 #[serde(rename = "sndRcvd")]
2199 SndRcvd {
2200 #[serde(rename = "msgRcptStatus")]
2201 msg_rcpt_status: MsgReceiptStatus,
2202
2203 #[serde(rename = "sndProgress")]
2204 snd_progress: SndCIStatusProgress,
2205
2206 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2207 undocumented: JsonObject,
2208 },
2209 #[serde(rename = "sndErrorAuth")]
2210 SndErrorAuth,
2211 #[serde(rename = "sndError")]
2212 SndError {
2213 #[serde(rename = "agentError")]
2214 agent_error: SndError,
2215
2216 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2217 undocumented: JsonObject,
2218 },
2219 #[serde(rename = "sndWarning")]
2220 SndWarning {
2221 #[serde(rename = "agentError")]
2222 agent_error: SndError,
2223
2224 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2225 undocumented: JsonObject,
2226 },
2227 #[serde(rename = "rcvNew")]
2228 RcvNew,
2229 #[serde(rename = "rcvRead")]
2230 RcvRead,
2231 #[serde(rename = "invalid")]
2232 Invalid {
2233 #[serde(rename = "text")]
2234 text: String,
2235
2236 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2237 undocumented: JsonObject,
2238 },
2239 #[serde(untagged)]
2240 Undocumented(JsonObject),
2241}
2242
2243impl CIStatus {
2244 pub fn make_snd_new() -> Self {
2245 Self::SndNew
2246 }
2247
2248 pub fn make_snd_sent(snd_progress: SndCIStatusProgress) -> Self {
2249 Self::SndSent {
2250 snd_progress,
2251 undocumented: Default::default(),
2252 }
2253 }
2254
2255 pub fn make_snd_rcvd(
2256 msg_rcpt_status: MsgReceiptStatus,
2257 snd_progress: SndCIStatusProgress,
2258 ) -> Self {
2259 Self::SndRcvd {
2260 msg_rcpt_status,
2261 snd_progress,
2262 undocumented: Default::default(),
2263 }
2264 }
2265
2266 pub fn make_snd_error_auth() -> Self {
2267 Self::SndErrorAuth
2268 }
2269
2270 pub fn make_snd_error(agent_error: SndError) -> Self {
2271 Self::SndError {
2272 agent_error,
2273 undocumented: Default::default(),
2274 }
2275 }
2276
2277 pub fn make_snd_warning(agent_error: SndError) -> Self {
2278 Self::SndWarning {
2279 agent_error,
2280 undocumented: Default::default(),
2281 }
2282 }
2283
2284 pub fn make_rcv_new() -> Self {
2285 Self::RcvNew
2286 }
2287
2288 pub fn make_rcv_read() -> Self {
2289 Self::RcvRead
2290 }
2291
2292 pub fn make_invalid(text: String) -> Self {
2293 Self::Invalid {
2294 text,
2295 undocumented: Default::default(),
2296 }
2297 }
2298}
2299
2300impl CIStatus {
2301 pub fn is_snd_new(&self) -> bool {
2302 matches!(self, Self::SndNew)
2303 }
2304 pub fn snd_sent(&self) -> Option<&SndCIStatusProgress> {
2305 if let Self::SndSent { snd_progress, .. } = self {
2306 Some(snd_progress)
2307 } else {
2308 None
2309 }
2310 }
2311 pub fn snd_rcvd(&self) -> Option<CIStatusSndRcvdRef<'_>> {
2312 if let Self::SndRcvd {
2313 msg_rcpt_status,
2314 snd_progress,
2315 ..
2316 } = self
2317 {
2318 Some(CIStatusSndRcvdRef {
2319 msg_rcpt_status,
2320 snd_progress,
2321 })
2322 } else {
2323 None
2324 }
2325 }
2326 pub fn is_snd_error_auth(&self) -> bool {
2327 matches!(self, Self::SndErrorAuth)
2328 }
2329 pub fn snd_error(&self) -> Option<&SndError> {
2330 if let Self::SndError { agent_error, .. } = self {
2331 Some(agent_error)
2332 } else {
2333 None
2334 }
2335 }
2336 pub fn snd_warning(&self) -> Option<&SndError> {
2337 if let Self::SndWarning { agent_error, .. } = self {
2338 Some(agent_error)
2339 } else {
2340 None
2341 }
2342 }
2343 pub fn is_rcv_new(&self) -> bool {
2344 matches!(self, Self::RcvNew)
2345 }
2346 pub fn is_rcv_read(&self) -> bool {
2347 matches!(self, Self::RcvRead)
2348 }
2349 pub fn invalid(&self) -> Option<&String> {
2350 if let Self::Invalid { text, .. } = self {
2351 Some(text)
2352 } else {
2353 None
2354 }
2355 }
2356}
2357#[derive(Clone, Copy)]
2358pub struct CIStatusSndRcvdRef<'a> {
2359 pub msg_rcpt_status: &'a MsgReceiptStatus,
2360 pub snd_progress: &'a SndCIStatusProgress,
2361}
2362
2363#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2364#[cfg_attr(feature = "bon", derive(::bon::Builder))]
2365#[cfg_attr(feature = "bon", builder(on(String, into)))]
2366pub struct CITimed {
2367 #[serde(rename = "ttl", deserialize_with = "deserialize_number_from_string")]
2368 pub ttl: i32,
2369
2370 #[serde(rename = "deleteAt", skip_serializing_if = "Option::is_none")]
2371 pub delete_at: Option<UtcTime>,
2372
2373 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2374 #[cfg_attr(feature = "bon", builder(default))]
2375 pub undocumented: JsonObject,
2376}
2377
2378#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2379#[serde(tag = "type")]
2380#[non_exhaustive]
2381pub enum ChatBotCommand {
2382 #[serde(rename = "command")]
2383 Command {
2384 #[serde(rename = "keyword")]
2385 keyword: String,
2386
2387 #[serde(rename = "label")]
2388 label: String,
2389
2390 #[serde(rename = "params", skip_serializing_if = "Option::is_none")]
2391 params: Option<String>,
2392
2393 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2394 undocumented: JsonObject,
2395 },
2396 #[serde(rename = "menu")]
2397 Menu {
2398 #[serde(rename = "label")]
2399 label: String,
2400
2401 #[serde(rename = "commands")]
2402 commands: Vec<ChatBotCommand>,
2403
2404 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2405 undocumented: JsonObject,
2406 },
2407 #[serde(untagged)]
2408 Undocumented(JsonObject),
2409}
2410
2411impl ChatBotCommand {
2412 pub fn make_command(keyword: String, label: String, params: Option<String>) -> Self {
2413 Self::Command {
2414 keyword,
2415 label,
2416 params,
2417 undocumented: Default::default(),
2418 }
2419 }
2420
2421 pub fn make_menu(label: String, commands: Vec<ChatBotCommand>) -> Self {
2422 Self::Menu {
2423 label,
2424 commands,
2425 undocumented: Default::default(),
2426 }
2427 }
2428}
2429
2430impl ChatBotCommand {
2431 pub fn command(&self) -> Option<ChatBotCommandCommandRef<'_>> {
2432 if let Self::Command {
2433 keyword,
2434 label,
2435 params,
2436 ..
2437 } = self
2438 {
2439 Some(ChatBotCommandCommandRef {
2440 keyword,
2441 label,
2442 params,
2443 })
2444 } else {
2445 None
2446 }
2447 }
2448 pub fn menu(&self) -> Option<ChatBotCommandMenuRef<'_>> {
2449 if let Self::Menu {
2450 label, commands, ..
2451 } = self
2452 {
2453 Some(ChatBotCommandMenuRef { label, commands })
2454 } else {
2455 None
2456 }
2457 }
2458}
2459#[derive(Clone, Copy)]
2460pub struct ChatBotCommandCommandRef<'a> {
2461 pub keyword: &'a String,
2462 pub label: &'a String,
2463 pub params: &'a Option<String>,
2464}
2465#[derive(Clone, Copy)]
2466pub struct ChatBotCommandMenuRef<'a> {
2467 pub label: &'a String,
2468 pub commands: &'a Vec<ChatBotCommand>,
2469}
2470
2471#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2477#[serde(tag = "type")]
2478#[non_exhaustive]
2479pub enum ChatDeleteMode {
2480 #[serde(rename = "full")]
2481 Full {
2482 #[serde(rename = "notify", default)]
2483 notify: bool,
2484
2485 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2486 undocumented: JsonObject,
2487 },
2488 #[serde(rename = "entity")]
2489 Entity {
2490 #[serde(rename = "notify", default)]
2491 notify: bool,
2492
2493 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2494 undocumented: JsonObject,
2495 },
2496 #[serde(rename = "messages")]
2497 Messages,
2498 #[serde(untagged)]
2499 Undocumented(JsonObject),
2500}
2501
2502impl CommandSyntax for ChatDeleteMode {
2503 const COMMAND_BUF_SIZE: usize = 64;
2504
2505 fn append_command_syntax(&self, buf: &mut String) {
2506 match self {
2507 Self::Full { notify, .. } => {
2508 buf.push_str("full");
2509 if !notify {
2510 buf.push_str(" notify=off");
2511 }
2512 }
2513 Self::Entity { notify, .. } => {
2514 buf.push_str("entity");
2515 if !notify {
2516 buf.push_str(" notify=off");
2517 }
2518 }
2519 Self::Messages | Self::Undocumented(_) => {}
2520 }
2521 }
2522}
2523
2524impl ChatDeleteMode {
2525 pub fn make_full(notify: bool) -> Self {
2526 Self::Full {
2527 notify,
2528 undocumented: Default::default(),
2529 }
2530 }
2531
2532 pub fn make_entity(notify: bool) -> Self {
2533 Self::Entity {
2534 notify,
2535 undocumented: Default::default(),
2536 }
2537 }
2538
2539 pub fn make_messages() -> Self {
2540 Self::Messages
2541 }
2542}
2543
2544impl ChatDeleteMode {
2545 pub fn full(&self) -> Option<&bool> {
2546 if let Self::Full { notify, .. } = self {
2547 Some(notify)
2548 } else {
2549 None
2550 }
2551 }
2552 pub fn entity(&self) -> Option<&bool> {
2553 if let Self::Entity { notify, .. } = self {
2554 Some(notify)
2555 } else {
2556 None
2557 }
2558 }
2559 pub fn is_messages(&self) -> bool {
2560 matches!(self, Self::Messages)
2561 }
2562}
2563
2564#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
2565#[non_exhaustive]
2566pub enum ChatFeature {
2567 #[default]
2568 #[serde(rename = "timedMessages")]
2569 TimedMessages,
2570 #[serde(rename = "fullDelete")]
2571 FullDelete,
2572 #[serde(rename = "reactions")]
2573 Reactions,
2574 #[serde(rename = "voice")]
2575 Voice,
2576 #[serde(rename = "files")]
2577 Files,
2578 #[serde(rename = "calls")]
2579 Calls,
2580 #[serde(rename = "sessions")]
2581 Sessions,
2582}
2583
2584#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2585#[serde(tag = "type")]
2586#[non_exhaustive]
2587pub enum ChatInfo {
2588 #[serde(rename = "direct")]
2589 Direct {
2590 #[serde(rename = "contact")]
2591 contact: Contact,
2592
2593 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2594 undocumented: JsonObject,
2595 },
2596 #[serde(rename = "group")]
2597 Group {
2598 #[serde(rename = "groupInfo")]
2599 group_info: GroupInfo,
2600
2601 #[serde(rename = "groupChatScope", skip_serializing_if = "Option::is_none")]
2602 group_chat_scope: Option<GroupChatScopeInfo>,
2603
2604 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2605 undocumented: JsonObject,
2606 },
2607 #[serde(rename = "local")]
2608 Local {
2609 #[serde(rename = "noteFolder")]
2610 note_folder: NoteFolder,
2611
2612 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2613 undocumented: JsonObject,
2614 },
2615 #[serde(rename = "contactRequest")]
2616 ContactRequest {
2617 #[serde(rename = "contactRequest")]
2618 contact_request: UserContactRequest,
2619
2620 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2621 undocumented: JsonObject,
2622 },
2623 #[serde(rename = "contactConnection")]
2624 ContactConnection {
2625 #[serde(rename = "contactConnection")]
2626 contact_connection: PendingContactConnection,
2627
2628 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2629 undocumented: JsonObject,
2630 },
2631 #[serde(untagged)]
2632 Undocumented(JsonObject),
2633}
2634
2635impl ChatInfo {
2636 pub fn make_direct(contact: Contact) -> Self {
2637 Self::Direct {
2638 contact,
2639 undocumented: Default::default(),
2640 }
2641 }
2642
2643 pub fn make_group(group_info: GroupInfo, group_chat_scope: Option<GroupChatScopeInfo>) -> Self {
2644 Self::Group {
2645 group_info,
2646 group_chat_scope,
2647 undocumented: Default::default(),
2648 }
2649 }
2650
2651 pub fn make_local(note_folder: NoteFolder) -> Self {
2652 Self::Local {
2653 note_folder,
2654 undocumented: Default::default(),
2655 }
2656 }
2657
2658 pub fn make_contact_request(contact_request: UserContactRequest) -> Self {
2659 Self::ContactRequest {
2660 contact_request,
2661 undocumented: Default::default(),
2662 }
2663 }
2664
2665 pub fn make_contact_connection(contact_connection: PendingContactConnection) -> Self {
2666 Self::ContactConnection {
2667 contact_connection,
2668 undocumented: Default::default(),
2669 }
2670 }
2671}
2672
2673impl ChatInfo {
2674 pub fn direct(&self) -> Option<&Contact> {
2675 if let Self::Direct { contact, .. } = self {
2676 Some(contact)
2677 } else {
2678 None
2679 }
2680 }
2681 pub fn group(&self) -> Option<ChatInfoGroupRef<'_>> {
2682 if let Self::Group {
2683 group_info,
2684 group_chat_scope,
2685 ..
2686 } = self
2687 {
2688 Some(ChatInfoGroupRef {
2689 group_info,
2690 group_chat_scope,
2691 })
2692 } else {
2693 None
2694 }
2695 }
2696 pub fn local(&self) -> Option<&NoteFolder> {
2697 if let Self::Local { note_folder, .. } = self {
2698 Some(note_folder)
2699 } else {
2700 None
2701 }
2702 }
2703 pub fn contact_request(&self) -> Option<&UserContactRequest> {
2704 if let Self::ContactRequest {
2705 contact_request, ..
2706 } = self
2707 {
2708 Some(contact_request)
2709 } else {
2710 None
2711 }
2712 }
2713 pub fn contact_connection(&self) -> Option<&PendingContactConnection> {
2714 if let Self::ContactConnection {
2715 contact_connection, ..
2716 } = self
2717 {
2718 Some(contact_connection)
2719 } else {
2720 None
2721 }
2722 }
2723}
2724#[derive(Clone, Copy)]
2725pub struct ChatInfoGroupRef<'a> {
2726 pub group_info: &'a GroupInfo,
2727 pub group_chat_scope: &'a Option<GroupChatScopeInfo>,
2728}
2729
2730#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2731#[cfg_attr(feature = "bon", derive(::bon::Builder))]
2732#[cfg_attr(feature = "bon", builder(on(String, into)))]
2733pub struct ChatItem {
2734 #[serde(rename = "chatDir")]
2735 pub chat_dir: CIDirection,
2736
2737 #[serde(rename = "meta")]
2738 pub meta: CIMeta,
2739
2740 #[serde(rename = "content")]
2741 pub content: CIContent,
2742
2743 #[serde(rename = "mentions")]
2744 pub mentions: BTreeMap<String, CIMention>,
2745
2746 #[serde(rename = "formattedText", skip_serializing_if = "Option::is_none")]
2747 pub formatted_text: Option<Vec<FormattedText>>,
2748
2749 #[serde(rename = "quotedItem", skip_serializing_if = "Option::is_none")]
2750 pub quoted_item: Option<CIQuote>,
2751
2752 #[serde(rename = "reactions")]
2753 pub reactions: Vec<CIReactionCount>,
2754
2755 #[serde(rename = "file", skip_serializing_if = "Option::is_none")]
2756 pub file: Option<CIFile>,
2757
2758 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2759 #[cfg_attr(feature = "bon", builder(default))]
2760 pub undocumented: JsonObject,
2761}
2762
2763#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2765#[cfg_attr(feature = "bon", derive(::bon::Builder))]
2766#[cfg_attr(feature = "bon", builder(on(String, into)))]
2767pub struct ChatItemDeletion {
2768 #[serde(rename = "deletedChatItem")]
2769 pub deleted_chat_item: AChatItem,
2770
2771 #[serde(rename = "toChatItem", skip_serializing_if = "Option::is_none")]
2772 pub to_chat_item: Option<AChatItem>,
2773
2774 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2775 #[cfg_attr(feature = "bon", builder(default))]
2776 pub undocumented: JsonObject,
2777}
2778
2779#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2780#[serde(tag = "type")]
2781#[non_exhaustive]
2782pub enum ChatListQuery {
2783 #[serde(rename = "filters")]
2784 Filters {
2785 #[serde(rename = "favorite", default)]
2786 favorite: bool,
2787
2788 #[serde(rename = "unread", default)]
2789 unread: bool,
2790
2791 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2792 undocumented: JsonObject,
2793 },
2794 #[serde(rename = "search")]
2795 Search {
2796 #[serde(rename = "search")]
2797 search: String,
2798
2799 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2800 undocumented: JsonObject,
2801 },
2802 #[serde(untagged)]
2803 Undocumented(JsonObject),
2804}
2805
2806impl ChatListQuery {
2807 pub fn make_filters(favorite: bool, unread: bool) -> Self {
2808 Self::Filters {
2809 favorite,
2810 unread,
2811 undocumented: Default::default(),
2812 }
2813 }
2814
2815 pub fn make_search(search: String) -> Self {
2816 Self::Search {
2817 search,
2818 undocumented: Default::default(),
2819 }
2820 }
2821}
2822
2823impl ChatListQuery {
2824 pub fn filters(&self) -> Option<ChatListQueryFiltersRef<'_>> {
2825 if let Self::Filters {
2826 favorite, unread, ..
2827 } = self
2828 {
2829 Some(ChatListQueryFiltersRef { favorite, unread })
2830 } else {
2831 None
2832 }
2833 }
2834 pub fn search(&self) -> Option<&String> {
2835 if let Self::Search { search, .. } = self {
2836 Some(search)
2837 } else {
2838 None
2839 }
2840 }
2841}
2842#[derive(Clone, Copy)]
2843pub struct ChatListQueryFiltersRef<'a> {
2844 pub favorite: &'a bool,
2845 pub unread: &'a bool,
2846}
2847
2848#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
2849#[non_exhaustive]
2850pub enum ChatPeerType {
2851 #[default]
2852 #[serde(rename = "human")]
2853 Human,
2854 #[serde(rename = "bot")]
2855 Bot,
2856}
2857
2858#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2866#[cfg_attr(feature = "bon", derive(::bon::Builder))]
2867#[cfg_attr(feature = "bon", builder(on(String, into)))]
2868pub struct ChatRef {
2869 #[serde(rename = "chatType")]
2870 pub chat_type: ChatType,
2871
2872 #[serde(rename = "chatId", deserialize_with = "deserialize_number_from_string")]
2873 pub chat_id: i64,
2874
2875 #[serde(rename = "chatScope", skip_serializing_if = "Option::is_none")]
2876 pub chat_scope: Option<GroupChatScope>,
2877
2878 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2879 #[cfg_attr(feature = "bon", builder(default))]
2880 pub undocumented: JsonObject,
2881}
2882
2883impl CommandSyntax for ChatRef {
2884 const COMMAND_BUF_SIZE: usize = 256;
2885
2886 fn append_command_syntax(&self, buf: &mut String) {
2887 self.chat_type.append_command_syntax(buf);
2888 write!(buf, "{}", self.chat_id).unwrap();
2889 if let Some(chat_scope) = &self.chat_scope {
2890 chat_scope.append_command_syntax(buf);
2891 }
2892 }
2893}
2894
2895#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2896#[cfg_attr(feature = "bon", derive(::bon::Builder))]
2897#[cfg_attr(feature = "bon", builder(on(String, into)))]
2898pub struct ChatSettings {
2899 #[serde(rename = "enableNtfs")]
2900 pub enable_ntfs: MsgFilter,
2901
2902 #[serde(rename = "sendRcpts", skip_serializing_if = "Option::is_none")]
2903 pub send_rcpts: Option<bool>,
2904
2905 #[serde(rename = "favorite", default)]
2906 pub favorite: bool,
2907
2908 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2909 #[cfg_attr(feature = "bon", builder(default))]
2910 pub undocumented: JsonObject,
2911}
2912
2913#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2914#[cfg_attr(feature = "bon", derive(::bon::Builder))]
2915#[cfg_attr(feature = "bon", builder(on(String, into)))]
2916pub struct ChatStats {
2917 #[serde(
2918 rename = "unreadCount",
2919 deserialize_with = "deserialize_number_from_string"
2920 )]
2921 pub unread_count: i32,
2922
2923 #[serde(
2924 rename = "unreadMentions",
2925 deserialize_with = "deserialize_number_from_string"
2926 )]
2927 pub unread_mentions: i32,
2928
2929 #[serde(
2930 rename = "reportsCount",
2931 deserialize_with = "deserialize_number_from_string"
2932 )]
2933 pub reports_count: i32,
2934
2935 #[serde(
2936 rename = "minUnreadItemId",
2937 deserialize_with = "deserialize_number_from_string"
2938 )]
2939 pub min_unread_item_id: i64,
2940
2941 #[serde(rename = "unreadChat", default)]
2942 pub unread_chat: bool,
2943
2944 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
2945 #[cfg_attr(feature = "bon", builder(default))]
2946 pub undocumented: JsonObject,
2947}
2948
2949#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
2955#[non_exhaustive]
2956pub enum ChatType {
2957 #[default]
2958 #[serde(rename = "direct")]
2959 Direct,
2960 #[serde(rename = "group")]
2961 Group,
2962 #[serde(rename = "local")]
2963 Local,
2964}
2965
2966impl CommandSyntax for ChatType {
2967 const COMMAND_BUF_SIZE: usize = 16;
2968
2969 fn append_command_syntax(&self, buf: &mut String) {
2970 match self {
2971 Self::Direct => {
2972 buf.push('@');
2973 }
2974 Self::Group => {
2975 buf.push('#');
2976 }
2977 Self::Local => {
2978 buf.push('*');
2979 }
2980 }
2981 }
2982}
2983
2984#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
2985#[cfg_attr(feature = "bon", derive(::bon::Builder))]
2986#[cfg_attr(feature = "bon", builder(on(String, into)))]
2987pub struct ChatWallpaper {
2988 #[serde(rename = "preset", skip_serializing_if = "Option::is_none")]
2989 pub preset: Option<String>,
2990
2991 #[serde(rename = "imageFile", skip_serializing_if = "Option::is_none")]
2992 pub image_file: Option<String>,
2993
2994 #[serde(rename = "background", skip_serializing_if = "Option::is_none")]
2995 pub background: Option<String>,
2996
2997 #[serde(rename = "tint", skip_serializing_if = "Option::is_none")]
2998 pub tint: Option<String>,
2999
3000 #[serde(rename = "scaleType", skip_serializing_if = "Option::is_none")]
3001 pub scale_type: Option<ChatWallpaperScale>,
3002
3003 #[serde(
3004 rename = "scale",
3005 skip_serializing_if = "Option::is_none",
3006 deserialize_with = "deserialize_option_number_from_string",
3007 default
3008 )]
3009 pub scale: Option<f64>,
3010
3011 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3012 #[cfg_attr(feature = "bon", builder(default))]
3013 pub undocumented: JsonObject,
3014}
3015
3016#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
3017#[non_exhaustive]
3018pub enum ChatWallpaperScale {
3019 #[default]
3020 #[serde(rename = "fill")]
3021 Fill,
3022 #[serde(rename = "fit")]
3023 Fit,
3024 #[serde(rename = "repeat")]
3025 Repeat,
3026}
3027
3028#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3029#[cfg_attr(feature = "bon", derive(::bon::Builder))]
3030#[cfg_attr(feature = "bon", builder(on(String, into)))]
3031pub struct ClientNotice {
3032 #[serde(
3033 rename = "ttl",
3034 skip_serializing_if = "Option::is_none",
3035 deserialize_with = "deserialize_option_number_from_string",
3036 default
3037 )]
3038 pub ttl: Option<i64>,
3039
3040 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3041 #[cfg_attr(feature = "bon", builder(default))]
3042 pub undocumented: JsonObject,
3043}
3044
3045#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
3046#[non_exhaustive]
3047pub enum Color {
3048 #[default]
3049 #[serde(rename = "black")]
3050 Black,
3051 #[serde(rename = "red")]
3052 Red,
3053 #[serde(rename = "green")]
3054 Green,
3055 #[serde(rename = "yellow")]
3056 Yellow,
3057 #[serde(rename = "blue")]
3058 Blue,
3059 #[serde(rename = "magenta")]
3060 Magenta,
3061 #[serde(rename = "cyan")]
3062 Cyan,
3063 #[serde(rename = "white")]
3064 White,
3065}
3066
3067#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3068#[cfg_attr(feature = "bon", derive(::bon::Builder))]
3069#[cfg_attr(feature = "bon", builder(on(String, into)))]
3070pub struct CommentsGroupPreference {
3071 #[serde(rename = "enable")]
3072 pub enable: GroupFeatureEnabled,
3073
3074 #[serde(
3075 rename = "duration",
3076 skip_serializing_if = "Option::is_none",
3077 deserialize_with = "deserialize_option_number_from_string",
3078 default
3079 )]
3080 pub duration: Option<i32>,
3081
3082 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3083 #[cfg_attr(feature = "bon", builder(default))]
3084 pub undocumented: JsonObject,
3085}
3086
3087#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3088#[cfg_attr(feature = "bon", derive(::bon::Builder))]
3089#[cfg_attr(feature = "bon", builder(on(String, into)))]
3090pub struct ComposedMessage {
3091 #[serde(rename = "fileSource", skip_serializing_if = "Option::is_none")]
3092 pub file_source: Option<CryptoFile>,
3093
3094 #[serde(
3095 rename = "quotedItemId",
3096 skip_serializing_if = "Option::is_none",
3097 deserialize_with = "deserialize_option_number_from_string",
3098 default
3099 )]
3100 pub quoted_item_id: Option<i64>,
3101
3102 #[serde(rename = "msgContent")]
3103 pub msg_content: MsgContent,
3104
3105 #[serde(rename = "mentions")]
3106 pub mentions: BTreeMap<String, i64>,
3107
3108 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3109 #[cfg_attr(feature = "bon", builder(default))]
3110 pub undocumented: JsonObject,
3111}
3112
3113#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3114#[serde(tag = "type")]
3115#[non_exhaustive]
3116pub enum ConnStatus {
3117 #[serde(rename = "new")]
3118 New,
3119 #[serde(rename = "prepared")]
3120 Prepared,
3121 #[serde(rename = "joined")]
3122 Joined,
3123 #[serde(rename = "requested")]
3124 Requested,
3125 #[serde(rename = "accepted")]
3126 Accepted,
3127 #[serde(rename = "sndReady")]
3128 SndReady,
3129 #[serde(rename = "ready")]
3130 Ready,
3131 #[serde(rename = "deleted")]
3132 Deleted,
3133 #[serde(rename = "failed")]
3134 Failed {
3135 #[serde(rename = "connError")]
3136 conn_error: String,
3137
3138 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3139 undocumented: JsonObject,
3140 },
3141 #[serde(untagged)]
3142 Undocumented(JsonObject),
3143}
3144
3145impl ConnStatus {
3146 pub fn make_new() -> Self {
3147 Self::New
3148 }
3149
3150 pub fn make_prepared() -> Self {
3151 Self::Prepared
3152 }
3153
3154 pub fn make_joined() -> Self {
3155 Self::Joined
3156 }
3157
3158 pub fn make_requested() -> Self {
3159 Self::Requested
3160 }
3161
3162 pub fn make_accepted() -> Self {
3163 Self::Accepted
3164 }
3165
3166 pub fn make_snd_ready() -> Self {
3167 Self::SndReady
3168 }
3169
3170 pub fn make_ready() -> Self {
3171 Self::Ready
3172 }
3173
3174 pub fn make_deleted() -> Self {
3175 Self::Deleted
3176 }
3177
3178 pub fn make_failed(conn_error: String) -> Self {
3179 Self::Failed {
3180 conn_error,
3181 undocumented: Default::default(),
3182 }
3183 }
3184}
3185
3186impl ConnStatus {
3187 pub fn is_new(&self) -> bool {
3188 matches!(self, Self::New)
3189 }
3190 pub fn is_prepared(&self) -> bool {
3191 matches!(self, Self::Prepared)
3192 }
3193 pub fn is_joined(&self) -> bool {
3194 matches!(self, Self::Joined)
3195 }
3196 pub fn is_requested(&self) -> bool {
3197 matches!(self, Self::Requested)
3198 }
3199 pub fn is_accepted(&self) -> bool {
3200 matches!(self, Self::Accepted)
3201 }
3202 pub fn is_snd_ready(&self) -> bool {
3203 matches!(self, Self::SndReady)
3204 }
3205 pub fn is_ready(&self) -> bool {
3206 matches!(self, Self::Ready)
3207 }
3208 pub fn is_deleted(&self) -> bool {
3209 matches!(self, Self::Deleted)
3210 }
3211 pub fn failed(&self) -> Option<&String> {
3212 if let Self::Failed { conn_error, .. } = self {
3213 Some(conn_error)
3214 } else {
3215 None
3216 }
3217 }
3218}
3219
3220#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
3221#[non_exhaustive]
3222pub enum ConnType {
3223 #[default]
3224 #[serde(rename = "contact")]
3225 Contact,
3226 #[serde(rename = "member")]
3227 Member,
3228 #[serde(rename = "user_contact")]
3229 UserContact,
3230}
3231
3232#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3233#[cfg_attr(feature = "bon", derive(::bon::Builder))]
3234#[cfg_attr(feature = "bon", builder(on(String, into)))]
3235pub struct Connection {
3236 #[serde(rename = "connId", deserialize_with = "deserialize_number_from_string")]
3237 pub conn_id: i64,
3238
3239 #[serde(rename = "agentConnId")]
3240 pub agent_conn_id: String,
3241
3242 #[serde(
3243 rename = "connChatVersion",
3244 deserialize_with = "deserialize_number_from_string"
3245 )]
3246 pub conn_chat_version: i32,
3247
3248 #[serde(rename = "peerChatVRange")]
3249 pub peer_chat_v_range: VersionRange,
3250
3251 #[serde(
3252 rename = "connLevel",
3253 deserialize_with = "deserialize_number_from_string"
3254 )]
3255 pub conn_level: i32,
3256
3257 #[serde(
3258 rename = "viaContact",
3259 skip_serializing_if = "Option::is_none",
3260 deserialize_with = "deserialize_option_number_from_string",
3261 default
3262 )]
3263 pub via_contact: Option<i64>,
3264
3265 #[serde(
3266 rename = "viaUserContactLink",
3267 skip_serializing_if = "Option::is_none",
3268 deserialize_with = "deserialize_option_number_from_string",
3269 default
3270 )]
3271 pub via_user_contact_link: Option<i64>,
3272
3273 #[serde(rename = "viaGroupLink", default)]
3274 pub via_group_link: bool,
3275
3276 #[serde(rename = "groupLinkId", skip_serializing_if = "Option::is_none")]
3277 pub group_link_id: Option<String>,
3278
3279 #[serde(rename = "xContactId", skip_serializing_if = "Option::is_none")]
3280 pub x_contact_id: Option<String>,
3281
3282 #[serde(
3283 rename = "customUserProfileId",
3284 skip_serializing_if = "Option::is_none",
3285 deserialize_with = "deserialize_option_number_from_string",
3286 default
3287 )]
3288 pub custom_user_profile_id: Option<i64>,
3289
3290 #[serde(rename = "connType")]
3291 pub conn_type: ConnType,
3292
3293 #[serde(rename = "connStatus")]
3294 pub conn_status: ConnStatus,
3295
3296 #[serde(rename = "contactConnInitiated", default)]
3297 pub contact_conn_initiated: bool,
3298
3299 #[serde(rename = "localAlias")]
3300 pub local_alias: String,
3301
3302 #[serde(
3303 rename = "entityId",
3304 skip_serializing_if = "Option::is_none",
3305 deserialize_with = "deserialize_option_number_from_string",
3306 default
3307 )]
3308 pub entity_id: Option<i64>,
3309
3310 #[serde(rename = "connectionCode", skip_serializing_if = "Option::is_none")]
3311 pub connection_code: Option<SecurityCode>,
3312
3313 #[serde(rename = "pqSupport", default)]
3314 pub pq_support: bool,
3315
3316 #[serde(rename = "pqEncryption", default)]
3317 pub pq_encryption: bool,
3318
3319 #[serde(rename = "pqSndEnabled", skip_serializing_if = "Option::is_none")]
3320 pub pq_snd_enabled: Option<bool>,
3321
3322 #[serde(rename = "pqRcvEnabled", skip_serializing_if = "Option::is_none")]
3323 pub pq_rcv_enabled: Option<bool>,
3324
3325 #[serde(
3326 rename = "authErrCounter",
3327 deserialize_with = "deserialize_number_from_string"
3328 )]
3329 pub auth_err_counter: i32,
3330
3331 #[serde(
3332 rename = "quotaErrCounter",
3333 deserialize_with = "deserialize_number_from_string"
3334 )]
3335 pub quota_err_counter: i32,
3336
3337 #[serde(rename = "createdAt")]
3338 pub created_at: UtcTime,
3339
3340 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3341 #[cfg_attr(feature = "bon", builder(default))]
3342 pub undocumented: JsonObject,
3343}
3344
3345#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3346#[serde(tag = "type")]
3347#[non_exhaustive]
3348pub enum ConnectionEntity {
3349 #[serde(rename = "rcvDirectMsgConnection")]
3350 RcvDirectMsgConnection {
3351 #[serde(rename = "entityConnection")]
3352 entity_connection: Connection,
3353
3354 #[serde(rename = "contact", skip_serializing_if = "Option::is_none")]
3355 contact: Option<Contact>,
3356
3357 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3358 undocumented: JsonObject,
3359 },
3360 #[serde(rename = "rcvGroupMsgConnection")]
3361 RcvGroupMsgConnection {
3362 #[serde(rename = "entityConnection")]
3363 entity_connection: Connection,
3364
3365 #[serde(rename = "groupInfo")]
3366 group_info: GroupInfo,
3367
3368 #[serde(rename = "groupMember")]
3369 group_member: GroupMember,
3370
3371 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3372 undocumented: JsonObject,
3373 },
3374 #[serde(rename = "userContactConnection")]
3375 UserContactConnection {
3376 #[serde(rename = "entityConnection")]
3377 entity_connection: Connection,
3378
3379 #[serde(rename = "userContact")]
3380 user_contact: UserContact,
3381
3382 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3383 undocumented: JsonObject,
3384 },
3385 #[serde(untagged)]
3386 Undocumented(JsonObject),
3387}
3388
3389impl ConnectionEntity {
3390 pub fn make_rcv_direct_msg_connection(
3391 entity_connection: Connection,
3392 contact: Option<Contact>,
3393 ) -> Self {
3394 Self::RcvDirectMsgConnection {
3395 entity_connection,
3396 contact,
3397 undocumented: Default::default(),
3398 }
3399 }
3400
3401 pub fn make_rcv_group_msg_connection(
3402 entity_connection: Connection,
3403 group_info: GroupInfo,
3404 group_member: GroupMember,
3405 ) -> Self {
3406 Self::RcvGroupMsgConnection {
3407 entity_connection,
3408 group_info,
3409 group_member,
3410 undocumented: Default::default(),
3411 }
3412 }
3413
3414 pub fn make_user_contact_connection(
3415 entity_connection: Connection,
3416 user_contact: UserContact,
3417 ) -> Self {
3418 Self::UserContactConnection {
3419 entity_connection,
3420 user_contact,
3421 undocumented: Default::default(),
3422 }
3423 }
3424}
3425
3426impl ConnectionEntity {
3427 pub fn rcv_direct_msg_connection(
3428 &self,
3429 ) -> Option<ConnectionEntityRcvDirectMsgConnectionRef<'_>> {
3430 if let Self::RcvDirectMsgConnection {
3431 entity_connection,
3432 contact,
3433 ..
3434 } = self
3435 {
3436 Some(ConnectionEntityRcvDirectMsgConnectionRef {
3437 entity_connection,
3438 contact,
3439 })
3440 } else {
3441 None
3442 }
3443 }
3444 pub fn rcv_group_msg_connection(&self) -> Option<ConnectionEntityRcvGroupMsgConnectionRef<'_>> {
3445 if let Self::RcvGroupMsgConnection {
3446 entity_connection,
3447 group_info,
3448 group_member,
3449 ..
3450 } = self
3451 {
3452 Some(ConnectionEntityRcvGroupMsgConnectionRef {
3453 entity_connection,
3454 group_info,
3455 group_member,
3456 })
3457 } else {
3458 None
3459 }
3460 }
3461 pub fn user_contact_connection(&self) -> Option<ConnectionEntityUserContactConnectionRef<'_>> {
3462 if let Self::UserContactConnection {
3463 entity_connection,
3464 user_contact,
3465 ..
3466 } = self
3467 {
3468 Some(ConnectionEntityUserContactConnectionRef {
3469 entity_connection,
3470 user_contact,
3471 })
3472 } else {
3473 None
3474 }
3475 }
3476}
3477#[derive(Clone, Copy)]
3478pub struct ConnectionEntityRcvDirectMsgConnectionRef<'a> {
3479 pub entity_connection: &'a Connection,
3480 pub contact: &'a Option<Contact>,
3481}
3482#[derive(Clone, Copy)]
3483pub struct ConnectionEntityRcvGroupMsgConnectionRef<'a> {
3484 pub entity_connection: &'a Connection,
3485 pub group_info: &'a GroupInfo,
3486 pub group_member: &'a GroupMember,
3487}
3488#[derive(Clone, Copy)]
3489pub struct ConnectionEntityUserContactConnectionRef<'a> {
3490 pub entity_connection: &'a Connection,
3491 pub user_contact: &'a UserContact,
3492}
3493
3494#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
3495#[non_exhaustive]
3496pub enum ConnectionMode {
3497 #[default]
3498 #[serde(rename = "inv")]
3499 Inv,
3500 #[serde(rename = "con")]
3501 Con,
3502}
3503
3504#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3505#[serde(tag = "type")]
3506#[non_exhaustive]
3507pub enum ConnectionPlan {
3508 #[serde(rename = "invitationLink")]
3509 InvitationLink {
3510 #[serde(rename = "invitationLinkPlan")]
3511 invitation_link_plan: InvitationLinkPlan,
3512
3513 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3514 undocumented: JsonObject,
3515 },
3516 #[serde(rename = "contactAddress")]
3517 ContactAddress {
3518 #[serde(rename = "contactAddressPlan")]
3519 contact_address_plan: ContactAddressPlan,
3520
3521 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3522 undocumented: JsonObject,
3523 },
3524 #[serde(rename = "groupLink")]
3525 GroupLink {
3526 #[serde(rename = "groupLinkPlan")]
3527 group_link_plan: GroupLinkPlan,
3528
3529 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3530 undocumented: JsonObject,
3531 },
3532 #[serde(rename = "error")]
3533 Error {
3534 #[serde(rename = "chatError")]
3535 chat_error: ChatError,
3536
3537 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3538 undocumented: JsonObject,
3539 },
3540 #[serde(untagged)]
3541 Undocumented(JsonObject),
3542}
3543
3544impl ConnectionPlan {
3545 pub fn make_invitation_link(invitation_link_plan: InvitationLinkPlan) -> Self {
3546 Self::InvitationLink {
3547 invitation_link_plan,
3548 undocumented: Default::default(),
3549 }
3550 }
3551
3552 pub fn make_contact_address(contact_address_plan: ContactAddressPlan) -> Self {
3553 Self::ContactAddress {
3554 contact_address_plan,
3555 undocumented: Default::default(),
3556 }
3557 }
3558
3559 pub fn make_group_link(group_link_plan: GroupLinkPlan) -> Self {
3560 Self::GroupLink {
3561 group_link_plan,
3562 undocumented: Default::default(),
3563 }
3564 }
3565
3566 pub fn make_error(chat_error: ChatError) -> Self {
3567 Self::Error {
3568 chat_error,
3569 undocumented: Default::default(),
3570 }
3571 }
3572}
3573
3574impl ConnectionPlan {
3575 pub fn invitation_link(&self) -> Option<&InvitationLinkPlan> {
3576 if let Self::InvitationLink {
3577 invitation_link_plan,
3578 ..
3579 } = self
3580 {
3581 Some(invitation_link_plan)
3582 } else {
3583 None
3584 }
3585 }
3586 pub fn contact_address(&self) -> Option<&ContactAddressPlan> {
3587 if let Self::ContactAddress {
3588 contact_address_plan,
3589 ..
3590 } = self
3591 {
3592 Some(contact_address_plan)
3593 } else {
3594 None
3595 }
3596 }
3597 pub fn group_link(&self) -> Option<&GroupLinkPlan> {
3598 if let Self::GroupLink {
3599 group_link_plan, ..
3600 } = self
3601 {
3602 Some(group_link_plan)
3603 } else {
3604 None
3605 }
3606 }
3607 pub fn error(&self) -> Option<&ChatError> {
3608 if let Self::Error { chat_error, .. } = self {
3609 Some(chat_error)
3610 } else {
3611 None
3612 }
3613 }
3614}
3615
3616#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3617#[cfg_attr(feature = "bon", derive(::bon::Builder))]
3618#[cfg_attr(feature = "bon", builder(on(String, into)))]
3619pub struct Contact {
3620 #[serde(
3621 rename = "contactId",
3622 deserialize_with = "deserialize_number_from_string"
3623 )]
3624 pub contact_id: i64,
3625
3626 #[serde(rename = "localDisplayName")]
3627 pub local_display_name: String,
3628
3629 #[serde(rename = "profile")]
3630 pub profile: LocalProfile,
3631
3632 #[serde(rename = "activeConn", skip_serializing_if = "Option::is_none")]
3633 pub active_conn: Option<Connection>,
3634
3635 #[serde(rename = "contactUsed", default)]
3636 pub contact_used: bool,
3637
3638 #[serde(rename = "contactStatus")]
3639 pub contact_status: ContactStatus,
3640
3641 #[serde(rename = "chatSettings")]
3642 pub chat_settings: ChatSettings,
3643
3644 #[serde(rename = "userPreferences")]
3645 pub user_preferences: Preferences,
3646
3647 #[serde(rename = "mergedPreferences")]
3648 pub merged_preferences: ContactUserPreferences,
3649
3650 #[serde(rename = "createdAt")]
3651 pub created_at: UtcTime,
3652
3653 #[serde(rename = "updatedAt")]
3654 pub updated_at: UtcTime,
3655
3656 #[serde(rename = "chatTs", skip_serializing_if = "Option::is_none")]
3657 pub chat_ts: Option<UtcTime>,
3658
3659 #[serde(rename = "preparedContact", skip_serializing_if = "Option::is_none")]
3660 pub prepared_contact: Option<PreparedContact>,
3661
3662 #[serde(
3663 rename = "contactRequestId",
3664 skip_serializing_if = "Option::is_none",
3665 deserialize_with = "deserialize_option_number_from_string",
3666 default
3667 )]
3668 pub contact_request_id: Option<i64>,
3669
3670 #[serde(
3671 rename = "contactGroupMemberId",
3672 skip_serializing_if = "Option::is_none",
3673 deserialize_with = "deserialize_option_number_from_string",
3674 default
3675 )]
3676 pub contact_group_member_id: Option<i64>,
3677
3678 #[serde(rename = "contactGrpInvSent", default)]
3679 pub contact_grp_inv_sent: bool,
3680
3681 #[serde(rename = "groupDirectInv", skip_serializing_if = "Option::is_none")]
3682 pub group_direct_inv: Option<GroupDirectInvitation>,
3683
3684 #[serde(rename = "chatTags")]
3685 pub chat_tags: Vec<i64>,
3686
3687 #[serde(
3688 rename = "chatItemTTL",
3689 skip_serializing_if = "Option::is_none",
3690 deserialize_with = "deserialize_option_number_from_string",
3691 default
3692 )]
3693 pub chat_item_ttl: Option<i64>,
3694
3695 #[serde(rename = "uiThemes", skip_serializing_if = "Option::is_none")]
3696 pub ui_themes: Option<UIThemeEntityOverrides>,
3697
3698 #[serde(rename = "chatDeleted", default)]
3699 pub chat_deleted: bool,
3700
3701 #[serde(rename = "customData", skip_serializing_if = "Option::is_none")]
3702 pub custom_data: Option<JsonObject>,
3703
3704 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3705 #[cfg_attr(feature = "bon", builder(default))]
3706 pub undocumented: JsonObject,
3707}
3708
3709#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3710#[serde(tag = "type")]
3711#[non_exhaustive]
3712pub enum ContactAddressPlan {
3713 #[serde(rename = "ok")]
3714 Ok {
3715 #[serde(rename = "contactSLinkData_", skip_serializing_if = "Option::is_none")]
3716 contact_s_link_data: Option<ContactShortLinkData>,
3717
3718 #[serde(rename = "ownerVerification", skip_serializing_if = "Option::is_none")]
3719 owner_verification: Option<OwnerVerification>,
3720
3721 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3722 undocumented: JsonObject,
3723 },
3724 #[serde(rename = "ownLink")]
3725 OwnLink,
3726 #[serde(rename = "connectingConfirmReconnect")]
3727 ConnectingConfirmReconnect,
3728 #[serde(rename = "connectingProhibit")]
3729 ConnectingProhibit {
3730 #[serde(rename = "contact")]
3731 contact: Contact,
3732
3733 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3734 undocumented: JsonObject,
3735 },
3736 #[serde(rename = "known")]
3737 Known {
3738 #[serde(rename = "contact")]
3739 contact: Contact,
3740
3741 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3742 undocumented: JsonObject,
3743 },
3744 #[serde(rename = "contactViaAddress")]
3745 ContactViaAddress {
3746 #[serde(rename = "contact")]
3747 contact: Contact,
3748
3749 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3750 undocumented: JsonObject,
3751 },
3752 #[serde(untagged)]
3753 Undocumented(JsonObject),
3754}
3755
3756impl ContactAddressPlan {
3757 pub fn make_ok(
3758 contact_s_link_data: Option<ContactShortLinkData>,
3759 owner_verification: Option<OwnerVerification>,
3760 ) -> Self {
3761 Self::Ok {
3762 contact_s_link_data,
3763 owner_verification,
3764 undocumented: Default::default(),
3765 }
3766 }
3767
3768 pub fn make_own_link() -> Self {
3769 Self::OwnLink
3770 }
3771
3772 pub fn make_connecting_confirm_reconnect() -> Self {
3773 Self::ConnectingConfirmReconnect
3774 }
3775
3776 pub fn make_connecting_prohibit(contact: Contact) -> Self {
3777 Self::ConnectingProhibit {
3778 contact,
3779 undocumented: Default::default(),
3780 }
3781 }
3782
3783 pub fn make_known(contact: Contact) -> Self {
3784 Self::Known {
3785 contact,
3786 undocumented: Default::default(),
3787 }
3788 }
3789
3790 pub fn make_contact_via_address(contact: Contact) -> Self {
3791 Self::ContactViaAddress {
3792 contact,
3793 undocumented: Default::default(),
3794 }
3795 }
3796}
3797
3798impl ContactAddressPlan {
3799 pub fn ok(&self) -> Option<ContactAddressPlanOkRef<'_>> {
3800 if let Self::Ok {
3801 contact_s_link_data,
3802 owner_verification,
3803 ..
3804 } = self
3805 {
3806 Some(ContactAddressPlanOkRef {
3807 contact_s_link_data,
3808 owner_verification,
3809 })
3810 } else {
3811 None
3812 }
3813 }
3814 pub fn is_own_link(&self) -> bool {
3815 matches!(self, Self::OwnLink)
3816 }
3817 pub fn is_connecting_confirm_reconnect(&self) -> bool {
3818 matches!(self, Self::ConnectingConfirmReconnect)
3819 }
3820 pub fn connecting_prohibit(&self) -> Option<&Contact> {
3821 if let Self::ConnectingProhibit { contact, .. } = self {
3822 Some(contact)
3823 } else {
3824 None
3825 }
3826 }
3827 pub fn known(&self) -> Option<&Contact> {
3828 if let Self::Known { contact, .. } = self {
3829 Some(contact)
3830 } else {
3831 None
3832 }
3833 }
3834 pub fn contact_via_address(&self) -> Option<&Contact> {
3835 if let Self::ContactViaAddress { contact, .. } = self {
3836 Some(contact)
3837 } else {
3838 None
3839 }
3840 }
3841}
3842#[derive(Clone, Copy)]
3843pub struct ContactAddressPlanOkRef<'a> {
3844 pub contact_s_link_data: &'a Option<ContactShortLinkData>,
3845 pub owner_verification: &'a Option<OwnerVerification>,
3846}
3847
3848#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3849#[cfg_attr(feature = "bon", derive(::bon::Builder))]
3850#[cfg_attr(feature = "bon", builder(on(String, into)))]
3851pub struct ContactShortLinkData {
3852 #[serde(rename = "profile")]
3853 pub profile: Profile,
3854
3855 #[serde(rename = "message", skip_serializing_if = "Option::is_none")]
3856 pub message: Option<MsgContent>,
3857
3858 #[serde(rename = "business", default)]
3859 pub business: bool,
3860
3861 #[serde(rename = "localBadge", skip_serializing_if = "Option::is_none")]
3862 pub local_badge: Option<LocalBadge>,
3863
3864 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3865 #[cfg_attr(feature = "bon", builder(default))]
3866 pub undocumented: JsonObject,
3867}
3868
3869#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
3870#[non_exhaustive]
3871pub enum ContactStatus {
3872 #[default]
3873 #[serde(rename = "active")]
3874 Active,
3875 #[serde(rename = "deleted")]
3876 Deleted,
3877 #[serde(rename = "deletedByUser")]
3878 DeletedByUser,
3879}
3880
3881#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3882#[serde(tag = "type")]
3883#[non_exhaustive]
3884pub enum ContactUserPref {
3885 #[serde(rename = "contact")]
3886 Contact {
3887 #[serde(rename = "preference")]
3888 preference: SimplePreference,
3889
3890 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3891 undocumented: JsonObject,
3892 },
3893 #[serde(rename = "user")]
3894 User {
3895 #[serde(rename = "preference")]
3896 preference: SimplePreference,
3897
3898 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3899 undocumented: JsonObject,
3900 },
3901 #[serde(untagged)]
3902 Undocumented(JsonObject),
3903}
3904
3905impl ContactUserPref {
3906 pub fn make_contact(preference: SimplePreference) -> Self {
3907 Self::Contact {
3908 preference,
3909 undocumented: Default::default(),
3910 }
3911 }
3912
3913 pub fn make_user(preference: SimplePreference) -> Self {
3914 Self::User {
3915 preference,
3916 undocumented: Default::default(),
3917 }
3918 }
3919}
3920
3921impl ContactUserPref {
3922 pub fn contact(&self) -> Option<&SimplePreference> {
3923 if let Self::Contact { preference, .. } = self {
3924 Some(preference)
3925 } else {
3926 None
3927 }
3928 }
3929 pub fn user(&self) -> Option<&SimplePreference> {
3930 if let Self::User { preference, .. } = self {
3931 Some(preference)
3932 } else {
3933 None
3934 }
3935 }
3936}
3937
3938#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3939#[cfg_attr(feature = "bon", derive(::bon::Builder))]
3940#[cfg_attr(feature = "bon", builder(on(String, into)))]
3941pub struct ContactUserPreference {
3942 #[serde(rename = "enabled")]
3943 pub enabled: PrefEnabled,
3944
3945 #[serde(rename = "userPreference")]
3946 pub user_preference: ContactUserPref,
3947
3948 #[serde(rename = "contactPreference")]
3949 pub contact_preference: SimplePreference,
3950
3951 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3952 #[cfg_attr(feature = "bon", builder(default))]
3953 pub undocumented: JsonObject,
3954}
3955
3956#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3957#[cfg_attr(feature = "bon", derive(::bon::Builder))]
3958#[cfg_attr(feature = "bon", builder(on(String, into)))]
3959pub struct ContactUserPreferences {
3960 #[serde(rename = "timedMessages")]
3961 pub timed_messages: ContactUserPreference,
3962
3963 #[serde(rename = "fullDelete")]
3964 pub full_delete: ContactUserPreference,
3965
3966 #[serde(rename = "reactions")]
3967 pub reactions: ContactUserPreference,
3968
3969 #[serde(rename = "voice")]
3970 pub voice: ContactUserPreference,
3971
3972 #[serde(rename = "files")]
3973 pub files: ContactUserPreference,
3974
3975 #[serde(rename = "calls")]
3976 pub calls: ContactUserPreference,
3977
3978 #[serde(rename = "sessions")]
3979 pub sessions: ContactUserPreference,
3980
3981 #[serde(rename = "commands", skip_serializing_if = "Option::is_none")]
3982 pub commands: Option<Vec<ChatBotCommand>>,
3983
3984 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
3985 #[cfg_attr(feature = "bon", builder(default))]
3986 pub undocumented: JsonObject,
3987}
3988
3989#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
3995#[cfg_attr(feature = "bon", derive(::bon::Builder))]
3996#[cfg_attr(feature = "bon", builder(on(String, into)))]
3997pub struct CreatedConnLink {
3998 #[serde(rename = "connFullLink")]
3999 pub conn_full_link: String,
4000
4001 #[serde(rename = "connShortLink", skip_serializing_if = "Option::is_none")]
4002 pub conn_short_link: Option<String>,
4003
4004 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4005 #[cfg_attr(feature = "bon", builder(default))]
4006 pub undocumented: JsonObject,
4007}
4008
4009impl CommandSyntax for CreatedConnLink {
4010 const COMMAND_BUF_SIZE: usize = 64;
4011
4012 fn append_command_syntax(&self, buf: &mut String) {
4013 write!(buf, "{}", self.conn_full_link).unwrap();
4014 if let Some(conn_short_link) = &self.conn_short_link {
4015 buf.push(' ');
4016 write!(buf, "{}", conn_short_link).unwrap();
4017 }
4018 }
4019}
4020
4021#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4022#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4023#[cfg_attr(feature = "bon", builder(on(String, into)))]
4024pub struct CryptoFile {
4025 #[serde(rename = "filePath")]
4026 pub file_path: String,
4027
4028 #[serde(rename = "cryptoArgs", skip_serializing_if = "Option::is_none")]
4029 pub crypto_args: Option<CryptoFileArgs>,
4030
4031 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4032 #[cfg_attr(feature = "bon", builder(default))]
4033 pub undocumented: JsonObject,
4034}
4035
4036#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4037#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4038#[cfg_attr(feature = "bon", builder(on(String, into)))]
4039pub struct CryptoFileArgs {
4040 #[serde(rename = "fileKey")]
4041 pub file_key: String,
4042
4043 #[serde(rename = "fileNonce")]
4044 pub file_nonce: String,
4045
4046 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4047 #[cfg_attr(feature = "bon", builder(default))]
4048 pub undocumented: JsonObject,
4049}
4050
4051#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4052#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4053#[cfg_attr(feature = "bon", builder(on(String, into)))]
4054pub struct DroppedMsg {
4055 #[serde(rename = "brokerTs")]
4056 pub broker_ts: UtcTime,
4057
4058 #[serde(
4059 rename = "attempts",
4060 deserialize_with = "deserialize_number_from_string"
4061 )]
4062 pub attempts: i32,
4063
4064 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4065 #[cfg_attr(feature = "bon", builder(default))]
4066 pub undocumented: JsonObject,
4067}
4068
4069#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4070#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4071#[cfg_attr(feature = "bon", builder(on(String, into)))]
4072pub struct E2EInfo {
4073 #[serde(rename = "public", skip_serializing_if = "Option::is_none")]
4074 pub public: Option<bool>,
4075
4076 #[serde(rename = "pqEnabled", skip_serializing_if = "Option::is_none")]
4077 pub pq_enabled: Option<bool>,
4078
4079 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4080 #[cfg_attr(feature = "bon", builder(default))]
4081 pub undocumented: JsonObject,
4082}
4083
4084#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
4085#[non_exhaustive]
4086pub enum FeatureAllowed {
4087 #[default]
4088 #[serde(rename = "always")]
4089 Always,
4090 #[serde(rename = "yes")]
4091 Yes,
4092 #[serde(rename = "no")]
4093 No,
4094}
4095
4096#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4097#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4098#[cfg_attr(feature = "bon", builder(on(String, into)))]
4099pub struct FileDescr {
4100 #[serde(rename = "fileDescrText")]
4101 pub file_descr_text: String,
4102
4103 #[serde(
4104 rename = "fileDescrPartNo",
4105 deserialize_with = "deserialize_number_from_string"
4106 )]
4107 pub file_descr_part_no: i32,
4108
4109 #[serde(rename = "fileDescrComplete", default)]
4110 pub file_descr_complete: bool,
4111
4112 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4113 #[cfg_attr(feature = "bon", builder(default))]
4114 pub undocumented: JsonObject,
4115}
4116
4117#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4118#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4119#[cfg_attr(feature = "bon", builder(on(String, into)))]
4120pub struct FileInvitation {
4121 #[serde(rename = "fileName")]
4122 pub file_name: String,
4123
4124 #[serde(
4125 rename = "fileSize",
4126 deserialize_with = "deserialize_number_from_string"
4127 )]
4128 pub file_size: i64,
4129
4130 #[serde(rename = "fileDigest", skip_serializing_if = "Option::is_none")]
4131 pub file_digest: Option<String>,
4132
4133 #[serde(rename = "fileConnReq", skip_serializing_if = "Option::is_none")]
4134 pub file_conn_req: Option<String>,
4135
4136 #[serde(rename = "fileInline", skip_serializing_if = "Option::is_none")]
4137 pub file_inline: Option<InlineFileMode>,
4138
4139 #[serde(rename = "fileDescr", skip_serializing_if = "Option::is_none")]
4140 pub file_descr: Option<FileDescr>,
4141
4142 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4143 #[cfg_attr(feature = "bon", builder(default))]
4144 pub undocumented: JsonObject,
4145}
4146
4147#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
4148#[non_exhaustive]
4149pub enum FileProtocol {
4150 #[default]
4151 #[serde(rename = "smp")]
4152 Smp,
4153 #[serde(rename = "xftp")]
4154 Xftp,
4155 #[serde(rename = "local")]
4156 Local,
4157}
4158
4159#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
4160#[non_exhaustive]
4161pub enum FileStatus {
4162 #[default]
4163 #[serde(rename = "new")]
4164 New,
4165 #[serde(rename = "accepted")]
4166 Accepted,
4167 #[serde(rename = "connected")]
4168 Connected,
4169 #[serde(rename = "complete")]
4170 Complete,
4171 #[serde(rename = "cancelled")]
4172 Cancelled,
4173}
4174
4175#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4176#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4177#[cfg_attr(feature = "bon", builder(on(String, into)))]
4178pub struct FileTransferMeta {
4179 #[serde(rename = "fileId", deserialize_with = "deserialize_number_from_string")]
4180 pub file_id: i64,
4181
4182 #[serde(rename = "xftpSndFile", skip_serializing_if = "Option::is_none")]
4183 pub xftp_snd_file: Option<XFTPSndFile>,
4184
4185 #[serde(
4186 rename = "xftpRedirectFor",
4187 skip_serializing_if = "Option::is_none",
4188 deserialize_with = "deserialize_option_number_from_string",
4189 default
4190 )]
4191 pub xftp_redirect_for: Option<i64>,
4192
4193 #[serde(rename = "fileName")]
4194 pub file_name: String,
4195
4196 #[serde(rename = "filePath")]
4197 pub file_path: String,
4198
4199 #[serde(
4200 rename = "fileSize",
4201 deserialize_with = "deserialize_number_from_string"
4202 )]
4203 pub file_size: i64,
4204
4205 #[serde(rename = "fileInline", skip_serializing_if = "Option::is_none")]
4206 pub file_inline: Option<InlineFileMode>,
4207
4208 #[serde(
4209 rename = "chunkSize",
4210 deserialize_with = "deserialize_number_from_string"
4211 )]
4212 pub chunk_size: i64,
4213
4214 #[serde(rename = "cancelled", default)]
4215 pub cancelled: bool,
4216
4217 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4218 #[cfg_attr(feature = "bon", builder(default))]
4219 pub undocumented: JsonObject,
4220}
4221
4222#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4223#[serde(tag = "type")]
4224#[non_exhaustive]
4225pub enum Format {
4226 #[serde(rename = "bold")]
4227 Bold,
4228 #[serde(rename = "italic")]
4229 Italic,
4230 #[serde(rename = "strikeThrough")]
4231 StrikeThrough,
4232 #[serde(rename = "snippet")]
4233 Snippet,
4234 #[serde(rename = "secret")]
4235 Secret,
4236 #[serde(rename = "small")]
4237 Small,
4238 #[serde(rename = "colored")]
4239 Colored {
4240 #[serde(rename = "color")]
4241 color: Color,
4242
4243 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4244 undocumented: JsonObject,
4245 },
4246 #[serde(rename = "uri")]
4247 Uri,
4248 #[serde(rename = "hyperLink")]
4249 HyperLink {
4250 #[serde(rename = "showText", skip_serializing_if = "Option::is_none")]
4251 show_text: Option<String>,
4252
4253 #[serde(rename = "linkUri")]
4254 link_uri: String,
4255
4256 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4257 undocumented: JsonObject,
4258 },
4259 #[serde(rename = "simplexLink")]
4260 SimplexLink {
4261 #[serde(rename = "showText", skip_serializing_if = "Option::is_none")]
4262 show_text: Option<String>,
4263
4264 #[serde(rename = "linkType")]
4265 link_type: SimplexLinkType,
4266
4267 #[serde(rename = "simplexUri")]
4268 simplex_uri: String,
4269
4270 #[serde(rename = "smpHosts")]
4271 smp_hosts: Vec<String>,
4272
4273 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4274 undocumented: JsonObject,
4275 },
4276 #[serde(rename = "simplexName")]
4277 SimplexName {
4278 #[serde(rename = "nameInfo")]
4279 name_info: SimplexNameInfo,
4280
4281 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4282 undocumented: JsonObject,
4283 },
4284 #[serde(rename = "command")]
4285 Command {
4286 #[serde(rename = "commandStr")]
4287 command_str: String,
4288
4289 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4290 undocumented: JsonObject,
4291 },
4292 #[serde(rename = "mention")]
4293 Mention {
4294 #[serde(rename = "memberName")]
4295 member_name: String,
4296
4297 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4298 undocumented: JsonObject,
4299 },
4300 #[serde(rename = "email")]
4301 Email,
4302 #[serde(rename = "phone")]
4303 Phone,
4304 #[serde(untagged)]
4305 Undocumented(JsonObject),
4306}
4307
4308impl Format {
4309 pub fn make_bold() -> Self {
4310 Self::Bold
4311 }
4312
4313 pub fn make_italic() -> Self {
4314 Self::Italic
4315 }
4316
4317 pub fn make_strike_through() -> Self {
4318 Self::StrikeThrough
4319 }
4320
4321 pub fn make_snippet() -> Self {
4322 Self::Snippet
4323 }
4324
4325 pub fn make_secret() -> Self {
4326 Self::Secret
4327 }
4328
4329 pub fn make_small() -> Self {
4330 Self::Small
4331 }
4332
4333 pub fn make_colored(color: Color) -> Self {
4334 Self::Colored {
4335 color,
4336 undocumented: Default::default(),
4337 }
4338 }
4339
4340 pub fn make_uri() -> Self {
4341 Self::Uri
4342 }
4343
4344 pub fn make_hyper_link(show_text: Option<String>, link_uri: String) -> Self {
4345 Self::HyperLink {
4346 show_text,
4347 link_uri,
4348 undocumented: Default::default(),
4349 }
4350 }
4351
4352 pub fn make_simplex_link(
4353 show_text: Option<String>,
4354 link_type: SimplexLinkType,
4355 simplex_uri: String,
4356 smp_hosts: Vec<String>,
4357 ) -> Self {
4358 Self::SimplexLink {
4359 show_text,
4360 link_type,
4361 simplex_uri,
4362 smp_hosts,
4363 undocumented: Default::default(),
4364 }
4365 }
4366
4367 pub fn make_simplex_name(name_info: SimplexNameInfo) -> Self {
4368 Self::SimplexName {
4369 name_info,
4370 undocumented: Default::default(),
4371 }
4372 }
4373
4374 pub fn make_command(command_str: String) -> Self {
4375 Self::Command {
4376 command_str,
4377 undocumented: Default::default(),
4378 }
4379 }
4380
4381 pub fn make_mention(member_name: String) -> Self {
4382 Self::Mention {
4383 member_name,
4384 undocumented: Default::default(),
4385 }
4386 }
4387
4388 pub fn make_email() -> Self {
4389 Self::Email
4390 }
4391
4392 pub fn make_phone() -> Self {
4393 Self::Phone
4394 }
4395}
4396
4397impl Format {
4398 pub fn is_bold(&self) -> bool {
4399 matches!(self, Self::Bold)
4400 }
4401 pub fn is_italic(&self) -> bool {
4402 matches!(self, Self::Italic)
4403 }
4404 pub fn is_strike_through(&self) -> bool {
4405 matches!(self, Self::StrikeThrough)
4406 }
4407 pub fn is_snippet(&self) -> bool {
4408 matches!(self, Self::Snippet)
4409 }
4410 pub fn is_secret(&self) -> bool {
4411 matches!(self, Self::Secret)
4412 }
4413 pub fn is_small(&self) -> bool {
4414 matches!(self, Self::Small)
4415 }
4416 pub fn colored(&self) -> Option<&Color> {
4417 if let Self::Colored { color, .. } = self {
4418 Some(color)
4419 } else {
4420 None
4421 }
4422 }
4423 pub fn is_uri(&self) -> bool {
4424 matches!(self, Self::Uri)
4425 }
4426 pub fn hyper_link(&self) -> Option<FormatHyperLinkRef<'_>> {
4427 if let Self::HyperLink {
4428 show_text,
4429 link_uri,
4430 ..
4431 } = self
4432 {
4433 Some(FormatHyperLinkRef {
4434 show_text,
4435 link_uri,
4436 })
4437 } else {
4438 None
4439 }
4440 }
4441 pub fn simplex_link(&self) -> Option<FormatSimplexLinkRef<'_>> {
4442 if let Self::SimplexLink {
4443 show_text,
4444 link_type,
4445 simplex_uri,
4446 smp_hosts,
4447 ..
4448 } = self
4449 {
4450 Some(FormatSimplexLinkRef {
4451 show_text,
4452 link_type,
4453 simplex_uri,
4454 smp_hosts,
4455 })
4456 } else {
4457 None
4458 }
4459 }
4460 pub fn simplex_name(&self) -> Option<&SimplexNameInfo> {
4461 if let Self::SimplexName { name_info, .. } = self {
4462 Some(name_info)
4463 } else {
4464 None
4465 }
4466 }
4467 pub fn command(&self) -> Option<&String> {
4468 if let Self::Command { command_str, .. } = self {
4469 Some(command_str)
4470 } else {
4471 None
4472 }
4473 }
4474 pub fn mention(&self) -> Option<&String> {
4475 if let Self::Mention { member_name, .. } = self {
4476 Some(member_name)
4477 } else {
4478 None
4479 }
4480 }
4481 pub fn is_email(&self) -> bool {
4482 matches!(self, Self::Email)
4483 }
4484 pub fn is_phone(&self) -> bool {
4485 matches!(self, Self::Phone)
4486 }
4487}
4488#[derive(Clone, Copy)]
4489pub struct FormatHyperLinkRef<'a> {
4490 pub show_text: &'a Option<String>,
4491 pub link_uri: &'a String,
4492}
4493#[derive(Clone, Copy)]
4494pub struct FormatSimplexLinkRef<'a> {
4495 pub show_text: &'a Option<String>,
4496 pub link_type: &'a SimplexLinkType,
4497 pub simplex_uri: &'a String,
4498 pub smp_hosts: &'a Vec<String>,
4499}
4500
4501#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4502#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4503#[cfg_attr(feature = "bon", builder(on(String, into)))]
4504pub struct FormattedText {
4505 #[serde(rename = "format", skip_serializing_if = "Option::is_none")]
4506 pub format: Option<Format>,
4507
4508 #[serde(rename = "text")]
4509 pub text: String,
4510
4511 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4512 #[cfg_attr(feature = "bon", builder(default))]
4513 pub undocumented: JsonObject,
4514}
4515
4516#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4517#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4518#[cfg_attr(feature = "bon", builder(on(String, into)))]
4519pub struct FullGroupPreferences {
4520 #[serde(rename = "timedMessages")]
4521 pub timed_messages: TimedMessagesGroupPreference,
4522
4523 #[serde(rename = "directMessages")]
4524 pub direct_messages: RoleGroupPreference,
4525
4526 #[serde(rename = "fullDelete")]
4527 pub full_delete: GroupPreference,
4528
4529 #[serde(rename = "reactions")]
4530 pub reactions: GroupPreference,
4531
4532 #[serde(rename = "voice")]
4533 pub voice: RoleGroupPreference,
4534
4535 #[serde(rename = "files")]
4536 pub files: RoleGroupPreference,
4537
4538 #[serde(rename = "simplexLinks")]
4539 pub simplex_links: RoleGroupPreference,
4540
4541 #[serde(rename = "reports")]
4542 pub reports: GroupPreference,
4543
4544 #[serde(rename = "history")]
4545 pub history: GroupPreference,
4546
4547 #[serde(rename = "support")]
4548 pub support: SupportGroupPreference,
4549
4550 #[serde(rename = "sessions")]
4551 pub sessions: RoleGroupPreference,
4552
4553 #[serde(rename = "comments")]
4554 pub comments: CommentsGroupPreference,
4555
4556 #[serde(rename = "commands")]
4557 pub commands: Vec<ChatBotCommand>,
4558
4559 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4560 #[cfg_attr(feature = "bon", builder(default))]
4561 pub undocumented: JsonObject,
4562}
4563
4564#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4565#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4566#[cfg_attr(feature = "bon", builder(on(String, into)))]
4567pub struct FullPreferences {
4568 #[serde(rename = "timedMessages")]
4569 pub timed_messages: TimedMessagesPreference,
4570
4571 #[serde(rename = "fullDelete")]
4572 pub full_delete: SimplePreference,
4573
4574 #[serde(rename = "reactions")]
4575 pub reactions: SimplePreference,
4576
4577 #[serde(rename = "voice")]
4578 pub voice: SimplePreference,
4579
4580 #[serde(rename = "files")]
4581 pub files: SimplePreference,
4582
4583 #[serde(rename = "calls")]
4584 pub calls: SimplePreference,
4585
4586 #[serde(rename = "sessions")]
4587 pub sessions: SimplePreference,
4588
4589 #[serde(rename = "commands")]
4590 pub commands: Vec<ChatBotCommand>,
4591
4592 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4593 #[cfg_attr(feature = "bon", builder(default))]
4594 pub undocumented: JsonObject,
4595}
4596
4597#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4598#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4599#[cfg_attr(feature = "bon", builder(on(String, into)))]
4600pub struct Group {
4601 #[serde(rename = "groupInfo")]
4602 pub group_info: GroupInfo,
4603
4604 #[serde(rename = "members")]
4605 pub members: Vec<GroupMember>,
4606
4607 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4608 #[cfg_attr(feature = "bon", builder(default))]
4609 pub undocumented: JsonObject,
4610}
4611
4612#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4618#[serde(tag = "type")]
4619#[non_exhaustive]
4620pub enum GroupChatScope {
4621 #[serde(rename = "memberSupport")]
4622 MemberSupport {
4623 #[serde(
4624 rename = "groupMemberId_",
4625 skip_serializing_if = "Option::is_none",
4626 deserialize_with = "deserialize_option_number_from_string",
4627 default
4628 )]
4629 group_member_id: Option<i64>,
4630
4631 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4632 undocumented: JsonObject,
4633 },
4634 #[serde(untagged)]
4635 Undocumented(JsonObject),
4636}
4637
4638impl CommandSyntax for GroupChatScope {
4639 const COMMAND_BUF_SIZE: usize = 64;
4640
4641 fn append_command_syntax(&self, buf: &mut String) {
4642 buf.push_str("(_support");
4643 match self {
4644 Self::MemberSupport {
4645 group_member_id, ..
4646 } => {
4647 if let Some(group_member_id) = group_member_id {
4648 buf.push(':');
4649 write!(buf, "{}", group_member_id).unwrap();
4650 }
4651 }
4652 Self::Undocumented(_) => {}
4653 }
4654 buf.push(')');
4655 }
4656}
4657
4658impl GroupChatScope {
4659 pub fn make_member_support(group_member_id: Option<i64>) -> Self {
4660 Self::MemberSupport {
4661 group_member_id,
4662 undocumented: Default::default(),
4663 }
4664 }
4665}
4666
4667impl GroupChatScope {
4668 pub fn member_support(&self) -> Option<&Option<i64>> {
4669 if let Self::MemberSupport {
4670 group_member_id, ..
4671 } = self
4672 {
4673 Some(group_member_id)
4674 } else {
4675 None
4676 }
4677 }
4678}
4679
4680#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4681#[serde(tag = "type")]
4682#[non_exhaustive]
4683pub enum GroupChatScopeInfo {
4684 #[serde(rename = "memberSupport")]
4685 MemberSupport {
4686 #[serde(rename = "groupMember_", skip_serializing_if = "Option::is_none")]
4687 group_member: Option<GroupMember>,
4688
4689 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4690 undocumented: JsonObject,
4691 },
4692 #[serde(untagged)]
4693 Undocumented(JsonObject),
4694}
4695
4696impl GroupChatScopeInfo {
4697 pub fn make_member_support(group_member: Option<GroupMember>) -> Self {
4698 Self::MemberSupport {
4699 group_member,
4700 undocumented: Default::default(),
4701 }
4702 }
4703}
4704
4705impl GroupChatScopeInfo {
4706 pub fn member_support(&self) -> Option<&Option<GroupMember>> {
4707 if let Self::MemberSupport { group_member, .. } = self {
4708 Some(group_member)
4709 } else {
4710 None
4711 }
4712 }
4713}
4714
4715#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4716#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4717#[cfg_attr(feature = "bon", builder(on(String, into)))]
4718pub struct GroupDirectInvitation {
4719 #[serde(rename = "groupDirectInvLink")]
4720 pub group_direct_inv_link: String,
4721
4722 #[serde(
4723 rename = "fromGroupId_",
4724 skip_serializing_if = "Option::is_none",
4725 deserialize_with = "deserialize_option_number_from_string",
4726 default
4727 )]
4728 pub from_group_id: Option<i64>,
4729
4730 #[serde(
4731 rename = "fromGroupMemberId_",
4732 skip_serializing_if = "Option::is_none",
4733 deserialize_with = "deserialize_option_number_from_string",
4734 default
4735 )]
4736 pub from_group_member_id: Option<i64>,
4737
4738 #[serde(
4739 rename = "fromGroupMemberConnId_",
4740 skip_serializing_if = "Option::is_none",
4741 deserialize_with = "deserialize_option_number_from_string",
4742 default
4743 )]
4744 pub from_group_member_conn_id: Option<i64>,
4745
4746 #[serde(rename = "groupDirectInvStartedConnection", default)]
4747 pub group_direct_inv_started_connection: bool,
4748
4749 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4750 #[cfg_attr(feature = "bon", builder(default))]
4751 pub undocumented: JsonObject,
4752}
4753
4754#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
4755#[non_exhaustive]
4756pub enum GroupFeature {
4757 #[default]
4758 #[serde(rename = "timedMessages")]
4759 TimedMessages,
4760 #[serde(rename = "directMessages")]
4761 DirectMessages,
4762 #[serde(rename = "fullDelete")]
4763 FullDelete,
4764 #[serde(rename = "reactions")]
4765 Reactions,
4766 #[serde(rename = "voice")]
4767 Voice,
4768 #[serde(rename = "files")]
4769 Files,
4770 #[serde(rename = "simplexLinks")]
4771 SimplexLinks,
4772 #[serde(rename = "reports")]
4773 Reports,
4774 #[serde(rename = "history")]
4775 History,
4776 #[serde(rename = "support")]
4777 Support,
4778 #[serde(rename = "sessions")]
4779 Sessions,
4780 #[serde(rename = "comments")]
4781 Comments,
4782}
4783
4784#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
4785#[non_exhaustive]
4786pub enum GroupFeatureEnabled {
4787 #[default]
4788 #[serde(rename = "on")]
4789 On,
4790 #[serde(rename = "off")]
4791 Off,
4792}
4793
4794#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4795#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4796#[cfg_attr(feature = "bon", builder(on(String, into)))]
4797pub struct GroupInfo {
4798 #[serde(
4799 rename = "groupId",
4800 deserialize_with = "deserialize_number_from_string"
4801 )]
4802 pub group_id: i64,
4803
4804 #[serde(rename = "useRelays", default)]
4805 pub use_relays: bool,
4806
4807 #[serde(rename = "relayOwnStatus", skip_serializing_if = "Option::is_none")]
4808 pub relay_own_status: Option<RelayStatus>,
4809
4810 #[serde(rename = "localDisplayName")]
4811 pub local_display_name: String,
4812
4813 #[serde(rename = "groupProfile")]
4814 pub group_profile: GroupProfile,
4815
4816 #[serde(rename = "localAlias")]
4817 pub local_alias: String,
4818
4819 #[serde(rename = "businessChat", skip_serializing_if = "Option::is_none")]
4820 pub business_chat: Option<BusinessChatInfo>,
4821
4822 #[serde(rename = "fullGroupPreferences")]
4823 pub full_group_preferences: FullGroupPreferences,
4824
4825 #[serde(rename = "membership")]
4826 pub membership: GroupMember,
4827
4828 #[serde(rename = "chatSettings")]
4829 pub chat_settings: ChatSettings,
4830
4831 #[serde(rename = "createdAt")]
4832 pub created_at: UtcTime,
4833
4834 #[serde(rename = "updatedAt")]
4835 pub updated_at: UtcTime,
4836
4837 #[serde(rename = "chatTs", skip_serializing_if = "Option::is_none")]
4838 pub chat_ts: Option<UtcTime>,
4839
4840 #[serde(
4841 rename = "userMemberProfileSentAt",
4842 skip_serializing_if = "Option::is_none"
4843 )]
4844 pub user_member_profile_sent_at: Option<UtcTime>,
4845
4846 #[serde(rename = "preparedGroup", skip_serializing_if = "Option::is_none")]
4847 pub prepared_group: Option<PreparedGroup>,
4848
4849 #[serde(rename = "chatTags")]
4850 pub chat_tags: Vec<i64>,
4851
4852 #[serde(
4853 rename = "chatItemTTL",
4854 skip_serializing_if = "Option::is_none",
4855 deserialize_with = "deserialize_option_number_from_string",
4856 default
4857 )]
4858 pub chat_item_ttl: Option<i64>,
4859
4860 #[serde(rename = "uiThemes", skip_serializing_if = "Option::is_none")]
4861 pub ui_themes: Option<UIThemeEntityOverrides>,
4862
4863 #[serde(rename = "customData", skip_serializing_if = "Option::is_none")]
4864 pub custom_data: Option<JsonObject>,
4865
4866 #[serde(rename = "groupSummary")]
4867 pub group_summary: GroupSummary,
4868
4869 #[serde(
4870 rename = "membersRequireAttention",
4871 deserialize_with = "deserialize_number_from_string"
4872 )]
4873 pub members_require_attention: i32,
4874
4875 #[serde(rename = "viaGroupLinkUri", skip_serializing_if = "Option::is_none")]
4876 pub via_group_link_uri: Option<String>,
4877
4878 #[serde(rename = "groupKeys", skip_serializing_if = "Option::is_none")]
4879 pub group_keys: Option<GroupKeys>,
4880
4881 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4882 #[cfg_attr(feature = "bon", builder(default))]
4883 pub undocumented: JsonObject,
4884}
4885
4886#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4887#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4888#[cfg_attr(feature = "bon", builder(on(String, into)))]
4889pub struct GroupKeys {
4890 #[serde(rename = "publicGroupId")]
4891 pub public_group_id: String,
4892
4893 #[serde(rename = "groupRootKey")]
4894 pub group_root_key: GroupRootKey,
4895
4896 #[serde(rename = "memberPrivKey")]
4897 pub member_priv_key: String,
4898
4899 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4900 #[cfg_attr(feature = "bon", builder(default))]
4901 pub undocumented: JsonObject,
4902}
4903
4904#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4905#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4906#[cfg_attr(feature = "bon", builder(on(String, into)))]
4907pub struct GroupLink {
4908 #[serde(
4909 rename = "userContactLinkId",
4910 deserialize_with = "deserialize_number_from_string"
4911 )]
4912 pub user_contact_link_id: i64,
4913
4914 #[serde(rename = "connLinkContact")]
4915 pub conn_link_contact: CreatedConnLink,
4916
4917 #[serde(rename = "shortLinkDataSet", default)]
4918 pub short_link_data_set: bool,
4919
4920 #[serde(rename = "shortLinkLargeDataSet", default)]
4921 pub short_link_large_data_set: bool,
4922
4923 #[serde(rename = "groupLinkId")]
4924 pub group_link_id: String,
4925
4926 #[serde(rename = "acceptMemberRole")]
4927 pub accept_member_role: GroupMemberRole,
4928
4929 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4930 #[cfg_attr(feature = "bon", builder(default))]
4931 pub undocumented: JsonObject,
4932}
4933
4934#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4935#[cfg_attr(feature = "bon", derive(::bon::Builder))]
4936#[cfg_attr(feature = "bon", builder(on(String, into)))]
4937pub struct GroupLinkOwner {
4938 #[serde(rename = "memberId")]
4939 pub member_id: String,
4940
4941 #[serde(rename = "memberKey")]
4942 pub member_key: String,
4943
4944 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4945 #[cfg_attr(feature = "bon", builder(default))]
4946 pub undocumented: JsonObject,
4947}
4948
4949#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
4950#[serde(tag = "type")]
4951#[non_exhaustive]
4952pub enum GroupLinkPlan {
4953 #[serde(rename = "ok")]
4954 Ok {
4955 #[serde(rename = "groupSLinkInfo_", skip_serializing_if = "Option::is_none")]
4956 group_s_link_info: Option<GroupShortLinkInfo>,
4957
4958 #[serde(rename = "groupSLinkData_", skip_serializing_if = "Option::is_none")]
4959 group_s_link_data: Option<GroupShortLinkData>,
4960
4961 #[serde(rename = "ownerVerification", skip_serializing_if = "Option::is_none")]
4962 owner_verification: Option<OwnerVerification>,
4963
4964 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4965 undocumented: JsonObject,
4966 },
4967 #[serde(rename = "ownLink")]
4968 OwnLink {
4969 #[serde(rename = "groupInfo")]
4970 group_info: GroupInfo,
4971
4972 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4973 undocumented: JsonObject,
4974 },
4975 #[serde(rename = "connectingConfirmReconnect")]
4976 ConnectingConfirmReconnect,
4977 #[serde(rename = "connectingProhibit")]
4978 ConnectingProhibit {
4979 #[serde(rename = "groupInfo_", skip_serializing_if = "Option::is_none")]
4980 group_info: Option<GroupInfo>,
4981
4982 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
4983 undocumented: JsonObject,
4984 },
4985 #[serde(rename = "known")]
4986 Known {
4987 #[serde(rename = "groupInfo")]
4988 group_info: GroupInfo,
4989
4990 #[serde(rename = "groupUpdated", default)]
4991 group_updated: bool,
4992
4993 #[serde(rename = "ownerVerification", skip_serializing_if = "Option::is_none")]
4994 owner_verification: Option<OwnerVerification>,
4995
4996 #[serde(rename = "linkOwners")]
4997 link_owners: Vec<GroupLinkOwner>,
4998
4999 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5000 undocumented: JsonObject,
5001 },
5002 #[serde(rename = "noRelays")]
5003 NoRelays {
5004 #[serde(rename = "groupSLinkData_", skip_serializing_if = "Option::is_none")]
5005 group_s_link_data: Option<GroupShortLinkData>,
5006
5007 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5008 undocumented: JsonObject,
5009 },
5010 #[serde(rename = "updateRequired")]
5011 UpdateRequired {
5012 #[serde(rename = "groupSLinkData_", skip_serializing_if = "Option::is_none")]
5013 group_s_link_data: Option<GroupShortLinkData>,
5014
5015 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5016 undocumented: JsonObject,
5017 },
5018 #[serde(untagged)]
5019 Undocumented(JsonObject),
5020}
5021
5022impl GroupLinkPlan {
5023 pub fn make_ok(
5024 group_s_link_info: Option<GroupShortLinkInfo>,
5025 group_s_link_data: Option<GroupShortLinkData>,
5026 owner_verification: Option<OwnerVerification>,
5027 ) -> Self {
5028 Self::Ok {
5029 group_s_link_info,
5030 group_s_link_data,
5031 owner_verification,
5032 undocumented: Default::default(),
5033 }
5034 }
5035
5036 pub fn make_own_link(group_info: GroupInfo) -> Self {
5037 Self::OwnLink {
5038 group_info,
5039 undocumented: Default::default(),
5040 }
5041 }
5042
5043 pub fn make_connecting_confirm_reconnect() -> Self {
5044 Self::ConnectingConfirmReconnect
5045 }
5046
5047 pub fn make_connecting_prohibit(group_info: Option<GroupInfo>) -> Self {
5048 Self::ConnectingProhibit {
5049 group_info,
5050 undocumented: Default::default(),
5051 }
5052 }
5053
5054 pub fn make_known(
5055 group_info: GroupInfo,
5056 group_updated: bool,
5057 owner_verification: Option<OwnerVerification>,
5058 link_owners: Vec<GroupLinkOwner>,
5059 ) -> Self {
5060 Self::Known {
5061 group_info,
5062 group_updated,
5063 owner_verification,
5064 link_owners,
5065 undocumented: Default::default(),
5066 }
5067 }
5068
5069 pub fn make_no_relays(group_s_link_data: Option<GroupShortLinkData>) -> Self {
5070 Self::NoRelays {
5071 group_s_link_data,
5072 undocumented: Default::default(),
5073 }
5074 }
5075
5076 pub fn make_update_required(group_s_link_data: Option<GroupShortLinkData>) -> Self {
5077 Self::UpdateRequired {
5078 group_s_link_data,
5079 undocumented: Default::default(),
5080 }
5081 }
5082}
5083
5084impl GroupLinkPlan {
5085 pub fn ok(&self) -> Option<GroupLinkPlanOkRef<'_>> {
5086 if let Self::Ok {
5087 group_s_link_info,
5088 group_s_link_data,
5089 owner_verification,
5090 ..
5091 } = self
5092 {
5093 Some(GroupLinkPlanOkRef {
5094 group_s_link_info,
5095 group_s_link_data,
5096 owner_verification,
5097 })
5098 } else {
5099 None
5100 }
5101 }
5102 pub fn own_link(&self) -> Option<&GroupInfo> {
5103 if let Self::OwnLink { group_info, .. } = self {
5104 Some(group_info)
5105 } else {
5106 None
5107 }
5108 }
5109 pub fn is_connecting_confirm_reconnect(&self) -> bool {
5110 matches!(self, Self::ConnectingConfirmReconnect)
5111 }
5112 pub fn connecting_prohibit(&self) -> Option<&Option<GroupInfo>> {
5113 if let Self::ConnectingProhibit { group_info, .. } = self {
5114 Some(group_info)
5115 } else {
5116 None
5117 }
5118 }
5119 pub fn known(&self) -> Option<GroupLinkPlanKnownRef<'_>> {
5120 if let Self::Known {
5121 group_info,
5122 group_updated,
5123 owner_verification,
5124 link_owners,
5125 ..
5126 } = self
5127 {
5128 Some(GroupLinkPlanKnownRef {
5129 group_info,
5130 group_updated,
5131 owner_verification,
5132 link_owners,
5133 })
5134 } else {
5135 None
5136 }
5137 }
5138 pub fn no_relays(&self) -> Option<&Option<GroupShortLinkData>> {
5139 if let Self::NoRelays {
5140 group_s_link_data, ..
5141 } = self
5142 {
5143 Some(group_s_link_data)
5144 } else {
5145 None
5146 }
5147 }
5148 pub fn update_required(&self) -> Option<&Option<GroupShortLinkData>> {
5149 if let Self::UpdateRequired {
5150 group_s_link_data, ..
5151 } = self
5152 {
5153 Some(group_s_link_data)
5154 } else {
5155 None
5156 }
5157 }
5158}
5159#[derive(Clone, Copy)]
5160pub struct GroupLinkPlanOkRef<'a> {
5161 pub group_s_link_info: &'a Option<GroupShortLinkInfo>,
5162 pub group_s_link_data: &'a Option<GroupShortLinkData>,
5163 pub owner_verification: &'a Option<OwnerVerification>,
5164}
5165#[derive(Clone, Copy)]
5166pub struct GroupLinkPlanKnownRef<'a> {
5167 pub group_info: &'a GroupInfo,
5168 pub group_updated: &'a bool,
5169 pub owner_verification: &'a Option<OwnerVerification>,
5170 pub link_owners: &'a Vec<GroupLinkOwner>,
5171}
5172
5173#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5174#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5175#[cfg_attr(feature = "bon", builder(on(String, into)))]
5176pub struct GroupMember {
5177 #[serde(
5178 rename = "groupMemberId",
5179 deserialize_with = "deserialize_number_from_string"
5180 )]
5181 pub group_member_id: i64,
5182
5183 #[serde(
5184 rename = "groupId",
5185 deserialize_with = "deserialize_number_from_string"
5186 )]
5187 pub group_id: i64,
5188
5189 #[serde(
5190 rename = "indexInGroup",
5191 deserialize_with = "deserialize_number_from_string"
5192 )]
5193 pub index_in_group: i64,
5194
5195 #[serde(rename = "memberId")]
5196 pub member_id: String,
5197
5198 #[serde(rename = "memberRole")]
5199 pub member_role: GroupMemberRole,
5200
5201 #[serde(rename = "memberCategory")]
5202 pub member_category: GroupMemberCategory,
5203
5204 #[serde(rename = "memberStatus")]
5205 pub member_status: GroupMemberStatus,
5206
5207 #[serde(rename = "memberSettings")]
5208 pub member_settings: GroupMemberSettings,
5209
5210 #[serde(rename = "blockedByAdmin", default)]
5211 pub blocked_by_admin: bool,
5212
5213 #[serde(rename = "invitedBy")]
5214 pub invited_by: InvitedBy,
5215
5216 #[serde(
5217 rename = "invitedByGroupMemberId",
5218 skip_serializing_if = "Option::is_none",
5219 deserialize_with = "deserialize_option_number_from_string",
5220 default
5221 )]
5222 pub invited_by_group_member_id: Option<i64>,
5223
5224 #[serde(rename = "localDisplayName")]
5225 pub local_display_name: String,
5226
5227 #[serde(rename = "memberProfile")]
5228 pub member_profile: LocalProfile,
5229
5230 #[serde(
5231 rename = "memberContactId",
5232 skip_serializing_if = "Option::is_none",
5233 deserialize_with = "deserialize_option_number_from_string",
5234 default
5235 )]
5236 pub member_contact_id: Option<i64>,
5237
5238 #[serde(
5239 rename = "memberContactProfileId",
5240 deserialize_with = "deserialize_number_from_string"
5241 )]
5242 pub member_contact_profile_id: i64,
5243
5244 #[serde(rename = "activeConn", skip_serializing_if = "Option::is_none")]
5245 pub active_conn: Option<Connection>,
5246
5247 #[serde(rename = "memberChatVRange")]
5248 pub member_chat_v_range: VersionRange,
5249
5250 #[serde(rename = "createdAt")]
5251 pub created_at: UtcTime,
5252
5253 #[serde(rename = "updatedAt")]
5254 pub updated_at: UtcTime,
5255
5256 #[serde(rename = "supportChat", skip_serializing_if = "Option::is_none")]
5257 pub support_chat: Option<GroupSupportChat>,
5258
5259 #[serde(rename = "memberPubKey", skip_serializing_if = "Option::is_none")]
5260 pub member_pub_key: Option<String>,
5261
5262 #[serde(rename = "relayLink", skip_serializing_if = "Option::is_none")]
5263 pub relay_link: Option<String>,
5264
5265 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5266 #[cfg_attr(feature = "bon", builder(default))]
5267 pub undocumented: JsonObject,
5268}
5269
5270#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5271#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5272#[cfg_attr(feature = "bon", builder(on(String, into)))]
5273pub struct GroupMemberAdmission {
5274 #[serde(rename = "review", skip_serializing_if = "Option::is_none")]
5275 pub review: Option<MemberCriteria>,
5276
5277 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5278 #[cfg_attr(feature = "bon", builder(default))]
5279 pub undocumented: JsonObject,
5280}
5281
5282#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
5283#[non_exhaustive]
5284pub enum GroupMemberCategory {
5285 #[default]
5286 #[serde(rename = "user")]
5287 User,
5288 #[serde(rename = "invitee")]
5289 Invitee,
5290 #[serde(rename = "host")]
5291 Host,
5292 #[serde(rename = "pre")]
5293 Pre,
5294 #[serde(rename = "post")]
5295 Post,
5296}
5297
5298#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5299#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5300#[cfg_attr(feature = "bon", builder(on(String, into)))]
5301pub struct GroupMemberRef {
5302 #[serde(
5303 rename = "groupMemberId",
5304 deserialize_with = "deserialize_number_from_string"
5305 )]
5306 pub group_member_id: i64,
5307
5308 #[serde(rename = "profile")]
5309 pub profile: Profile,
5310
5311 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5312 #[cfg_attr(feature = "bon", builder(default))]
5313 pub undocumented: JsonObject,
5314}
5315
5316#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
5317#[non_exhaustive]
5318pub enum GroupMemberRole {
5319 #[default]
5320 #[serde(rename = "relay")]
5321 Relay,
5322 #[serde(rename = "observer")]
5323 Observer,
5324 #[serde(rename = "author")]
5325 Author,
5326 #[serde(rename = "member")]
5327 Member,
5328 #[serde(rename = "moderator")]
5329 Moderator,
5330 #[serde(rename = "admin")]
5331 Admin,
5332 #[serde(rename = "owner")]
5333 Owner,
5334}
5335
5336#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5337#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5338#[cfg_attr(feature = "bon", builder(on(String, into)))]
5339pub struct GroupMemberSettings {
5340 #[serde(rename = "showMessages", default)]
5341 pub show_messages: bool,
5342
5343 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5344 #[cfg_attr(feature = "bon", builder(default))]
5345 pub undocumented: JsonObject,
5346}
5347
5348#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
5349#[non_exhaustive]
5350pub enum GroupMemberStatus {
5351 #[default]
5352 #[serde(rename = "rejected")]
5353 Rejected,
5354 #[serde(rename = "removed")]
5355 Removed,
5356 #[serde(rename = "left")]
5357 Left,
5358 #[serde(rename = "deleted")]
5359 Deleted,
5360 #[serde(rename = "unknown")]
5361 Unknown,
5362 #[serde(rename = "invited")]
5363 Invited,
5364 #[serde(rename = "pending_approval")]
5365 PendingApproval,
5366 #[serde(rename = "pending_review")]
5367 PendingReview,
5368 #[serde(rename = "introduced")]
5369 Introduced,
5370 #[serde(rename = "intro-inv")]
5371 IntroInv,
5372 #[serde(rename = "accepted")]
5373 Accepted,
5374 #[serde(rename = "announced")]
5375 Announced,
5376 #[serde(rename = "connected")]
5377 Connected,
5378 #[serde(rename = "complete")]
5379 Complete,
5380 #[serde(rename = "creator")]
5381 Creator,
5382}
5383
5384#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5385#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5386#[cfg_attr(feature = "bon", builder(on(String, into)))]
5387pub struct GroupPreference {
5388 #[serde(rename = "enable")]
5389 pub enable: GroupFeatureEnabled,
5390
5391 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5392 #[cfg_attr(feature = "bon", builder(default))]
5393 pub undocumented: JsonObject,
5394}
5395
5396#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5397#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5398#[cfg_attr(feature = "bon", builder(on(String, into)))]
5399pub struct GroupPreferences {
5400 #[serde(rename = "timedMessages", skip_serializing_if = "Option::is_none")]
5401 pub timed_messages: Option<TimedMessagesGroupPreference>,
5402
5403 #[serde(rename = "directMessages", skip_serializing_if = "Option::is_none")]
5404 pub direct_messages: Option<RoleGroupPreference>,
5405
5406 #[serde(rename = "fullDelete", skip_serializing_if = "Option::is_none")]
5407 pub full_delete: Option<GroupPreference>,
5408
5409 #[serde(rename = "reactions", skip_serializing_if = "Option::is_none")]
5410 pub reactions: Option<GroupPreference>,
5411
5412 #[serde(rename = "voice", skip_serializing_if = "Option::is_none")]
5413 pub voice: Option<RoleGroupPreference>,
5414
5415 #[serde(rename = "files", skip_serializing_if = "Option::is_none")]
5416 pub files: Option<RoleGroupPreference>,
5417
5418 #[serde(rename = "simplexLinks", skip_serializing_if = "Option::is_none")]
5419 pub simplex_links: Option<RoleGroupPreference>,
5420
5421 #[serde(rename = "reports", skip_serializing_if = "Option::is_none")]
5422 pub reports: Option<GroupPreference>,
5423
5424 #[serde(rename = "history", skip_serializing_if = "Option::is_none")]
5425 pub history: Option<GroupPreference>,
5426
5427 #[serde(rename = "support", skip_serializing_if = "Option::is_none")]
5428 pub support: Option<SupportGroupPreference>,
5429
5430 #[serde(rename = "sessions", skip_serializing_if = "Option::is_none")]
5431 pub sessions: Option<RoleGroupPreference>,
5432
5433 #[serde(rename = "comments", skip_serializing_if = "Option::is_none")]
5434 pub comments: Option<CommentsGroupPreference>,
5435
5436 #[serde(rename = "commands", skip_serializing_if = "Option::is_none")]
5437 pub commands: Option<Vec<ChatBotCommand>>,
5438
5439 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5440 #[cfg_attr(feature = "bon", builder(default))]
5441 pub undocumented: JsonObject,
5442}
5443
5444#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5445#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5446#[cfg_attr(feature = "bon", builder(on(String, into)))]
5447pub struct GroupProfile {
5448 #[serde(rename = "displayName")]
5449 pub display_name: String,
5450
5451 #[serde(rename = "fullName")]
5452 pub full_name: String,
5453
5454 #[serde(rename = "shortDescr", skip_serializing_if = "Option::is_none")]
5455 pub short_descr: Option<String>,
5456
5457 #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
5458 pub description: Option<String>,
5459
5460 #[serde(rename = "image", skip_serializing_if = "Option::is_none")]
5461 pub image: Option<String>,
5462
5463 #[serde(rename = "publicGroup", skip_serializing_if = "Option::is_none")]
5464 pub public_group: Option<PublicGroupProfile>,
5465
5466 #[serde(rename = "groupPreferences", skip_serializing_if = "Option::is_none")]
5467 pub group_preferences: Option<GroupPreferences>,
5468
5469 #[serde(rename = "memberAdmission", skip_serializing_if = "Option::is_none")]
5470 pub member_admission: Option<GroupMemberAdmission>,
5471
5472 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5473 #[cfg_attr(feature = "bon", builder(default))]
5474 pub undocumented: JsonObject,
5475}
5476
5477#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5478#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5479#[cfg_attr(feature = "bon", builder(on(String, into)))]
5480pub struct GroupRelay {
5481 #[serde(
5482 rename = "groupRelayId",
5483 deserialize_with = "deserialize_number_from_string"
5484 )]
5485 pub group_relay_id: i64,
5486
5487 #[serde(
5488 rename = "groupMemberId",
5489 deserialize_with = "deserialize_number_from_string"
5490 )]
5491 pub group_member_id: i64,
5492
5493 #[serde(rename = "userChatRelay")]
5494 pub user_chat_relay: UserChatRelay,
5495
5496 #[serde(rename = "relayStatus")]
5497 pub relay_status: RelayStatus,
5498
5499 #[serde(rename = "relayLink", skip_serializing_if = "Option::is_none")]
5500 pub relay_link: Option<String>,
5501
5502 #[serde(rename = "relayCap")]
5503 pub relay_cap: RelayCapabilities,
5504
5505 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5506 #[cfg_attr(feature = "bon", builder(default))]
5507 pub undocumented: JsonObject,
5508}
5509
5510#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5511#[serde(tag = "type")]
5512#[non_exhaustive]
5513pub enum GroupRootKey {
5514 #[serde(rename = "private")]
5515 Private {
5516 #[serde(rename = "rootPrivKey")]
5517 root_priv_key: String,
5518
5519 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5520 undocumented: JsonObject,
5521 },
5522 #[serde(rename = "public")]
5523 Public {
5524 #[serde(rename = "rootPubKey")]
5525 root_pub_key: String,
5526
5527 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5528 undocumented: JsonObject,
5529 },
5530 #[serde(untagged)]
5531 Undocumented(JsonObject),
5532}
5533
5534impl GroupRootKey {
5535 pub fn make_private(root_priv_key: String) -> Self {
5536 Self::Private {
5537 root_priv_key,
5538 undocumented: Default::default(),
5539 }
5540 }
5541
5542 pub fn make_public(root_pub_key: String) -> Self {
5543 Self::Public {
5544 root_pub_key,
5545 undocumented: Default::default(),
5546 }
5547 }
5548}
5549
5550impl GroupRootKey {
5551 pub fn private(&self) -> Option<&String> {
5552 if let Self::Private { root_priv_key, .. } = self {
5553 Some(root_priv_key)
5554 } else {
5555 None
5556 }
5557 }
5558 pub fn public(&self) -> Option<&String> {
5559 if let Self::Public { root_pub_key, .. } = self {
5560 Some(root_pub_key)
5561 } else {
5562 None
5563 }
5564 }
5565}
5566
5567#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5568#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5569#[cfg_attr(feature = "bon", builder(on(String, into)))]
5570pub struct GroupShortLinkData {
5571 #[serde(rename = "groupProfile")]
5572 pub group_profile: GroupProfile,
5573
5574 #[serde(rename = "publicGroupData", skip_serializing_if = "Option::is_none")]
5575 pub public_group_data: Option<PublicGroupData>,
5576
5577 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5578 #[cfg_attr(feature = "bon", builder(default))]
5579 pub undocumented: JsonObject,
5580}
5581
5582#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5583#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5584#[cfg_attr(feature = "bon", builder(on(String, into)))]
5585pub struct GroupShortLinkInfo {
5586 #[serde(rename = "direct", default)]
5587 pub direct: bool,
5588
5589 #[serde(rename = "groupRelays")]
5590 pub group_relays: Vec<String>,
5591
5592 #[serde(rename = "publicGroupId", skip_serializing_if = "Option::is_none")]
5593 pub public_group_id: Option<String>,
5594
5595 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5596 #[cfg_attr(feature = "bon", builder(default))]
5597 pub undocumented: JsonObject,
5598}
5599
5600#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5601#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5602#[cfg_attr(feature = "bon", builder(on(String, into)))]
5603pub struct GroupSummary {
5604 #[serde(
5605 rename = "currentMembers",
5606 deserialize_with = "deserialize_number_from_string"
5607 )]
5608 pub current_members: i64,
5609
5610 #[serde(
5611 rename = "publicMemberCount",
5612 skip_serializing_if = "Option::is_none",
5613 deserialize_with = "deserialize_option_number_from_string",
5614 default
5615 )]
5616 pub public_member_count: Option<i64>,
5617
5618 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5619 #[cfg_attr(feature = "bon", builder(default))]
5620 pub undocumented: JsonObject,
5621}
5622
5623#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5624#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5625#[cfg_attr(feature = "bon", builder(on(String, into)))]
5626pub struct GroupSupportChat {
5627 #[serde(rename = "chatTs")]
5628 pub chat_ts: UtcTime,
5629
5630 #[serde(rename = "unread", deserialize_with = "deserialize_number_from_string")]
5631 pub unread: i64,
5632
5633 #[serde(
5634 rename = "memberAttention",
5635 deserialize_with = "deserialize_number_from_string"
5636 )]
5637 pub member_attention: i64,
5638
5639 #[serde(
5640 rename = "mentions",
5641 deserialize_with = "deserialize_number_from_string"
5642 )]
5643 pub mentions: i64,
5644
5645 #[serde(
5646 rename = "lastMsgFromMemberTs",
5647 skip_serializing_if = "Option::is_none"
5648 )]
5649 pub last_msg_from_member_ts: Option<UtcTime>,
5650
5651 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5652 #[cfg_attr(feature = "bon", builder(default))]
5653 pub undocumented: JsonObject,
5654}
5655
5656#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
5657#[non_exhaustive]
5658pub enum GroupType {
5659 #[default]
5660 #[serde(rename = "channel")]
5661 Channel,
5662 #[serde(rename = "group")]
5663 Group,
5664}
5665
5666#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
5667#[non_exhaustive]
5668pub enum InlineFileMode {
5669 #[default]
5670 #[serde(rename = "offer")]
5671 Offer,
5672 #[serde(rename = "sent")]
5673 Sent,
5674}
5675
5676#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5677#[serde(tag = "type")]
5678#[non_exhaustive]
5679pub enum InvitationLinkPlan {
5680 #[serde(rename = "ok")]
5681 Ok {
5682 #[serde(rename = "contactSLinkData_", skip_serializing_if = "Option::is_none")]
5683 contact_s_link_data: Option<ContactShortLinkData>,
5684
5685 #[serde(rename = "ownerVerification", skip_serializing_if = "Option::is_none")]
5686 owner_verification: Option<OwnerVerification>,
5687
5688 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5689 undocumented: JsonObject,
5690 },
5691 #[serde(rename = "ownLink")]
5692 OwnLink,
5693 #[serde(rename = "connecting")]
5694 Connecting {
5695 #[serde(rename = "contact_", skip_serializing_if = "Option::is_none")]
5696 contact: Option<Contact>,
5697
5698 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5699 undocumented: JsonObject,
5700 },
5701 #[serde(rename = "known")]
5702 Known {
5703 #[serde(rename = "contact")]
5704 contact: Contact,
5705
5706 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5707 undocumented: JsonObject,
5708 },
5709 #[serde(untagged)]
5710 Undocumented(JsonObject),
5711}
5712
5713impl InvitationLinkPlan {
5714 pub fn make_ok(
5715 contact_s_link_data: Option<ContactShortLinkData>,
5716 owner_verification: Option<OwnerVerification>,
5717 ) -> Self {
5718 Self::Ok {
5719 contact_s_link_data,
5720 owner_verification,
5721 undocumented: Default::default(),
5722 }
5723 }
5724
5725 pub fn make_own_link() -> Self {
5726 Self::OwnLink
5727 }
5728
5729 pub fn make_connecting(contact: Option<Contact>) -> Self {
5730 Self::Connecting {
5731 contact,
5732 undocumented: Default::default(),
5733 }
5734 }
5735
5736 pub fn make_known(contact: Contact) -> Self {
5737 Self::Known {
5738 contact,
5739 undocumented: Default::default(),
5740 }
5741 }
5742}
5743
5744impl InvitationLinkPlan {
5745 pub fn ok(&self) -> Option<InvitationLinkPlanOkRef<'_>> {
5746 if let Self::Ok {
5747 contact_s_link_data,
5748 owner_verification,
5749 ..
5750 } = self
5751 {
5752 Some(InvitationLinkPlanOkRef {
5753 contact_s_link_data,
5754 owner_verification,
5755 })
5756 } else {
5757 None
5758 }
5759 }
5760 pub fn is_own_link(&self) -> bool {
5761 matches!(self, Self::OwnLink)
5762 }
5763 pub fn connecting(&self) -> Option<&Option<Contact>> {
5764 if let Self::Connecting { contact, .. } = self {
5765 Some(contact)
5766 } else {
5767 None
5768 }
5769 }
5770 pub fn known(&self) -> Option<&Contact> {
5771 if let Self::Known { contact, .. } = self {
5772 Some(contact)
5773 } else {
5774 None
5775 }
5776 }
5777}
5778#[derive(Clone, Copy)]
5779pub struct InvitationLinkPlanOkRef<'a> {
5780 pub contact_s_link_data: &'a Option<ContactShortLinkData>,
5781 pub owner_verification: &'a Option<OwnerVerification>,
5782}
5783
5784#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5785#[serde(tag = "type")]
5786#[non_exhaustive]
5787pub enum InvitedBy {
5788 #[serde(rename = "contact")]
5789 Contact {
5790 #[serde(
5791 rename = "byContactId",
5792 deserialize_with = "deserialize_number_from_string"
5793 )]
5794 by_contact_id: i64,
5795
5796 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5797 undocumented: JsonObject,
5798 },
5799 #[serde(rename = "user")]
5800 User,
5801 #[serde(rename = "unknown")]
5802 Unknown,
5803 #[serde(untagged)]
5804 Undocumented(JsonObject),
5805}
5806
5807impl InvitedBy {
5808 pub fn make_contact(by_contact_id: i64) -> Self {
5809 Self::Contact {
5810 by_contact_id,
5811 undocumented: Default::default(),
5812 }
5813 }
5814
5815 pub fn make_user() -> Self {
5816 Self::User
5817 }
5818
5819 pub fn make_unknown() -> Self {
5820 Self::Unknown
5821 }
5822}
5823
5824impl InvitedBy {
5825 pub fn contact(&self) -> Option<&i64> {
5826 if let Self::Contact { by_contact_id, .. } = self {
5827 Some(by_contact_id)
5828 } else {
5829 None
5830 }
5831 }
5832 pub fn is_user(&self) -> bool {
5833 matches!(self, Self::User)
5834 }
5835 pub fn is_unknown(&self) -> bool {
5836 matches!(self, Self::Unknown)
5837 }
5838}
5839
5840#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5841#[serde(tag = "type")]
5842#[non_exhaustive]
5843pub enum LinkContent {
5844 #[serde(rename = "page")]
5845 Page,
5846 #[serde(rename = "image")]
5847 Image,
5848 #[serde(rename = "video")]
5849 Video {
5850 #[serde(
5851 rename = "duration",
5852 skip_serializing_if = "Option::is_none",
5853 deserialize_with = "deserialize_option_number_from_string",
5854 default
5855 )]
5856 duration: Option<i32>,
5857
5858 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5859 undocumented: JsonObject,
5860 },
5861 #[serde(rename = "unknown")]
5862 Unknown {
5863 #[serde(rename = "tag")]
5864 tag: String,
5865
5866 #[serde(rename = "json")]
5867 json: JsonObject,
5868
5869 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5870 undocumented: JsonObject,
5871 },
5872 #[serde(untagged)]
5873 Undocumented(JsonObject),
5874}
5875
5876impl LinkContent {
5877 pub fn make_page() -> Self {
5878 Self::Page
5879 }
5880
5881 pub fn make_image() -> Self {
5882 Self::Image
5883 }
5884
5885 pub fn make_video(duration: Option<i32>) -> Self {
5886 Self::Video {
5887 duration,
5888 undocumented: Default::default(),
5889 }
5890 }
5891
5892 pub fn make_unknown(tag: String, json: JsonObject) -> Self {
5893 Self::Unknown {
5894 tag,
5895 json,
5896 undocumented: Default::default(),
5897 }
5898 }
5899}
5900
5901impl LinkContent {
5902 pub fn is_page(&self) -> bool {
5903 matches!(self, Self::Page)
5904 }
5905 pub fn is_image(&self) -> bool {
5906 matches!(self, Self::Image)
5907 }
5908 pub fn video(&self) -> Option<&Option<i32>> {
5909 if let Self::Video { duration, .. } = self {
5910 Some(duration)
5911 } else {
5912 None
5913 }
5914 }
5915 pub fn unknown(&self) -> Option<LinkContentUnknownRef<'_>> {
5916 if let Self::Unknown { tag, json, .. } = self {
5917 Some(LinkContentUnknownRef { tag, json })
5918 } else {
5919 None
5920 }
5921 }
5922}
5923#[derive(Clone, Copy)]
5924pub struct LinkContentUnknownRef<'a> {
5925 pub tag: &'a String,
5926 pub json: &'a JsonObject,
5927}
5928
5929#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5930#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5931#[cfg_attr(feature = "bon", builder(on(String, into)))]
5932pub struct LinkOwnerSig {
5933 #[serde(rename = "ownerId", skip_serializing_if = "Option::is_none")]
5934 pub owner_id: Option<String>,
5935
5936 #[serde(rename = "chatBinding")]
5937 pub chat_binding: String,
5938
5939 #[serde(rename = "ownerSig")]
5940 pub owner_sig: String,
5941
5942 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5943 #[cfg_attr(feature = "bon", builder(default))]
5944 pub undocumented: JsonObject,
5945}
5946
5947#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5948#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5949#[cfg_attr(feature = "bon", builder(on(String, into)))]
5950pub struct LinkPreview {
5951 #[serde(rename = "uri")]
5952 pub uri: String,
5953
5954 #[serde(rename = "title")]
5955 pub title: String,
5956
5957 #[serde(rename = "description")]
5958 pub description: String,
5959
5960 #[serde(rename = "image")]
5961 pub image: String,
5962
5963 #[serde(rename = "content", skip_serializing_if = "Option::is_none")]
5964 pub content: Option<LinkContent>,
5965
5966 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5967 #[cfg_attr(feature = "bon", builder(default))]
5968 pub undocumented: JsonObject,
5969}
5970
5971#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5972#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5973#[cfg_attr(feature = "bon", builder(on(String, into)))]
5974pub struct LocalBadge {
5975 #[serde(rename = "badge")]
5976 pub badge: BadgeInfo,
5977
5978 #[serde(rename = "status")]
5979 pub status: BadgeStatus,
5980
5981 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
5982 #[cfg_attr(feature = "bon", builder(default))]
5983 pub undocumented: JsonObject,
5984}
5985
5986#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
5987#[cfg_attr(feature = "bon", derive(::bon::Builder))]
5988#[cfg_attr(feature = "bon", builder(on(String, into)))]
5989pub struct LocalProfile {
5990 #[serde(
5991 rename = "profileId",
5992 deserialize_with = "deserialize_number_from_string"
5993 )]
5994 pub profile_id: i64,
5995
5996 #[serde(rename = "displayName")]
5997 pub display_name: String,
5998
5999 #[serde(rename = "fullName")]
6000 pub full_name: String,
6001
6002 #[serde(rename = "shortDescr", skip_serializing_if = "Option::is_none")]
6003 pub short_descr: Option<String>,
6004
6005 #[serde(rename = "image", skip_serializing_if = "Option::is_none")]
6006 pub image: Option<String>,
6007
6008 #[serde(rename = "contactLink", skip_serializing_if = "Option::is_none")]
6009 pub contact_link: Option<String>,
6010
6011 #[serde(rename = "preferences", skip_serializing_if = "Option::is_none")]
6012 pub preferences: Option<Preferences>,
6013
6014 #[serde(rename = "peerType", skip_serializing_if = "Option::is_none")]
6015 pub peer_type: Option<ChatPeerType>,
6016
6017 #[serde(rename = "localBadge", skip_serializing_if = "Option::is_none")]
6018 pub local_badge: Option<LocalBadge>,
6019
6020 #[serde(rename = "localAlias")]
6021 pub local_alias: String,
6022
6023 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6024 #[cfg_attr(feature = "bon", builder(default))]
6025 pub undocumented: JsonObject,
6026}
6027
6028#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
6029#[non_exhaustive]
6030pub enum MemberCriteria {
6031 #[default]
6032 #[serde(rename = "all")]
6033 All,
6034}
6035
6036#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6038#[serde(tag = "type")]
6039#[non_exhaustive]
6040pub enum MsgChatLink {
6041 #[serde(rename = "contact")]
6042 Contact {
6043 #[serde(rename = "connLink")]
6044 conn_link: String,
6045
6046 #[serde(rename = "profile")]
6047 profile: Profile,
6048
6049 #[serde(rename = "business", default)]
6050 business: bool,
6051
6052 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6053 undocumented: JsonObject,
6054 },
6055 #[serde(rename = "invitation")]
6056 Invitation {
6057 #[serde(rename = "invLink")]
6058 inv_link: String,
6059
6060 #[serde(rename = "profile")]
6061 profile: Profile,
6062
6063 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6064 undocumented: JsonObject,
6065 },
6066 #[serde(rename = "group")]
6067 Group {
6068 #[serde(rename = "connLink")]
6069 conn_link: String,
6070
6071 #[serde(rename = "groupProfile")]
6072 group_profile: GroupProfile,
6073
6074 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6075 undocumented: JsonObject,
6076 },
6077 #[serde(untagged)]
6078 Undocumented(JsonObject),
6079}
6080
6081impl MsgChatLink {
6082 pub fn make_contact(conn_link: String, profile: Profile, business: bool) -> Self {
6083 Self::Contact {
6084 conn_link,
6085 profile,
6086 business,
6087 undocumented: Default::default(),
6088 }
6089 }
6090
6091 pub fn make_invitation(inv_link: String, profile: Profile) -> Self {
6092 Self::Invitation {
6093 inv_link,
6094 profile,
6095 undocumented: Default::default(),
6096 }
6097 }
6098
6099 pub fn make_group(conn_link: String, group_profile: GroupProfile) -> Self {
6100 Self::Group {
6101 conn_link,
6102 group_profile,
6103 undocumented: Default::default(),
6104 }
6105 }
6106}
6107
6108impl MsgChatLink {
6109 pub fn contact(&self) -> Option<MsgChatLinkContactRef<'_>> {
6110 if let Self::Contact {
6111 conn_link,
6112 profile,
6113 business,
6114 ..
6115 } = self
6116 {
6117 Some(MsgChatLinkContactRef {
6118 conn_link,
6119 profile,
6120 business,
6121 })
6122 } else {
6123 None
6124 }
6125 }
6126 pub fn invitation(&self) -> Option<MsgChatLinkInvitationRef<'_>> {
6127 if let Self::Invitation {
6128 inv_link, profile, ..
6129 } = self
6130 {
6131 Some(MsgChatLinkInvitationRef { inv_link, profile })
6132 } else {
6133 None
6134 }
6135 }
6136 pub fn group(&self) -> Option<MsgChatLinkGroupRef<'_>> {
6137 if let Self::Group {
6138 conn_link,
6139 group_profile,
6140 ..
6141 } = self
6142 {
6143 Some(MsgChatLinkGroupRef {
6144 conn_link,
6145 group_profile,
6146 })
6147 } else {
6148 None
6149 }
6150 }
6151}
6152#[derive(Clone, Copy)]
6153pub struct MsgChatLinkContactRef<'a> {
6154 pub conn_link: &'a String,
6155 pub profile: &'a Profile,
6156 pub business: &'a bool,
6157}
6158#[derive(Clone, Copy)]
6159pub struct MsgChatLinkInvitationRef<'a> {
6160 pub inv_link: &'a String,
6161 pub profile: &'a Profile,
6162}
6163#[derive(Clone, Copy)]
6164pub struct MsgChatLinkGroupRef<'a> {
6165 pub conn_link: &'a String,
6166 pub group_profile: &'a GroupProfile,
6167}
6168
6169#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6170#[serde(tag = "type")]
6171#[non_exhaustive]
6172pub enum MsgContent {
6173 #[serde(rename = "text")]
6174 Text {
6175 #[serde(rename = "text")]
6176 text: String,
6177
6178 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6179 undocumented: JsonObject,
6180 },
6181 #[serde(rename = "link")]
6182 Link {
6183 #[serde(rename = "text")]
6184 text: String,
6185
6186 #[serde(rename = "preview")]
6187 preview: LinkPreview,
6188
6189 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6190 undocumented: JsonObject,
6191 },
6192 #[serde(rename = "image")]
6193 Image {
6194 #[serde(rename = "text")]
6195 text: String,
6196
6197 #[serde(rename = "image")]
6198 image: String,
6199
6200 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6201 undocumented: JsonObject,
6202 },
6203 #[serde(rename = "video")]
6204 Video {
6205 #[serde(rename = "text")]
6206 text: String,
6207
6208 #[serde(rename = "image")]
6209 image: String,
6210
6211 #[serde(
6212 rename = "duration",
6213 deserialize_with = "deserialize_number_from_string"
6214 )]
6215 duration: i32,
6216
6217 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6218 undocumented: JsonObject,
6219 },
6220 #[serde(rename = "voice")]
6221 Voice {
6222 #[serde(rename = "text")]
6223 text: String,
6224
6225 #[serde(
6226 rename = "duration",
6227 deserialize_with = "deserialize_number_from_string"
6228 )]
6229 duration: i32,
6230
6231 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6232 undocumented: JsonObject,
6233 },
6234 #[serde(rename = "file")]
6235 File {
6236 #[serde(rename = "text")]
6237 text: String,
6238
6239 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6240 undocumented: JsonObject,
6241 },
6242 #[serde(rename = "report")]
6243 Report {
6244 #[serde(rename = "text")]
6245 text: String,
6246
6247 #[serde(rename = "reason")]
6248 reason: ReportReason,
6249
6250 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6251 undocumented: JsonObject,
6252 },
6253 #[serde(rename = "chat")]
6254 Chat {
6255 #[serde(rename = "text")]
6256 text: String,
6257
6258 #[serde(rename = "chatLink")]
6259 chat_link: MsgChatLink,
6260
6261 #[serde(rename = "ownerSig", skip_serializing_if = "Option::is_none")]
6262 owner_sig: Option<LinkOwnerSig>,
6263
6264 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6265 undocumented: JsonObject,
6266 },
6267 #[serde(rename = "unknown")]
6268 Unknown {
6269 #[serde(rename = "tag")]
6270 tag: String,
6271
6272 #[serde(rename = "text")]
6273 text: String,
6274
6275 #[serde(rename = "json")]
6276 json: JsonObject,
6277
6278 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6279 undocumented: JsonObject,
6280 },
6281 #[serde(untagged)]
6282 Undocumented(JsonObject),
6283}
6284
6285impl MsgContent {
6286 pub fn make_text(text: String) -> Self {
6287 Self::Text {
6288 text,
6289 undocumented: Default::default(),
6290 }
6291 }
6292
6293 pub fn make_link(text: String, preview: LinkPreview) -> Self {
6294 Self::Link {
6295 text,
6296 preview,
6297 undocumented: Default::default(),
6298 }
6299 }
6300
6301 pub fn make_image(text: String, image: String) -> Self {
6302 Self::Image {
6303 text,
6304 image,
6305 undocumented: Default::default(),
6306 }
6307 }
6308
6309 pub fn make_video(text: String, image: String, duration: i32) -> Self {
6310 Self::Video {
6311 text,
6312 image,
6313 duration,
6314 undocumented: Default::default(),
6315 }
6316 }
6317
6318 pub fn make_voice(text: String, duration: i32) -> Self {
6319 Self::Voice {
6320 text,
6321 duration,
6322 undocumented: Default::default(),
6323 }
6324 }
6325
6326 pub fn make_file(text: String) -> Self {
6327 Self::File {
6328 text,
6329 undocumented: Default::default(),
6330 }
6331 }
6332
6333 pub fn make_report(text: String, reason: ReportReason) -> Self {
6334 Self::Report {
6335 text,
6336 reason,
6337 undocumented: Default::default(),
6338 }
6339 }
6340
6341 pub fn make_chat(
6342 text: String,
6343 chat_link: MsgChatLink,
6344 owner_sig: Option<LinkOwnerSig>,
6345 ) -> Self {
6346 Self::Chat {
6347 text,
6348 chat_link,
6349 owner_sig,
6350 undocumented: Default::default(),
6351 }
6352 }
6353
6354 pub fn make_unknown(tag: String, text: String, json: JsonObject) -> Self {
6355 Self::Unknown {
6356 tag,
6357 text,
6358 json,
6359 undocumented: Default::default(),
6360 }
6361 }
6362}
6363
6364impl MsgContent {
6365 pub fn text(&self) -> Option<&String> {
6366 if let Self::Text { text, .. } = self {
6367 Some(text)
6368 } else {
6369 None
6370 }
6371 }
6372 pub fn link(&self) -> Option<MsgContentLinkRef<'_>> {
6373 if let Self::Link { text, preview, .. } = self {
6374 Some(MsgContentLinkRef { text, preview })
6375 } else {
6376 None
6377 }
6378 }
6379 pub fn image(&self) -> Option<MsgContentImageRef<'_>> {
6380 if let Self::Image { text, image, .. } = self {
6381 Some(MsgContentImageRef { text, image })
6382 } else {
6383 None
6384 }
6385 }
6386 pub fn video(&self) -> Option<MsgContentVideoRef<'_>> {
6387 if let Self::Video {
6388 text,
6389 image,
6390 duration,
6391 ..
6392 } = self
6393 {
6394 Some(MsgContentVideoRef {
6395 text,
6396 image,
6397 duration,
6398 })
6399 } else {
6400 None
6401 }
6402 }
6403 pub fn voice(&self) -> Option<MsgContentVoiceRef<'_>> {
6404 if let Self::Voice { text, duration, .. } = self {
6405 Some(MsgContentVoiceRef { text, duration })
6406 } else {
6407 None
6408 }
6409 }
6410 pub fn file(&self) -> Option<&String> {
6411 if let Self::File { text, .. } = self {
6412 Some(text)
6413 } else {
6414 None
6415 }
6416 }
6417 pub fn report(&self) -> Option<MsgContentReportRef<'_>> {
6418 if let Self::Report { text, reason, .. } = self {
6419 Some(MsgContentReportRef { text, reason })
6420 } else {
6421 None
6422 }
6423 }
6424 pub fn chat(&self) -> Option<MsgContentChatRef<'_>> {
6425 if let Self::Chat {
6426 text,
6427 chat_link,
6428 owner_sig,
6429 ..
6430 } = self
6431 {
6432 Some(MsgContentChatRef {
6433 text,
6434 chat_link,
6435 owner_sig,
6436 })
6437 } else {
6438 None
6439 }
6440 }
6441 pub fn unknown(&self) -> Option<MsgContentUnknownRef<'_>> {
6442 if let Self::Unknown {
6443 tag, text, json, ..
6444 } = self
6445 {
6446 Some(MsgContentUnknownRef { tag, text, json })
6447 } else {
6448 None
6449 }
6450 }
6451}
6452#[derive(Clone, Copy)]
6453pub struct MsgContentLinkRef<'a> {
6454 pub text: &'a String,
6455 pub preview: &'a LinkPreview,
6456}
6457#[derive(Clone, Copy)]
6458pub struct MsgContentImageRef<'a> {
6459 pub text: &'a String,
6460 pub image: &'a String,
6461}
6462#[derive(Clone, Copy)]
6463pub struct MsgContentVideoRef<'a> {
6464 pub text: &'a String,
6465 pub image: &'a String,
6466 pub duration: &'a i32,
6467}
6468#[derive(Clone, Copy)]
6469pub struct MsgContentVoiceRef<'a> {
6470 pub text: &'a String,
6471 pub duration: &'a i32,
6472}
6473#[derive(Clone, Copy)]
6474pub struct MsgContentReportRef<'a> {
6475 pub text: &'a String,
6476 pub reason: &'a ReportReason,
6477}
6478#[derive(Clone, Copy)]
6479pub struct MsgContentChatRef<'a> {
6480 pub text: &'a String,
6481 pub chat_link: &'a MsgChatLink,
6482 pub owner_sig: &'a Option<LinkOwnerSig>,
6483}
6484#[derive(Clone, Copy)]
6485pub struct MsgContentUnknownRef<'a> {
6486 pub tag: &'a String,
6487 pub text: &'a String,
6488 pub json: &'a JsonObject,
6489}
6490
6491#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
6492#[non_exhaustive]
6493pub enum MsgDirection {
6494 #[default]
6495 #[serde(rename = "rcv")]
6496 Rcv,
6497 #[serde(rename = "snd")]
6498 Snd,
6499}
6500
6501#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
6502#[non_exhaustive]
6503pub enum MsgFilter {
6504 #[default]
6505 #[serde(rename = "none")]
6506 None,
6507 #[serde(rename = "all")]
6508 All,
6509 #[serde(rename = "mentions")]
6510 Mentions,
6511}
6512
6513#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6514#[serde(tag = "type")]
6515#[non_exhaustive]
6516pub enum MsgReaction {
6517 #[serde(rename = "emoji")]
6518 Emoji {
6519 #[serde(rename = "emoji")]
6520 emoji: String,
6521
6522 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6523 undocumented: JsonObject,
6524 },
6525 #[serde(rename = "unknown")]
6526 Unknown {
6527 #[serde(rename = "tag")]
6528 tag: String,
6529
6530 #[serde(rename = "json")]
6531 json: JsonObject,
6532
6533 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6534 undocumented: JsonObject,
6535 },
6536 #[serde(untagged)]
6537 Undocumented(JsonObject),
6538}
6539
6540impl MsgReaction {
6541 pub fn make_emoji(emoji: String) -> Self {
6542 Self::Emoji {
6543 emoji,
6544 undocumented: Default::default(),
6545 }
6546 }
6547
6548 pub fn make_unknown(tag: String, json: JsonObject) -> Self {
6549 Self::Unknown {
6550 tag,
6551 json,
6552 undocumented: Default::default(),
6553 }
6554 }
6555}
6556
6557impl MsgReaction {
6558 pub fn emoji(&self) -> Option<&String> {
6559 if let Self::Emoji { emoji, .. } = self {
6560 Some(emoji)
6561 } else {
6562 None
6563 }
6564 }
6565 pub fn unknown(&self) -> Option<MsgReactionUnknownRef<'_>> {
6566 if let Self::Unknown { tag, json, .. } = self {
6567 Some(MsgReactionUnknownRef { tag, json })
6568 } else {
6569 None
6570 }
6571 }
6572}
6573#[derive(Clone, Copy)]
6574pub struct MsgReactionUnknownRef<'a> {
6575 pub tag: &'a String,
6576 pub json: &'a JsonObject,
6577}
6578
6579#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
6580#[non_exhaustive]
6581pub enum MsgReceiptStatus {
6582 #[default]
6583 #[serde(rename = "ok")]
6584 Ok,
6585 #[serde(rename = "badMsgHash")]
6586 BadMsgHash,
6587}
6588
6589#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
6590#[non_exhaustive]
6591pub enum MsgSigStatus {
6592 #[default]
6593 #[serde(rename = "verified")]
6594 Verified,
6595 #[serde(rename = "signedNoKey")]
6596 SignedNoKey,
6597}
6598
6599#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6600#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6601#[cfg_attr(feature = "bon", builder(on(String, into)))]
6602pub struct NewUser {
6603 #[serde(rename = "profile", skip_serializing_if = "Option::is_none")]
6604 pub profile: Option<Profile>,
6605
6606 #[serde(rename = "pastTimestamp", default)]
6607 pub past_timestamp: bool,
6608
6609 #[serde(rename = "userChatRelay", default)]
6610 pub user_chat_relay: bool,
6611
6612 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6613 #[cfg_attr(feature = "bon", builder(default))]
6614 pub undocumented: JsonObject,
6615}
6616
6617#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6618#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6619#[cfg_attr(feature = "bon", builder(on(String, into)))]
6620pub struct NoteFolder {
6621 #[serde(
6622 rename = "noteFolderId",
6623 deserialize_with = "deserialize_number_from_string"
6624 )]
6625 pub note_folder_id: i64,
6626
6627 #[serde(rename = "userId", deserialize_with = "deserialize_number_from_string")]
6628 pub user_id: i64,
6629
6630 #[serde(rename = "createdAt")]
6631 pub created_at: UtcTime,
6632
6633 #[serde(rename = "updatedAt")]
6634 pub updated_at: UtcTime,
6635
6636 #[serde(rename = "chatTs")]
6637 pub chat_ts: UtcTime,
6638
6639 #[serde(rename = "favorite", default)]
6640 pub favorite: bool,
6641
6642 #[serde(rename = "unread", default)]
6643 pub unread: bool,
6644
6645 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6646 #[cfg_attr(feature = "bon", builder(default))]
6647 pub undocumented: JsonObject,
6648}
6649
6650#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6651#[serde(tag = "type")]
6652#[non_exhaustive]
6653pub enum OwnerVerification {
6654 #[serde(rename = "verified")]
6655 Verified,
6656 #[serde(rename = "failed")]
6657 Failed {
6658 #[serde(rename = "reason")]
6659 reason: String,
6660
6661 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6662 undocumented: JsonObject,
6663 },
6664 #[serde(untagged)]
6665 Undocumented(JsonObject),
6666}
6667
6668impl OwnerVerification {
6669 pub fn make_verified() -> Self {
6670 Self::Verified
6671 }
6672
6673 pub fn make_failed(reason: String) -> Self {
6674 Self::Failed {
6675 reason,
6676 undocumented: Default::default(),
6677 }
6678 }
6679}
6680
6681impl OwnerVerification {
6682 pub fn is_verified(&self) -> bool {
6683 matches!(self, Self::Verified)
6684 }
6685 pub fn failed(&self) -> Option<&String> {
6686 if let Self::Failed { reason, .. } = self {
6687 Some(reason)
6688 } else {
6689 None
6690 }
6691 }
6692}
6693
6694#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6700#[serde(tag = "type")]
6701#[non_exhaustive]
6702pub enum PaginationByTime {
6703 #[serde(rename = "last")]
6704 Last {
6705 #[serde(rename = "count", deserialize_with = "deserialize_number_from_string")]
6706 count: i32,
6707
6708 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6709 undocumented: JsonObject,
6710 },
6711 #[serde(untagged)]
6712 Undocumented(JsonObject),
6713}
6714
6715impl CommandSyntax for PaginationByTime {
6716 const COMMAND_BUF_SIZE: usize = 32;
6717
6718 fn append_command_syntax(&self, buf: &mut String) {
6719 match self {
6720 Self::Last {
6721 count,
6722 undocumented: _,
6723 } => {
6724 buf.push_str("count=");
6725 write!(buf, "{count}").unwrap();
6726 }
6727 Self::Undocumented(_) => {}
6728 }
6729 }
6730}
6731
6732impl PaginationByTime {
6733 pub fn make_last(count: i32) -> Self {
6734 Self::Last {
6735 count,
6736 undocumented: Default::default(),
6737 }
6738 }
6739}
6740
6741impl PaginationByTime {
6742 pub fn last(&self) -> Option<&i32> {
6743 if let Self::Last { count, .. } = self {
6744 Some(count)
6745 } else {
6746 None
6747 }
6748 }
6749}
6750
6751#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6752#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6753#[cfg_attr(feature = "bon", builder(on(String, into)))]
6754pub struct PendingContactConnection {
6755 #[serde(
6756 rename = "pccConnId",
6757 deserialize_with = "deserialize_number_from_string"
6758 )]
6759 pub pcc_conn_id: i64,
6760
6761 #[serde(rename = "pccAgentConnId")]
6762 pub pcc_agent_conn_id: String,
6763
6764 #[serde(rename = "pccConnStatus")]
6765 pub pcc_conn_status: ConnStatus,
6766
6767 #[serde(rename = "viaContactUri", default)]
6768 pub via_contact_uri: bool,
6769
6770 #[serde(
6771 rename = "viaUserContactLink",
6772 skip_serializing_if = "Option::is_none",
6773 deserialize_with = "deserialize_option_number_from_string",
6774 default
6775 )]
6776 pub via_user_contact_link: Option<i64>,
6777
6778 #[serde(rename = "groupLinkId", skip_serializing_if = "Option::is_none")]
6779 pub group_link_id: Option<String>,
6780
6781 #[serde(
6782 rename = "customUserProfileId",
6783 skip_serializing_if = "Option::is_none",
6784 deserialize_with = "deserialize_option_number_from_string",
6785 default
6786 )]
6787 pub custom_user_profile_id: Option<i64>,
6788
6789 #[serde(rename = "connLinkInv", skip_serializing_if = "Option::is_none")]
6790 pub conn_link_inv: Option<CreatedConnLink>,
6791
6792 #[serde(rename = "localAlias")]
6793 pub local_alias: String,
6794
6795 #[serde(rename = "createdAt")]
6796 pub created_at: UtcTime,
6797
6798 #[serde(rename = "updatedAt")]
6799 pub updated_at: UtcTime,
6800
6801 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6802 #[cfg_attr(feature = "bon", builder(default))]
6803 pub undocumented: JsonObject,
6804}
6805
6806#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6807#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6808#[cfg_attr(feature = "bon", builder(on(String, into)))]
6809pub struct PrefEnabled {
6810 #[serde(rename = "forUser", default)]
6811 pub for_user: bool,
6812
6813 #[serde(rename = "forContact", default)]
6814 pub for_contact: bool,
6815
6816 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6817 #[cfg_attr(feature = "bon", builder(default))]
6818 pub undocumented: JsonObject,
6819}
6820
6821#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6822#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6823#[cfg_attr(feature = "bon", builder(on(String, into)))]
6824pub struct Preferences {
6825 #[serde(rename = "timedMessages", skip_serializing_if = "Option::is_none")]
6826 pub timed_messages: Option<TimedMessagesPreference>,
6827
6828 #[serde(rename = "fullDelete", skip_serializing_if = "Option::is_none")]
6829 pub full_delete: Option<SimplePreference>,
6830
6831 #[serde(rename = "reactions", skip_serializing_if = "Option::is_none")]
6832 pub reactions: Option<SimplePreference>,
6833
6834 #[serde(rename = "voice", skip_serializing_if = "Option::is_none")]
6835 pub voice: Option<SimplePreference>,
6836
6837 #[serde(rename = "files", skip_serializing_if = "Option::is_none")]
6838 pub files: Option<SimplePreference>,
6839
6840 #[serde(rename = "calls", skip_serializing_if = "Option::is_none")]
6841 pub calls: Option<SimplePreference>,
6842
6843 #[serde(rename = "sessions", skip_serializing_if = "Option::is_none")]
6844 pub sessions: Option<SimplePreference>,
6845
6846 #[serde(rename = "commands", skip_serializing_if = "Option::is_none")]
6847 pub commands: Option<Vec<ChatBotCommand>>,
6848
6849 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6850 #[cfg_attr(feature = "bon", builder(default))]
6851 pub undocumented: JsonObject,
6852}
6853
6854#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6855#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6856#[cfg_attr(feature = "bon", builder(on(String, into)))]
6857pub struct PreparedContact {
6858 #[serde(rename = "connLinkToConnect")]
6859 pub conn_link_to_connect: CreatedConnLink,
6860
6861 #[serde(rename = "uiConnLinkType")]
6862 pub ui_conn_link_type: ConnectionMode,
6863
6864 #[serde(rename = "welcomeSharedMsgId", skip_serializing_if = "Option::is_none")]
6865 pub welcome_shared_msg_id: Option<String>,
6866
6867 #[serde(rename = "requestSharedMsgId", skip_serializing_if = "Option::is_none")]
6868 pub request_shared_msg_id: Option<String>,
6869
6870 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6871 #[cfg_attr(feature = "bon", builder(default))]
6872 pub undocumented: JsonObject,
6873}
6874
6875#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6876#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6877#[cfg_attr(feature = "bon", builder(on(String, into)))]
6878pub struct PreparedGroup {
6879 #[serde(rename = "connLinkToConnect")]
6880 pub conn_link_to_connect: CreatedConnLink,
6881
6882 #[serde(rename = "connLinkPreparedConnection", default)]
6883 pub conn_link_prepared_connection: bool,
6884
6885 #[serde(rename = "connLinkStartedConnection", default)]
6886 pub conn_link_started_connection: bool,
6887
6888 #[serde(rename = "welcomeSharedMsgId", skip_serializing_if = "Option::is_none")]
6889 pub welcome_shared_msg_id: Option<String>,
6890
6891 #[serde(rename = "requestSharedMsgId", skip_serializing_if = "Option::is_none")]
6892 pub request_shared_msg_id: Option<String>,
6893
6894 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6895 #[cfg_attr(feature = "bon", builder(default))]
6896 pub undocumented: JsonObject,
6897}
6898
6899#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6900#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6901#[cfg_attr(feature = "bon", builder(on(String, into)))]
6902pub struct Profile {
6903 #[serde(rename = "displayName")]
6904 pub display_name: String,
6905
6906 #[serde(rename = "fullName")]
6907 pub full_name: String,
6908
6909 #[serde(rename = "shortDescr", skip_serializing_if = "Option::is_none")]
6910 pub short_descr: Option<String>,
6911
6912 #[serde(rename = "image", skip_serializing_if = "Option::is_none")]
6913 pub image: Option<String>,
6914
6915 #[serde(rename = "contactLink", skip_serializing_if = "Option::is_none")]
6916 pub contact_link: Option<String>,
6917
6918 #[serde(rename = "preferences", skip_serializing_if = "Option::is_none")]
6919 pub preferences: Option<Preferences>,
6920
6921 #[serde(rename = "peerType", skip_serializing_if = "Option::is_none")]
6922 pub peer_type: Option<ChatPeerType>,
6923
6924 #[serde(rename = "badge", skip_serializing_if = "Option::is_none")]
6925 pub badge: Option<BadgeProof>,
6926
6927 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6928 #[cfg_attr(feature = "bon", builder(default))]
6929 pub undocumented: JsonObject,
6930}
6931
6932#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6933#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6934#[cfg_attr(feature = "bon", builder(on(String, into)))]
6935pub struct PublicGroupAccess {
6936 #[serde(rename = "groupWebPage", skip_serializing_if = "Option::is_none")]
6937 pub group_web_page: Option<String>,
6938
6939 #[serde(rename = "groupDomain", skip_serializing_if = "Option::is_none")]
6940 pub group_domain: Option<String>,
6941
6942 #[serde(rename = "domainWebPage", default)]
6943 pub domain_web_page: bool,
6944
6945 #[serde(rename = "allowEmbedding", default)]
6946 pub allow_embedding: bool,
6947
6948 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6949 #[cfg_attr(feature = "bon", builder(default))]
6950 pub undocumented: JsonObject,
6951}
6952
6953#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6954#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6955#[cfg_attr(feature = "bon", builder(on(String, into)))]
6956pub struct PublicGroupData {
6957 #[serde(
6958 rename = "publicMemberCount",
6959 deserialize_with = "deserialize_number_from_string"
6960 )]
6961 pub public_member_count: i64,
6962
6963 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6964 #[cfg_attr(feature = "bon", builder(default))]
6965 pub undocumented: JsonObject,
6966}
6967
6968#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6969#[cfg_attr(feature = "bon", derive(::bon::Builder))]
6970#[cfg_attr(feature = "bon", builder(on(String, into)))]
6971pub struct PublicGroupProfile {
6972 #[serde(rename = "groupType")]
6973 pub group_type: GroupType,
6974
6975 #[serde(rename = "groupLink")]
6976 pub group_link: String,
6977
6978 #[serde(rename = "publicGroupId")]
6979 pub public_group_id: String,
6980
6981 #[serde(rename = "publicGroupAccess", skip_serializing_if = "Option::is_none")]
6982 pub public_group_access: Option<PublicGroupAccess>,
6983
6984 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
6985 #[cfg_attr(feature = "bon", builder(default))]
6986 pub undocumented: JsonObject,
6987}
6988
6989#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
6990#[non_exhaustive]
6991pub enum RatchetSyncState {
6992 #[default]
6993 #[serde(rename = "ok")]
6994 Ok,
6995 #[serde(rename = "allowed")]
6996 Allowed,
6997 #[serde(rename = "required")]
6998 Required,
6999 #[serde(rename = "started")]
7000 Started,
7001 #[serde(rename = "agreed")]
7002 Agreed,
7003}
7004
7005#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7006#[serde(tag = "type")]
7007#[non_exhaustive]
7008pub enum RcvConnEvent {
7009 #[serde(rename = "switchQueue")]
7010 SwitchQueue {
7011 #[serde(rename = "phase")]
7012 phase: SwitchPhase,
7013
7014 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7015 undocumented: JsonObject,
7016 },
7017 #[serde(rename = "ratchetSync")]
7018 RatchetSync {
7019 #[serde(rename = "syncStatus")]
7020 sync_status: RatchetSyncState,
7021
7022 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7023 undocumented: JsonObject,
7024 },
7025 #[serde(rename = "verificationCodeReset")]
7026 VerificationCodeReset,
7027 #[serde(rename = "pqEnabled")]
7028 PqEnabled {
7029 #[serde(rename = "enabled", default)]
7030 enabled: bool,
7031
7032 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7033 undocumented: JsonObject,
7034 },
7035 #[serde(untagged)]
7036 Undocumented(JsonObject),
7037}
7038
7039impl RcvConnEvent {
7040 pub fn make_switch_queue(phase: SwitchPhase) -> Self {
7041 Self::SwitchQueue {
7042 phase,
7043 undocumented: Default::default(),
7044 }
7045 }
7046
7047 pub fn make_ratchet_sync(sync_status: RatchetSyncState) -> Self {
7048 Self::RatchetSync {
7049 sync_status,
7050 undocumented: Default::default(),
7051 }
7052 }
7053
7054 pub fn make_verification_code_reset() -> Self {
7055 Self::VerificationCodeReset
7056 }
7057
7058 pub fn make_pq_enabled(enabled: bool) -> Self {
7059 Self::PqEnabled {
7060 enabled,
7061 undocumented: Default::default(),
7062 }
7063 }
7064}
7065
7066impl RcvConnEvent {
7067 pub fn switch_queue(&self) -> Option<&SwitchPhase> {
7068 if let Self::SwitchQueue { phase, .. } = self {
7069 Some(phase)
7070 } else {
7071 None
7072 }
7073 }
7074 pub fn ratchet_sync(&self) -> Option<&RatchetSyncState> {
7075 if let Self::RatchetSync { sync_status, .. } = self {
7076 Some(sync_status)
7077 } else {
7078 None
7079 }
7080 }
7081 pub fn is_verification_code_reset(&self) -> bool {
7082 matches!(self, Self::VerificationCodeReset)
7083 }
7084 pub fn pq_enabled(&self) -> Option<&bool> {
7085 if let Self::PqEnabled { enabled, .. } = self {
7086 Some(enabled)
7087 } else {
7088 None
7089 }
7090 }
7091}
7092
7093#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7094#[serde(tag = "type")]
7095#[non_exhaustive]
7096pub enum RcvDirectEvent {
7097 #[serde(rename = "contactDeleted")]
7098 ContactDeleted,
7099 #[serde(rename = "profileUpdated")]
7100 ProfileUpdated {
7101 #[serde(rename = "fromProfile")]
7102 from_profile: Profile,
7103
7104 #[serde(rename = "toProfile")]
7105 to_profile: Profile,
7106
7107 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7108 undocumented: JsonObject,
7109 },
7110 #[serde(rename = "groupInvLinkReceived")]
7111 GroupInvLinkReceived {
7112 #[serde(rename = "groupProfile")]
7113 group_profile: GroupProfile,
7114
7115 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7116 undocumented: JsonObject,
7117 },
7118 #[serde(untagged)]
7119 Undocumented(JsonObject),
7120}
7121
7122impl RcvDirectEvent {
7123 pub fn make_contact_deleted() -> Self {
7124 Self::ContactDeleted
7125 }
7126
7127 pub fn make_profile_updated(from_profile: Profile, to_profile: Profile) -> Self {
7128 Self::ProfileUpdated {
7129 from_profile,
7130 to_profile,
7131 undocumented: Default::default(),
7132 }
7133 }
7134
7135 pub fn make_group_inv_link_received(group_profile: GroupProfile) -> Self {
7136 Self::GroupInvLinkReceived {
7137 group_profile,
7138 undocumented: Default::default(),
7139 }
7140 }
7141}
7142
7143impl RcvDirectEvent {
7144 pub fn is_contact_deleted(&self) -> bool {
7145 matches!(self, Self::ContactDeleted)
7146 }
7147 pub fn profile_updated(&self) -> Option<RcvDirectEventProfileUpdatedRef<'_>> {
7148 if let Self::ProfileUpdated {
7149 from_profile,
7150 to_profile,
7151 ..
7152 } = self
7153 {
7154 Some(RcvDirectEventProfileUpdatedRef {
7155 from_profile,
7156 to_profile,
7157 })
7158 } else {
7159 None
7160 }
7161 }
7162 pub fn group_inv_link_received(&self) -> Option<&GroupProfile> {
7163 if let Self::GroupInvLinkReceived { group_profile, .. } = self {
7164 Some(group_profile)
7165 } else {
7166 None
7167 }
7168 }
7169}
7170#[derive(Clone, Copy)]
7171pub struct RcvDirectEventProfileUpdatedRef<'a> {
7172 pub from_profile: &'a Profile,
7173 pub to_profile: &'a Profile,
7174}
7175
7176#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7177#[cfg_attr(feature = "bon", derive(::bon::Builder))]
7178#[cfg_attr(feature = "bon", builder(on(String, into)))]
7179pub struct RcvFileDescr {
7180 #[serde(
7181 rename = "fileDescrId",
7182 deserialize_with = "deserialize_number_from_string"
7183 )]
7184 pub file_descr_id: i64,
7185
7186 #[serde(rename = "fileDescrText")]
7187 pub file_descr_text: String,
7188
7189 #[serde(
7190 rename = "fileDescrPartNo",
7191 deserialize_with = "deserialize_number_from_string"
7192 )]
7193 pub file_descr_part_no: i32,
7194
7195 #[serde(rename = "fileDescrComplete", default)]
7196 pub file_descr_complete: bool,
7197
7198 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7199 #[cfg_attr(feature = "bon", builder(default))]
7200 pub undocumented: JsonObject,
7201}
7202
7203#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7204#[serde(tag = "type")]
7205#[non_exhaustive]
7206pub enum RcvFileStatus {
7207 #[serde(rename = "new")]
7208 New,
7209 #[serde(rename = "accepted")]
7210 Accepted {
7211 #[serde(rename = "filePath")]
7212 file_path: String,
7213
7214 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7215 undocumented: JsonObject,
7216 },
7217 #[serde(rename = "connected")]
7218 Connected {
7219 #[serde(rename = "filePath")]
7220 file_path: String,
7221
7222 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7223 undocumented: JsonObject,
7224 },
7225 #[serde(rename = "complete")]
7226 Complete {
7227 #[serde(rename = "filePath")]
7228 file_path: String,
7229
7230 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7231 undocumented: JsonObject,
7232 },
7233 #[serde(rename = "cancelled")]
7234 Cancelled {
7235 #[serde(rename = "filePath_", skip_serializing_if = "Option::is_none")]
7236 file_path: Option<String>,
7237
7238 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7239 undocumented: JsonObject,
7240 },
7241 #[serde(untagged)]
7242 Undocumented(JsonObject),
7243}
7244
7245impl RcvFileStatus {
7246 pub fn make_new() -> Self {
7247 Self::New
7248 }
7249
7250 pub fn make_accepted(file_path: String) -> Self {
7251 Self::Accepted {
7252 file_path,
7253 undocumented: Default::default(),
7254 }
7255 }
7256
7257 pub fn make_connected(file_path: String) -> Self {
7258 Self::Connected {
7259 file_path,
7260 undocumented: Default::default(),
7261 }
7262 }
7263
7264 pub fn make_complete(file_path: String) -> Self {
7265 Self::Complete {
7266 file_path,
7267 undocumented: Default::default(),
7268 }
7269 }
7270
7271 pub fn make_cancelled(file_path: Option<String>) -> Self {
7272 Self::Cancelled {
7273 file_path,
7274 undocumented: Default::default(),
7275 }
7276 }
7277}
7278
7279impl RcvFileStatus {
7280 pub fn is_new(&self) -> bool {
7281 matches!(self, Self::New)
7282 }
7283 pub fn accepted(&self) -> Option<&String> {
7284 if let Self::Accepted { file_path, .. } = self {
7285 Some(file_path)
7286 } else {
7287 None
7288 }
7289 }
7290 pub fn connected(&self) -> Option<&String> {
7291 if let Self::Connected { file_path, .. } = self {
7292 Some(file_path)
7293 } else {
7294 None
7295 }
7296 }
7297 pub fn complete(&self) -> Option<&String> {
7298 if let Self::Complete { file_path, .. } = self {
7299 Some(file_path)
7300 } else {
7301 None
7302 }
7303 }
7304 pub fn cancelled(&self) -> Option<&Option<String>> {
7305 if let Self::Cancelled { file_path, .. } = self {
7306 Some(file_path)
7307 } else {
7308 None
7309 }
7310 }
7311}
7312
7313#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7314#[cfg_attr(feature = "bon", derive(::bon::Builder))]
7315#[cfg_attr(feature = "bon", builder(on(String, into)))]
7316pub struct RcvFileTransfer {
7317 #[serde(rename = "fileId", deserialize_with = "deserialize_number_from_string")]
7318 pub file_id: i64,
7319
7320 #[serde(rename = "xftpRcvFile", skip_serializing_if = "Option::is_none")]
7321 pub xftp_rcv_file: Option<XFTPRcvFile>,
7322
7323 #[serde(rename = "fileInvitation")]
7324 pub file_invitation: FileInvitation,
7325
7326 #[serde(rename = "fileStatus")]
7327 pub file_status: RcvFileStatus,
7328
7329 #[serde(rename = "rcvFileInline", skip_serializing_if = "Option::is_none")]
7330 pub rcv_file_inline: Option<InlineFileMode>,
7331
7332 #[serde(rename = "senderDisplayName")]
7333 pub sender_display_name: String,
7334
7335 #[serde(
7336 rename = "chunkSize",
7337 deserialize_with = "deserialize_number_from_string"
7338 )]
7339 pub chunk_size: i64,
7340
7341 #[serde(rename = "cancelled", default)]
7342 pub cancelled: bool,
7343
7344 #[serde(
7345 rename = "grpMemberId",
7346 skip_serializing_if = "Option::is_none",
7347 deserialize_with = "deserialize_option_number_from_string",
7348 default
7349 )]
7350 pub grp_member_id: Option<i64>,
7351
7352 #[serde(rename = "cryptoArgs", skip_serializing_if = "Option::is_none")]
7353 pub crypto_args: Option<CryptoFileArgs>,
7354
7355 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7356 #[cfg_attr(feature = "bon", builder(default))]
7357 pub undocumented: JsonObject,
7358}
7359
7360#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7361#[serde(tag = "type")]
7362#[non_exhaustive]
7363pub enum RcvGroupEvent {
7364 #[serde(rename = "memberAdded")]
7365 MemberAdded {
7366 #[serde(
7367 rename = "groupMemberId",
7368 deserialize_with = "deserialize_number_from_string"
7369 )]
7370 group_member_id: i64,
7371
7372 #[serde(rename = "profile")]
7373 profile: Profile,
7374
7375 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7376 undocumented: JsonObject,
7377 },
7378 #[serde(rename = "memberConnected")]
7379 MemberConnected,
7380 #[serde(rename = "memberAccepted")]
7381 MemberAccepted {
7382 #[serde(
7383 rename = "groupMemberId",
7384 deserialize_with = "deserialize_number_from_string"
7385 )]
7386 group_member_id: i64,
7387
7388 #[serde(rename = "profile")]
7389 profile: Profile,
7390
7391 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7392 undocumented: JsonObject,
7393 },
7394 #[serde(rename = "userAccepted")]
7395 UserAccepted,
7396 #[serde(rename = "memberLeft")]
7397 MemberLeft,
7398 #[serde(rename = "memberRole")]
7399 MemberRole {
7400 #[serde(
7401 rename = "groupMemberId",
7402 deserialize_with = "deserialize_number_from_string"
7403 )]
7404 group_member_id: i64,
7405
7406 #[serde(rename = "profile")]
7407 profile: Profile,
7408
7409 #[serde(rename = "role")]
7410 role: GroupMemberRole,
7411
7412 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7413 undocumented: JsonObject,
7414 },
7415 #[serde(rename = "memberBlocked")]
7416 MemberBlocked {
7417 #[serde(
7418 rename = "groupMemberId",
7419 deserialize_with = "deserialize_number_from_string"
7420 )]
7421 group_member_id: i64,
7422
7423 #[serde(rename = "profile")]
7424 profile: Profile,
7425
7426 #[serde(rename = "blocked", default)]
7427 blocked: bool,
7428
7429 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7430 undocumented: JsonObject,
7431 },
7432 #[serde(rename = "userRole")]
7433 UserRole {
7434 #[serde(rename = "role")]
7435 role: GroupMemberRole,
7436
7437 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7438 undocumented: JsonObject,
7439 },
7440 #[serde(rename = "memberDeleted")]
7441 MemberDeleted {
7442 #[serde(
7443 rename = "groupMemberId",
7444 deserialize_with = "deserialize_number_from_string"
7445 )]
7446 group_member_id: i64,
7447
7448 #[serde(rename = "profile")]
7449 profile: Profile,
7450
7451 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7452 undocumented: JsonObject,
7453 },
7454 #[serde(rename = "userDeleted")]
7455 UserDeleted,
7456 #[serde(rename = "groupDeleted")]
7457 GroupDeleted,
7458 #[serde(rename = "groupUpdated")]
7459 GroupUpdated {
7460 #[serde(rename = "groupProfile")]
7461 group_profile: GroupProfile,
7462
7463 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7464 undocumented: JsonObject,
7465 },
7466 #[serde(rename = "invitedViaGroupLink")]
7467 InvitedViaGroupLink,
7468 #[serde(rename = "memberCreatedContact")]
7469 MemberCreatedContact,
7470 #[serde(rename = "memberProfileUpdated")]
7471 MemberProfileUpdated {
7472 #[serde(rename = "fromProfile")]
7473 from_profile: Profile,
7474
7475 #[serde(rename = "toProfile")]
7476 to_profile: Profile,
7477
7478 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7479 undocumented: JsonObject,
7480 },
7481 #[serde(rename = "newMemberPendingReview")]
7482 NewMemberPendingReview,
7483 #[serde(rename = "msgBadSignature")]
7484 MsgBadSignature,
7485 #[serde(untagged)]
7486 Undocumented(JsonObject),
7487}
7488
7489impl RcvGroupEvent {
7490 pub fn make_member_added(group_member_id: i64, profile: Profile) -> Self {
7491 Self::MemberAdded {
7492 group_member_id,
7493 profile,
7494 undocumented: Default::default(),
7495 }
7496 }
7497
7498 pub fn make_member_connected() -> Self {
7499 Self::MemberConnected
7500 }
7501
7502 pub fn make_member_accepted(group_member_id: i64, profile: Profile) -> Self {
7503 Self::MemberAccepted {
7504 group_member_id,
7505 profile,
7506 undocumented: Default::default(),
7507 }
7508 }
7509
7510 pub fn make_user_accepted() -> Self {
7511 Self::UserAccepted
7512 }
7513
7514 pub fn make_member_left() -> Self {
7515 Self::MemberLeft
7516 }
7517
7518 pub fn make_member_role(group_member_id: i64, profile: Profile, role: GroupMemberRole) -> Self {
7519 Self::MemberRole {
7520 group_member_id,
7521 profile,
7522 role,
7523 undocumented: Default::default(),
7524 }
7525 }
7526
7527 pub fn make_member_blocked(group_member_id: i64, profile: Profile, blocked: bool) -> Self {
7528 Self::MemberBlocked {
7529 group_member_id,
7530 profile,
7531 blocked,
7532 undocumented: Default::default(),
7533 }
7534 }
7535
7536 pub fn make_user_role(role: GroupMemberRole) -> Self {
7537 Self::UserRole {
7538 role,
7539 undocumented: Default::default(),
7540 }
7541 }
7542
7543 pub fn make_member_deleted(group_member_id: i64, profile: Profile) -> Self {
7544 Self::MemberDeleted {
7545 group_member_id,
7546 profile,
7547 undocumented: Default::default(),
7548 }
7549 }
7550
7551 pub fn make_user_deleted() -> Self {
7552 Self::UserDeleted
7553 }
7554
7555 pub fn make_group_deleted() -> Self {
7556 Self::GroupDeleted
7557 }
7558
7559 pub fn make_group_updated(group_profile: GroupProfile) -> Self {
7560 Self::GroupUpdated {
7561 group_profile,
7562 undocumented: Default::default(),
7563 }
7564 }
7565
7566 pub fn make_invited_via_group_link() -> Self {
7567 Self::InvitedViaGroupLink
7568 }
7569
7570 pub fn make_member_created_contact() -> Self {
7571 Self::MemberCreatedContact
7572 }
7573
7574 pub fn make_member_profile_updated(from_profile: Profile, to_profile: Profile) -> Self {
7575 Self::MemberProfileUpdated {
7576 from_profile,
7577 to_profile,
7578 undocumented: Default::default(),
7579 }
7580 }
7581
7582 pub fn make_new_member_pending_review() -> Self {
7583 Self::NewMemberPendingReview
7584 }
7585
7586 pub fn make_msg_bad_signature() -> Self {
7587 Self::MsgBadSignature
7588 }
7589}
7590
7591impl RcvGroupEvent {
7592 pub fn member_added(&self) -> Option<RcvGroupEventMemberAddedRef<'_>> {
7593 if let Self::MemberAdded {
7594 group_member_id,
7595 profile,
7596 ..
7597 } = self
7598 {
7599 Some(RcvGroupEventMemberAddedRef {
7600 group_member_id,
7601 profile,
7602 })
7603 } else {
7604 None
7605 }
7606 }
7607 pub fn is_member_connected(&self) -> bool {
7608 matches!(self, Self::MemberConnected)
7609 }
7610 pub fn member_accepted(&self) -> Option<RcvGroupEventMemberAcceptedRef<'_>> {
7611 if let Self::MemberAccepted {
7612 group_member_id,
7613 profile,
7614 ..
7615 } = self
7616 {
7617 Some(RcvGroupEventMemberAcceptedRef {
7618 group_member_id,
7619 profile,
7620 })
7621 } else {
7622 None
7623 }
7624 }
7625 pub fn is_user_accepted(&self) -> bool {
7626 matches!(self, Self::UserAccepted)
7627 }
7628 pub fn is_member_left(&self) -> bool {
7629 matches!(self, Self::MemberLeft)
7630 }
7631 pub fn member_role(&self) -> Option<RcvGroupEventMemberRoleRef<'_>> {
7632 if let Self::MemberRole {
7633 group_member_id,
7634 profile,
7635 role,
7636 ..
7637 } = self
7638 {
7639 Some(RcvGroupEventMemberRoleRef {
7640 group_member_id,
7641 profile,
7642 role,
7643 })
7644 } else {
7645 None
7646 }
7647 }
7648 pub fn member_blocked(&self) -> Option<RcvGroupEventMemberBlockedRef<'_>> {
7649 if let Self::MemberBlocked {
7650 group_member_id,
7651 profile,
7652 blocked,
7653 ..
7654 } = self
7655 {
7656 Some(RcvGroupEventMemberBlockedRef {
7657 group_member_id,
7658 profile,
7659 blocked,
7660 })
7661 } else {
7662 None
7663 }
7664 }
7665 pub fn user_role(&self) -> Option<&GroupMemberRole> {
7666 if let Self::UserRole { role, .. } = self {
7667 Some(role)
7668 } else {
7669 None
7670 }
7671 }
7672 pub fn member_deleted(&self) -> Option<RcvGroupEventMemberDeletedRef<'_>> {
7673 if let Self::MemberDeleted {
7674 group_member_id,
7675 profile,
7676 ..
7677 } = self
7678 {
7679 Some(RcvGroupEventMemberDeletedRef {
7680 group_member_id,
7681 profile,
7682 })
7683 } else {
7684 None
7685 }
7686 }
7687 pub fn is_user_deleted(&self) -> bool {
7688 matches!(self, Self::UserDeleted)
7689 }
7690 pub fn is_group_deleted(&self) -> bool {
7691 matches!(self, Self::GroupDeleted)
7692 }
7693 pub fn group_updated(&self) -> Option<&GroupProfile> {
7694 if let Self::GroupUpdated { group_profile, .. } = self {
7695 Some(group_profile)
7696 } else {
7697 None
7698 }
7699 }
7700 pub fn is_invited_via_group_link(&self) -> bool {
7701 matches!(self, Self::InvitedViaGroupLink)
7702 }
7703 pub fn is_member_created_contact(&self) -> bool {
7704 matches!(self, Self::MemberCreatedContact)
7705 }
7706 pub fn member_profile_updated(&self) -> Option<RcvGroupEventMemberProfileUpdatedRef<'_>> {
7707 if let Self::MemberProfileUpdated {
7708 from_profile,
7709 to_profile,
7710 ..
7711 } = self
7712 {
7713 Some(RcvGroupEventMemberProfileUpdatedRef {
7714 from_profile,
7715 to_profile,
7716 })
7717 } else {
7718 None
7719 }
7720 }
7721 pub fn is_new_member_pending_review(&self) -> bool {
7722 matches!(self, Self::NewMemberPendingReview)
7723 }
7724 pub fn is_msg_bad_signature(&self) -> bool {
7725 matches!(self, Self::MsgBadSignature)
7726 }
7727}
7728#[derive(Clone, Copy)]
7729pub struct RcvGroupEventMemberAddedRef<'a> {
7730 pub group_member_id: &'a i64,
7731 pub profile: &'a Profile,
7732}
7733#[derive(Clone, Copy)]
7734pub struct RcvGroupEventMemberAcceptedRef<'a> {
7735 pub group_member_id: &'a i64,
7736 pub profile: &'a Profile,
7737}
7738#[derive(Clone, Copy)]
7739pub struct RcvGroupEventMemberRoleRef<'a> {
7740 pub group_member_id: &'a i64,
7741 pub profile: &'a Profile,
7742 pub role: &'a GroupMemberRole,
7743}
7744#[derive(Clone, Copy)]
7745pub struct RcvGroupEventMemberBlockedRef<'a> {
7746 pub group_member_id: &'a i64,
7747 pub profile: &'a Profile,
7748 pub blocked: &'a bool,
7749}
7750#[derive(Clone, Copy)]
7751pub struct RcvGroupEventMemberDeletedRef<'a> {
7752 pub group_member_id: &'a i64,
7753 pub profile: &'a Profile,
7754}
7755#[derive(Clone, Copy)]
7756pub struct RcvGroupEventMemberProfileUpdatedRef<'a> {
7757 pub from_profile: &'a Profile,
7758 pub to_profile: &'a Profile,
7759}
7760
7761#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7762#[cfg_attr(feature = "bon", derive(::bon::Builder))]
7763#[cfg_attr(feature = "bon", builder(on(String, into)))]
7764pub struct RelayCapabilities {
7765 #[serde(rename = "webDomain", skip_serializing_if = "Option::is_none")]
7766 pub web_domain: Option<String>,
7767
7768 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7769 #[cfg_attr(feature = "bon", builder(default))]
7770 pub undocumented: JsonObject,
7771}
7772
7773#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7774#[cfg_attr(feature = "bon", derive(::bon::Builder))]
7775#[cfg_attr(feature = "bon", builder(on(String, into)))]
7776pub struct RelayProfile {
7777 #[serde(rename = "displayName")]
7778 pub display_name: String,
7779
7780 #[serde(rename = "fullName")]
7781 pub full_name: String,
7782
7783 #[serde(rename = "shortDescr", skip_serializing_if = "Option::is_none")]
7784 pub short_descr: Option<String>,
7785
7786 #[serde(rename = "image", skip_serializing_if = "Option::is_none")]
7787 pub image: Option<String>,
7788
7789 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7790 #[cfg_attr(feature = "bon", builder(default))]
7791 pub undocumented: JsonObject,
7792}
7793
7794#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
7795#[non_exhaustive]
7796pub enum RelayStatus {
7797 #[default]
7798 #[serde(rename = "new")]
7799 New,
7800 #[serde(rename = "invited")]
7801 Invited,
7802 #[serde(rename = "accepted")]
7803 Accepted,
7804 #[serde(rename = "active")]
7805 Active,
7806 #[serde(rename = "inactive")]
7807 Inactive,
7808 #[serde(rename = "rejected")]
7809 Rejected,
7810}
7811
7812#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
7813#[non_exhaustive]
7814pub enum ReportReason {
7815 #[default]
7816 #[serde(rename = "spam")]
7817 Spam,
7818 #[serde(rename = "content")]
7819 Content,
7820 #[serde(rename = "community")]
7821 Community,
7822 #[serde(rename = "profile")]
7823 Profile,
7824 #[serde(rename = "other")]
7825 Other,
7826}
7827
7828#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7829#[cfg_attr(feature = "bon", derive(::bon::Builder))]
7830#[cfg_attr(feature = "bon", builder(on(String, into)))]
7831pub struct RoleGroupPreference {
7832 #[serde(rename = "enable")]
7833 pub enable: GroupFeatureEnabled,
7834
7835 #[serde(rename = "role", skip_serializing_if = "Option::is_none")]
7836 pub role: Option<GroupMemberRole>,
7837
7838 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7839 #[cfg_attr(feature = "bon", builder(default))]
7840 pub undocumented: JsonObject,
7841}
7842
7843#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7844#[cfg_attr(feature = "bon", derive(::bon::Builder))]
7845#[cfg_attr(feature = "bon", builder(on(String, into)))]
7846pub struct SecurityCode {
7847 #[serde(rename = "securityCode")]
7848 pub security_code: String,
7849
7850 #[serde(rename = "verifiedAt")]
7851 pub verified_at: UtcTime,
7852
7853 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7854 #[cfg_attr(feature = "bon", builder(default))]
7855 pub undocumented: JsonObject,
7856}
7857
7858#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7859#[cfg_attr(feature = "bon", derive(::bon::Builder))]
7860#[cfg_attr(feature = "bon", builder(on(String, into)))]
7861pub struct SimplePreference {
7862 #[serde(rename = "allow")]
7863 pub allow: FeatureAllowed,
7864
7865 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7866 #[cfg_attr(feature = "bon", builder(default))]
7867 pub undocumented: JsonObject,
7868}
7869
7870#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
7871#[non_exhaustive]
7872pub enum SimplexLinkType {
7873 #[default]
7874 #[serde(rename = "contact")]
7875 Contact,
7876 #[serde(rename = "invitation")]
7877 Invitation,
7878 #[serde(rename = "group")]
7879 Group,
7880 #[serde(rename = "channel")]
7881 Channel,
7882 #[serde(rename = "relay")]
7883 Relay,
7884}
7885
7886#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7887#[cfg_attr(feature = "bon", derive(::bon::Builder))]
7888#[cfg_attr(feature = "bon", builder(on(String, into)))]
7889pub struct SimplexNameDomain {
7890 #[serde(rename = "nameTLD")]
7891 pub name_tld: SimplexTLD,
7892
7893 #[serde(rename = "domain")]
7894 pub domain: String,
7895
7896 #[serde(rename = "subDomain")]
7897 pub sub_domain: Vec<String>,
7898
7899 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7900 #[cfg_attr(feature = "bon", builder(default))]
7901 pub undocumented: JsonObject,
7902}
7903
7904#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7905#[cfg_attr(feature = "bon", derive(::bon::Builder))]
7906#[cfg_attr(feature = "bon", builder(on(String, into)))]
7907pub struct SimplexNameInfo {
7908 #[serde(rename = "nameType")]
7909 pub name_type: SimplexNameType,
7910
7911 #[serde(rename = "nameDomain")]
7912 pub name_domain: SimplexNameDomain,
7913
7914 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7915 #[cfg_attr(feature = "bon", builder(default))]
7916 pub undocumented: JsonObject,
7917}
7918
7919#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
7920#[non_exhaustive]
7921pub enum SimplexNameType {
7922 #[default]
7923 #[serde(rename = "publicGroup")]
7924 PublicGroup,
7925 #[serde(rename = "contact")]
7926 Contact,
7927}
7928
7929#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
7930#[non_exhaustive]
7931pub enum SimplexTLD {
7932 #[default]
7933 #[serde(rename = "simplex")]
7934 Simplex,
7935 #[serde(rename = "testing")]
7936 Testing,
7937 #[serde(rename = "web")]
7938 Web,
7939}
7940
7941#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
7942#[non_exhaustive]
7943pub enum SndCIStatusProgress {
7944 #[default]
7945 #[serde(rename = "partial")]
7946 Partial,
7947 #[serde(rename = "complete")]
7948 Complete,
7949}
7950
7951#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
7952#[serde(tag = "type")]
7953#[non_exhaustive]
7954pub enum SndConnEvent {
7955 #[serde(rename = "switchQueue")]
7956 SwitchQueue {
7957 #[serde(rename = "phase")]
7958 phase: SwitchPhase,
7959
7960 #[serde(rename = "member", skip_serializing_if = "Option::is_none")]
7961 member: Option<GroupMemberRef>,
7962
7963 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7964 undocumented: JsonObject,
7965 },
7966 #[serde(rename = "ratchetSync")]
7967 RatchetSync {
7968 #[serde(rename = "syncStatus")]
7969 sync_status: RatchetSyncState,
7970
7971 #[serde(rename = "member", skip_serializing_if = "Option::is_none")]
7972 member: Option<GroupMemberRef>,
7973
7974 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7975 undocumented: JsonObject,
7976 },
7977 #[serde(rename = "pqEnabled")]
7978 PqEnabled {
7979 #[serde(rename = "enabled", default)]
7980 enabled: bool,
7981
7982 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
7983 undocumented: JsonObject,
7984 },
7985 #[serde(untagged)]
7986 Undocumented(JsonObject),
7987}
7988
7989impl SndConnEvent {
7990 pub fn make_switch_queue(phase: SwitchPhase, member: Option<GroupMemberRef>) -> Self {
7991 Self::SwitchQueue {
7992 phase,
7993 member,
7994 undocumented: Default::default(),
7995 }
7996 }
7997
7998 pub fn make_ratchet_sync(
7999 sync_status: RatchetSyncState,
8000 member: Option<GroupMemberRef>,
8001 ) -> Self {
8002 Self::RatchetSync {
8003 sync_status,
8004 member,
8005 undocumented: Default::default(),
8006 }
8007 }
8008
8009 pub fn make_pq_enabled(enabled: bool) -> Self {
8010 Self::PqEnabled {
8011 enabled,
8012 undocumented: Default::default(),
8013 }
8014 }
8015}
8016
8017impl SndConnEvent {
8018 pub fn switch_queue(&self) -> Option<SndConnEventSwitchQueueRef<'_>> {
8019 if let Self::SwitchQueue { phase, member, .. } = self {
8020 Some(SndConnEventSwitchQueueRef { phase, member })
8021 } else {
8022 None
8023 }
8024 }
8025 pub fn ratchet_sync(&self) -> Option<SndConnEventRatchetSyncRef<'_>> {
8026 if let Self::RatchetSync {
8027 sync_status,
8028 member,
8029 ..
8030 } = self
8031 {
8032 Some(SndConnEventRatchetSyncRef {
8033 sync_status,
8034 member,
8035 })
8036 } else {
8037 None
8038 }
8039 }
8040 pub fn pq_enabled(&self) -> Option<&bool> {
8041 if let Self::PqEnabled { enabled, .. } = self {
8042 Some(enabled)
8043 } else {
8044 None
8045 }
8046 }
8047}
8048#[derive(Clone, Copy)]
8049pub struct SndConnEventSwitchQueueRef<'a> {
8050 pub phase: &'a SwitchPhase,
8051 pub member: &'a Option<GroupMemberRef>,
8052}
8053#[derive(Clone, Copy)]
8054pub struct SndConnEventRatchetSyncRef<'a> {
8055 pub sync_status: &'a RatchetSyncState,
8056 pub member: &'a Option<GroupMemberRef>,
8057}
8058
8059#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8060#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8061#[cfg_attr(feature = "bon", builder(on(String, into)))]
8062pub struct SndFileTransfer {
8063 #[serde(rename = "fileId", deserialize_with = "deserialize_number_from_string")]
8064 pub file_id: i64,
8065
8066 #[serde(rename = "fileName")]
8067 pub file_name: String,
8068
8069 #[serde(rename = "filePath")]
8070 pub file_path: String,
8071
8072 #[serde(
8073 rename = "fileSize",
8074 deserialize_with = "deserialize_number_from_string"
8075 )]
8076 pub file_size: i64,
8077
8078 #[serde(
8079 rename = "chunkSize",
8080 deserialize_with = "deserialize_number_from_string"
8081 )]
8082 pub chunk_size: i64,
8083
8084 #[serde(rename = "recipientDisplayName")]
8085 pub recipient_display_name: String,
8086
8087 #[serde(rename = "connId", deserialize_with = "deserialize_number_from_string")]
8088 pub conn_id: i64,
8089
8090 #[serde(rename = "agentConnId")]
8091 pub agent_conn_id: String,
8092
8093 #[serde(
8094 rename = "groupMemberId",
8095 skip_serializing_if = "Option::is_none",
8096 deserialize_with = "deserialize_option_number_from_string",
8097 default
8098 )]
8099 pub group_member_id: Option<i64>,
8100
8101 #[serde(rename = "fileStatus")]
8102 pub file_status: FileStatus,
8103
8104 #[serde(
8105 rename = "fileDescrId",
8106 skip_serializing_if = "Option::is_none",
8107 deserialize_with = "deserialize_option_number_from_string",
8108 default
8109 )]
8110 pub file_descr_id: Option<i64>,
8111
8112 #[serde(rename = "fileInline", skip_serializing_if = "Option::is_none")]
8113 pub file_inline: Option<InlineFileMode>,
8114
8115 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8116 #[cfg_attr(feature = "bon", builder(default))]
8117 pub undocumented: JsonObject,
8118}
8119
8120#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8121#[serde(tag = "type")]
8122#[non_exhaustive]
8123pub enum SndGroupEvent {
8124 #[serde(rename = "memberRole")]
8125 MemberRole {
8126 #[serde(
8127 rename = "groupMemberId",
8128 deserialize_with = "deserialize_number_from_string"
8129 )]
8130 group_member_id: i64,
8131
8132 #[serde(rename = "profile")]
8133 profile: Profile,
8134
8135 #[serde(rename = "role")]
8136 role: GroupMemberRole,
8137
8138 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8139 undocumented: JsonObject,
8140 },
8141 #[serde(rename = "memberBlocked")]
8142 MemberBlocked {
8143 #[serde(
8144 rename = "groupMemberId",
8145 deserialize_with = "deserialize_number_from_string"
8146 )]
8147 group_member_id: i64,
8148
8149 #[serde(rename = "profile")]
8150 profile: Profile,
8151
8152 #[serde(rename = "blocked", default)]
8153 blocked: bool,
8154
8155 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8156 undocumented: JsonObject,
8157 },
8158 #[serde(rename = "userRole")]
8159 UserRole {
8160 #[serde(rename = "role")]
8161 role: GroupMemberRole,
8162
8163 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8164 undocumented: JsonObject,
8165 },
8166 #[serde(rename = "memberDeleted")]
8167 MemberDeleted {
8168 #[serde(
8169 rename = "groupMemberId",
8170 deserialize_with = "deserialize_number_from_string"
8171 )]
8172 group_member_id: i64,
8173
8174 #[serde(rename = "profile")]
8175 profile: Profile,
8176
8177 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8178 undocumented: JsonObject,
8179 },
8180 #[serde(rename = "userLeft")]
8181 UserLeft,
8182 #[serde(rename = "groupUpdated")]
8183 GroupUpdated {
8184 #[serde(rename = "groupProfile")]
8185 group_profile: GroupProfile,
8186
8187 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8188 undocumented: JsonObject,
8189 },
8190 #[serde(rename = "memberAccepted")]
8191 MemberAccepted {
8192 #[serde(
8193 rename = "groupMemberId",
8194 deserialize_with = "deserialize_number_from_string"
8195 )]
8196 group_member_id: i64,
8197
8198 #[serde(rename = "profile")]
8199 profile: Profile,
8200
8201 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8202 undocumented: JsonObject,
8203 },
8204 #[serde(rename = "userPendingReview")]
8205 UserPendingReview,
8206 #[serde(untagged)]
8207 Undocumented(JsonObject),
8208}
8209
8210impl SndGroupEvent {
8211 pub fn make_member_role(group_member_id: i64, profile: Profile, role: GroupMemberRole) -> Self {
8212 Self::MemberRole {
8213 group_member_id,
8214 profile,
8215 role,
8216 undocumented: Default::default(),
8217 }
8218 }
8219
8220 pub fn make_member_blocked(group_member_id: i64, profile: Profile, blocked: bool) -> Self {
8221 Self::MemberBlocked {
8222 group_member_id,
8223 profile,
8224 blocked,
8225 undocumented: Default::default(),
8226 }
8227 }
8228
8229 pub fn make_user_role(role: GroupMemberRole) -> Self {
8230 Self::UserRole {
8231 role,
8232 undocumented: Default::default(),
8233 }
8234 }
8235
8236 pub fn make_member_deleted(group_member_id: i64, profile: Profile) -> Self {
8237 Self::MemberDeleted {
8238 group_member_id,
8239 profile,
8240 undocumented: Default::default(),
8241 }
8242 }
8243
8244 pub fn make_user_left() -> Self {
8245 Self::UserLeft
8246 }
8247
8248 pub fn make_group_updated(group_profile: GroupProfile) -> Self {
8249 Self::GroupUpdated {
8250 group_profile,
8251 undocumented: Default::default(),
8252 }
8253 }
8254
8255 pub fn make_member_accepted(group_member_id: i64, profile: Profile) -> Self {
8256 Self::MemberAccepted {
8257 group_member_id,
8258 profile,
8259 undocumented: Default::default(),
8260 }
8261 }
8262
8263 pub fn make_user_pending_review() -> Self {
8264 Self::UserPendingReview
8265 }
8266}
8267
8268impl SndGroupEvent {
8269 pub fn member_role(&self) -> Option<SndGroupEventMemberRoleRef<'_>> {
8270 if let Self::MemberRole {
8271 group_member_id,
8272 profile,
8273 role,
8274 ..
8275 } = self
8276 {
8277 Some(SndGroupEventMemberRoleRef {
8278 group_member_id,
8279 profile,
8280 role,
8281 })
8282 } else {
8283 None
8284 }
8285 }
8286 pub fn member_blocked(&self) -> Option<SndGroupEventMemberBlockedRef<'_>> {
8287 if let Self::MemberBlocked {
8288 group_member_id,
8289 profile,
8290 blocked,
8291 ..
8292 } = self
8293 {
8294 Some(SndGroupEventMemberBlockedRef {
8295 group_member_id,
8296 profile,
8297 blocked,
8298 })
8299 } else {
8300 None
8301 }
8302 }
8303 pub fn user_role(&self) -> Option<&GroupMemberRole> {
8304 if let Self::UserRole { role, .. } = self {
8305 Some(role)
8306 } else {
8307 None
8308 }
8309 }
8310 pub fn member_deleted(&self) -> Option<SndGroupEventMemberDeletedRef<'_>> {
8311 if let Self::MemberDeleted {
8312 group_member_id,
8313 profile,
8314 ..
8315 } = self
8316 {
8317 Some(SndGroupEventMemberDeletedRef {
8318 group_member_id,
8319 profile,
8320 })
8321 } else {
8322 None
8323 }
8324 }
8325 pub fn is_user_left(&self) -> bool {
8326 matches!(self, Self::UserLeft)
8327 }
8328 pub fn group_updated(&self) -> Option<&GroupProfile> {
8329 if let Self::GroupUpdated { group_profile, .. } = self {
8330 Some(group_profile)
8331 } else {
8332 None
8333 }
8334 }
8335 pub fn member_accepted(&self) -> Option<SndGroupEventMemberAcceptedRef<'_>> {
8336 if let Self::MemberAccepted {
8337 group_member_id,
8338 profile,
8339 ..
8340 } = self
8341 {
8342 Some(SndGroupEventMemberAcceptedRef {
8343 group_member_id,
8344 profile,
8345 })
8346 } else {
8347 None
8348 }
8349 }
8350 pub fn is_user_pending_review(&self) -> bool {
8351 matches!(self, Self::UserPendingReview)
8352 }
8353}
8354#[derive(Clone, Copy)]
8355pub struct SndGroupEventMemberRoleRef<'a> {
8356 pub group_member_id: &'a i64,
8357 pub profile: &'a Profile,
8358 pub role: &'a GroupMemberRole,
8359}
8360#[derive(Clone, Copy)]
8361pub struct SndGroupEventMemberBlockedRef<'a> {
8362 pub group_member_id: &'a i64,
8363 pub profile: &'a Profile,
8364 pub blocked: &'a bool,
8365}
8366#[derive(Clone, Copy)]
8367pub struct SndGroupEventMemberDeletedRef<'a> {
8368 pub group_member_id: &'a i64,
8369 pub profile: &'a Profile,
8370}
8371#[derive(Clone, Copy)]
8372pub struct SndGroupEventMemberAcceptedRef<'a> {
8373 pub group_member_id: &'a i64,
8374 pub profile: &'a Profile,
8375}
8376
8377#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8378#[serde(tag = "type")]
8379#[non_exhaustive]
8380pub enum SubscriptionStatus {
8381 #[serde(rename = "active")]
8382 Active,
8383 #[serde(rename = "pending")]
8384 Pending,
8385 #[serde(rename = "removed")]
8386 Removed {
8387 #[serde(rename = "subError")]
8388 sub_error: String,
8389
8390 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8391 undocumented: JsonObject,
8392 },
8393 #[serde(rename = "noSub")]
8394 NoSub,
8395 #[serde(untagged)]
8396 Undocumented(JsonObject),
8397}
8398
8399impl SubscriptionStatus {
8400 pub fn make_active() -> Self {
8401 Self::Active
8402 }
8403
8404 pub fn make_pending() -> Self {
8405 Self::Pending
8406 }
8407
8408 pub fn make_removed(sub_error: String) -> Self {
8409 Self::Removed {
8410 sub_error,
8411 undocumented: Default::default(),
8412 }
8413 }
8414
8415 pub fn make_no_sub() -> Self {
8416 Self::NoSub
8417 }
8418}
8419
8420impl SubscriptionStatus {
8421 pub fn is_active(&self) -> bool {
8422 matches!(self, Self::Active)
8423 }
8424 pub fn is_pending(&self) -> bool {
8425 matches!(self, Self::Pending)
8426 }
8427 pub fn removed(&self) -> Option<&String> {
8428 if let Self::Removed { sub_error, .. } = self {
8429 Some(sub_error)
8430 } else {
8431 None
8432 }
8433 }
8434 pub fn is_no_sub(&self) -> bool {
8435 matches!(self, Self::NoSub)
8436 }
8437}
8438
8439#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8440#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8441#[cfg_attr(feature = "bon", builder(on(String, into)))]
8442pub struct SupportGroupPreference {
8443 #[serde(rename = "enable")]
8444 pub enable: GroupFeatureEnabled,
8445
8446 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8447 #[cfg_attr(feature = "bon", builder(default))]
8448 pub undocumented: JsonObject,
8449}
8450
8451#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
8452#[non_exhaustive]
8453pub enum SwitchPhase {
8454 #[default]
8455 #[serde(rename = "started")]
8456 Started,
8457 #[serde(rename = "confirmed")]
8458 Confirmed,
8459 #[serde(rename = "secured")]
8460 Secured,
8461 #[serde(rename = "completed")]
8462 Completed,
8463}
8464
8465#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8466#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8467#[cfg_attr(feature = "bon", builder(on(String, into)))]
8468pub struct TimedMessagesGroupPreference {
8469 #[serde(rename = "enable")]
8470 pub enable: GroupFeatureEnabled,
8471
8472 #[serde(
8473 rename = "ttl",
8474 skip_serializing_if = "Option::is_none",
8475 deserialize_with = "deserialize_option_number_from_string",
8476 default
8477 )]
8478 pub ttl: Option<i32>,
8479
8480 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8481 #[cfg_attr(feature = "bon", builder(default))]
8482 pub undocumented: JsonObject,
8483}
8484
8485#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8486#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8487#[cfg_attr(feature = "bon", builder(on(String, into)))]
8488pub struct TimedMessagesPreference {
8489 #[serde(rename = "allow")]
8490 pub allow: FeatureAllowed,
8491
8492 #[serde(
8493 rename = "ttl",
8494 skip_serializing_if = "Option::is_none",
8495 deserialize_with = "deserialize_option_number_from_string",
8496 default
8497 )]
8498 pub ttl: Option<i32>,
8499
8500 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8501 #[cfg_attr(feature = "bon", builder(default))]
8502 pub undocumented: JsonObject,
8503}
8504
8505#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
8506#[non_exhaustive]
8507pub enum UIColorMode {
8508 #[default]
8509 #[serde(rename = "light")]
8510 Light,
8511 #[serde(rename = "dark")]
8512 Dark,
8513}
8514
8515#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8516#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8517#[cfg_attr(feature = "bon", builder(on(String, into)))]
8518pub struct UIColors {
8519 #[serde(rename = "accent", skip_serializing_if = "Option::is_none")]
8520 pub accent: Option<String>,
8521
8522 #[serde(rename = "accentVariant", skip_serializing_if = "Option::is_none")]
8523 pub accent_variant: Option<String>,
8524
8525 #[serde(rename = "secondary", skip_serializing_if = "Option::is_none")]
8526 pub secondary: Option<String>,
8527
8528 #[serde(rename = "secondaryVariant", skip_serializing_if = "Option::is_none")]
8529 pub secondary_variant: Option<String>,
8530
8531 #[serde(rename = "background", skip_serializing_if = "Option::is_none")]
8532 pub background: Option<String>,
8533
8534 #[serde(rename = "menus", skip_serializing_if = "Option::is_none")]
8535 pub menus: Option<String>,
8536
8537 #[serde(rename = "title", skip_serializing_if = "Option::is_none")]
8538 pub title: Option<String>,
8539
8540 #[serde(rename = "accentVariant2", skip_serializing_if = "Option::is_none")]
8541 pub accent_variant_2: Option<String>,
8542
8543 #[serde(rename = "sentMessage", skip_serializing_if = "Option::is_none")]
8544 pub sent_message: Option<String>,
8545
8546 #[serde(rename = "sentReply", skip_serializing_if = "Option::is_none")]
8547 pub sent_reply: Option<String>,
8548
8549 #[serde(rename = "receivedMessage", skip_serializing_if = "Option::is_none")]
8550 pub received_message: Option<String>,
8551
8552 #[serde(rename = "receivedReply", skip_serializing_if = "Option::is_none")]
8553 pub received_reply: Option<String>,
8554
8555 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8556 #[cfg_attr(feature = "bon", builder(default))]
8557 pub undocumented: JsonObject,
8558}
8559
8560#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8561#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8562#[cfg_attr(feature = "bon", builder(on(String, into)))]
8563pub struct UIThemeEntityOverride {
8564 #[serde(rename = "mode")]
8565 pub mode: UIColorMode,
8566
8567 #[serde(rename = "wallpaper", skip_serializing_if = "Option::is_none")]
8568 pub wallpaper: Option<ChatWallpaper>,
8569
8570 #[serde(rename = "colors")]
8571 pub colors: UIColors,
8572
8573 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8574 #[cfg_attr(feature = "bon", builder(default))]
8575 pub undocumented: JsonObject,
8576}
8577
8578#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8579#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8580#[cfg_attr(feature = "bon", builder(on(String, into)))]
8581pub struct UIThemeEntityOverrides {
8582 #[serde(rename = "light", skip_serializing_if = "Option::is_none")]
8583 pub light: Option<UIThemeEntityOverride>,
8584
8585 #[serde(rename = "dark", skip_serializing_if = "Option::is_none")]
8586 pub dark: Option<UIThemeEntityOverride>,
8587
8588 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8589 #[cfg_attr(feature = "bon", builder(default))]
8590 pub undocumented: JsonObject,
8591}
8592
8593#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8594#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8595#[cfg_attr(feature = "bon", builder(on(String, into)))]
8596pub struct UpdatedMessage {
8597 #[serde(rename = "msgContent")]
8598 pub msg_content: MsgContent,
8599
8600 #[serde(rename = "mentions")]
8601 pub mentions: BTreeMap<String, i64>,
8602
8603 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8604 #[cfg_attr(feature = "bon", builder(default))]
8605 pub undocumented: JsonObject,
8606}
8607
8608#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8609#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8610#[cfg_attr(feature = "bon", builder(on(String, into)))]
8611pub struct User {
8612 #[serde(rename = "userId", deserialize_with = "deserialize_number_from_string")]
8613 pub user_id: i64,
8614
8615 #[serde(
8616 rename = "agentUserId",
8617 deserialize_with = "deserialize_number_from_string"
8618 )]
8619 pub agent_user_id: i64,
8620
8621 #[serde(
8622 rename = "userContactId",
8623 deserialize_with = "deserialize_number_from_string"
8624 )]
8625 pub user_contact_id: i64,
8626
8627 #[serde(rename = "localDisplayName")]
8628 pub local_display_name: String,
8629
8630 #[serde(rename = "profile")]
8631 pub profile: LocalProfile,
8632
8633 #[serde(rename = "fullPreferences")]
8634 pub full_preferences: FullPreferences,
8635
8636 #[serde(rename = "activeUser", default)]
8637 pub active_user: bool,
8638
8639 #[serde(
8640 rename = "activeOrder",
8641 deserialize_with = "deserialize_number_from_string"
8642 )]
8643 pub active_order: i64,
8644
8645 #[serde(rename = "viewPwdHash", skip_serializing_if = "Option::is_none")]
8646 pub view_pwd_hash: Option<UserPwdHash>,
8647
8648 #[serde(rename = "showNtfs", default)]
8649 pub show_ntfs: bool,
8650
8651 #[serde(rename = "sendRcptsContacts", default)]
8652 pub send_rcpts_contacts: bool,
8653
8654 #[serde(rename = "sendRcptsSmallGroups", default)]
8655 pub send_rcpts_small_groups: bool,
8656
8657 #[serde(rename = "autoAcceptMemberContacts", default)]
8658 pub auto_accept_member_contacts: bool,
8659
8660 #[serde(
8661 rename = "userMemberProfileUpdatedAt",
8662 skip_serializing_if = "Option::is_none"
8663 )]
8664 pub user_member_profile_updated_at: Option<UtcTime>,
8665
8666 #[serde(rename = "uiThemes", skip_serializing_if = "Option::is_none")]
8667 pub ui_themes: Option<UIThemeEntityOverrides>,
8668
8669 #[serde(rename = "userChatRelay", default)]
8670 pub user_chat_relay: bool,
8671
8672 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8673 #[cfg_attr(feature = "bon", builder(default))]
8674 pub undocumented: JsonObject,
8675}
8676
8677#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8678#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8679#[cfg_attr(feature = "bon", builder(on(String, into)))]
8680pub struct UserChatRelay {
8681 #[serde(
8682 rename = "chatRelayId",
8683 deserialize_with = "deserialize_number_from_string"
8684 )]
8685 pub chat_relay_id: i64,
8686
8687 #[serde(rename = "address")]
8688 pub address: String,
8689
8690 #[serde(rename = "relayProfile")]
8691 pub relay_profile: RelayProfile,
8692
8693 #[serde(rename = "domains")]
8694 pub domains: Vec<String>,
8695
8696 #[serde(rename = "preset", default)]
8697 pub preset: bool,
8698
8699 #[serde(rename = "tested", skip_serializing_if = "Option::is_none")]
8700 pub tested: Option<bool>,
8701
8702 #[serde(rename = "enabled", default)]
8703 pub enabled: bool,
8704
8705 #[serde(rename = "deleted", default)]
8706 pub deleted: bool,
8707
8708 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8709 #[cfg_attr(feature = "bon", builder(default))]
8710 pub undocumented: JsonObject,
8711}
8712
8713#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8714#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8715#[cfg_attr(feature = "bon", builder(on(String, into)))]
8716pub struct UserContact {
8717 #[serde(
8718 rename = "userContactLinkId",
8719 deserialize_with = "deserialize_number_from_string"
8720 )]
8721 pub user_contact_link_id: i64,
8722
8723 #[serde(rename = "connReqContact")]
8724 pub conn_req_contact: String,
8725
8726 #[serde(
8727 rename = "groupId",
8728 skip_serializing_if = "Option::is_none",
8729 deserialize_with = "deserialize_option_number_from_string",
8730 default
8731 )]
8732 pub group_id: Option<i64>,
8733
8734 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8735 #[cfg_attr(feature = "bon", builder(default))]
8736 pub undocumented: JsonObject,
8737}
8738
8739#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8740#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8741#[cfg_attr(feature = "bon", builder(on(String, into)))]
8742pub struct UserContactLink {
8743 #[serde(
8744 rename = "userContactLinkId",
8745 deserialize_with = "deserialize_number_from_string"
8746 )]
8747 pub user_contact_link_id: i64,
8748
8749 #[serde(rename = "connLinkContact")]
8750 pub conn_link_contact: CreatedConnLink,
8751
8752 #[serde(rename = "shortLinkDataSet", default)]
8753 pub short_link_data_set: bool,
8754
8755 #[serde(rename = "shortLinkLargeDataSet", default)]
8756 pub short_link_large_data_set: bool,
8757
8758 #[serde(rename = "addressSettings")]
8759 pub address_settings: AddressSettings,
8760
8761 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8762 #[cfg_attr(feature = "bon", builder(default))]
8763 pub undocumented: JsonObject,
8764}
8765
8766#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8767#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8768#[cfg_attr(feature = "bon", builder(on(String, into)))]
8769pub struct UserContactRequest {
8770 #[serde(
8771 rename = "contactRequestId",
8772 deserialize_with = "deserialize_number_from_string"
8773 )]
8774 pub contact_request_id: i64,
8775
8776 #[serde(rename = "agentInvitationId")]
8777 pub agent_invitation_id: String,
8778
8779 #[serde(
8780 rename = "contactId_",
8781 skip_serializing_if = "Option::is_none",
8782 deserialize_with = "deserialize_option_number_from_string",
8783 default
8784 )]
8785 pub contact_id: Option<i64>,
8786
8787 #[serde(
8788 rename = "businessGroupId_",
8789 skip_serializing_if = "Option::is_none",
8790 deserialize_with = "deserialize_option_number_from_string",
8791 default
8792 )]
8793 pub business_group_id: Option<i64>,
8794
8795 #[serde(
8796 rename = "userContactLinkId_",
8797 skip_serializing_if = "Option::is_none",
8798 deserialize_with = "deserialize_option_number_from_string",
8799 default
8800 )]
8801 pub user_contact_link_id: Option<i64>,
8802
8803 #[serde(rename = "cReqChatVRange")]
8804 pub c_req_chat_v_range: VersionRange,
8805
8806 #[serde(rename = "localDisplayName")]
8807 pub local_display_name: String,
8808
8809 #[serde(
8810 rename = "profileId",
8811 deserialize_with = "deserialize_number_from_string"
8812 )]
8813 pub profile_id: i64,
8814
8815 #[serde(rename = "profile")]
8816 pub profile: LocalProfile,
8817
8818 #[serde(rename = "createdAt")]
8819 pub created_at: UtcTime,
8820
8821 #[serde(rename = "updatedAt")]
8822 pub updated_at: UtcTime,
8823
8824 #[serde(rename = "xContactId", skip_serializing_if = "Option::is_none")]
8825 pub x_contact_id: Option<String>,
8826
8827 #[serde(rename = "pqSupport", default)]
8828 pub pq_support: bool,
8829
8830 #[serde(rename = "welcomeSharedMsgId", skip_serializing_if = "Option::is_none")]
8831 pub welcome_shared_msg_id: Option<String>,
8832
8833 #[serde(rename = "requestSharedMsgId", skip_serializing_if = "Option::is_none")]
8834 pub request_shared_msg_id: Option<String>,
8835
8836 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8837 #[cfg_attr(feature = "bon", builder(default))]
8838 pub undocumented: JsonObject,
8839}
8840
8841#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8842#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8843#[cfg_attr(feature = "bon", builder(on(String, into)))]
8844pub struct UserInfo {
8845 #[serde(rename = "user")]
8846 pub user: User,
8847
8848 #[serde(
8849 rename = "unreadCount",
8850 deserialize_with = "deserialize_number_from_string"
8851 )]
8852 pub unread_count: i32,
8853
8854 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8855 #[cfg_attr(feature = "bon", builder(default))]
8856 pub undocumented: JsonObject,
8857}
8858
8859#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8860#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8861#[cfg_attr(feature = "bon", builder(on(String, into)))]
8862pub struct UserProfileUpdateSummary {
8863 #[serde(
8864 rename = "updateSuccesses",
8865 deserialize_with = "deserialize_number_from_string"
8866 )]
8867 pub update_successes: i32,
8868
8869 #[serde(
8870 rename = "updateFailures",
8871 deserialize_with = "deserialize_number_from_string"
8872 )]
8873 pub update_failures: i32,
8874
8875 #[serde(rename = "changedContacts")]
8876 pub changed_contacts: Vec<Contact>,
8877
8878 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8879 #[cfg_attr(feature = "bon", builder(default))]
8880 pub undocumented: JsonObject,
8881}
8882
8883#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8884#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8885#[cfg_attr(feature = "bon", builder(on(String, into)))]
8886pub struct UserPwdHash {
8887 #[serde(rename = "hash")]
8888 pub hash: String,
8889
8890 #[serde(rename = "salt")]
8891 pub salt: String,
8892
8893 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8894 #[cfg_attr(feature = "bon", builder(default))]
8895 pub undocumented: JsonObject,
8896}
8897
8898#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8899#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8900#[cfg_attr(feature = "bon", builder(on(String, into)))]
8901pub struct VersionRange {
8902 #[serde(
8903 rename = "minVersion",
8904 deserialize_with = "deserialize_number_from_string"
8905 )]
8906 pub min_version: i32,
8907
8908 #[serde(
8909 rename = "maxVersion",
8910 deserialize_with = "deserialize_number_from_string"
8911 )]
8912 pub max_version: i32,
8913
8914 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8915 #[cfg_attr(feature = "bon", builder(default))]
8916 pub undocumented: JsonObject,
8917}
8918
8919#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8920#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8921#[cfg_attr(feature = "bon", builder(on(String, into)))]
8922pub struct XFTPRcvFile {
8923 #[serde(rename = "rcvFileDescription")]
8924 pub rcv_file_description: RcvFileDescr,
8925
8926 #[serde(rename = "agentRcvFileId", skip_serializing_if = "Option::is_none")]
8927 pub agent_rcv_file_id: Option<String>,
8928
8929 #[serde(rename = "agentRcvFileDeleted", default)]
8930 pub agent_rcv_file_deleted: bool,
8931
8932 #[serde(rename = "userApprovedRelays", default)]
8933 pub user_approved_relays: bool,
8934
8935 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8936 #[cfg_attr(feature = "bon", builder(default))]
8937 pub undocumented: JsonObject,
8938}
8939
8940#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
8941#[cfg_attr(feature = "bon", derive(::bon::Builder))]
8942#[cfg_attr(feature = "bon", builder(on(String, into)))]
8943pub struct XFTPSndFile {
8944 #[serde(rename = "agentSndFileId")]
8945 pub agent_snd_file_id: String,
8946
8947 #[serde(
8948 rename = "privateSndFileDescr",
8949 skip_serializing_if = "Option::is_none"
8950 )]
8951 pub private_snd_file_descr: Option<String>,
8952
8953 #[serde(rename = "agentSndFileDeleted", default)]
8954 pub agent_snd_file_deleted: bool,
8955
8956 #[serde(rename = "cryptoArgs", skip_serializing_if = "Option::is_none")]
8957 pub crypto_args: Option<CryptoFileArgs>,
8958
8959 #[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
8960 #[cfg_attr(feature = "bon", builder(default))]
8961 pub undocumented: JsonObject,
8962}