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