#![allow(clippy::large_enum_variant)]
#![allow(clippy::new_without_default)]
pub mod client_api;
pub mod commands;
pub mod errors;
pub mod events;
pub mod responses;
pub mod utils;
use errors::*;
use serde::{Deserialize, Serialize};
use serde_aux::field_attributes::{
deserialize_number_from_string, deserialize_option_number_from_string,
};
use std::{collections::BTreeMap, fmt::Write as _, sync::Arc};
use utils::CommandSyntax;
pub type UtcTime = String;
pub type JsonObject = serde_json::Value;
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct ACIReaction {
#[serde(rename = "chatInfo")]
pub chat_info: ChatInfo,
#[serde(rename = "chatReaction")]
pub chat_reaction: CIReaction,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct AChat {
#[serde(rename = "chatInfo")]
pub chat_info: ChatInfo,
#[serde(rename = "chatItems")]
pub chat_items: Vec<ChatItem>,
#[serde(rename = "chatStats")]
pub chat_stats: ChatStats,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct AChatItem {
#[serde(rename = "chatInfo")]
pub chat_info: ChatInfo,
#[serde(rename = "chatItem")]
pub chat_item: ChatItem,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct AddressSettings {
#[serde(rename = "businessAddress")]
pub business_address: bool,
#[serde(rename = "autoAccept", skip_serializing_if = "Option::is_none")]
pub auto_accept: Option<AutoAccept>,
#[serde(rename = "autoReply", skip_serializing_if = "Option::is_none")]
pub auto_reply: Option<MsgContent>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct AutoAccept {
#[serde(rename = "acceptIncognito")]
pub accept_incognito: bool,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct BlockingInfo {
#[serde(rename = "reason")]
pub reason: BlockingReason,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum BlockingReason {
#[default]
#[serde(rename = "spam")]
Spam,
#[serde(rename = "content")]
Content,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct BusinessChatInfo {
#[serde(rename = "chatType")]
pub chat_type: BusinessChatType,
#[serde(rename = "businessId")]
pub business_id: String,
#[serde(rename = "customerId")]
pub customer_id: String,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum BusinessChatType {
#[default]
#[serde(rename = "business")]
Business,
#[serde(rename = "customer")]
Customer,
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum CICallStatus {
#[default]
#[serde(rename = "pending")]
Pending,
#[serde(rename = "missed")]
Missed,
#[serde(rename = "rejected")]
Rejected,
#[serde(rename = "accepted")]
Accepted,
#[serde(rename = "negotiated")]
Negotiated,
#[serde(rename = "progress")]
Progress,
#[serde(rename = "ended")]
Ended,
#[serde(rename = "error")]
Error,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum CIContent {
#[serde(rename = "sndMsgContent")]
SndMsgContent {
#[serde(rename = "msgContent")]
msg_content: MsgContent,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "rcvMsgContent")]
RcvMsgContent {
#[serde(rename = "msgContent")]
msg_content: MsgContent,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "sndDeleted")]
SndDeleted {
#[serde(rename = "deleteMode")]
delete_mode: CIDeleteMode,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "rcvDeleted")]
RcvDeleted {
#[serde(rename = "deleteMode")]
delete_mode: CIDeleteMode,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "sndCall")]
SndCall {
#[serde(rename = "status")]
status: CICallStatus,
#[serde(
rename = "duration",
deserialize_with = "deserialize_number_from_string"
)]
duration: i32,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "rcvCall")]
RcvCall {
#[serde(rename = "status")]
status: CICallStatus,
#[serde(
rename = "duration",
deserialize_with = "deserialize_number_from_string"
)]
duration: i32,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "rcvIntegrityError")]
RcvIntegrityError {
#[serde(rename = "msgError")]
msg_error: MsgErrorType,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "rcvDecryptionError")]
RcvDecryptionError {
#[serde(rename = "msgDecryptError")]
msg_decrypt_error: MsgDecryptError,
#[serde(
rename = "msgCount",
deserialize_with = "deserialize_number_from_string"
)]
msg_count: u32,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "rcvGroupInvitation")]
RcvGroupInvitation {
#[serde(rename = "groupInvitation")]
group_invitation: CIGroupInvitation,
#[serde(rename = "memberRole")]
member_role: GroupMemberRole,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "sndGroupInvitation")]
SndGroupInvitation {
#[serde(rename = "groupInvitation")]
group_invitation: CIGroupInvitation,
#[serde(rename = "memberRole")]
member_role: GroupMemberRole,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "rcvDirectEvent")]
RcvDirectEvent {
#[serde(rename = "rcvDirectEvent")]
rcv_direct_event: RcvDirectEvent,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "rcvGroupEvent")]
RcvGroupEvent {
#[serde(rename = "rcvGroupEvent")]
rcv_group_event: RcvGroupEvent,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "sndGroupEvent")]
SndGroupEvent {
#[serde(rename = "sndGroupEvent")]
snd_group_event: SndGroupEvent,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "rcvConnEvent")]
RcvConnEvent {
#[serde(rename = "rcvConnEvent")]
rcv_conn_event: RcvConnEvent,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "sndConnEvent")]
SndConnEvent {
#[serde(rename = "sndConnEvent")]
snd_conn_event: SndConnEvent,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "rcvChatFeature")]
RcvChatFeature {
#[serde(rename = "feature")]
feature: ChatFeature,
#[serde(rename = "enabled")]
enabled: PrefEnabled,
#[serde(
rename = "param",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
param: Option<i32>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "sndChatFeature")]
SndChatFeature {
#[serde(rename = "feature")]
feature: ChatFeature,
#[serde(rename = "enabled")]
enabled: PrefEnabled,
#[serde(
rename = "param",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
param: Option<i32>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "rcvChatPreference")]
RcvChatPreference {
#[serde(rename = "feature")]
feature: ChatFeature,
#[serde(rename = "allowed")]
allowed: FeatureAllowed,
#[serde(
rename = "param",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
param: Option<i32>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "sndChatPreference")]
SndChatPreference {
#[serde(rename = "feature")]
feature: ChatFeature,
#[serde(rename = "allowed")]
allowed: FeatureAllowed,
#[serde(
rename = "param",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
param: Option<i32>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "rcvGroupFeature")]
RcvGroupFeature {
#[serde(rename = "groupFeature")]
group_feature: GroupFeature,
#[serde(rename = "preference")]
preference: GroupPreference,
#[serde(
rename = "param",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
param: Option<i32>,
#[serde(rename = "memberRole_", skip_serializing_if = "Option::is_none")]
member_role: Option<GroupMemberRole>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "sndGroupFeature")]
SndGroupFeature {
#[serde(rename = "groupFeature")]
group_feature: GroupFeature,
#[serde(rename = "preference")]
preference: GroupPreference,
#[serde(
rename = "param",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
param: Option<i32>,
#[serde(rename = "memberRole_", skip_serializing_if = "Option::is_none")]
member_role: Option<GroupMemberRole>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "rcvChatFeatureRejected")]
RcvChatFeatureRejected {
#[serde(rename = "feature")]
feature: ChatFeature,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "rcvGroupFeatureRejected")]
RcvGroupFeatureRejected {
#[serde(rename = "groupFeature")]
group_feature: GroupFeature,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "sndModerated")]
SndModerated,
#[serde(rename = "rcvModerated")]
RcvModerated,
#[serde(rename = "rcvBlocked")]
RcvBlocked,
#[serde(rename = "sndDirectE2EEInfo")]
SndDirectE2EeInfo {
#[serde(rename = "e2eeInfo")]
e_2_ee_info: E2EInfo,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "rcvDirectE2EEInfo")]
RcvDirectE2EeInfo {
#[serde(rename = "e2eeInfo")]
e_2_ee_info: E2EInfo,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "sndGroupE2EEInfo")]
SndGroupE2EeInfo {
#[serde(rename = "e2eeInfo")]
e_2_ee_info: E2EInfo,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "rcvGroupE2EEInfo")]
RcvGroupE2EeInfo {
#[serde(rename = "e2eeInfo")]
e_2_ee_info: E2EInfo,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "chatBanner")]
ChatBanner,
#[serde(untagged)]
Undocumented(JsonObject),
}
impl CIContent {
pub fn snd_msg_content(msg_content: MsgContent) -> Self {
Self::SndMsgContent {
msg_content,
undocumented: Default::default(),
}
}
pub fn rcv_msg_content(msg_content: MsgContent) -> Self {
Self::RcvMsgContent {
msg_content,
undocumented: Default::default(),
}
}
pub fn snd_deleted(delete_mode: CIDeleteMode) -> Self {
Self::SndDeleted {
delete_mode,
undocumented: Default::default(),
}
}
pub fn rcv_deleted(delete_mode: CIDeleteMode) -> Self {
Self::RcvDeleted {
delete_mode,
undocumented: Default::default(),
}
}
pub fn snd_call(status: CICallStatus, duration: i32) -> Self {
Self::SndCall {
status,
duration,
undocumented: Default::default(),
}
}
pub fn rcv_call(status: CICallStatus, duration: i32) -> Self {
Self::RcvCall {
status,
duration,
undocumented: Default::default(),
}
}
pub fn rcv_integrity_error(msg_error: MsgErrorType) -> Self {
Self::RcvIntegrityError {
msg_error,
undocumented: Default::default(),
}
}
pub fn rcv_decryption_error(msg_decrypt_error: MsgDecryptError, msg_count: u32) -> Self {
Self::RcvDecryptionError {
msg_decrypt_error,
msg_count,
undocumented: Default::default(),
}
}
pub fn rcv_group_invitation(
group_invitation: CIGroupInvitation,
member_role: GroupMemberRole,
) -> Self {
Self::RcvGroupInvitation {
group_invitation,
member_role,
undocumented: Default::default(),
}
}
pub fn snd_group_invitation(
group_invitation: CIGroupInvitation,
member_role: GroupMemberRole,
) -> Self {
Self::SndGroupInvitation {
group_invitation,
member_role,
undocumented: Default::default(),
}
}
pub fn rcv_direct_event(rcv_direct_event: RcvDirectEvent) -> Self {
Self::RcvDirectEvent {
rcv_direct_event,
undocumented: Default::default(),
}
}
pub fn rcv_group_event(rcv_group_event: RcvGroupEvent) -> Self {
Self::RcvGroupEvent {
rcv_group_event,
undocumented: Default::default(),
}
}
pub fn snd_group_event(snd_group_event: SndGroupEvent) -> Self {
Self::SndGroupEvent {
snd_group_event,
undocumented: Default::default(),
}
}
pub fn rcv_conn_event(rcv_conn_event: RcvConnEvent) -> Self {
Self::RcvConnEvent {
rcv_conn_event,
undocumented: Default::default(),
}
}
pub fn snd_conn_event(snd_conn_event: SndConnEvent) -> Self {
Self::SndConnEvent {
snd_conn_event,
undocumented: Default::default(),
}
}
pub fn rcv_chat_feature(
feature: ChatFeature,
enabled: PrefEnabled,
param: Option<i32>,
) -> Self {
Self::RcvChatFeature {
feature,
enabled,
param,
undocumented: Default::default(),
}
}
pub fn snd_chat_feature(
feature: ChatFeature,
enabled: PrefEnabled,
param: Option<i32>,
) -> Self {
Self::SndChatFeature {
feature,
enabled,
param,
undocumented: Default::default(),
}
}
pub fn rcv_chat_preference(
feature: ChatFeature,
allowed: FeatureAllowed,
param: Option<i32>,
) -> Self {
Self::RcvChatPreference {
feature,
allowed,
param,
undocumented: Default::default(),
}
}
pub fn snd_chat_preference(
feature: ChatFeature,
allowed: FeatureAllowed,
param: Option<i32>,
) -> Self {
Self::SndChatPreference {
feature,
allowed,
param,
undocumented: Default::default(),
}
}
pub fn rcv_group_feature(
group_feature: GroupFeature,
preference: GroupPreference,
param: Option<i32>,
member_role: Option<GroupMemberRole>,
) -> Self {
Self::RcvGroupFeature {
group_feature,
preference,
param,
member_role,
undocumented: Default::default(),
}
}
pub fn snd_group_feature(
group_feature: GroupFeature,
preference: GroupPreference,
param: Option<i32>,
member_role: Option<GroupMemberRole>,
) -> Self {
Self::SndGroupFeature {
group_feature,
preference,
param,
member_role,
undocumented: Default::default(),
}
}
pub fn rcv_chat_feature_rejected(feature: ChatFeature) -> Self {
Self::RcvChatFeatureRejected {
feature,
undocumented: Default::default(),
}
}
pub fn rcv_group_feature_rejected(group_feature: GroupFeature) -> Self {
Self::RcvGroupFeatureRejected {
group_feature,
undocumented: Default::default(),
}
}
pub fn snd_moderated() -> Self {
Self::SndModerated
}
pub fn rcv_moderated() -> Self {
Self::RcvModerated
}
pub fn rcv_blocked() -> Self {
Self::RcvBlocked
}
pub fn snd_direct_e_2_ee_info(e_2_ee_info: E2EInfo) -> Self {
Self::SndDirectE2EeInfo {
e_2_ee_info,
undocumented: Default::default(),
}
}
pub fn rcv_direct_e_2_ee_info(e_2_ee_info: E2EInfo) -> Self {
Self::RcvDirectE2EeInfo {
e_2_ee_info,
undocumented: Default::default(),
}
}
pub fn snd_group_e_2_ee_info(e_2_ee_info: E2EInfo) -> Self {
Self::SndGroupE2EeInfo {
e_2_ee_info,
undocumented: Default::default(),
}
}
pub fn rcv_group_e_2_ee_info(e_2_ee_info: E2EInfo) -> Self {
Self::RcvGroupE2EeInfo {
e_2_ee_info,
undocumented: Default::default(),
}
}
pub fn chat_banner() -> Self {
Self::ChatBanner
}
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum CIDeleteMode {
#[default]
#[serde(rename = "broadcast")]
Broadcast,
#[serde(rename = "internal")]
Internal,
#[serde(rename = "internalMark")]
InternalMark,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum CIDeleted {
#[serde(rename = "deleted")]
Deleted {
#[serde(rename = "deletedTs", skip_serializing_if = "Option::is_none")]
deleted_ts: Option<UtcTime>,
#[serde(rename = "chatType")]
chat_type: ChatType,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "blocked")]
Blocked {
#[serde(rename = "deletedTs", skip_serializing_if = "Option::is_none")]
deleted_ts: Option<UtcTime>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "blockedByAdmin")]
BlockedByAdmin {
#[serde(rename = "deletedTs", skip_serializing_if = "Option::is_none")]
deleted_ts: Option<UtcTime>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "moderated")]
Moderated {
#[serde(rename = "deletedTs", skip_serializing_if = "Option::is_none")]
deleted_ts: Option<UtcTime>,
#[serde(rename = "byGroupMember")]
by_group_member: GroupMember,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(untagged)]
Undocumented(JsonObject),
}
impl CIDeleted {
pub fn deleted(deleted_ts: Option<UtcTime>, chat_type: ChatType) -> Self {
Self::Deleted {
deleted_ts,
chat_type,
undocumented: Default::default(),
}
}
pub fn blocked(deleted_ts: Option<UtcTime>) -> Self {
Self::Blocked {
deleted_ts,
undocumented: Default::default(),
}
}
pub fn blocked_by_admin(deleted_ts: Option<UtcTime>) -> Self {
Self::BlockedByAdmin {
deleted_ts,
undocumented: Default::default(),
}
}
pub fn moderated(deleted_ts: Option<UtcTime>, by_group_member: GroupMember) -> Self {
Self::Moderated {
deleted_ts,
by_group_member,
undocumented: Default::default(),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum CIDirection {
#[serde(rename = "directSnd")]
DirectSnd,
#[serde(rename = "directRcv")]
DirectRcv,
#[serde(rename = "groupSnd")]
GroupSnd,
#[serde(rename = "groupRcv")]
GroupRcv {
#[serde(rename = "groupMember")]
group_member: GroupMember,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "localSnd")]
LocalSnd,
#[serde(rename = "localRcv")]
LocalRcv,
#[serde(untagged)]
Undocumented(JsonObject),
}
impl CIDirection {
pub fn direct_snd() -> Self {
Self::DirectSnd
}
pub fn direct_rcv() -> Self {
Self::DirectRcv
}
pub fn group_snd() -> Self {
Self::GroupSnd
}
pub fn group_rcv(group_member: GroupMember) -> Self {
Self::GroupRcv {
group_member,
undocumented: Default::default(),
}
}
pub fn local_snd() -> Self {
Self::LocalSnd
}
pub fn local_rcv() -> Self {
Self::LocalRcv
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct CIFile {
#[serde(rename = "fileId", deserialize_with = "deserialize_number_from_string")]
pub file_id: i64,
#[serde(rename = "fileName")]
pub file_name: String,
#[serde(
rename = "fileSize",
deserialize_with = "deserialize_number_from_string"
)]
pub file_size: i64,
#[serde(rename = "fileSource", skip_serializing_if = "Option::is_none")]
pub file_source: Option<CryptoFile>,
#[serde(rename = "fileStatus")]
pub file_status: CIFileStatus,
#[serde(rename = "fileProtocol")]
pub file_protocol: FileProtocol,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum CIFileStatus {
#[serde(rename = "sndStored")]
SndStored,
#[serde(rename = "sndTransfer")]
SndTransfer {
#[serde(
rename = "sndProgress",
deserialize_with = "deserialize_number_from_string"
)]
snd_progress: i64,
#[serde(
rename = "sndTotal",
deserialize_with = "deserialize_number_from_string"
)]
snd_total: i64,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "sndCancelled")]
SndCancelled,
#[serde(rename = "sndComplete")]
SndComplete,
#[serde(rename = "sndError")]
SndError {
#[serde(rename = "sndFileError")]
snd_file_error: FileError,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "sndWarning")]
SndWarning {
#[serde(rename = "sndFileError")]
snd_file_error: FileError,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "rcvInvitation")]
RcvInvitation,
#[serde(rename = "rcvAccepted")]
RcvAccepted,
#[serde(rename = "rcvTransfer")]
RcvTransfer {
#[serde(
rename = "rcvProgress",
deserialize_with = "deserialize_number_from_string"
)]
rcv_progress: i64,
#[serde(
rename = "rcvTotal",
deserialize_with = "deserialize_number_from_string"
)]
rcv_total: i64,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "rcvAborted")]
RcvAborted,
#[serde(rename = "rcvComplete")]
RcvComplete,
#[serde(rename = "rcvCancelled")]
RcvCancelled,
#[serde(rename = "rcvError")]
RcvError {
#[serde(rename = "rcvFileError")]
rcv_file_error: FileError,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "rcvWarning")]
RcvWarning {
#[serde(rename = "rcvFileError")]
rcv_file_error: FileError,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "invalid")]
Invalid {
#[serde(rename = "text")]
text: String,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(untagged)]
Undocumented(JsonObject),
}
impl CIFileStatus {
pub fn snd_stored() -> Self {
Self::SndStored
}
pub fn snd_transfer(snd_progress: i64, snd_total: i64) -> Self {
Self::SndTransfer {
snd_progress,
snd_total,
undocumented: Default::default(),
}
}
pub fn snd_cancelled() -> Self {
Self::SndCancelled
}
pub fn snd_complete() -> Self {
Self::SndComplete
}
pub fn snd_error(snd_file_error: FileError) -> Self {
Self::SndError {
snd_file_error,
undocumented: Default::default(),
}
}
pub fn snd_warning(snd_file_error: FileError) -> Self {
Self::SndWarning {
snd_file_error,
undocumented: Default::default(),
}
}
pub fn rcv_invitation() -> Self {
Self::RcvInvitation
}
pub fn rcv_accepted() -> Self {
Self::RcvAccepted
}
pub fn rcv_transfer(rcv_progress: i64, rcv_total: i64) -> Self {
Self::RcvTransfer {
rcv_progress,
rcv_total,
undocumented: Default::default(),
}
}
pub fn rcv_aborted() -> Self {
Self::RcvAborted
}
pub fn rcv_complete() -> Self {
Self::RcvComplete
}
pub fn rcv_cancelled() -> Self {
Self::RcvCancelled
}
pub fn rcv_error(rcv_file_error: FileError) -> Self {
Self::RcvError {
rcv_file_error,
undocumented: Default::default(),
}
}
pub fn rcv_warning(rcv_file_error: FileError) -> Self {
Self::RcvWarning {
rcv_file_error,
undocumented: Default::default(),
}
}
pub fn invalid(text: String) -> Self {
Self::Invalid {
text,
undocumented: Default::default(),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum CIForwardedFrom {
#[serde(rename = "unknown")]
Unknown,
#[serde(rename = "contact")]
Contact {
#[serde(rename = "chatName")]
chat_name: String,
#[serde(rename = "msgDir")]
msg_dir: MsgDirection,
#[serde(
rename = "contactId",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
contact_id: Option<i64>,
#[serde(
rename = "chatItemId",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
chat_item_id: Option<i64>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "group")]
Group {
#[serde(rename = "chatName")]
chat_name: String,
#[serde(rename = "msgDir")]
msg_dir: MsgDirection,
#[serde(
rename = "groupId",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
group_id: Option<i64>,
#[serde(
rename = "chatItemId",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
chat_item_id: Option<i64>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(untagged)]
Undocumented(JsonObject),
}
impl CIForwardedFrom {
pub fn unknown() -> Self {
Self::Unknown
}
pub fn contact(
chat_name: String,
msg_dir: MsgDirection,
contact_id: Option<i64>,
chat_item_id: Option<i64>,
) -> Self {
Self::Contact {
chat_name,
msg_dir,
contact_id,
chat_item_id,
undocumented: Default::default(),
}
}
pub fn group(
chat_name: String,
msg_dir: MsgDirection,
group_id: Option<i64>,
chat_item_id: Option<i64>,
) -> Self {
Self::Group {
chat_name,
msg_dir,
group_id,
chat_item_id,
undocumented: Default::default(),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct CIGroupInvitation {
#[serde(
rename = "groupId",
deserialize_with = "deserialize_number_from_string"
)]
pub group_id: i64,
#[serde(
rename = "groupMemberId",
deserialize_with = "deserialize_number_from_string"
)]
pub group_member_id: i64,
#[serde(rename = "localDisplayName")]
pub local_display_name: String,
#[serde(rename = "groupProfile")]
pub group_profile: GroupProfile,
#[serde(rename = "status")]
pub status: CIGroupInvitationStatus,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum CIGroupInvitationStatus {
#[default]
#[serde(rename = "pending")]
Pending,
#[serde(rename = "accepted")]
Accepted,
#[serde(rename = "rejected")]
Rejected,
#[serde(rename = "expired")]
Expired,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct CIMention {
#[serde(rename = "memberId")]
pub member_id: String,
#[serde(rename = "memberRef", skip_serializing_if = "Option::is_none")]
pub member_ref: Option<CIMentionMember>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct CIMentionMember {
#[serde(
rename = "groupMemberId",
deserialize_with = "deserialize_number_from_string"
)]
pub group_member_id: i64,
#[serde(rename = "displayName")]
pub display_name: String,
#[serde(rename = "localAlias", skip_serializing_if = "Option::is_none")]
pub local_alias: Option<String>,
#[serde(rename = "memberRole")]
pub member_role: GroupMemberRole,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct CIMeta {
#[serde(rename = "itemId", deserialize_with = "deserialize_number_from_string")]
pub item_id: i64,
#[serde(rename = "itemTs")]
pub item_ts: UtcTime,
#[serde(rename = "itemText")]
pub item_text: String,
#[serde(rename = "itemStatus")]
pub item_status: CIStatus,
#[serde(rename = "sentViaProxy", skip_serializing_if = "Option::is_none")]
pub sent_via_proxy: Option<bool>,
#[serde(rename = "itemSharedMsgId", skip_serializing_if = "Option::is_none")]
pub item_shared_msg_id: Option<String>,
#[serde(rename = "itemForwarded", skip_serializing_if = "Option::is_none")]
pub item_forwarded: Option<CIForwardedFrom>,
#[serde(rename = "itemDeleted", skip_serializing_if = "Option::is_none")]
pub item_deleted: Option<CIDeleted>,
#[serde(rename = "itemEdited")]
pub item_edited: bool,
#[serde(rename = "itemTimed", skip_serializing_if = "Option::is_none")]
pub item_timed: Option<CITimed>,
#[serde(rename = "itemLive", skip_serializing_if = "Option::is_none")]
pub item_live: Option<bool>,
#[serde(rename = "userMention")]
pub user_mention: bool,
#[serde(rename = "deletable")]
pub deletable: bool,
#[serde(rename = "editable")]
pub editable: bool,
#[serde(
rename = "forwardedByMember",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub forwarded_by_member: Option<i64>,
#[serde(rename = "showGroupAsSender")]
pub show_group_as_sender: bool,
#[serde(rename = "createdAt")]
pub created_at: UtcTime,
#[serde(rename = "updatedAt")]
pub updated_at: UtcTime,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct CIQuote {
#[serde(rename = "chatDir", skip_serializing_if = "Option::is_none")]
pub chat_dir: Option<CIDirection>,
#[serde(
rename = "itemId",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub item_id: Option<i64>,
#[serde(rename = "sharedMsgId", skip_serializing_if = "Option::is_none")]
pub shared_msg_id: Option<String>,
#[serde(rename = "sentAt")]
pub sent_at: UtcTime,
#[serde(rename = "content")]
pub content: MsgContent,
#[serde(rename = "formattedText", skip_serializing_if = "Option::is_none")]
pub formatted_text: Option<Vec<FormattedText>>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct CIReaction {
#[serde(rename = "chatDir")]
pub chat_dir: CIDirection,
#[serde(rename = "chatItem")]
pub chat_item: ChatItem,
#[serde(rename = "sentAt")]
pub sent_at: UtcTime,
#[serde(rename = "reaction")]
pub reaction: MsgReaction,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct CIReactionCount {
#[serde(rename = "reaction")]
pub reaction: MsgReaction,
#[serde(rename = "userReacted")]
pub user_reacted: bool,
#[serde(
rename = "totalReacted",
deserialize_with = "deserialize_number_from_string"
)]
pub total_reacted: i32,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum CIStatus {
#[serde(rename = "sndNew")]
SndNew,
#[serde(rename = "sndSent")]
SndSent {
#[serde(rename = "sndProgress")]
snd_progress: SndCIStatusProgress,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "sndRcvd")]
SndRcvd {
#[serde(rename = "msgRcptStatus")]
msg_rcpt_status: MsgReceiptStatus,
#[serde(rename = "sndProgress")]
snd_progress: SndCIStatusProgress,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "sndErrorAuth")]
SndErrorAuth,
#[serde(rename = "sndError")]
SndError {
#[serde(rename = "agentError")]
agent_error: SndError,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "sndWarning")]
SndWarning {
#[serde(rename = "agentError")]
agent_error: SndError,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "rcvNew")]
RcvNew,
#[serde(rename = "rcvRead")]
RcvRead,
#[serde(rename = "invalid")]
Invalid {
#[serde(rename = "text")]
text: String,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(untagged)]
Undocumented(JsonObject),
}
impl CIStatus {
pub fn snd_new() -> Self {
Self::SndNew
}
pub fn snd_sent(snd_progress: SndCIStatusProgress) -> Self {
Self::SndSent {
snd_progress,
undocumented: Default::default(),
}
}
pub fn snd_rcvd(msg_rcpt_status: MsgReceiptStatus, snd_progress: SndCIStatusProgress) -> Self {
Self::SndRcvd {
msg_rcpt_status,
snd_progress,
undocumented: Default::default(),
}
}
pub fn snd_error_auth() -> Self {
Self::SndErrorAuth
}
pub fn snd_error(agent_error: SndError) -> Self {
Self::SndError {
agent_error,
undocumented: Default::default(),
}
}
pub fn snd_warning(agent_error: SndError) -> Self {
Self::SndWarning {
agent_error,
undocumented: Default::default(),
}
}
pub fn rcv_new() -> Self {
Self::RcvNew
}
pub fn rcv_read() -> Self {
Self::RcvRead
}
pub fn invalid(text: String) -> Self {
Self::Invalid {
text,
undocumented: Default::default(),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct CITimed {
#[serde(rename = "ttl", deserialize_with = "deserialize_number_from_string")]
pub ttl: i32,
#[serde(rename = "deleteAt", skip_serializing_if = "Option::is_none")]
pub delete_at: Option<UtcTime>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum ChatBotCommand {
#[serde(rename = "command")]
Command {
#[serde(rename = "keyword")]
keyword: String,
#[serde(rename = "label")]
label: String,
#[serde(rename = "params", skip_serializing_if = "Option::is_none")]
params: Option<String>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "menu")]
Menu {
#[serde(rename = "label")]
label: String,
#[serde(rename = "commands")]
commands: Vec<ChatBotCommand>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(untagged)]
Undocumented(JsonObject),
}
impl ChatBotCommand {
pub fn command(keyword: String, label: String, params: Option<String>) -> Self {
Self::Command {
keyword,
label,
params,
undocumented: Default::default(),
}
}
pub fn menu(label: String, commands: Vec<ChatBotCommand>) -> Self {
Self::Menu {
label,
commands,
undocumented: Default::default(),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum ChatDeleteMode {
#[serde(rename = "full")]
Full {
#[serde(rename = "notify")]
notify: bool,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "entity")]
Entity {
#[serde(rename = "notify")]
notify: bool,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "messages")]
Messages,
#[serde(untagged)]
Undocumented(JsonObject),
}
impl CommandSyntax for ChatDeleteMode {
const COMMAND_BUF_SIZE: usize = 64;
fn append_command_syntax(&self, buf: &mut String) {
match self {
Self::Full { notify, .. } => {
buf.push_str("full");
if !notify {
buf.push_str(" notify=off");
}
}
Self::Entity { notify, .. } => {
buf.push_str("entity");
if !notify {
buf.push_str(" notify=off");
}
}
Self::Messages | Self::Undocumented(_) => {}
}
}
}
impl ChatDeleteMode {
pub fn full(notify: bool) -> Self {
Self::Full {
notify,
undocumented: Default::default(),
}
}
pub fn entity(notify: bool) -> Self {
Self::Entity {
notify,
undocumented: Default::default(),
}
}
pub fn messages() -> Self {
Self::Messages
}
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum ChatFeature {
#[default]
#[serde(rename = "timedMessages")]
TimedMessages,
#[serde(rename = "fullDelete")]
FullDelete,
#[serde(rename = "reactions")]
Reactions,
#[serde(rename = "voice")]
Voice,
#[serde(rename = "files")]
Files,
#[serde(rename = "calls")]
Calls,
#[serde(rename = "sessions")]
Sessions,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum ChatInfo {
#[serde(rename = "direct")]
Direct {
#[serde(rename = "contact")]
contact: Contact,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "group")]
Group {
#[serde(rename = "groupInfo")]
group_info: GroupInfo,
#[serde(rename = "groupChatScope", skip_serializing_if = "Option::is_none")]
group_chat_scope: Option<GroupChatScopeInfo>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "local")]
Local {
#[serde(rename = "noteFolder")]
note_folder: NoteFolder,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "contactRequest")]
ContactRequest {
#[serde(rename = "contactRequest")]
contact_request: UserContactRequest,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "contactConnection")]
ContactConnection {
#[serde(rename = "contactConnection")]
contact_connection: PendingContactConnection,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(untagged)]
Undocumented(JsonObject),
}
impl ChatInfo {
pub fn direct(contact: Contact) -> Self {
Self::Direct {
contact,
undocumented: Default::default(),
}
}
pub fn group(group_info: GroupInfo, group_chat_scope: Option<GroupChatScopeInfo>) -> Self {
Self::Group {
group_info,
group_chat_scope,
undocumented: Default::default(),
}
}
pub fn local(note_folder: NoteFolder) -> Self {
Self::Local {
note_folder,
undocumented: Default::default(),
}
}
pub fn contact_request(contact_request: UserContactRequest) -> Self {
Self::ContactRequest {
contact_request,
undocumented: Default::default(),
}
}
pub fn contact_connection(contact_connection: PendingContactConnection) -> Self {
Self::ContactConnection {
contact_connection,
undocumented: Default::default(),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct ChatItem {
#[serde(rename = "chatDir")]
pub chat_dir: CIDirection,
#[serde(rename = "meta")]
pub meta: CIMeta,
#[serde(rename = "content")]
pub content: CIContent,
#[serde(rename = "mentions")]
pub mentions: BTreeMap<String, CIMention>,
#[serde(rename = "formattedText", skip_serializing_if = "Option::is_none")]
pub formatted_text: Option<Vec<FormattedText>>,
#[serde(rename = "quotedItem", skip_serializing_if = "Option::is_none")]
pub quoted_item: Option<CIQuote>,
#[serde(rename = "reactions")]
pub reactions: Vec<CIReactionCount>,
#[serde(rename = "file", skip_serializing_if = "Option::is_none")]
pub file: Option<CIFile>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct ChatItemDeletion {
#[serde(rename = "deletedChatItem")]
pub deleted_chat_item: AChatItem,
#[serde(rename = "toChatItem", skip_serializing_if = "Option::is_none")]
pub to_chat_item: Option<AChatItem>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum ChatPeerType {
#[default]
#[serde(rename = "human")]
Human,
#[serde(rename = "bot")]
Bot,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct ChatRef {
#[serde(rename = "chatType")]
pub chat_type: ChatType,
#[serde(rename = "chatId", deserialize_with = "deserialize_number_from_string")]
pub chat_id: i64,
#[serde(rename = "chatScope", skip_serializing_if = "Option::is_none")]
pub chat_scope: Option<GroupChatScope>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
impl CommandSyntax for ChatRef {
const COMMAND_BUF_SIZE: usize = 256;
fn append_command_syntax(&self, buf: &mut String) {
self.chat_type.append_command_syntax(buf);
write!(buf, "{}", self.chat_id).unwrap();
if let Some(chat_scope) = &self.chat_scope {
chat_scope.append_command_syntax(buf);
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct ChatSettings {
#[serde(rename = "enableNtfs")]
pub enable_ntfs: MsgFilter,
#[serde(rename = "sendRcpts", skip_serializing_if = "Option::is_none")]
pub send_rcpts: Option<bool>,
#[serde(rename = "favorite")]
pub favorite: bool,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct ChatStats {
#[serde(
rename = "unreadCount",
deserialize_with = "deserialize_number_from_string"
)]
pub unread_count: i32,
#[serde(
rename = "unreadMentions",
deserialize_with = "deserialize_number_from_string"
)]
pub unread_mentions: i32,
#[serde(
rename = "reportsCount",
deserialize_with = "deserialize_number_from_string"
)]
pub reports_count: i32,
#[serde(
rename = "minUnreadItemId",
deserialize_with = "deserialize_number_from_string"
)]
pub min_unread_item_id: i64,
#[serde(rename = "unreadChat")]
pub unread_chat: bool,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum ChatType {
#[default]
#[serde(rename = "direct")]
Direct,
#[serde(rename = "group")]
Group,
#[serde(rename = "local")]
Local,
}
impl CommandSyntax for ChatType {
const COMMAND_BUF_SIZE: usize = 16;
fn append_command_syntax(&self, buf: &mut String) {
match self {
Self::Direct => {
buf.push('@');
}
Self::Group => {
buf.push('#');
}
Self::Local => {
buf.push('*');
}
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct ChatWallpaper {
#[serde(rename = "preset", skip_serializing_if = "Option::is_none")]
pub preset: Option<String>,
#[serde(rename = "imageFile", skip_serializing_if = "Option::is_none")]
pub image_file: Option<String>,
#[serde(rename = "background", skip_serializing_if = "Option::is_none")]
pub background: Option<String>,
#[serde(rename = "tint", skip_serializing_if = "Option::is_none")]
pub tint: Option<String>,
#[serde(rename = "scaleType", skip_serializing_if = "Option::is_none")]
pub scale_type: Option<ChatWallpaperScale>,
#[serde(
rename = "scale",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub scale: Option<f64>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum ChatWallpaperScale {
#[default]
#[serde(rename = "fill")]
Fill,
#[serde(rename = "fit")]
Fit,
#[serde(rename = "repeat")]
Repeat,
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum Color {
#[default]
#[serde(rename = "black")]
Black,
#[serde(rename = "red")]
Red,
#[serde(rename = "green")]
Green,
#[serde(rename = "yellow")]
Yellow,
#[serde(rename = "blue")]
Blue,
#[serde(rename = "magenta")]
Magenta,
#[serde(rename = "cyan")]
Cyan,
#[serde(rename = "white")]
White,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct ComposedMessage {
#[serde(rename = "fileSource", skip_serializing_if = "Option::is_none")]
pub file_source: Option<CryptoFile>,
#[serde(
rename = "quotedItemId",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub quoted_item_id: Option<i64>,
#[serde(rename = "msgContent")]
pub msg_content: MsgContent,
#[serde(rename = "mentions")]
pub mentions: BTreeMap<String, i64>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum ConnStatus {
#[default]
#[serde(rename = "new")]
New,
#[serde(rename = "prepared")]
Prepared,
#[serde(rename = "joined")]
Joined,
#[serde(rename = "requested")]
Requested,
#[serde(rename = "accepted")]
Accepted,
#[serde(rename = "snd-ready")]
SndReady,
#[serde(rename = "ready")]
Ready,
#[serde(rename = "deleted")]
Deleted,
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum ConnType {
#[default]
#[serde(rename = "contact")]
Contact,
#[serde(rename = "member")]
Member,
#[serde(rename = "user_contact")]
UserContact,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct Connection {
#[serde(rename = "connId", deserialize_with = "deserialize_number_from_string")]
pub conn_id: i64,
#[serde(rename = "agentConnId")]
pub agent_conn_id: String,
#[serde(
rename = "connChatVersion",
deserialize_with = "deserialize_number_from_string"
)]
pub conn_chat_version: i32,
#[serde(rename = "peerChatVRange")]
pub peer_chat_v_range: VersionRange,
#[serde(
rename = "connLevel",
deserialize_with = "deserialize_number_from_string"
)]
pub conn_level: i32,
#[serde(
rename = "viaContact",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub via_contact: Option<i64>,
#[serde(
rename = "viaUserContactLink",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub via_user_contact_link: Option<i64>,
#[serde(rename = "viaGroupLink")]
pub via_group_link: bool,
#[serde(rename = "groupLinkId", skip_serializing_if = "Option::is_none")]
pub group_link_id: Option<String>,
#[serde(rename = "xContactId", skip_serializing_if = "Option::is_none")]
pub x_contact_id: Option<String>,
#[serde(
rename = "customUserProfileId",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub custom_user_profile_id: Option<i64>,
#[serde(rename = "connType")]
pub conn_type: ConnType,
#[serde(rename = "connStatus")]
pub conn_status: ConnStatus,
#[serde(rename = "contactConnInitiated")]
pub contact_conn_initiated: bool,
#[serde(rename = "localAlias")]
pub local_alias: String,
#[serde(
rename = "entityId",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub entity_id: Option<i64>,
#[serde(rename = "connectionCode", skip_serializing_if = "Option::is_none")]
pub connection_code: Option<SecurityCode>,
#[serde(rename = "pqSupport")]
pub pq_support: bool,
#[serde(rename = "pqEncryption")]
pub pq_encryption: bool,
#[serde(rename = "pqSndEnabled", skip_serializing_if = "Option::is_none")]
pub pq_snd_enabled: Option<bool>,
#[serde(rename = "pqRcvEnabled", skip_serializing_if = "Option::is_none")]
pub pq_rcv_enabled: Option<bool>,
#[serde(
rename = "authErrCounter",
deserialize_with = "deserialize_number_from_string"
)]
pub auth_err_counter: i32,
#[serde(
rename = "quotaErrCounter",
deserialize_with = "deserialize_number_from_string"
)]
pub quota_err_counter: i32,
#[serde(rename = "createdAt")]
pub created_at: UtcTime,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum ConnectionEntity {
#[serde(rename = "rcvDirectMsgConnection")]
RcvDirectMsgConnection {
#[serde(rename = "entityConnection")]
entity_connection: Connection,
#[serde(rename = "contact", skip_serializing_if = "Option::is_none")]
contact: Option<Contact>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "rcvGroupMsgConnection")]
RcvGroupMsgConnection {
#[serde(rename = "entityConnection")]
entity_connection: Connection,
#[serde(rename = "groupInfo")]
group_info: GroupInfo,
#[serde(rename = "groupMember")]
group_member: GroupMember,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "sndFileConnection")]
SndFileConnection {
#[serde(rename = "entityConnection")]
entity_connection: Connection,
#[serde(rename = "sndFileTransfer")]
snd_file_transfer: SndFileTransfer,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "rcvFileConnection")]
RcvFileConnection {
#[serde(rename = "entityConnection")]
entity_connection: Connection,
#[serde(rename = "rcvFileTransfer")]
rcv_file_transfer: RcvFileTransfer,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "userContactConnection")]
UserContactConnection {
#[serde(rename = "entityConnection")]
entity_connection: Connection,
#[serde(rename = "userContact")]
user_contact: UserContact,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(untagged)]
Undocumented(JsonObject),
}
impl ConnectionEntity {
pub fn rcv_direct_msg_connection(
entity_connection: Connection,
contact: Option<Contact>,
) -> Self {
Self::RcvDirectMsgConnection {
entity_connection,
contact,
undocumented: Default::default(),
}
}
pub fn rcv_group_msg_connection(
entity_connection: Connection,
group_info: GroupInfo,
group_member: GroupMember,
) -> Self {
Self::RcvGroupMsgConnection {
entity_connection,
group_info,
group_member,
undocumented: Default::default(),
}
}
pub fn snd_file_connection(
entity_connection: Connection,
snd_file_transfer: SndFileTransfer,
) -> Self {
Self::SndFileConnection {
entity_connection,
snd_file_transfer,
undocumented: Default::default(),
}
}
pub fn rcv_file_connection(
entity_connection: Connection,
rcv_file_transfer: RcvFileTransfer,
) -> Self {
Self::RcvFileConnection {
entity_connection,
rcv_file_transfer,
undocumented: Default::default(),
}
}
pub fn user_contact_connection(
entity_connection: Connection,
user_contact: UserContact,
) -> Self {
Self::UserContactConnection {
entity_connection,
user_contact,
undocumented: Default::default(),
}
}
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum ConnectionMode {
#[default]
#[serde(rename = "inv")]
Inv,
#[serde(rename = "con")]
Con,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum ConnectionPlan {
#[serde(rename = "invitationLink")]
InvitationLink {
#[serde(rename = "invitationLinkPlan")]
invitation_link_plan: InvitationLinkPlan,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "contactAddress")]
ContactAddress {
#[serde(rename = "contactAddressPlan")]
contact_address_plan: ContactAddressPlan,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "groupLink")]
GroupLink {
#[serde(rename = "groupLinkPlan")]
group_link_plan: GroupLinkPlan,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "error")]
Error {
#[serde(rename = "chatError")]
chat_error: ChatError,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(untagged)]
Undocumented(JsonObject),
}
impl ConnectionPlan {
pub fn invitation_link(invitation_link_plan: InvitationLinkPlan) -> Self {
Self::InvitationLink {
invitation_link_plan,
undocumented: Default::default(),
}
}
pub fn contact_address(contact_address_plan: ContactAddressPlan) -> Self {
Self::ContactAddress {
contact_address_plan,
undocumented: Default::default(),
}
}
pub fn group_link(group_link_plan: GroupLinkPlan) -> Self {
Self::GroupLink {
group_link_plan,
undocumented: Default::default(),
}
}
pub fn error(chat_error: ChatError) -> Self {
Self::Error {
chat_error,
undocumented: Default::default(),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct Contact {
#[serde(
rename = "contactId",
deserialize_with = "deserialize_number_from_string"
)]
pub contact_id: i64,
#[serde(rename = "localDisplayName")]
pub local_display_name: String,
#[serde(rename = "profile")]
pub profile: LocalProfile,
#[serde(rename = "activeConn", skip_serializing_if = "Option::is_none")]
pub active_conn: Option<Connection>,
#[serde(
rename = "viaGroup",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub via_group: Option<i64>,
#[serde(rename = "contactUsed")]
pub contact_used: bool,
#[serde(rename = "contactStatus")]
pub contact_status: ContactStatus,
#[serde(rename = "chatSettings")]
pub chat_settings: ChatSettings,
#[serde(rename = "userPreferences")]
pub user_preferences: Preferences,
#[serde(rename = "mergedPreferences")]
pub merged_preferences: ContactUserPreferences,
#[serde(rename = "createdAt")]
pub created_at: UtcTime,
#[serde(rename = "updatedAt")]
pub updated_at: UtcTime,
#[serde(rename = "chatTs", skip_serializing_if = "Option::is_none")]
pub chat_ts: Option<UtcTime>,
#[serde(rename = "preparedContact", skip_serializing_if = "Option::is_none")]
pub prepared_contact: Option<PreparedContact>,
#[serde(
rename = "contactRequestId",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub contact_request_id: Option<i64>,
#[serde(
rename = "contactGroupMemberId",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub contact_group_member_id: Option<i64>,
#[serde(rename = "contactGrpInvSent")]
pub contact_grp_inv_sent: bool,
#[serde(rename = "groupDirectInv", skip_serializing_if = "Option::is_none")]
pub group_direct_inv: Option<GroupDirectInvitation>,
#[serde(rename = "chatTags")]
pub chat_tags: Vec<i64>,
#[serde(
rename = "chatItemTTL",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub chat_item_ttl: Option<i64>,
#[serde(rename = "uiThemes", skip_serializing_if = "Option::is_none")]
pub ui_themes: Option<UIThemeEntityOverrides>,
#[serde(rename = "chatDeleted")]
pub chat_deleted: bool,
#[serde(rename = "customData", skip_serializing_if = "Option::is_none")]
pub custom_data: Option<JsonObject>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum ContactAddressPlan {
#[serde(rename = "ok")]
Ok {
#[serde(rename = "contactSLinkData_", skip_serializing_if = "Option::is_none")]
contact_s_link_data: Option<ContactShortLinkData>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "ownLink")]
OwnLink,
#[serde(rename = "connectingConfirmReconnect")]
ConnectingConfirmReconnect,
#[serde(rename = "connectingProhibit")]
ConnectingProhibit {
#[serde(rename = "contact")]
contact: Contact,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "known")]
Known {
#[serde(rename = "contact")]
contact: Contact,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "contactViaAddress")]
ContactViaAddress {
#[serde(rename = "contact")]
contact: Contact,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(untagged)]
Undocumented(JsonObject),
}
impl ContactAddressPlan {
pub fn ok(contact_s_link_data: Option<ContactShortLinkData>) -> Self {
Self::Ok {
contact_s_link_data,
undocumented: Default::default(),
}
}
pub fn own_link() -> Self {
Self::OwnLink
}
pub fn connecting_confirm_reconnect() -> Self {
Self::ConnectingConfirmReconnect
}
pub fn connecting_prohibit(contact: Contact) -> Self {
Self::ConnectingProhibit {
contact,
undocumented: Default::default(),
}
}
pub fn known(contact: Contact) -> Self {
Self::Known {
contact,
undocumented: Default::default(),
}
}
pub fn contact_via_address(contact: Contact) -> Self {
Self::ContactViaAddress {
contact,
undocumented: Default::default(),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct ContactShortLinkData {
#[serde(rename = "profile")]
pub profile: Profile,
#[serde(rename = "message", skip_serializing_if = "Option::is_none")]
pub message: Option<MsgContent>,
#[serde(rename = "business")]
pub business: bool,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum ContactStatus {
#[default]
#[serde(rename = "active")]
Active,
#[serde(rename = "deleted")]
Deleted,
#[serde(rename = "deletedByUser")]
DeletedByUser,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum ContactUserPref {
#[serde(rename = "contact")]
Contact {
#[serde(rename = "preference")]
preference: SimplePreference,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "user")]
User {
#[serde(rename = "preference")]
preference: SimplePreference,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(untagged)]
Undocumented(JsonObject),
}
impl ContactUserPref {
pub fn contact(preference: SimplePreference) -> Self {
Self::Contact {
preference,
undocumented: Default::default(),
}
}
pub fn user(preference: SimplePreference) -> Self {
Self::User {
preference,
undocumented: Default::default(),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct ContactUserPreference {
#[serde(rename = "enabled")]
pub enabled: PrefEnabled,
#[serde(rename = "userPreference")]
pub user_preference: ContactUserPref,
#[serde(rename = "contactPreference")]
pub contact_preference: SimplePreference,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct ContactUserPreferences {
#[serde(rename = "timedMessages")]
pub timed_messages: ContactUserPreference,
#[serde(rename = "fullDelete")]
pub full_delete: ContactUserPreference,
#[serde(rename = "reactions")]
pub reactions: ContactUserPreference,
#[serde(rename = "voice")]
pub voice: ContactUserPreference,
#[serde(rename = "files")]
pub files: ContactUserPreference,
#[serde(rename = "calls")]
pub calls: ContactUserPreference,
#[serde(rename = "sessions")]
pub sessions: ContactUserPreference,
#[serde(rename = "commands", skip_serializing_if = "Option::is_none")]
pub commands: Option<Vec<ChatBotCommand>>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct CreatedConnLink {
#[serde(rename = "connFullLink")]
pub conn_full_link: String,
#[serde(rename = "connShortLink", skip_serializing_if = "Option::is_none")]
pub conn_short_link: Option<String>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
impl CommandSyntax for CreatedConnLink {
const COMMAND_BUF_SIZE: usize = 64;
fn append_command_syntax(&self, buf: &mut String) {
write!(buf, "{}", self.conn_full_link).unwrap();
if let Some(conn_short_link) = &self.conn_short_link {
buf.push(' ');
write!(buf, "{}", conn_short_link).unwrap();
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct CryptoFile {
#[serde(rename = "filePath")]
pub file_path: String,
#[serde(rename = "cryptoArgs", skip_serializing_if = "Option::is_none")]
pub crypto_args: Option<CryptoFileArgs>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct CryptoFileArgs {
#[serde(rename = "fileKey")]
pub file_key: String,
#[serde(rename = "fileNonce")]
pub file_nonce: String,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct E2EInfo {
#[serde(rename = "pqEnabled", skip_serializing_if = "Option::is_none")]
pub pq_enabled: Option<bool>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum FeatureAllowed {
#[default]
#[serde(rename = "always")]
Always,
#[serde(rename = "yes")]
Yes,
#[serde(rename = "no")]
No,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct FileDescr {
#[serde(rename = "fileDescrText")]
pub file_descr_text: String,
#[serde(
rename = "fileDescrPartNo",
deserialize_with = "deserialize_number_from_string"
)]
pub file_descr_part_no: i32,
#[serde(rename = "fileDescrComplete")]
pub file_descr_complete: bool,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct FileInvitation {
#[serde(rename = "fileName")]
pub file_name: String,
#[serde(
rename = "fileSize",
deserialize_with = "deserialize_number_from_string"
)]
pub file_size: i64,
#[serde(rename = "fileDigest", skip_serializing_if = "Option::is_none")]
pub file_digest: Option<String>,
#[serde(rename = "fileConnReq", skip_serializing_if = "Option::is_none")]
pub file_conn_req: Option<String>,
#[serde(rename = "fileInline", skip_serializing_if = "Option::is_none")]
pub file_inline: Option<InlineFileMode>,
#[serde(rename = "fileDescr", skip_serializing_if = "Option::is_none")]
pub file_descr: Option<FileDescr>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum FileProtocol {
#[default]
#[serde(rename = "smp")]
Smp,
#[serde(rename = "xftp")]
Xftp,
#[serde(rename = "local")]
Local,
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum FileStatus {
#[default]
#[serde(rename = "new")]
New,
#[serde(rename = "accepted")]
Accepted,
#[serde(rename = "connected")]
Connected,
#[serde(rename = "complete")]
Complete,
#[serde(rename = "cancelled")]
Cancelled,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct FileTransferMeta {
#[serde(rename = "fileId", deserialize_with = "deserialize_number_from_string")]
pub file_id: i64,
#[serde(rename = "xftpSndFile", skip_serializing_if = "Option::is_none")]
pub xftp_snd_file: Option<XFTPSndFile>,
#[serde(
rename = "xftpRedirectFor",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub xftp_redirect_for: Option<i64>,
#[serde(rename = "fileName")]
pub file_name: String,
#[serde(rename = "filePath")]
pub file_path: String,
#[serde(
rename = "fileSize",
deserialize_with = "deserialize_number_from_string"
)]
pub file_size: i64,
#[serde(rename = "fileInline", skip_serializing_if = "Option::is_none")]
pub file_inline: Option<InlineFileMode>,
#[serde(
rename = "chunkSize",
deserialize_with = "deserialize_number_from_string"
)]
pub chunk_size: i64,
#[serde(rename = "cancelled")]
pub cancelled: bool,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum Format {
#[serde(rename = "bold")]
Bold,
#[serde(rename = "italic")]
Italic,
#[serde(rename = "strikeThrough")]
StrikeThrough,
#[serde(rename = "snippet")]
Snippet,
#[serde(rename = "secret")]
Secret,
#[serde(rename = "colored")]
Colored {
#[serde(rename = "color")]
color: Color,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "uri")]
Uri,
#[serde(rename = "hyperLink")]
HyperLink {
#[serde(rename = "showText", skip_serializing_if = "Option::is_none")]
show_text: Option<String>,
#[serde(rename = "linkUri")]
link_uri: String,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "simplexLink")]
SimplexLink {
#[serde(rename = "showText", skip_serializing_if = "Option::is_none")]
show_text: Option<String>,
#[serde(rename = "linkType")]
link_type: SimplexLinkType,
#[serde(rename = "simplexUri")]
simplex_uri: String,
#[serde(rename = "smpHosts")]
smp_hosts: Vec<String>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "command")]
Command {
#[serde(rename = "commandStr")]
command_str: String,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "mention")]
Mention {
#[serde(rename = "memberName")]
member_name: String,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "email")]
Email,
#[serde(rename = "phone")]
Phone,
#[serde(untagged)]
Undocumented(JsonObject),
}
impl Format {
pub fn bold() -> Self {
Self::Bold
}
pub fn italic() -> Self {
Self::Italic
}
pub fn strike_through() -> Self {
Self::StrikeThrough
}
pub fn snippet() -> Self {
Self::Snippet
}
pub fn secret() -> Self {
Self::Secret
}
pub fn colored(color: Color) -> Self {
Self::Colored {
color,
undocumented: Default::default(),
}
}
pub fn uri() -> Self {
Self::Uri
}
pub fn hyper_link(show_text: Option<String>, link_uri: String) -> Self {
Self::HyperLink {
show_text,
link_uri,
undocumented: Default::default(),
}
}
pub fn simplex_link(
show_text: Option<String>,
link_type: SimplexLinkType,
simplex_uri: String,
smp_hosts: Vec<String>,
) -> Self {
Self::SimplexLink {
show_text,
link_type,
simplex_uri,
smp_hosts,
undocumented: Default::default(),
}
}
pub fn command(command_str: String) -> Self {
Self::Command {
command_str,
undocumented: Default::default(),
}
}
pub fn mention(member_name: String) -> Self {
Self::Mention {
member_name,
undocumented: Default::default(),
}
}
pub fn email() -> Self {
Self::Email
}
pub fn phone() -> Self {
Self::Phone
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct FormattedText {
#[serde(rename = "format", skip_serializing_if = "Option::is_none")]
pub format: Option<Format>,
#[serde(rename = "text")]
pub text: String,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct FullGroupPreferences {
#[serde(rename = "timedMessages")]
pub timed_messages: TimedMessagesGroupPreference,
#[serde(rename = "directMessages")]
pub direct_messages: RoleGroupPreference,
#[serde(rename = "fullDelete")]
pub full_delete: GroupPreference,
#[serde(rename = "reactions")]
pub reactions: GroupPreference,
#[serde(rename = "voice")]
pub voice: RoleGroupPreference,
#[serde(rename = "files")]
pub files: RoleGroupPreference,
#[serde(rename = "simplexLinks")]
pub simplex_links: RoleGroupPreference,
#[serde(rename = "reports")]
pub reports: GroupPreference,
#[serde(rename = "history")]
pub history: GroupPreference,
#[serde(rename = "sessions")]
pub sessions: RoleGroupPreference,
#[serde(rename = "commands")]
pub commands: Vec<ChatBotCommand>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct FullPreferences {
#[serde(rename = "timedMessages")]
pub timed_messages: TimedMessagesPreference,
#[serde(rename = "fullDelete")]
pub full_delete: SimplePreference,
#[serde(rename = "reactions")]
pub reactions: SimplePreference,
#[serde(rename = "voice")]
pub voice: SimplePreference,
#[serde(rename = "files")]
pub files: SimplePreference,
#[serde(rename = "calls")]
pub calls: SimplePreference,
#[serde(rename = "sessions")]
pub sessions: SimplePreference,
#[serde(rename = "commands")]
pub commands: Vec<ChatBotCommand>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct Group {
#[serde(rename = "groupInfo")]
pub group_info: GroupInfo,
#[serde(rename = "members")]
pub members: Vec<GroupMember>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum GroupChatScope {
#[serde(rename = "memberSupport")]
MemberSupport {
#[serde(
rename = "groupMemberId_",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
group_member_id: Option<i64>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(untagged)]
Undocumented(JsonObject),
}
impl CommandSyntax for GroupChatScope {
const COMMAND_BUF_SIZE: usize = 64;
fn append_command_syntax(&self, buf: &mut String) {
buf.push_str("(_support");
match self {
Self::MemberSupport {
group_member_id, ..
} => {
if let Some(group_member_id) = group_member_id {
buf.push(':');
write!(buf, "{}", group_member_id).unwrap();
}
}
Self::Undocumented(_) => {}
}
buf.push(')');
}
}
impl GroupChatScope {
pub fn member_support(group_member_id: Option<i64>) -> Self {
Self::MemberSupport {
group_member_id,
undocumented: Default::default(),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum GroupChatScopeInfo {
#[serde(rename = "memberSupport")]
MemberSupport {
#[serde(rename = "groupMember_", skip_serializing_if = "Option::is_none")]
group_member: Option<GroupMember>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(untagged)]
Undocumented(JsonObject),
}
impl GroupChatScopeInfo {
pub fn member_support(group_member: Option<GroupMember>) -> Self {
Self::MemberSupport {
group_member,
undocumented: Default::default(),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct GroupDirectInvitation {
#[serde(rename = "groupDirectInvLink")]
pub group_direct_inv_link: String,
#[serde(
rename = "fromGroupId_",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub from_group_id: Option<i64>,
#[serde(
rename = "fromGroupMemberId_",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub from_group_member_id: Option<i64>,
#[serde(
rename = "fromGroupMemberConnId_",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub from_group_member_conn_id: Option<i64>,
#[serde(rename = "groupDirectInvStartedConnection")]
pub group_direct_inv_started_connection: bool,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum GroupFeature {
#[default]
#[serde(rename = "timedMessages")]
TimedMessages,
#[serde(rename = "directMessages")]
DirectMessages,
#[serde(rename = "fullDelete")]
FullDelete,
#[serde(rename = "reactions")]
Reactions,
#[serde(rename = "voice")]
Voice,
#[serde(rename = "files")]
Files,
#[serde(rename = "simplexLinks")]
SimplexLinks,
#[serde(rename = "reports")]
Reports,
#[serde(rename = "history")]
History,
#[serde(rename = "sessions")]
Sessions,
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum GroupFeatureEnabled {
#[default]
#[serde(rename = "on")]
On,
#[serde(rename = "off")]
Off,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct GroupInfo {
#[serde(
rename = "groupId",
deserialize_with = "deserialize_number_from_string"
)]
pub group_id: i64,
#[serde(rename = "localDisplayName")]
pub local_display_name: String,
#[serde(rename = "groupProfile")]
pub group_profile: GroupProfile,
#[serde(rename = "localAlias")]
pub local_alias: String,
#[serde(rename = "businessChat", skip_serializing_if = "Option::is_none")]
pub business_chat: Option<BusinessChatInfo>,
#[serde(rename = "fullGroupPreferences")]
pub full_group_preferences: FullGroupPreferences,
#[serde(rename = "membership")]
pub membership: GroupMember,
#[serde(rename = "chatSettings")]
pub chat_settings: ChatSettings,
#[serde(rename = "createdAt")]
pub created_at: UtcTime,
#[serde(rename = "updatedAt")]
pub updated_at: UtcTime,
#[serde(rename = "chatTs", skip_serializing_if = "Option::is_none")]
pub chat_ts: Option<UtcTime>,
#[serde(
rename = "userMemberProfileSentAt",
skip_serializing_if = "Option::is_none"
)]
pub user_member_profile_sent_at: Option<UtcTime>,
#[serde(rename = "preparedGroup", skip_serializing_if = "Option::is_none")]
pub prepared_group: Option<PreparedGroup>,
#[serde(rename = "chatTags")]
pub chat_tags: Vec<i64>,
#[serde(
rename = "chatItemTTL",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub chat_item_ttl: Option<i64>,
#[serde(rename = "uiThemes", skip_serializing_if = "Option::is_none")]
pub ui_themes: Option<UIThemeEntityOverrides>,
#[serde(rename = "customData", skip_serializing_if = "Option::is_none")]
pub custom_data: Option<JsonObject>,
#[serde(
rename = "membersRequireAttention",
deserialize_with = "deserialize_number_from_string"
)]
pub members_require_attention: i32,
#[serde(rename = "viaGroupLinkUri", skip_serializing_if = "Option::is_none")]
pub via_group_link_uri: Option<String>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct GroupInfoSummary {
#[serde(rename = "groupInfo")]
pub group_info: GroupInfo,
#[serde(rename = "groupSummary")]
pub group_summary: GroupSummary,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct GroupLink {
#[serde(
rename = "userContactLinkId",
deserialize_with = "deserialize_number_from_string"
)]
pub user_contact_link_id: i64,
#[serde(rename = "connLinkContact")]
pub conn_link_contact: CreatedConnLink,
#[serde(rename = "shortLinkDataSet")]
pub short_link_data_set: bool,
#[serde(rename = "shortLinkLargeDataSet")]
pub short_link_large_data_set: bool,
#[serde(rename = "groupLinkId")]
pub group_link_id: String,
#[serde(rename = "acceptMemberRole")]
pub accept_member_role: GroupMemberRole,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum GroupLinkPlan {
#[serde(rename = "ok")]
Ok {
#[serde(rename = "groupSLinkData_", skip_serializing_if = "Option::is_none")]
group_s_link_data: Option<GroupShortLinkData>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "ownLink")]
OwnLink {
#[serde(rename = "groupInfo")]
group_info: GroupInfo,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "connectingConfirmReconnect")]
ConnectingConfirmReconnect,
#[serde(rename = "connectingProhibit")]
ConnectingProhibit {
#[serde(rename = "groupInfo_", skip_serializing_if = "Option::is_none")]
group_info: Option<GroupInfo>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "known")]
Known {
#[serde(rename = "groupInfo")]
group_info: GroupInfo,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(untagged)]
Undocumented(JsonObject),
}
impl GroupLinkPlan {
pub fn ok(group_s_link_data: Option<GroupShortLinkData>) -> Self {
Self::Ok {
group_s_link_data,
undocumented: Default::default(),
}
}
pub fn own_link(group_info: GroupInfo) -> Self {
Self::OwnLink {
group_info,
undocumented: Default::default(),
}
}
pub fn connecting_confirm_reconnect() -> Self {
Self::ConnectingConfirmReconnect
}
pub fn connecting_prohibit(group_info: Option<GroupInfo>) -> Self {
Self::ConnectingProhibit {
group_info,
undocumented: Default::default(),
}
}
pub fn known(group_info: GroupInfo) -> Self {
Self::Known {
group_info,
undocumented: Default::default(),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct GroupMember {
#[serde(
rename = "groupMemberId",
deserialize_with = "deserialize_number_from_string"
)]
pub group_member_id: i64,
#[serde(
rename = "groupId",
deserialize_with = "deserialize_number_from_string"
)]
pub group_id: i64,
#[serde(rename = "memberId")]
pub member_id: String,
#[serde(rename = "memberRole")]
pub member_role: GroupMemberRole,
#[serde(rename = "memberCategory")]
pub member_category: GroupMemberCategory,
#[serde(rename = "memberStatus")]
pub member_status: GroupMemberStatus,
#[serde(rename = "memberSettings")]
pub member_settings: GroupMemberSettings,
#[serde(rename = "blockedByAdmin")]
pub blocked_by_admin: bool,
#[serde(rename = "invitedBy")]
pub invited_by: InvitedBy,
#[serde(
rename = "invitedByGroupMemberId",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub invited_by_group_member_id: Option<i64>,
#[serde(rename = "localDisplayName")]
pub local_display_name: String,
#[serde(rename = "memberProfile")]
pub member_profile: LocalProfile,
#[serde(
rename = "memberContactId",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub member_contact_id: Option<i64>,
#[serde(
rename = "memberContactProfileId",
deserialize_with = "deserialize_number_from_string"
)]
pub member_contact_profile_id: i64,
#[serde(rename = "activeConn", skip_serializing_if = "Option::is_none")]
pub active_conn: Option<Connection>,
#[serde(rename = "memberChatVRange")]
pub member_chat_v_range: VersionRange,
#[serde(rename = "createdAt")]
pub created_at: UtcTime,
#[serde(rename = "updatedAt")]
pub updated_at: UtcTime,
#[serde(rename = "supportChat", skip_serializing_if = "Option::is_none")]
pub support_chat: Option<GroupSupportChat>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct GroupMemberAdmission {
#[serde(rename = "review", skip_serializing_if = "Option::is_none")]
pub review: Option<MemberCriteria>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum GroupMemberCategory {
#[default]
#[serde(rename = "user")]
User,
#[serde(rename = "invitee")]
Invitee,
#[serde(rename = "host")]
Host,
#[serde(rename = "pre")]
Pre,
#[serde(rename = "post")]
Post,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct GroupMemberRef {
#[serde(
rename = "groupMemberId",
deserialize_with = "deserialize_number_from_string"
)]
pub group_member_id: i64,
#[serde(rename = "profile")]
pub profile: Profile,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum GroupMemberRole {
#[default]
#[serde(rename = "observer")]
Observer,
#[serde(rename = "author")]
Author,
#[serde(rename = "member")]
Member,
#[serde(rename = "moderator")]
Moderator,
#[serde(rename = "admin")]
Admin,
#[serde(rename = "owner")]
Owner,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct GroupMemberSettings {
#[serde(rename = "showMessages")]
pub show_messages: bool,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum GroupMemberStatus {
#[default]
#[serde(rename = "rejected")]
Rejected,
#[serde(rename = "removed")]
Removed,
#[serde(rename = "left")]
Left,
#[serde(rename = "deleted")]
Deleted,
#[serde(rename = "unknown")]
Unknown,
#[serde(rename = "invited")]
Invited,
#[serde(rename = "pending_approval")]
PendingApproval,
#[serde(rename = "pending_review")]
PendingReview,
#[serde(rename = "introduced")]
Introduced,
#[serde(rename = "intro-inv")]
IntroInv,
#[serde(rename = "accepted")]
Accepted,
#[serde(rename = "announced")]
Announced,
#[serde(rename = "connected")]
Connected,
#[serde(rename = "complete")]
Complete,
#[serde(rename = "creator")]
Creator,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct GroupPreference {
#[serde(rename = "enable")]
pub enable: GroupFeatureEnabled,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct GroupPreferences {
#[serde(rename = "timedMessages", skip_serializing_if = "Option::is_none")]
pub timed_messages: Option<TimedMessagesGroupPreference>,
#[serde(rename = "directMessages", skip_serializing_if = "Option::is_none")]
pub direct_messages: Option<RoleGroupPreference>,
#[serde(rename = "fullDelete", skip_serializing_if = "Option::is_none")]
pub full_delete: Option<GroupPreference>,
#[serde(rename = "reactions", skip_serializing_if = "Option::is_none")]
pub reactions: Option<GroupPreference>,
#[serde(rename = "voice", skip_serializing_if = "Option::is_none")]
pub voice: Option<RoleGroupPreference>,
#[serde(rename = "files", skip_serializing_if = "Option::is_none")]
pub files: Option<RoleGroupPreference>,
#[serde(rename = "simplexLinks", skip_serializing_if = "Option::is_none")]
pub simplex_links: Option<RoleGroupPreference>,
#[serde(rename = "reports", skip_serializing_if = "Option::is_none")]
pub reports: Option<GroupPreference>,
#[serde(rename = "history", skip_serializing_if = "Option::is_none")]
pub history: Option<GroupPreference>,
#[serde(rename = "sessions", skip_serializing_if = "Option::is_none")]
pub sessions: Option<RoleGroupPreference>,
#[serde(rename = "commands", skip_serializing_if = "Option::is_none")]
pub commands: Option<Vec<ChatBotCommand>>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct GroupProfile {
#[serde(rename = "displayName")]
pub display_name: String,
#[serde(rename = "fullName")]
pub full_name: String,
#[serde(rename = "shortDescr", skip_serializing_if = "Option::is_none")]
pub short_descr: Option<String>,
#[serde(rename = "description", skip_serializing_if = "Option::is_none")]
pub description: Option<String>,
#[serde(rename = "image", skip_serializing_if = "Option::is_none")]
pub image: Option<String>,
#[serde(rename = "groupPreferences", skip_serializing_if = "Option::is_none")]
pub group_preferences: Option<GroupPreferences>,
#[serde(rename = "memberAdmission", skip_serializing_if = "Option::is_none")]
pub member_admission: Option<GroupMemberAdmission>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct GroupShortLinkData {
#[serde(rename = "groupProfile")]
pub group_profile: GroupProfile,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct GroupSummary {
#[serde(
rename = "currentMembers",
deserialize_with = "deserialize_number_from_string"
)]
pub current_members: i32,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct GroupSupportChat {
#[serde(rename = "chatTs")]
pub chat_ts: UtcTime,
#[serde(rename = "unread", deserialize_with = "deserialize_number_from_string")]
pub unread: i64,
#[serde(
rename = "memberAttention",
deserialize_with = "deserialize_number_from_string"
)]
pub member_attention: i64,
#[serde(
rename = "mentions",
deserialize_with = "deserialize_number_from_string"
)]
pub mentions: i64,
#[serde(
rename = "lastMsgFromMemberTs",
skip_serializing_if = "Option::is_none"
)]
pub last_msg_from_member_ts: Option<UtcTime>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum InlineFileMode {
#[default]
#[serde(rename = "offer")]
Offer,
#[serde(rename = "sent")]
Sent,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum InvitationLinkPlan {
#[serde(rename = "ok")]
Ok {
#[serde(rename = "contactSLinkData_", skip_serializing_if = "Option::is_none")]
contact_s_link_data: Option<ContactShortLinkData>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "ownLink")]
OwnLink,
#[serde(rename = "connecting")]
Connecting {
#[serde(rename = "contact_", skip_serializing_if = "Option::is_none")]
contact: Option<Contact>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "known")]
Known {
#[serde(rename = "contact")]
contact: Contact,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(untagged)]
Undocumented(JsonObject),
}
impl InvitationLinkPlan {
pub fn ok(contact_s_link_data: Option<ContactShortLinkData>) -> Self {
Self::Ok {
contact_s_link_data,
undocumented: Default::default(),
}
}
pub fn own_link() -> Self {
Self::OwnLink
}
pub fn connecting(contact: Option<Contact>) -> Self {
Self::Connecting {
contact,
undocumented: Default::default(),
}
}
pub fn known(contact: Contact) -> Self {
Self::Known {
contact,
undocumented: Default::default(),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum InvitedBy {
#[serde(rename = "contact")]
Contact {
#[serde(
rename = "byContactId",
deserialize_with = "deserialize_number_from_string"
)]
by_contact_id: i64,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "user")]
User,
#[serde(rename = "unknown")]
Unknown,
#[serde(untagged)]
Undocumented(JsonObject),
}
impl InvitedBy {
pub fn contact(by_contact_id: i64) -> Self {
Self::Contact {
by_contact_id,
undocumented: Default::default(),
}
}
pub fn user() -> Self {
Self::User
}
pub fn unknown() -> Self {
Self::Unknown
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum LinkContent {
#[serde(rename = "page")]
Page,
#[serde(rename = "image")]
Image,
#[serde(rename = "video")]
Video {
#[serde(
rename = "duration",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
duration: Option<i32>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "unknown")]
Unknown {
#[serde(rename = "tag")]
tag: String,
#[serde(rename = "json")]
json: JsonObject,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(untagged)]
Undocumented(JsonObject),
}
impl LinkContent {
pub fn page() -> Self {
Self::Page
}
pub fn image() -> Self {
Self::Image
}
pub fn video(duration: Option<i32>) -> Self {
Self::Video {
duration,
undocumented: Default::default(),
}
}
pub fn unknown(tag: String, json: JsonObject) -> Self {
Self::Unknown {
tag,
json,
undocumented: Default::default(),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct LinkPreview {
#[serde(rename = "uri")]
pub uri: String,
#[serde(rename = "title")]
pub title: String,
#[serde(rename = "description")]
pub description: String,
#[serde(rename = "image")]
pub image: String,
#[serde(rename = "content", skip_serializing_if = "Option::is_none")]
pub content: Option<LinkContent>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct LocalProfile {
#[serde(
rename = "profileId",
deserialize_with = "deserialize_number_from_string"
)]
pub profile_id: i64,
#[serde(rename = "displayName")]
pub display_name: String,
#[serde(rename = "fullName")]
pub full_name: String,
#[serde(rename = "shortDescr", skip_serializing_if = "Option::is_none")]
pub short_descr: Option<String>,
#[serde(rename = "image", skip_serializing_if = "Option::is_none")]
pub image: Option<String>,
#[serde(rename = "contactLink", skip_serializing_if = "Option::is_none")]
pub contact_link: Option<String>,
#[serde(rename = "preferences", skip_serializing_if = "Option::is_none")]
pub preferences: Option<Preferences>,
#[serde(rename = "peerType", skip_serializing_if = "Option::is_none")]
pub peer_type: Option<ChatPeerType>,
#[serde(rename = "localAlias")]
pub local_alias: String,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum MemberCriteria {
#[default]
#[serde(rename = "all")]
All,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum MsgChatLink {
#[serde(rename = "contact")]
Contact {
#[serde(rename = "connLink")]
conn_link: String,
#[serde(rename = "profile")]
profile: Profile,
#[serde(rename = "business")]
business: bool,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "invitation")]
Invitation {
#[serde(rename = "invLink")]
inv_link: String,
#[serde(rename = "profile")]
profile: Profile,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "group")]
Group {
#[serde(rename = "connLink")]
conn_link: String,
#[serde(rename = "groupProfile")]
group_profile: GroupProfile,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(untagged)]
Undocumented(JsonObject),
}
impl MsgChatLink {
pub fn contact(conn_link: String, profile: Profile, business: bool) -> Self {
Self::Contact {
conn_link,
profile,
business,
undocumented: Default::default(),
}
}
pub fn invitation(inv_link: String, profile: Profile) -> Self {
Self::Invitation {
inv_link,
profile,
undocumented: Default::default(),
}
}
pub fn group(conn_link: String, group_profile: GroupProfile) -> Self {
Self::Group {
conn_link,
group_profile,
undocumented: Default::default(),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum MsgContent {
#[serde(rename = "text")]
Text {
#[serde(rename = "text")]
text: String,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "link")]
Link {
#[serde(rename = "text")]
text: String,
#[serde(rename = "preview")]
preview: LinkPreview,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "image")]
Image {
#[serde(rename = "text")]
text: String,
#[serde(rename = "image")]
image: String,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "video")]
Video {
#[serde(rename = "text")]
text: String,
#[serde(rename = "image")]
image: String,
#[serde(
rename = "duration",
deserialize_with = "deserialize_number_from_string"
)]
duration: i32,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "voice")]
Voice {
#[serde(rename = "text")]
text: String,
#[serde(
rename = "duration",
deserialize_with = "deserialize_number_from_string"
)]
duration: i32,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "file")]
File {
#[serde(rename = "text")]
text: String,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "report")]
Report {
#[serde(rename = "text")]
text: String,
#[serde(rename = "reason")]
reason: ReportReason,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "chat")]
Chat {
#[serde(rename = "text")]
text: String,
#[serde(rename = "chatLink")]
chat_link: MsgChatLink,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "unknown")]
Unknown {
#[serde(rename = "tag")]
tag: String,
#[serde(rename = "text")]
text: String,
#[serde(rename = "json")]
json: JsonObject,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(untagged)]
Undocumented(JsonObject),
}
impl MsgContent {
pub fn text(text: String) -> Self {
Self::Text {
text,
undocumented: Default::default(),
}
}
pub fn link(text: String, preview: LinkPreview) -> Self {
Self::Link {
text,
preview,
undocumented: Default::default(),
}
}
pub fn image(text: String, image: String) -> Self {
Self::Image {
text,
image,
undocumented: Default::default(),
}
}
pub fn video(text: String, image: String, duration: i32) -> Self {
Self::Video {
text,
image,
duration,
undocumented: Default::default(),
}
}
pub fn voice(text: String, duration: i32) -> Self {
Self::Voice {
text,
duration,
undocumented: Default::default(),
}
}
pub fn file(text: String) -> Self {
Self::File {
text,
undocumented: Default::default(),
}
}
pub fn report(text: String, reason: ReportReason) -> Self {
Self::Report {
text,
reason,
undocumented: Default::default(),
}
}
pub fn chat(text: String, chat_link: MsgChatLink) -> Self {
Self::Chat {
text,
chat_link,
undocumented: Default::default(),
}
}
pub fn unknown(tag: String, text: String, json: JsonObject) -> Self {
Self::Unknown {
tag,
text,
json,
undocumented: Default::default(),
}
}
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum MsgDirection {
#[default]
#[serde(rename = "rcv")]
Rcv,
#[serde(rename = "snd")]
Snd,
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum MsgFilter {
#[default]
#[serde(rename = "none")]
None,
#[serde(rename = "all")]
All,
#[serde(rename = "mentions")]
Mentions,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum MsgReaction {
#[serde(rename = "emoji")]
Emoji {
#[serde(rename = "emoji")]
emoji: String,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "unknown")]
Unknown {
#[serde(rename = "tag")]
tag: String,
#[serde(rename = "json")]
json: JsonObject,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(untagged)]
Undocumented(JsonObject),
}
impl MsgReaction {
pub fn emoji(emoji: String) -> Self {
Self::Emoji {
emoji,
undocumented: Default::default(),
}
}
pub fn unknown(tag: String, json: JsonObject) -> Self {
Self::Unknown {
tag,
json,
undocumented: Default::default(),
}
}
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum MsgReceiptStatus {
#[default]
#[serde(rename = "ok")]
Ok,
#[serde(rename = "badMsgHash")]
BadMsgHash,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct NewUser {
#[serde(rename = "profile", skip_serializing_if = "Option::is_none")]
pub profile: Option<Profile>,
#[serde(rename = "pastTimestamp")]
pub past_timestamp: bool,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct NoteFolder {
#[serde(
rename = "noteFolderId",
deserialize_with = "deserialize_number_from_string"
)]
pub note_folder_id: i64,
#[serde(rename = "userId", deserialize_with = "deserialize_number_from_string")]
pub user_id: i64,
#[serde(rename = "createdAt")]
pub created_at: UtcTime,
#[serde(rename = "updatedAt")]
pub updated_at: UtcTime,
#[serde(rename = "chatTs")]
pub chat_ts: UtcTime,
#[serde(rename = "favorite")]
pub favorite: bool,
#[serde(rename = "unread")]
pub unread: bool,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct PendingContactConnection {
#[serde(
rename = "pccConnId",
deserialize_with = "deserialize_number_from_string"
)]
pub pcc_conn_id: i64,
#[serde(rename = "pccAgentConnId")]
pub pcc_agent_conn_id: String,
#[serde(rename = "pccConnStatus")]
pub pcc_conn_status: ConnStatus,
#[serde(rename = "viaContactUri")]
pub via_contact_uri: bool,
#[serde(
rename = "viaUserContactLink",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub via_user_contact_link: Option<i64>,
#[serde(rename = "groupLinkId", skip_serializing_if = "Option::is_none")]
pub group_link_id: Option<String>,
#[serde(
rename = "customUserProfileId",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub custom_user_profile_id: Option<i64>,
#[serde(rename = "connLinkInv", skip_serializing_if = "Option::is_none")]
pub conn_link_inv: Option<CreatedConnLink>,
#[serde(rename = "localAlias")]
pub local_alias: String,
#[serde(rename = "createdAt")]
pub created_at: UtcTime,
#[serde(rename = "updatedAt")]
pub updated_at: UtcTime,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct PrefEnabled {
#[serde(rename = "forUser")]
pub for_user: bool,
#[serde(rename = "forContact")]
pub for_contact: bool,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct Preferences {
#[serde(rename = "timedMessages", skip_serializing_if = "Option::is_none")]
pub timed_messages: Option<TimedMessagesPreference>,
#[serde(rename = "fullDelete", skip_serializing_if = "Option::is_none")]
pub full_delete: Option<SimplePreference>,
#[serde(rename = "reactions", skip_serializing_if = "Option::is_none")]
pub reactions: Option<SimplePreference>,
#[serde(rename = "voice", skip_serializing_if = "Option::is_none")]
pub voice: Option<SimplePreference>,
#[serde(rename = "files", skip_serializing_if = "Option::is_none")]
pub files: Option<SimplePreference>,
#[serde(rename = "calls", skip_serializing_if = "Option::is_none")]
pub calls: Option<SimplePreference>,
#[serde(rename = "sessions", skip_serializing_if = "Option::is_none")]
pub sessions: Option<SimplePreference>,
#[serde(rename = "commands", skip_serializing_if = "Option::is_none")]
pub commands: Option<Vec<ChatBotCommand>>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct PreparedContact {
#[serde(rename = "connLinkToConnect")]
pub conn_link_to_connect: CreatedConnLink,
#[serde(rename = "uiConnLinkType")]
pub ui_conn_link_type: ConnectionMode,
#[serde(rename = "welcomeSharedMsgId", skip_serializing_if = "Option::is_none")]
pub welcome_shared_msg_id: Option<String>,
#[serde(rename = "requestSharedMsgId", skip_serializing_if = "Option::is_none")]
pub request_shared_msg_id: Option<String>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct PreparedGroup {
#[serde(rename = "connLinkToConnect")]
pub conn_link_to_connect: CreatedConnLink,
#[serde(rename = "connLinkPreparedConnection")]
pub conn_link_prepared_connection: bool,
#[serde(rename = "connLinkStartedConnection")]
pub conn_link_started_connection: bool,
#[serde(rename = "welcomeSharedMsgId", skip_serializing_if = "Option::is_none")]
pub welcome_shared_msg_id: Option<String>,
#[serde(rename = "requestSharedMsgId", skip_serializing_if = "Option::is_none")]
pub request_shared_msg_id: Option<String>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct Profile {
#[serde(rename = "displayName")]
pub display_name: String,
#[serde(rename = "fullName")]
pub full_name: String,
#[serde(rename = "shortDescr", skip_serializing_if = "Option::is_none")]
pub short_descr: Option<String>,
#[serde(rename = "image", skip_serializing_if = "Option::is_none")]
pub image: Option<String>,
#[serde(rename = "contactLink", skip_serializing_if = "Option::is_none")]
pub contact_link: Option<String>,
#[serde(rename = "preferences", skip_serializing_if = "Option::is_none")]
pub preferences: Option<Preferences>,
#[serde(rename = "peerType", skip_serializing_if = "Option::is_none")]
pub peer_type: Option<ChatPeerType>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum RatchetSyncState {
#[default]
#[serde(rename = "ok")]
Ok,
#[serde(rename = "allowed")]
Allowed,
#[serde(rename = "required")]
Required,
#[serde(rename = "started")]
Started,
#[serde(rename = "agreed")]
Agreed,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum RcvConnEvent {
#[serde(rename = "switchQueue")]
SwitchQueue {
#[serde(rename = "phase")]
phase: SwitchPhase,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "ratchetSync")]
RatchetSync {
#[serde(rename = "syncStatus")]
sync_status: RatchetSyncState,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "verificationCodeReset")]
VerificationCodeReset,
#[serde(rename = "pqEnabled")]
PqEnabled {
#[serde(rename = "enabled")]
enabled: bool,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(untagged)]
Undocumented(JsonObject),
}
impl RcvConnEvent {
pub fn switch_queue(phase: SwitchPhase) -> Self {
Self::SwitchQueue {
phase,
undocumented: Default::default(),
}
}
pub fn ratchet_sync(sync_status: RatchetSyncState) -> Self {
Self::RatchetSync {
sync_status,
undocumented: Default::default(),
}
}
pub fn verification_code_reset() -> Self {
Self::VerificationCodeReset
}
pub fn pq_enabled(enabled: bool) -> Self {
Self::PqEnabled {
enabled,
undocumented: Default::default(),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum RcvDirectEvent {
#[serde(rename = "contactDeleted")]
ContactDeleted,
#[serde(rename = "profileUpdated")]
ProfileUpdated {
#[serde(rename = "fromProfile")]
from_profile: Profile,
#[serde(rename = "toProfile")]
to_profile: Profile,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "groupInvLinkReceived")]
GroupInvLinkReceived {
#[serde(rename = "groupProfile")]
group_profile: GroupProfile,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(untagged)]
Undocumented(JsonObject),
}
impl RcvDirectEvent {
pub fn contact_deleted() -> Self {
Self::ContactDeleted
}
pub fn profile_updated(from_profile: Profile, to_profile: Profile) -> Self {
Self::ProfileUpdated {
from_profile,
to_profile,
undocumented: Default::default(),
}
}
pub fn group_inv_link_received(group_profile: GroupProfile) -> Self {
Self::GroupInvLinkReceived {
group_profile,
undocumented: Default::default(),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct RcvFileDescr {
#[serde(
rename = "fileDescrId",
deserialize_with = "deserialize_number_from_string"
)]
pub file_descr_id: i64,
#[serde(rename = "fileDescrText")]
pub file_descr_text: String,
#[serde(
rename = "fileDescrPartNo",
deserialize_with = "deserialize_number_from_string"
)]
pub file_descr_part_no: i32,
#[serde(rename = "fileDescrComplete")]
pub file_descr_complete: bool,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct RcvFileInfo {
#[serde(rename = "filePath")]
pub file_path: String,
#[serde(
rename = "connId",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub conn_id: Option<i64>,
#[serde(rename = "agentConnId", skip_serializing_if = "Option::is_none")]
pub agent_conn_id: Option<String>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum RcvFileStatus {
#[serde(rename = "new")]
New,
#[serde(rename = "accepted")]
Accepted {
#[serde(rename = "fileInfo")]
file_info: RcvFileInfo,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "connected")]
Connected {
#[serde(rename = "fileInfo")]
file_info: RcvFileInfo,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "complete")]
Complete {
#[serde(rename = "fileInfo")]
file_info: RcvFileInfo,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "cancelled")]
Cancelled {
#[serde(rename = "fileInfo_", skip_serializing_if = "Option::is_none")]
file_info: Option<RcvFileInfo>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(untagged)]
Undocumented(JsonObject),
}
impl RcvFileStatus {
pub fn new() -> Self {
Self::New
}
pub fn accepted(file_info: RcvFileInfo) -> Self {
Self::Accepted {
file_info,
undocumented: Default::default(),
}
}
pub fn connected(file_info: RcvFileInfo) -> Self {
Self::Connected {
file_info,
undocumented: Default::default(),
}
}
pub fn complete(file_info: RcvFileInfo) -> Self {
Self::Complete {
file_info,
undocumented: Default::default(),
}
}
pub fn cancelled(file_info: Option<RcvFileInfo>) -> Self {
Self::Cancelled {
file_info,
undocumented: Default::default(),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct RcvFileTransfer {
#[serde(rename = "fileId", deserialize_with = "deserialize_number_from_string")]
pub file_id: i64,
#[serde(rename = "xftpRcvFile", skip_serializing_if = "Option::is_none")]
pub xftp_rcv_file: Option<XFTPRcvFile>,
#[serde(rename = "fileInvitation")]
pub file_invitation: FileInvitation,
#[serde(rename = "fileStatus")]
pub file_status: RcvFileStatus,
#[serde(rename = "rcvFileInline", skip_serializing_if = "Option::is_none")]
pub rcv_file_inline: Option<InlineFileMode>,
#[serde(rename = "senderDisplayName")]
pub sender_display_name: String,
#[serde(
rename = "chunkSize",
deserialize_with = "deserialize_number_from_string"
)]
pub chunk_size: i64,
#[serde(rename = "cancelled")]
pub cancelled: bool,
#[serde(
rename = "grpMemberId",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub grp_member_id: Option<i64>,
#[serde(rename = "cryptoArgs", skip_serializing_if = "Option::is_none")]
pub crypto_args: Option<CryptoFileArgs>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum RcvGroupEvent {
#[serde(rename = "memberAdded")]
MemberAdded {
#[serde(
rename = "groupMemberId",
deserialize_with = "deserialize_number_from_string"
)]
group_member_id: i64,
#[serde(rename = "profile")]
profile: Profile,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "memberConnected")]
MemberConnected,
#[serde(rename = "memberAccepted")]
MemberAccepted {
#[serde(
rename = "groupMemberId",
deserialize_with = "deserialize_number_from_string"
)]
group_member_id: i64,
#[serde(rename = "profile")]
profile: Profile,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "userAccepted")]
UserAccepted,
#[serde(rename = "memberLeft")]
MemberLeft,
#[serde(rename = "memberRole")]
MemberRole {
#[serde(
rename = "groupMemberId",
deserialize_with = "deserialize_number_from_string"
)]
group_member_id: i64,
#[serde(rename = "profile")]
profile: Profile,
#[serde(rename = "role")]
role: GroupMemberRole,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "memberBlocked")]
MemberBlocked {
#[serde(
rename = "groupMemberId",
deserialize_with = "deserialize_number_from_string"
)]
group_member_id: i64,
#[serde(rename = "profile")]
profile: Profile,
#[serde(rename = "blocked")]
blocked: bool,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "userRole")]
UserRole {
#[serde(rename = "role")]
role: GroupMemberRole,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "memberDeleted")]
MemberDeleted {
#[serde(
rename = "groupMemberId",
deserialize_with = "deserialize_number_from_string"
)]
group_member_id: i64,
#[serde(rename = "profile")]
profile: Profile,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "userDeleted")]
UserDeleted,
#[serde(rename = "groupDeleted")]
GroupDeleted,
#[serde(rename = "groupUpdated")]
GroupUpdated {
#[serde(rename = "groupProfile")]
group_profile: GroupProfile,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "invitedViaGroupLink")]
InvitedViaGroupLink,
#[serde(rename = "memberCreatedContact")]
MemberCreatedContact,
#[serde(rename = "memberProfileUpdated")]
MemberProfileUpdated {
#[serde(rename = "fromProfile")]
from_profile: Profile,
#[serde(rename = "toProfile")]
to_profile: Profile,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "newMemberPendingReview")]
NewMemberPendingReview,
#[serde(untagged)]
Undocumented(JsonObject),
}
impl RcvGroupEvent {
pub fn member_added(group_member_id: i64, profile: Profile) -> Self {
Self::MemberAdded {
group_member_id,
profile,
undocumented: Default::default(),
}
}
pub fn member_connected() -> Self {
Self::MemberConnected
}
pub fn member_accepted(group_member_id: i64, profile: Profile) -> Self {
Self::MemberAccepted {
group_member_id,
profile,
undocumented: Default::default(),
}
}
pub fn user_accepted() -> Self {
Self::UserAccepted
}
pub fn member_left() -> Self {
Self::MemberLeft
}
pub fn member_role(group_member_id: i64, profile: Profile, role: GroupMemberRole) -> Self {
Self::MemberRole {
group_member_id,
profile,
role,
undocumented: Default::default(),
}
}
pub fn member_blocked(group_member_id: i64, profile: Profile, blocked: bool) -> Self {
Self::MemberBlocked {
group_member_id,
profile,
blocked,
undocumented: Default::default(),
}
}
pub fn user_role(role: GroupMemberRole) -> Self {
Self::UserRole {
role,
undocumented: Default::default(),
}
}
pub fn member_deleted(group_member_id: i64, profile: Profile) -> Self {
Self::MemberDeleted {
group_member_id,
profile,
undocumented: Default::default(),
}
}
pub fn user_deleted() -> Self {
Self::UserDeleted
}
pub fn group_deleted() -> Self {
Self::GroupDeleted
}
pub fn group_updated(group_profile: GroupProfile) -> Self {
Self::GroupUpdated {
group_profile,
undocumented: Default::default(),
}
}
pub fn invited_via_group_link() -> Self {
Self::InvitedViaGroupLink
}
pub fn member_created_contact() -> Self {
Self::MemberCreatedContact
}
pub fn member_profile_updated(from_profile: Profile, to_profile: Profile) -> Self {
Self::MemberProfileUpdated {
from_profile,
to_profile,
undocumented: Default::default(),
}
}
pub fn new_member_pending_review() -> Self {
Self::NewMemberPendingReview
}
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum ReportReason {
#[default]
#[serde(rename = "spam")]
Spam,
#[serde(rename = "content")]
Content,
#[serde(rename = "community")]
Community,
#[serde(rename = "profile")]
Profile,
#[serde(rename = "other")]
Other,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct RoleGroupPreference {
#[serde(rename = "enable")]
pub enable: GroupFeatureEnabled,
#[serde(rename = "role", skip_serializing_if = "Option::is_none")]
pub role: Option<GroupMemberRole>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct SecurityCode {
#[serde(rename = "securityCode")]
pub security_code: String,
#[serde(rename = "verifiedAt")]
pub verified_at: UtcTime,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct SimplePreference {
#[serde(rename = "allow")]
pub allow: FeatureAllowed,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum SimplexLinkType {
#[default]
#[serde(rename = "contact")]
Contact,
#[serde(rename = "invitation")]
Invitation,
#[serde(rename = "group")]
Group,
#[serde(rename = "channel")]
Channel,
#[serde(rename = "relay")]
Relay,
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum SndCIStatusProgress {
#[default]
#[serde(rename = "partial")]
Partial,
#[serde(rename = "complete")]
Complete,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum SndConnEvent {
#[serde(rename = "switchQueue")]
SwitchQueue {
#[serde(rename = "phase")]
phase: SwitchPhase,
#[serde(rename = "member", skip_serializing_if = "Option::is_none")]
member: Option<GroupMemberRef>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "ratchetSync")]
RatchetSync {
#[serde(rename = "syncStatus")]
sync_status: RatchetSyncState,
#[serde(rename = "member", skip_serializing_if = "Option::is_none")]
member: Option<GroupMemberRef>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "pqEnabled")]
PqEnabled {
#[serde(rename = "enabled")]
enabled: bool,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(untagged)]
Undocumented(JsonObject),
}
impl SndConnEvent {
pub fn switch_queue(phase: SwitchPhase, member: Option<GroupMemberRef>) -> Self {
Self::SwitchQueue {
phase,
member,
undocumented: Default::default(),
}
}
pub fn ratchet_sync(sync_status: RatchetSyncState, member: Option<GroupMemberRef>) -> Self {
Self::RatchetSync {
sync_status,
member,
undocumented: Default::default(),
}
}
pub fn pq_enabled(enabled: bool) -> Self {
Self::PqEnabled {
enabled,
undocumented: Default::default(),
}
}
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct SndFileTransfer {
#[serde(rename = "fileId", deserialize_with = "deserialize_number_from_string")]
pub file_id: i64,
#[serde(rename = "fileName")]
pub file_name: String,
#[serde(rename = "filePath")]
pub file_path: String,
#[serde(
rename = "fileSize",
deserialize_with = "deserialize_number_from_string"
)]
pub file_size: i64,
#[serde(
rename = "chunkSize",
deserialize_with = "deserialize_number_from_string"
)]
pub chunk_size: i64,
#[serde(rename = "recipientDisplayName")]
pub recipient_display_name: String,
#[serde(rename = "connId", deserialize_with = "deserialize_number_from_string")]
pub conn_id: i64,
#[serde(rename = "agentConnId")]
pub agent_conn_id: String,
#[serde(
rename = "groupMemberId",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub group_member_id: Option<i64>,
#[serde(rename = "fileStatus")]
pub file_status: FileStatus,
#[serde(
rename = "fileDescrId",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub file_descr_id: Option<i64>,
#[serde(rename = "fileInline", skip_serializing_if = "Option::is_none")]
pub file_inline: Option<InlineFileMode>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "type")]
#[non_exhaustive]
pub enum SndGroupEvent {
#[serde(rename = "memberRole")]
MemberRole {
#[serde(
rename = "groupMemberId",
deserialize_with = "deserialize_number_from_string"
)]
group_member_id: i64,
#[serde(rename = "profile")]
profile: Profile,
#[serde(rename = "role")]
role: GroupMemberRole,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "memberBlocked")]
MemberBlocked {
#[serde(
rename = "groupMemberId",
deserialize_with = "deserialize_number_from_string"
)]
group_member_id: i64,
#[serde(rename = "profile")]
profile: Profile,
#[serde(rename = "blocked")]
blocked: bool,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "userRole")]
UserRole {
#[serde(rename = "role")]
role: GroupMemberRole,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "memberDeleted")]
MemberDeleted {
#[serde(
rename = "groupMemberId",
deserialize_with = "deserialize_number_from_string"
)]
group_member_id: i64,
#[serde(rename = "profile")]
profile: Profile,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "userLeft")]
UserLeft,
#[serde(rename = "groupUpdated")]
GroupUpdated {
#[serde(rename = "groupProfile")]
group_profile: GroupProfile,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "memberAccepted")]
MemberAccepted {
#[serde(
rename = "groupMemberId",
deserialize_with = "deserialize_number_from_string"
)]
group_member_id: i64,
#[serde(rename = "profile")]
profile: Profile,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
undocumented: JsonObject,
},
#[serde(rename = "userPendingReview")]
UserPendingReview,
#[serde(untagged)]
Undocumented(JsonObject),
}
impl SndGroupEvent {
pub fn member_role(group_member_id: i64, profile: Profile, role: GroupMemberRole) -> Self {
Self::MemberRole {
group_member_id,
profile,
role,
undocumented: Default::default(),
}
}
pub fn member_blocked(group_member_id: i64, profile: Profile, blocked: bool) -> Self {
Self::MemberBlocked {
group_member_id,
profile,
blocked,
undocumented: Default::default(),
}
}
pub fn user_role(role: GroupMemberRole) -> Self {
Self::UserRole {
role,
undocumented: Default::default(),
}
}
pub fn member_deleted(group_member_id: i64, profile: Profile) -> Self {
Self::MemberDeleted {
group_member_id,
profile,
undocumented: Default::default(),
}
}
pub fn user_left() -> Self {
Self::UserLeft
}
pub fn group_updated(group_profile: GroupProfile) -> Self {
Self::GroupUpdated {
group_profile,
undocumented: Default::default(),
}
}
pub fn member_accepted(group_member_id: i64, profile: Profile) -> Self {
Self::MemberAccepted {
group_member_id,
profile,
undocumented: Default::default(),
}
}
pub fn user_pending_review() -> Self {
Self::UserPendingReview
}
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum SwitchPhase {
#[default]
#[serde(rename = "started")]
Started,
#[serde(rename = "confirmed")]
Confirmed,
#[serde(rename = "secured")]
Secured,
#[serde(rename = "completed")]
Completed,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct TimedMessagesGroupPreference {
#[serde(rename = "enable")]
pub enable: GroupFeatureEnabled,
#[serde(
rename = "ttl",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub ttl: Option<i32>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct TimedMessagesPreference {
#[serde(rename = "allow")]
pub allow: FeatureAllowed,
#[serde(
rename = "ttl",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub ttl: Option<i32>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[non_exhaustive]
pub enum UIColorMode {
#[default]
#[serde(rename = "light")]
Light,
#[serde(rename = "dark")]
Dark,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct UIColors {
#[serde(rename = "accent", skip_serializing_if = "Option::is_none")]
pub accent: Option<String>,
#[serde(rename = "accentVariant", skip_serializing_if = "Option::is_none")]
pub accent_variant: Option<String>,
#[serde(rename = "secondary", skip_serializing_if = "Option::is_none")]
pub secondary: Option<String>,
#[serde(rename = "secondaryVariant", skip_serializing_if = "Option::is_none")]
pub secondary_variant: Option<String>,
#[serde(rename = "background", skip_serializing_if = "Option::is_none")]
pub background: Option<String>,
#[serde(rename = "menus", skip_serializing_if = "Option::is_none")]
pub menus: Option<String>,
#[serde(rename = "title", skip_serializing_if = "Option::is_none")]
pub title: Option<String>,
#[serde(rename = "accentVariant2", skip_serializing_if = "Option::is_none")]
pub accent_variant_2: Option<String>,
#[serde(rename = "sentMessage", skip_serializing_if = "Option::is_none")]
pub sent_message: Option<String>,
#[serde(rename = "sentReply", skip_serializing_if = "Option::is_none")]
pub sent_reply: Option<String>,
#[serde(rename = "receivedMessage", skip_serializing_if = "Option::is_none")]
pub received_message: Option<String>,
#[serde(rename = "receivedReply", skip_serializing_if = "Option::is_none")]
pub received_reply: Option<String>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct UIThemeEntityOverride {
#[serde(rename = "mode")]
pub mode: UIColorMode,
#[serde(rename = "wallpaper", skip_serializing_if = "Option::is_none")]
pub wallpaper: Option<ChatWallpaper>,
#[serde(rename = "colors")]
pub colors: UIColors,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct UIThemeEntityOverrides {
#[serde(rename = "light", skip_serializing_if = "Option::is_none")]
pub light: Option<UIThemeEntityOverride>,
#[serde(rename = "dark", skip_serializing_if = "Option::is_none")]
pub dark: Option<UIThemeEntityOverride>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct UpdatedMessage {
#[serde(rename = "msgContent")]
pub msg_content: MsgContent,
#[serde(rename = "mentions")]
pub mentions: BTreeMap<String, i64>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct User {
#[serde(rename = "userId", deserialize_with = "deserialize_number_from_string")]
pub user_id: i64,
#[serde(
rename = "agentUserId",
deserialize_with = "deserialize_number_from_string"
)]
pub agent_user_id: i64,
#[serde(
rename = "userContactId",
deserialize_with = "deserialize_number_from_string"
)]
pub user_contact_id: i64,
#[serde(rename = "localDisplayName")]
pub local_display_name: String,
#[serde(rename = "profile")]
pub profile: LocalProfile,
#[serde(rename = "fullPreferences")]
pub full_preferences: FullPreferences,
#[serde(rename = "activeUser")]
pub active_user: bool,
#[serde(
rename = "activeOrder",
deserialize_with = "deserialize_number_from_string"
)]
pub active_order: i64,
#[serde(rename = "viewPwdHash", skip_serializing_if = "Option::is_none")]
pub view_pwd_hash: Option<UserPwdHash>,
#[serde(rename = "showNtfs")]
pub show_ntfs: bool,
#[serde(rename = "sendRcptsContacts")]
pub send_rcpts_contacts: bool,
#[serde(rename = "sendRcptsSmallGroups")]
pub send_rcpts_small_groups: bool,
#[serde(rename = "autoAcceptMemberContacts")]
pub auto_accept_member_contacts: bool,
#[serde(
rename = "userMemberProfileUpdatedAt",
skip_serializing_if = "Option::is_none"
)]
pub user_member_profile_updated_at: Option<UtcTime>,
#[serde(rename = "uiThemes", skip_serializing_if = "Option::is_none")]
pub ui_themes: Option<UIThemeEntityOverrides>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct UserContact {
#[serde(
rename = "userContactLinkId",
deserialize_with = "deserialize_number_from_string"
)]
pub user_contact_link_id: i64,
#[serde(rename = "connReqContact")]
pub conn_req_contact: String,
#[serde(
rename = "groupId",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub group_id: Option<i64>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct UserContactLink {
#[serde(
rename = "userContactLinkId",
deserialize_with = "deserialize_number_from_string"
)]
pub user_contact_link_id: i64,
#[serde(rename = "connLinkContact")]
pub conn_link_contact: CreatedConnLink,
#[serde(rename = "shortLinkDataSet")]
pub short_link_data_set: bool,
#[serde(rename = "shortLinkLargeDataSet")]
pub short_link_large_data_set: bool,
#[serde(rename = "addressSettings")]
pub address_settings: AddressSettings,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct UserContactRequest {
#[serde(
rename = "contactRequestId",
deserialize_with = "deserialize_number_from_string"
)]
pub contact_request_id: i64,
#[serde(rename = "agentInvitationId")]
pub agent_invitation_id: String,
#[serde(
rename = "contactId_",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub contact_id: Option<i64>,
#[serde(
rename = "businessGroupId_",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub business_group_id: Option<i64>,
#[serde(
rename = "userContactLinkId_",
skip_serializing_if = "Option::is_none",
deserialize_with = "deserialize_option_number_from_string",
default
)]
pub user_contact_link_id: Option<i64>,
#[serde(rename = "cReqChatVRange")]
pub c_req_chat_v_range: VersionRange,
#[serde(rename = "localDisplayName")]
pub local_display_name: String,
#[serde(
rename = "profileId",
deserialize_with = "deserialize_number_from_string"
)]
pub profile_id: i64,
#[serde(rename = "profile")]
pub profile: Profile,
#[serde(rename = "createdAt")]
pub created_at: UtcTime,
#[serde(rename = "updatedAt")]
pub updated_at: UtcTime,
#[serde(rename = "xContactId", skip_serializing_if = "Option::is_none")]
pub x_contact_id: Option<String>,
#[serde(rename = "pqSupport")]
pub pq_support: bool,
#[serde(rename = "welcomeSharedMsgId", skip_serializing_if = "Option::is_none")]
pub welcome_shared_msg_id: Option<String>,
#[serde(rename = "requestSharedMsgId", skip_serializing_if = "Option::is_none")]
pub request_shared_msg_id: Option<String>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct UserInfo {
#[serde(rename = "user")]
pub user: User,
#[serde(
rename = "unreadCount",
deserialize_with = "deserialize_number_from_string"
)]
pub unread_count: i32,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct UserProfileUpdateSummary {
#[serde(
rename = "updateSuccesses",
deserialize_with = "deserialize_number_from_string"
)]
pub update_successes: i32,
#[serde(
rename = "updateFailures",
deserialize_with = "deserialize_number_from_string"
)]
pub update_failures: i32,
#[serde(rename = "changedContacts")]
pub changed_contacts: Vec<Contact>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct UserPwdHash {
#[serde(rename = "hash")]
pub hash: String,
#[serde(rename = "salt")]
pub salt: String,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct VersionRange {
#[serde(
rename = "minVersion",
deserialize_with = "deserialize_number_from_string"
)]
pub min_version: i32,
#[serde(
rename = "maxVersion",
deserialize_with = "deserialize_number_from_string"
)]
pub max_version: i32,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct XFTPRcvFile {
#[serde(rename = "rcvFileDescription")]
pub rcv_file_description: RcvFileDescr,
#[serde(rename = "agentRcvFileId", skip_serializing_if = "Option::is_none")]
pub agent_rcv_file_id: Option<String>,
#[serde(rename = "agentRcvFileDeleted")]
pub agent_rcv_file_deleted: bool,
#[serde(rename = "userApprovedRelays")]
pub user_approved_relays: bool,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "bon", derive(::bon::Builder))]
#[cfg_attr(feature = "bon", builder(on(String, into)))]
pub struct XFTPSndFile {
#[serde(rename = "agentSndFileId")]
pub agent_snd_file_id: String,
#[serde(
rename = "privateSndFileDescr",
skip_serializing_if = "Option::is_none"
)]
pub private_snd_file_descr: Option<String>,
#[serde(rename = "agentSndFileDeleted")]
pub agent_snd_file_deleted: bool,
#[serde(rename = "cryptoArgs", skip_serializing_if = "Option::is_none")]
pub crypto_args: Option<CryptoFileArgs>,
#[serde(flatten, skip_serializing_if = "JsonObject::is_null")]
#[cfg_attr(feature = "bon", builder(default))]
pub undocumented: JsonObject,
}