From 6dda560cc3ed9b0d595ae7b4755378b362f45e08 Mon Sep 17 00:00:00 2001 From: nextel Date: Thu, 12 Sep 2019 20:05:59 +0300 Subject: [PATCH 1/4] cargo fmt of ../requests --- src/core/requests/get_file.rs | 3 +-- src/core/requests/get_user_profile_photos.rs | 3 +-- src/core/requests/kick_chat_member.rs | 3 +-- src/core/requests/mod.rs | 16 ++++++++-------- src/core/requests/restrict_chat_member.rs | 3 +-- src/core/requests/send_chat_action.rs | 3 +-- src/core/requests/send_contact.rs | 3 +-- src/core/requests/send_poll.rs | 3 +-- src/core/requests/send_venue.rs | 3 +-- src/core/requests/unban_chat_member.rs | 3 +-- 10 files changed, 17 insertions(+), 26 deletions(-) diff --git a/src/core/requests/get_file.rs b/src/core/requests/get_file.rs index 9ffa9062..e74ecbb5 100644 --- a/src/core/requests/get_file.rs +++ b/src/core/requests/get_file.rs @@ -1,3 +1,2 @@ - //TODO: need implementation -struct GetFile<'a>{} \ No newline at end of file +struct GetFile<'a> {} diff --git a/src/core/requests/get_user_profile_photos.rs b/src/core/requests/get_user_profile_photos.rs index 6d90eddc..857e3534 100644 --- a/src/core/requests/get_user_profile_photos.rs +++ b/src/core/requests/get_user_profile_photos.rs @@ -1,3 +1,2 @@ - //TODO: need implementation -struct GetUserProfilePhotos<'a>{} \ No newline at end of file +struct GetUserProfilePhotos<'a> {} diff --git a/src/core/requests/kick_chat_member.rs b/src/core/requests/kick_chat_member.rs index d8e1ab95..636f7a9a 100644 --- a/src/core/requests/kick_chat_member.rs +++ b/src/core/requests/kick_chat_member.rs @@ -1,3 +1,2 @@ - //TODO: need implementation -struct KickChatMember<'a>{} \ No newline at end of file +struct KickChatMember<'a> {} diff --git a/src/core/requests/mod.rs b/src/core/requests/mod.rs index cd513516..05e69f7f 100644 --- a/src/core/requests/mod.rs +++ b/src/core/requests/mod.rs @@ -91,19 +91,19 @@ mod tests { pub mod edit_message_live_location; pub mod forward_message; +pub mod get_file; pub mod get_me; +pub mod get_user_profile_photos; +pub mod kick_chat_member; +pub mod restrict_chat_member; pub mod send_audio; +pub mod send_chat_action; +pub mod send_contact; pub mod send_location; pub mod send_media_group; pub mod send_message; pub mod send_photo; -pub mod stop_message_live_location; -pub mod send_venue; -pub mod send_contact; pub mod send_poll; -pub mod send_chat_action; -pub mod get_user_profile_photos; -pub mod get_file; -pub mod kick_chat_member; +pub mod send_venue; +pub mod stop_message_live_location; pub mod unban_chat_member; -pub mod restrict_chat_member; diff --git a/src/core/requests/restrict_chat_member.rs b/src/core/requests/restrict_chat_member.rs index f7857f63..18412edb 100644 --- a/src/core/requests/restrict_chat_member.rs +++ b/src/core/requests/restrict_chat_member.rs @@ -1,3 +1,2 @@ - //TODO: need implementation -struct RestrictChatMember<'a>{} \ No newline at end of file +struct RestrictChatMember<'a> {} diff --git a/src/core/requests/send_chat_action.rs b/src/core/requests/send_chat_action.rs index 70b00dfd..ce266097 100644 --- a/src/core/requests/send_chat_action.rs +++ b/src/core/requests/send_chat_action.rs @@ -1,3 +1,2 @@ - //TODO: need implementation -struct SendChatAction<'a>{} \ No newline at end of file +struct SendChatAction<'a> {} diff --git a/src/core/requests/send_contact.rs b/src/core/requests/send_contact.rs index f0f9f9ff..7c90da4c 100644 --- a/src/core/requests/send_contact.rs +++ b/src/core/requests/send_contact.rs @@ -1,3 +1,2 @@ - //TODO: need implementation -struct SendContact<'a>{} \ No newline at end of file +struct SendContact<'a> {} diff --git a/src/core/requests/send_poll.rs b/src/core/requests/send_poll.rs index f09f99f0..a4eb62b5 100644 --- a/src/core/requests/send_poll.rs +++ b/src/core/requests/send_poll.rs @@ -1,3 +1,2 @@ - //TODO: need implementation -struct SendPoll<'a>{} \ No newline at end of file +struct SendPoll<'a> {} diff --git a/src/core/requests/send_venue.rs b/src/core/requests/send_venue.rs index 417005e2..6a24952a 100644 --- a/src/core/requests/send_venue.rs +++ b/src/core/requests/send_venue.rs @@ -1,3 +1,2 @@ - //TODO:need implementation -struct SendVenue<'a>{} \ No newline at end of file +struct SendVenue<'a> {} diff --git a/src/core/requests/unban_chat_member.rs b/src/core/requests/unban_chat_member.rs index 5b3726b7..9a99d4a3 100644 --- a/src/core/requests/unban_chat_member.rs +++ b/src/core/requests/unban_chat_member.rs @@ -1,3 +1,2 @@ - //TODO: need implementation -struct UnbanChatMember<'a>{} \ No newline at end of file +struct UnbanChatMember<'a> {} From 278f9690b74d588b4c3d73cd314f5568c86314ef Mon Sep 17 00:00:00 2001 From: nextel Date: Thu, 12 Sep 2019 20:33:28 +0300 Subject: [PATCH 2/4] add sendVenue --- src/core/requests/get_file.rs | 9 +++- src/core/requests/get_user_profile_photos.rs | 9 +++- src/core/requests/kick_chat_member.rs | 10 +++- src/core/requests/restrict_chat_member.rs | 9 +++- src/core/requests/send_chat_action.rs | 9 +++- src/core/requests/send_contact.rs | 9 +++- src/core/requests/send_poll.rs | 9 +++- src/core/requests/send_venue.rs | 46 ++++++++++++++++++- .../requests/stop_message_live_location.rs | 5 +- src/core/requests/unban_chat_member.rs | 9 +++- 10 files changed, 104 insertions(+), 20 deletions(-) diff --git a/src/core/requests/get_file.rs b/src/core/requests/get_file.rs index e74ecbb5..496368b4 100644 --- a/src/core/requests/get_file.rs +++ b/src/core/requests/get_file.rs @@ -1,2 +1,7 @@ -//TODO: need implementation -struct GetFile<'a> {} +use crate::core::requests::RequestContext; + +#[derive(Debug, Clone, Serialize)] +struct GetFile<'a> { + #[serde(skip_serializing)] + ctx: RequestContext<'a>, +} diff --git a/src/core/requests/get_user_profile_photos.rs b/src/core/requests/get_user_profile_photos.rs index 857e3534..2cffec70 100644 --- a/src/core/requests/get_user_profile_photos.rs +++ b/src/core/requests/get_user_profile_photos.rs @@ -1,2 +1,7 @@ -//TODO: need implementation -struct GetUserProfilePhotos<'a> {} +use crate::core::requests::RequestContext; + +#[derive(Debug, Clone, Serialize)] +struct GetUserProfilePhotos<'a> { + #[serde(skip_serializing)] + ctx: RequestContext<'a>, +} diff --git a/src/core/requests/kick_chat_member.rs b/src/core/requests/kick_chat_member.rs index 636f7a9a..f8d757fc 100644 --- a/src/core/requests/kick_chat_member.rs +++ b/src/core/requests/kick_chat_member.rs @@ -1,2 +1,8 @@ -//TODO: need implementation -struct KickChatMember<'a> {} +use crate::core::requests::RequestContext; + +#[derive(Debug, Clone, Serialize)] +struct KickChatMember<'a> { + #[serde(skip_serializing)] + ctx: RequestContext<'a>, + +} diff --git a/src/core/requests/restrict_chat_member.rs b/src/core/requests/restrict_chat_member.rs index 18412edb..34a4bd7c 100644 --- a/src/core/requests/restrict_chat_member.rs +++ b/src/core/requests/restrict_chat_member.rs @@ -1,2 +1,7 @@ -//TODO: need implementation -struct RestrictChatMember<'a> {} +use crate::core::requests::RequestContext; + +#[derive(Debug, Clone, Serialize)] +struct RestrictChatMember<'a> { + #[serde(skip_serializing)] + ctx: RequestContext<'a>, +} diff --git a/src/core/requests/send_chat_action.rs b/src/core/requests/send_chat_action.rs index ce266097..aee6fd0a 100644 --- a/src/core/requests/send_chat_action.rs +++ b/src/core/requests/send_chat_action.rs @@ -1,2 +1,7 @@ -//TODO: need implementation -struct SendChatAction<'a> {} +use crate::core::requests::RequestContext; + +#[derive(Debug, Clone, Serialize)] +struct SendChatAction<'a> { + #[serde(skip_serializing)] + ctx: RequestContext<'a>, +} diff --git a/src/core/requests/send_contact.rs b/src/core/requests/send_contact.rs index 7c90da4c..959e7b11 100644 --- a/src/core/requests/send_contact.rs +++ b/src/core/requests/send_contact.rs @@ -1,2 +1,7 @@ -//TODO: need implementation -struct SendContact<'a> {} +use crate::core::requests::RequestContext; + +#[derive(Debug, Clone, Serialize)] +struct SendContact<'a> { + #[serde(skip_serializing)] + ctx: RequestContext<'a>, +} diff --git a/src/core/requests/send_poll.rs b/src/core/requests/send_poll.rs index a4eb62b5..f1f1752e 100644 --- a/src/core/requests/send_poll.rs +++ b/src/core/requests/send_poll.rs @@ -1,2 +1,7 @@ -//TODO: need implementation -struct SendPoll<'a> {} +use crate::core::requests::RequestContext; + +#[derive(Debug, Clone, Serialize)] +struct SendPoll<'a> { + #[serde(skip_serializing)] + ctx: RequestContext<'a>, +} diff --git a/src/core/requests/send_venue.rs b/src/core/requests/send_venue.rs index 6a24952a..3b11a734 100644 --- a/src/core/requests/send_venue.rs +++ b/src/core/requests/send_venue.rs @@ -1,2 +1,44 @@ -//TODO:need implementation -struct SendVenue<'a> {} +use crate::core::requests::{ChatId, RequestContext}; + +///Use this method to send information about a venue. On success, the sent +/// Message is returned. +#[derive(Debug, Clone, Serialize)] +struct SendVenue<'a> { + #[serde(skip_serializing)] + ctx: RequestContext<'a>, + /// Integer or String Yes Unique identifier for the target chat or + /// username of the target channel (in the format @channelusername) + chat_id: ChatId, + /// Float number Yes Latitude of the venue + latitude: f64, + ///Float number Yes Longitude of the venue + longitude: f64, + /// Yes Name of the venue + title: String, + ///String Yes Address of the venue + address: String, + /// String Optional Foursquare identifier of the venue + #[serde(skip_serializing_if = "Option::is_none")] + foursquare_id: Option, + /// String Optional Foursquare type of the venue, if known. (For + /// example, “arts_entertainment/default”, “arts_entertainment/aquarium” or + /// “food/icecream”.) + #[serde(skip_serializing_if = "Option::is_none")] + foursquare_type: Option, + /// Boolean Optional Sends the message silently. Users will receive a + /// notification with no sound. + #[serde(skip_serializing_if = "Option::is_none")] + disable_notification: Option, + /// Integer Optional If the message is a reply, ID of the original + /// message + #[serde(skip_serializing_if = "Option::is_none")] + reply_to_message_id: Option, + /// InlineKeyboardMarkup or ReplyKeyboardMarkup or ReplyKeyboardRemove or + /// ForceReply Optional Additional interface options. A JSON-serialized + /// object for an inline keyboard, custom reply keyboard, instructions to + /// remove reply keyboard or to force a reply from the user. + #[serde(skip_serializing_if = "Option::is_none")] + reply_markup: Option<()>, //TODO: need concrete type +} + + diff --git a/src/core/requests/stop_message_live_location.rs b/src/core/requests/stop_message_live_location.rs index e102635e..2598f4bf 100644 --- a/src/core/requests/stop_message_live_location.rs +++ b/src/core/requests/stop_message_live_location.rs @@ -14,6 +14,7 @@ use crate::core::{ /// returned, otherwise True is returned. #[derive(Debug, Clone, Serialize)] struct StopMessageLiveLocation<'a> { + #[serde(skip_serializing)] ctx: RequestContext<'a>, /// Required if inline_message_id is not specified. Unique identifier for /// the target chat or username of the target channel (in the format @@ -65,7 +66,7 @@ impl<'a> StopMessageLiveLocation<'a> { where T: Into, { - self.chat_id = chat_id.into(); + self.chat_id = Some(chat_id.into()); self } @@ -89,7 +90,7 @@ impl<'a> StopMessageLiveLocation<'a> { where T: Into, { - self.inline_message_id = Some(reply_markup.into()); + self.reply_markup = Some(reply_markup.into()); self } } diff --git a/src/core/requests/unban_chat_member.rs b/src/core/requests/unban_chat_member.rs index 9a99d4a3..a07a6086 100644 --- a/src/core/requests/unban_chat_member.rs +++ b/src/core/requests/unban_chat_member.rs @@ -1,2 +1,7 @@ -//TODO: need implementation -struct UnbanChatMember<'a> {} +use crate::core::requests::RequestContext; + +#[derive(Debug, Clone, Serialize)] +struct UnbanChatMember<'a> { + #[serde(skip_serializing)] + ctx: RequestContext<'a>, +} From 9a5606f63fb2291b925fa763ba22a2efa6c6689e Mon Sep 17 00:00:00 2001 From: nextel Date: Thu, 12 Sep 2019 20:40:14 +0300 Subject: [PATCH 3/4] return TODO --- src/core/requests/get_file.rs | 1 + src/core/requests/kick_chat_member.rs | 2 +- src/core/requests/restrict_chat_member.rs | 1 + src/core/requests/send_chat_action.rs | 1 + src/core/requests/send_contact.rs | 2 +- src/core/requests/send_poll.rs | 2 +- src/core/requests/send_venue.rs | 3 +-- src/core/requests/unban_chat_member.rs | 2 +- 8 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/core/requests/get_file.rs b/src/core/requests/get_file.rs index 496368b4..7a00e587 100644 --- a/src/core/requests/get_file.rs +++ b/src/core/requests/get_file.rs @@ -1,4 +1,5 @@ use crate::core::requests::RequestContext; +//TODO:: need implementation #[derive(Debug, Clone, Serialize)] struct GetFile<'a> { diff --git a/src/core/requests/kick_chat_member.rs b/src/core/requests/kick_chat_member.rs index f8d757fc..69c158a8 100644 --- a/src/core/requests/kick_chat_member.rs +++ b/src/core/requests/kick_chat_member.rs @@ -1,8 +1,8 @@ use crate::core::requests::RequestContext; +//TODO:: need implementation #[derive(Debug, Clone, Serialize)] struct KickChatMember<'a> { #[serde(skip_serializing)] ctx: RequestContext<'a>, - } diff --git a/src/core/requests/restrict_chat_member.rs b/src/core/requests/restrict_chat_member.rs index 34a4bd7c..161f45ab 100644 --- a/src/core/requests/restrict_chat_member.rs +++ b/src/core/requests/restrict_chat_member.rs @@ -1,4 +1,5 @@ use crate::core::requests::RequestContext; +//TODO:: need implementation #[derive(Debug, Clone, Serialize)] struct RestrictChatMember<'a> { diff --git a/src/core/requests/send_chat_action.rs b/src/core/requests/send_chat_action.rs index aee6fd0a..ad686836 100644 --- a/src/core/requests/send_chat_action.rs +++ b/src/core/requests/send_chat_action.rs @@ -1,4 +1,5 @@ use crate::core::requests::RequestContext; +//TODO:: need implementation #[derive(Debug, Clone, Serialize)] struct SendChatAction<'a> { diff --git a/src/core/requests/send_contact.rs b/src/core/requests/send_contact.rs index 959e7b11..6ffd1f2a 100644 --- a/src/core/requests/send_contact.rs +++ b/src/core/requests/send_contact.rs @@ -1,5 +1,5 @@ use crate::core::requests::RequestContext; - +//TODO:: need implementation #[derive(Debug, Clone, Serialize)] struct SendContact<'a> { #[serde(skip_serializing)] diff --git a/src/core/requests/send_poll.rs b/src/core/requests/send_poll.rs index f1f1752e..9a19bae7 100644 --- a/src/core/requests/send_poll.rs +++ b/src/core/requests/send_poll.rs @@ -1,5 +1,5 @@ use crate::core::requests::RequestContext; - +//TODO:: need implementation #[derive(Debug, Clone, Serialize)] struct SendPoll<'a> { #[serde(skip_serializing)] diff --git a/src/core/requests/send_venue.rs b/src/core/requests/send_venue.rs index 3b11a734..deac9b61 100644 --- a/src/core/requests/send_venue.rs +++ b/src/core/requests/send_venue.rs @@ -1,5 +1,6 @@ use crate::core::requests::{ChatId, RequestContext}; +//TODO:: need implementation ///Use this method to send information about a venue. On success, the sent /// Message is returned. #[derive(Debug, Clone, Serialize)] @@ -40,5 +41,3 @@ struct SendVenue<'a> { #[serde(skip_serializing_if = "Option::is_none")] reply_markup: Option<()>, //TODO: need concrete type } - - diff --git a/src/core/requests/unban_chat_member.rs b/src/core/requests/unban_chat_member.rs index a07a6086..175da985 100644 --- a/src/core/requests/unban_chat_member.rs +++ b/src/core/requests/unban_chat_member.rs @@ -1,5 +1,5 @@ use crate::core::requests::RequestContext; - +//TODO:: need implementation #[derive(Debug, Clone, Serialize)] struct UnbanChatMember<'a> { #[serde(skip_serializing)] From a95829243a72af42c4457e28b22f6aa8169cce74 Mon Sep 17 00:00:00 2001 From: nextel Date: Thu, 12 Sep 2019 20:43:19 +0300 Subject: [PATCH 4/4] return TODO to get file action --- src/core/requests/get_user_profile_photos.rs | 1 + src/core/requests/send_poll.rs | 1 + src/core/requests/unban_chat_member.rs | 1 + 3 files changed, 3 insertions(+) diff --git a/src/core/requests/get_user_profile_photos.rs b/src/core/requests/get_user_profile_photos.rs index 2cffec70..2dfed773 100644 --- a/src/core/requests/get_user_profile_photos.rs +++ b/src/core/requests/get_user_profile_photos.rs @@ -1,4 +1,5 @@ use crate::core::requests::RequestContext; +//TODO:: need implementation #[derive(Debug, Clone, Serialize)] struct GetUserProfilePhotos<'a> { diff --git a/src/core/requests/send_poll.rs b/src/core/requests/send_poll.rs index 9a19bae7..8341bb39 100644 --- a/src/core/requests/send_poll.rs +++ b/src/core/requests/send_poll.rs @@ -1,5 +1,6 @@ use crate::core::requests::RequestContext; //TODO:: need implementation + #[derive(Debug, Clone, Serialize)] struct SendPoll<'a> { #[serde(skip_serializing)] diff --git a/src/core/requests/unban_chat_member.rs b/src/core/requests/unban_chat_member.rs index 175da985..8f833b9b 100644 --- a/src/core/requests/unban_chat_member.rs +++ b/src/core/requests/unban_chat_member.rs @@ -1,5 +1,6 @@ use crate::core::requests::RequestContext; //TODO:: need implementation + #[derive(Debug, Clone, Serialize)] struct UnbanChatMember<'a> { #[serde(skip_serializing)]