Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Append some types to update response #243

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions raw/src/types/chat_invite_link.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use crate::types::*;

#[derive(Debug, Clone, PartialEq, PartialOrd, Deserialize)]
pub struct ChatInviteLink {
pub invite_link: String,
pub creator: User,
pub is_primary: bool,
pub is_revoked: bool,
pub expire_date: Integer,
pub member_limit: Integer,
}
11 changes: 11 additions & 0 deletions raw/src/types/chat_member_update.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use crate::types::*;

#[derive(Debug, Clone, PartialEq, PartialOrd, Deserialize)]
pub struct ChatMemberUpdate {
pub chat: Chat,
pub from: User,
pub date: Integer,
pub old_chat_member: ChatMember,
pub new_chat_member: ChatMember,
pub invite_link: Option<ChatInviteLink>,
}
10 changes: 10 additions & 0 deletions raw/src/types/chosen_inline_result.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use crate::types::*;

#[derive(Debug, Clone, PartialEq, PartialOrd, Deserialize)]
pub struct ChosenInlineResult {
pub result_id: String,
pub from: User,
pub location: Option<Location>,
pub inline_message_id: Option<String>,
pub query: String,
}
10 changes: 10 additions & 0 deletions raw/src/types/mod.rs
Original file line number Diff line number Diff line change
@@ -1,27 +1,37 @@
pub mod callback_query;
pub mod chat;
pub mod chat_invite_link;
pub mod chat_member;
pub mod chat_member_update;
pub mod chosen_inline_result;
pub mod inline_query;
pub mod inline_query_result;
pub mod input_file;
pub mod message;
pub mod pre_checkout_query;
pub mod primitive;
pub mod refs;
pub mod reply_markup;
pub mod response_parameters;
pub mod shipping_query;
pub mod text;
pub mod update;

pub use self::callback_query::*;
pub use self::chat::*;
pub use self::chat_invite_link::*;
pub use self::chat_member::*;
pub use self::chat_member_update::*;
pub use self::chosen_inline_result::*;
pub use self::inline_query::*;
pub use self::inline_query_result::*;
pub use self::input_file::*;
pub use self::message::*;
pub use self::pre_checkout_query::*;
pub use self::primitive::*;
pub use self::refs::*;
pub use self::reply_markup::*;
pub use self::response_parameters::*;
pub use self::shipping_query::*;
pub use self::text::*;
pub use self::update::*;
30 changes: 30 additions & 0 deletions raw/src/types/pre_checkout_query.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
use crate::types::*;

#[derive(Debug, Clone, PartialEq, PartialOrd, Deserialize)]
pub struct PreCheckoutQuery {
pub id: CallbackQueryId,
pub from: User,
pub currency: String,
pub total_amount: Integer,
pub invoice_payload: String,
pub shipping_option_id: Option<String>,
pub order_info: Option<OrderInfo>,
}

#[derive(Debug, Clone, PartialEq, PartialOrd, Deserialize)]
pub struct OrderInfo {
pub name: Option<String>,
pub phone_number: Option<String>,
pub email: Option<String>,
pub shipping_address: Option<ShippingAddress>,
}

#[derive(Debug, Clone, PartialEq, PartialOrd, Deserialize)]
pub struct ShippingAddress {
pub country_code: String,
pub state: String,
pub city: String,
pub street_line1: String,
pub street_line2: String,
pub post_code: String,
}
9 changes: 9 additions & 0 deletions raw/src/types/shipping_query.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use crate::types::*;

#[derive(Debug, Clone, PartialEq, PartialOrd, Deserialize)]
pub struct ShippingQuery {
pub id: CallbackQueryId,
pub from: User,
pub invoice_payload: String,
pub shipping_address: ShippingAddress,
}
13 changes: 12 additions & 1 deletion raw/src/types/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ pub struct Update {
/// Kind of the incoming update.
#[derive(Debug, Clone, PartialEq, PartialOrd, Deserialize)]
pub enum UpdateKind {
#[serde(rename = "update_id")]
UpdateId(Integer),
/// New incoming message of any kind — text, photo, sticker, etc.
#[serde(rename = "message")]
Message(Message),
Expand All @@ -29,15 +31,24 @@ pub enum UpdateKind {
EditedChannelPost(ChannelPost),
#[serde(rename = "inline_query")]
InlineQuery(InlineQuery),
// ChosenInlineResult(ChosenInlineResult),
#[serde(rename = "chosen_inline_result")]
ChosenInlineResult(ChosenInlineResult),
#[serde(rename = "callback_query")]
CallbackQuery(CallbackQuery),
#[serde(rename = "shipping_query")]
ShippingQuery(ShippingQuery),
#[serde(rename = "pre_checkout_query")]
PreCheckoutQuery(PreCheckoutQuery),
/// New poll state. Bots receive only updates about stopped polls and polls, which are sent by the bot
#[serde(rename = "poll")]
Poll(Poll),
/// A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself
#[serde(rename = "poll_answer")]
PollAnswer(PollAnswer),
#[serde(rename = "my_chat_member")]
MyChatMember(ChatMemberUpdate),
#[serde(rename = "chat_member")]
ChatMember(ChatMemberUpdate),
#[doc(hidden)]
Error(String),
#[doc(hidden)]
Expand Down