Fix send_contact singnature

- `phone_number: f64` -> `phone_number: String`
- `first_name: f64` -> `first_name: String`
This commit is contained in:
Waffle 2021-02-22 08:47:50 +03:00
parent a61d81d829
commit dcdba78285
5 changed files with 26 additions and 10 deletions

View file

@ -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

View file

@ -267,9 +267,11 @@ impl Requester for Bot {
type SendContact = JsonRequest<payloads::SendContact>;
fn send_contact<C>(&self, chat_id: C, phone_number: f64, first_name: f64) -> Self::SendContact
fn send_contact<C, P, F>(&self, chat_id: C, phone_number: P, first_name: F) -> Self::SendContact
where
C: Into<ChatId>,
P: Into<String>,
F: Into<String>,
{
Self::SendContact::new(
self.clone(),

View file

@ -393,7 +393,7 @@ macro_rules! impl_payload {
}
#[macro_use]
// This macro is auto generated by `cg` <https://github.com/teloxide/cg> (be02d84).
// This macro is auto generated by `cg` <https://github.com/teloxide/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<C>(&self, chat_id: C, phone_number: f64, first_name: f64) -> Self::SendContact where C: Into<ChatId> {
fn send_contact<C, P, F>(&self, chat_id: C, phone_number: P, first_name: F) -> Self::SendContact where C: Into<ChatId>,
P: Into<String>,
F: Into<String> {
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) => {

View file

@ -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

View file

@ -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` <https://github.com/teloxide/cg> (be02d84).
// This block is auto generated by `cg` <https://github.com/teloxide/cg> (8ee7ef2).
// **DO NOT EDIT THIS BLOCK**,
// edit `cg` instead.
@ -251,9 +251,16 @@ pub trait Requester {
type SendContact: Request<Payload = SendContact, Err = Self::Err>;
/// For Telegram documentation see [`SendContact`].
fn send_contact<C>(&self, chat_id: C, phone_number: f64, first_name: f64) -> Self::SendContact
fn send_contact<C, P, F>(
&self,
chat_id: C,
phone_number: P,
first_name: F,
) -> Self::SendContact
where
C: Into<ChatId>;
C: Into<ChatId>,
P: Into<String>,
F: Into<String>;
type SendPoll: Request<Payload = SendPoll, Err = Self::Err>;