#[non_exhaustive]pub enum ApiShowMyAddressResponse {
UserContactLink(UserContactLinkResponse),
ChatCmdError(ChatCmdErrorResponse),
Undocumented(Value),
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
UserContactLink(UserContactLinkResponse)
UserContactLink: User contact address.
ChatCmdError(ChatCmdErrorResponse)
ChatCmdError: Command error.
Undocumented(Value)
Implementations§
Source§impl ApiShowMyAddressResponse
impl ApiShowMyAddressResponse
Sourcepub fn user_contact_link(&self) -> Option<&UserContactLinkResponse>
pub fn user_contact_link(&self) -> Option<&UserContactLinkResponse>
Examples found in repository?
examples/multi_user_bot.rs (line 42)
23async fn main() -> Result<(), Box<dyn Error>> {
24 let (client, mut events) = simploxide_client::connect("ws://127.0.0.1:5225").await?;
25
26 // Use destructuring to extract data from the expected response
27 let ShowActiveUserResponse::ActiveUser(ActiveUserResponse { ref user, .. }) =
28 *client.show_active_user().await?
29 else {
30 return Err("No active user profile".into());
31 };
32
33 println!(
34 "Bot profile: {} ({})",
35 user.profile.display_name, user.profile.full_name
36 );
37
38 // Alternatively, use response getters
39 let (address_long, address_short) = match client
40 .api_show_my_address(user.user_id)
41 .await?
42 .user_contact_link()
43 {
44 Some(resp) => (
45 resp.contact_link.conn_link_contact.conn_full_link.clone(),
46 resp.contact_link.conn_link_contact.conn_short_link.clone(),
47 ),
48 None => client
49 .api_create_my_address(user.user_id)
50 .await?
51 .user_contact_link_created()
52 .map(|resp| {
53 (
54 resp.conn_link_contact.conn_full_link.clone(),
55 resp.conn_link_contact.conn_short_link.clone(),
56 )
57 })
58 .ok_or("Failed to create bot address")?,
59 };
60
61 println!("Bot long address: {address_long}");
62 println!("Bot short address: {address_short:?}");
63
64 let mut counter = 0;
65 'reactor: while let Some(ev) = events.try_next().await? {
66 match ev.as_ref() {
67 // Got the message -> square the number
68 Event::NewChatItems(new_msgs) => {
69 counter += 1;
70 if counter > 10 {
71 break 'reactor;
72 }
73 }
74 // Ignore all other events
75 _ => (),
76 }
77 }
78
79 client
80 .api_set_address_settings(
81 user.user_id,
82 AddressSettings {
83 business_address: false,
84 auto_accept: None,
85 auto_reply: None,
86 undocumented: Default::default(),
87 },
88 )
89 .await?;
90
91 client
92 .api_set_profile_address(ApiSetProfileAddress {
93 user_id: user.user_id,
94 enable: false,
95 })
96 .await?;
97
98 Ok(())
99}pub fn chat_cmd_error(&self) -> Option<&ChatCmdErrorResponse>
pub fn undocumented(&self) -> Option<&Value>
Trait Implementations§
Source§impl Clone for ApiShowMyAddressResponse
impl Clone for ApiShowMyAddressResponse
Source§fn clone(&self) -> ApiShowMyAddressResponse
fn clone(&self) -> ApiShowMyAddressResponse
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ApiShowMyAddressResponse
impl Debug for ApiShowMyAddressResponse
Source§impl<'de> Deserialize<'de> for ApiShowMyAddressResponse
impl<'de> Deserialize<'de> for ApiShowMyAddressResponse
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ApiShowMyAddressResponse, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ApiShowMyAddressResponse, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ApiShowMyAddressResponse
impl PartialEq for ApiShowMyAddressResponse
Source§impl Serialize for ApiShowMyAddressResponse
impl Serialize for ApiShowMyAddressResponse
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for ApiShowMyAddressResponse
Auto Trait Implementations§
impl Freeze for ApiShowMyAddressResponse
impl RefUnwindSafe for ApiShowMyAddressResponse
impl Send for ApiShowMyAddressResponse
impl Sync for ApiShowMyAddressResponse
impl Unpin for ApiShowMyAddressResponse
impl UnwindSafe for ApiShowMyAddressResponse
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more