Fix typos in payloads

- `get_updates`: `offset` `i64` -> `i32`
- `send_location`: make `live_period` optional
This commit is contained in:
Waffle 2021-02-22 11:30:13 +03:00
parent b1c1bd1b85
commit 7025de58f5
6 changed files with 12 additions and 20 deletions

View file

@ -9,9 +9,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Fix typos in payloads ([#57][pr57]):
- `get_updates`: `offset` `i64` -> `i32`
- `send_location`: make `live_period` optional
- `send_contact` signature (`phone_number` and `first_name` `f64` => `String`) ([#56][pr56])
[pr56]: https://github.com/teloxide/teloxide-core/pull/56
[pr57]: https://github.com/teloxide/teloxide-core/pull/57
## [0.1.1] - 2020-02-17

View file

@ -158,19 +158,13 @@ impl Requester for Bot {
type SendLocation = JsonRequest<payloads::SendLocation>;
fn send_location<C>(
&self,
chat_id: C,
latitude: f64,
longitude: f64,
live_period: u32,
) -> Self::SendLocation
fn send_location<C>(&self, chat_id: C, latitude: f64, longitude: f64) -> Self::SendLocation
where
C: Into<ChatId>,
{
Self::SendLocation::new(
self.clone(),
payloads::SendLocation::new(chat_id, latitude, longitude, live_period),
payloads::SendLocation::new(chat_id, latitude, longitude),
)
}

View file

@ -532,9 +532,9 @@ macro_rules! requester_forward {
(@method send_location $body:ident $ty:ident) => {
type SendLocation = $ty![SendLocation];
fn send_location<C>(&self, chat_id: C, latitude: f64, longitude: f64, live_period: u32) -> Self::SendLocation where C: Into<ChatId> {
fn send_location<C>(&self, chat_id: C, latitude: f64, longitude: f64) -> Self::SendLocation where C: Into<ChatId> {
let this = self;
$body!(send_location this (chat_id: C, latitude: f64, longitude: f64, live_period: u32))
$body!(send_location this (chat_id: C, latitude: f64, longitude: f64))
}
};
(@method edit_message_live_location $body:ident $ty:ident) => {

View file

@ -17,7 +17,7 @@ impl_payload! {
/// Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as [`GetUpdates`] is called with an offset higher than its update_id. The negative offset can be specified to retrieve updates starting from -offset update from the end of the updates queue. All previous updates will forgotten.
///
/// [`GetUpdates`]: crate::payloads::GetUpdates
pub offset: i64,
pub offset: i32,
/// Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100.
pub limit: u8,
/// Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only.

View file

@ -18,12 +18,12 @@ impl_payload! {
pub latitude: f64,
/// Longitude of the location
pub longitude: f64,
}
optional {
/// Period in seconds for which the location will be updated (see [Live Locations], should be between 60 and 86400.
///
/// [Live Locations]: https://telegram.org/blog/live-locations
pub live_period: u32,
}
optional {
/// Sends the message [silently]. Users will receive a notification with no sound.
///
/// [silently]: https://telegram.org/blog/channels-2-0#silent-messages

View file

@ -166,13 +166,7 @@ pub trait Requester {
type SendLocation: Request<Payload = SendLocation, Err = Self::Err>;
/// For Telegram documentation see [`SendLocation`].
fn send_location<C>(
&self,
chat_id: C,
latitude: f64,
longitude: f64,
live_period: u32,
) -> Self::SendLocation
fn send_location<C>(&self, chat_id: C, latitude: f64, longitude: f64) -> Self::SendLocation
where
C: Into<ChatId>;