diff --git a/CHANGELOG.md b/CHANGELOG.md index 62aebd43..a6479ddc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [unreleased] +### Fixed + +- `send_contact` signature (`phone_number` and `first_name` `f64` => `String`) ([#56][pr56]) + +[pr56]: https://github.com/teloxide/teloxide-core/pull/56 ## [0.1.1] - 2020-02-17 diff --git a/src/bot/api.rs b/src/bot/api.rs index 86997994..0cbcf24f 100644 --- a/src/bot/api.rs +++ b/src/bot/api.rs @@ -267,9 +267,11 @@ impl Requester for Bot { type SendContact = JsonRequest; - fn send_contact(&self, chat_id: C, phone_number: f64, first_name: f64) -> Self::SendContact + fn send_contact(&self, chat_id: C, phone_number: P, first_name: F) -> Self::SendContact where C: Into, + P: Into, + F: Into, { Self::SendContact::new( self.clone(), diff --git a/src/local_macros.rs b/src/local_macros.rs index 1129e983..357e17b9 100644 --- a/src/local_macros.rs +++ b/src/local_macros.rs @@ -393,7 +393,7 @@ macro_rules! impl_payload { } #[macro_use] -// This macro is auto generated by `cg` (be02d84). +// This macro is auto generated by `cg` (8ee7ef2). // **DO NOT EDIT THIS MACRO**, // edit `cg` instead. macro_rules! requester_forward { @@ -582,9 +582,11 @@ macro_rules! requester_forward { (@method send_contact $body:ident $ty:ident) => { type SendContact = $ty![SendContact]; - fn send_contact(&self, chat_id: C, phone_number: f64, first_name: f64) -> Self::SendContact where C: Into { + fn send_contact(&self, chat_id: C, phone_number: P, first_name: F) -> Self::SendContact where C: Into, + P: Into, + F: Into { let this = self; - $body!(send_contact this (chat_id: C, phone_number: f64, first_name: f64)) + $body!(send_contact this (chat_id: C, phone_number: P, first_name: F)) } }; (@method send_poll $body:ident $ty:ident) => { diff --git a/src/payloads/send_contact.rs b/src/payloads/send_contact.rs index 215cd02f..f6b464fc 100644 --- a/src/payloads/send_contact.rs +++ b/src/payloads/send_contact.rs @@ -9,15 +9,15 @@ impl_payload! { /// Use this method to send phone contacts. On success, the sent [`Message`] is returned. /// /// [`Message`]: crate::types::Message - #[derive(Debug, PartialEq, Clone, Serialize)] + #[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)] pub SendContact (SendContactSetters) => Message { required { /// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) pub chat_id: ChatId [into], /// Contact's phone number - pub phone_number: f64, + pub phone_number: String [into], /// Contact's first name - pub first_name: f64, + pub first_name: String [into], } optional { /// Contact's last name diff --git a/src/requests/requester.rs b/src/requests/requester.rs index 68ea02b9..0335ca02 100644 --- a/src/requests/requester.rs +++ b/src/requests/requester.rs @@ -53,7 +53,7 @@ pub trait Requester { /// Error type returned by all requests. type Err: std::error::Error + Send; - // This block is auto generated by `cg` (be02d84). + // This block is auto generated by `cg` (8ee7ef2). // **DO NOT EDIT THIS BLOCK**, // edit `cg` instead. @@ -251,9 +251,16 @@ pub trait Requester { type SendContact: Request; /// For Telegram documentation see [`SendContact`]. - fn send_contact(&self, chat_id: C, phone_number: f64, first_name: f64) -> Self::SendContact + fn send_contact( + &self, + chat_id: C, + phone_number: P, + first_name: F, + ) -> Self::SendContact where - C: Into; + C: Into, + P: Into, + F: Into; type SendPoll: Request;