mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 22:46:39 +01:00
add struct
This commit is contained in:
parent
23b94bab01
commit
1891976650
2 changed files with 66 additions and 0 deletions
11
src/core/types/chosen_inline_result.rs
Normal file
11
src/core/types/chosen_inline_result.rs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
use serde::Deserialize;
|
||||||
|
use crate::core::types::user::User;
|
||||||
|
|
||||||
|
#[derive(Debug, Deserealize)]
|
||||||
|
pub struct ChosenInlineResult {
|
||||||
|
pub result_id: String,
|
||||||
|
pub from: User,
|
||||||
|
pub location: Option<Location>,
|
||||||
|
pub inline_message_id: Option<String>,
|
||||||
|
pub query: String,
|
||||||
|
}
|
55
src/core/types/input_message_content.rs
Normal file
55
src/core/types/input_message_content.rs
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
use serde::Serialize;
|
||||||
|
use crate::core::parse_mode::ParseMode;
|
||||||
|
|
||||||
|
pub enum InputMessageContent {
|
||||||
|
Text(InputTextMessageContent),
|
||||||
|
Location(InputLocationMessageContent),
|
||||||
|
Venue(InputVenueMessageContent),
|
||||||
|
Contact(InputContactMessageContent),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize)]
|
||||||
|
pub struct InputTextMessageContent {
|
||||||
|
pub message_text: String,
|
||||||
|
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub parse_mode: Option<ParseMode>,
|
||||||
|
|
||||||
|
#[serde(skip_serializing_if = "Not::not")]
|
||||||
|
pub disable_web_page_preview: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize)]
|
||||||
|
pub struct InputLocationMessageContent {
|
||||||
|
pub latitude: f64,
|
||||||
|
pub longitude: f64,
|
||||||
|
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub live_period: Option<u32> // should be between 60 and 86400
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize)]
|
||||||
|
pub struct InputVenueMessageContent {
|
||||||
|
pub latitude: f64,
|
||||||
|
pub longitude: f64,
|
||||||
|
pub title: String,
|
||||||
|
pub address: String,
|
||||||
|
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub foursquare_id: Option<String>,
|
||||||
|
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub foursquare_type: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize)]
|
||||||
|
pub struct InputContactMessageContent {
|
||||||
|
pub phone_number: String,
|
||||||
|
pub first_name: String,
|
||||||
|
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub last_name: Option<String>,
|
||||||
|
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
pub vcard: Option<String>,
|
||||||
|
}
|
Loading…
Reference in a new issue