Documentation gardening

This commit is contained in:
Temirkhan Myrzamadi 2020-12-23 22:24:31 +06:00
parent e260f11558
commit f5d9cb1a73
15 changed files with 152 additions and 152 deletions

View file

@ -1,11 +1,10 @@
//! ## Bot adaptors //! Wrappers altering functionality of a bot.
//! //!
//! Bot adaptors are very similar to [`Iterator`] adaptors — //! Bot adaptors are very similar to the [`Iterator`] adaptors: they are bots
//! they are bots (implement [`Requester`]) which wrap other bots //! wrapping other bots to alter existing or add new functionality.
//! adding new functionality.
//! //!
//! E.g. [`AutoSend`] allows `await`ing requests directly, //! E.g. [`AutoSend`] allows `await`ing requests directly, no need to to use
//! without need to use `.send()`. //! `.send()`.
//! //!
//! [`Requester`]: crate::requests::Requester //! [`Requester`]: crate::requests::Requester

View file

@ -5,14 +5,14 @@ use crate::{
}; };
/// Default parse mode adaptor, see /// Default parse mode adaptor, see
/// [`RequesterExt::parse_mode`](crate::requests::RequesterExt::parse_mode) /// [`RequesterExt::parse_mode`](crate::requests::RequesterExt::parse_mode).
pub struct DefaultParseMode<B> { pub struct DefaultParseMode<B> {
bot: B, bot: B,
mode: ParseMode, mode: ParseMode,
} }
impl<B> DefaultParseMode<B> { impl<B> DefaultParseMode<B> {
/// Creates new [`DefaultParseMode`] /// Creates new [`DefaultParseMode`].
/// ///
/// Note: it's recommended to use [`RequesterExt::parse_mode`] instead. /// Note: it's recommended to use [`RequesterExt::parse_mode`] instead.
/// ///
@ -21,12 +21,12 @@ impl<B> DefaultParseMode<B> {
Self { bot, mode: parse_mode } Self { bot, mode: parse_mode }
} }
/// Allows to access inner bot /// Allows to access the inner bot.
pub fn inner(&self) -> &B { pub fn inner(&self) -> &B {
&self.bot &self.bot
} }
/// Unwraps inner bot /// Unwraps the inner bot.
pub fn into_inner(self) -> B { pub fn into_inner(self) -> B {
self.bot self.bot
} }

View file

@ -8,11 +8,11 @@ use thiserror::Error;
/// An error caused by downloading a file. /// An error caused by downloading a file.
#[derive(Debug, Error, From)] #[derive(Debug, Error, From)]
pub enum DownloadError { pub enum DownloadError {
/// Network error while downloading file from telegram. /// Network error while downloading a file from Telegram.
#[error("A network error: {0}")] #[error("A network error: {0}")]
NetworkError(#[source] reqwest::Error), NetworkError(#[source] reqwest::Error),
/// I/O error while writing file to destination. /// An I/O error while writing a file to destination.
#[error("An I/O error: {0}")] #[error("An I/O error: {0}")]
Io(#[source] std::io::Error), Io(#[source] std::io::Error),
} }
@ -20,12 +20,13 @@ pub enum DownloadError {
/// An error caused by sending a request to Telegram. /// An error caused by sending a request to Telegram.
#[derive(Debug, Error)] #[derive(Debug, Error)]
pub enum RequestError { pub enum RequestError {
/// Telegram API error /// Telegram API error.
#[error("A Telegram's error #{status_code}: {kind:?}")] #[error("A Telegram's error #{status_code}: {kind:?}")]
ApiError { ApiError {
/// Kind of api error /// Kind of an API error.
kind: ApiError, kind: ApiError,
/// HTTP code returned by telegram, not very usefull in practice.
/// An HTTP code returned by Telegram, not very useful in practice.
status_code: StatusCode, status_code: StatusCode,
}, },
@ -39,11 +40,11 @@ pub enum RequestError {
#[error("Retry after {0} seconds")] #[error("Retry after {0} seconds")]
RetryAfter(i32), RetryAfter(i32),
/// Network error while sending request to telegram. /// Network error while sending a request to Telegram.
#[error("A network error: {0}")] #[error("A network error: {0}")]
NetworkError(#[source] reqwest::Error), NetworkError(#[source] reqwest::Error),
/// Error while parsing response from telegram. /// Error while parsing a response from Telegram.
/// ///
/// If you've received this error, please, [open an issue] with the /// If you've received this error, please, [open an issue] with the
/// description of the error. /// description of the error.

View file

@ -11,17 +11,15 @@ use tokio::io::{AsyncWrite, AsyncWriteExt};
use crate::{errors::DownloadError, net::file_url}; use crate::{errors::DownloadError, net::file_url};
/// Download client. /// A trait for downloading files from Telegram.
///
/// This trait allows you to download files from telegram.
pub trait Download<'w> pub trait Download<'w>
/* FIXME(waffle): ideally, this lifetime ('w) shouldn't be here, but we can't help it without /* FIXME(waffle): ideally, this lifetime ('w) shouldn't be here, but we can't help it without
* GATs */ * GATs */
{ {
/// Error returned by [`download_file`](Self::download_file) /// An error returned from [`download_file`](Self::download_file).
type Err; type Err;
/// Future returned from [`download_file`](Self::download_file) /// A future returned from [`download_file`](Self::download_file).
type Fut: Future<Output = Result<(), Self::Err>> + Send; type Fut: Future<Output = Result<(), Self::Err>> + Send;
/// Download a file from Telegram into `destination`. /// Download a file from Telegram into `destination`.
@ -58,15 +56,16 @@ pub trait Download<'w>
destination: &'w mut (dyn AsyncWrite + Unpin + Send), destination: &'w mut (dyn AsyncWrite + Unpin + Send),
) -> Self::Fut; ) -> Self::Fut;
/// Error returned by [`download_file_stream`](Self::download_file_stream) /// An error returned from
/// [`download_file_stream`](Self::download_file_stream).
type StreamErr; type StreamErr;
/// Stream returned from [`download_file_stream`] /// A stream returned from [`download_file_stream`].
/// ///
///[`download_file_stream`]: (Self::download_file_stream) ///[`download_file_stream`]: (Self::download_file_stream)
type Stream: Stream<Item = Result<Bytes, Self::StreamErr>> + Send; type Stream: Stream<Item = Result<Bytes, Self::StreamErr>> + Send;
/// Download a file from Telegram as a [`Stream`]. /// Download a file from Telegram as [`Stream`].
/// ///
/// `path` can be obtained from the [`GetFile`]. /// `path` can be obtained from the [`GetFile`].
/// ///
@ -84,7 +83,7 @@ pub trait Download<'w>
/// ///
/// Note: if you don't need to use a different (from you're bot) client and /// Note: if you don't need to use a different (from you're bot) client and
/// don't need to get *all* performance (and you don't, c'mon it's very io-bound /// don't need to get *all* performance (and you don't, c'mon it's very io-bound
/// job), then it's recommended to use [`Download::download_file`] /// job), then it's recommended to use [`Download::download_file`].
pub fn download_file<'o, D>( pub fn download_file<'o, D>(
client: &Client, client: &Client,
api_url: Url, api_url: Url,
@ -106,11 +105,11 @@ where
}) })
} }
/// Download a file from Telegram as a [`Stream`]. /// Download a file from Telegram as [`Stream`].
/// ///
/// Note: if you don't need to use a different (from you're bot) client and /// Note: if you don't need to use a different (from you're bot) client and
/// don't need to get *all* performance (and you don't, c'mon it's very io-bound /// don't need to get *all* performance (and you don't, c'mon it's very io-bound
/// job), then it's recommended to use [`Download::download_file_stream`] /// job), then it's recommended to use [`Download::download_file_stream`].
pub fn download_file_stream( pub fn download_file_stream(
client: &Client, client: &Client,
api_url: Url, api_url: Url,

View file

@ -1,8 +1,4 @@
//! Network specific items. //! Network-specific API.
//!
//! Currently this module contains only the file download stuff and the default
//! api url.
// ... and some internal stuff :P
pub use self::download::{download_file, download_file_stream, Download}; pub use self::download::{download_file, download_file_stream, Download};
@ -15,7 +11,7 @@ mod download;
mod request; mod request;
mod telegram_response; mod telegram_response;
/// Default telegram api url /// The default Telegram API URL.
pub const TELEGRAM_API_URL: &str = "https://api.telegram.org"; pub const TELEGRAM_API_URL: &str = "https://api.telegram.org";
/// Creates URL for making HTTPS requests. See the [Telegram documentation]. /// Creates URL for making HTTPS requests. See the [Telegram documentation].

View file

@ -1,11 +1,14 @@
//! Payloads - data types sended to relegram //! Request data sent to Telegram.
/// This module reexports all setters traits as `_`. When used with a glob /// This module re-exports all the setters traits as `_`. When used with a glob
/// import: /// import:
///
/// ``` /// ```
/// use teloxide_core::payloads::setters::*; /// use teloxide_core::payloads::setters::*;
/// ``` /// ```
/// It allows you to use all payloads setters, without polluting your namespace. ///
/// It allows you to use all the payloads setters, without polluting your
/// namespace.
pub mod setters; pub mod setters;
// This block is auto generated by `cg` <https://github.com/teloxide/cg> (878e847). // This block is auto generated by `cg` <https://github.com/teloxide/cg> (878e847).

View file

@ -1,3 +1,3 @@
//! Crate prelude //! Commonly used items.
pub use crate::requests::Requester; pub use crate::requests::Requester;

View file

@ -1,15 +1,14 @@
use crate::requests::Payload; use crate::requests::Payload;
/// Represent types that have payload inside it. E.g.: the payload itself or a /// Represents types having payload inside.
/// `Request`.
/// ///
/// This trait is something between [`DerefMut`] and [`BorrowMut`] — it allows /// This trait is something between [`DerefMut`] and [`BorrowMut`] — it allows
/// only one implementation per type (the [output] is associated type, not a /// only one implementation per type (the [output type] is associated, not
/// generic), have implementations for all types `P` such `P: `[`Payload`], but /// generic), has implementations for all types `P` such `P: `[`Payload`], but
/// have no magic compiler support like [`DerefMut`] does nor does it require /// has no magic compiler support like [`DerefMut`] does nor does it require
/// any laws about `Eq`, `Ord` and `Hash` as [`BorrowMut`] does. /// any laws about `Eq`, `Ord` and `Hash` as [`BorrowMut`] does.
/// ///
/// Also [output] type is bounded by [`Payload`] trait. /// Also the [output type] is bounded by the [`Payload`] trait.
/// ///
/// This trait is mostly used to implement payload setters (on both payloads & /// This trait is mostly used to implement payload setters (on both payloads &
/// requests), so you probably won't find yourself using it directly. /// requests), so you probably won't find yourself using it directly.
@ -17,13 +16,13 @@ use crate::requests::Payload;
/// [`DerefMut`]: std::ops::DerefMut /// [`DerefMut`]: std::ops::DerefMut
/// [`BorrowMut`]: std::borrow::BorrowMut /// [`BorrowMut`]: std::borrow::BorrowMut
/// [`Payload`]: crate::requests::Payload /// [`Payload`]: crate::requests::Payload
/// [output]: HasPayload::Payload /// [output type]: HasPayload::Payload
pub trait HasPayload pub trait HasPayload
// FIXME(waffle): // FIXME(waffle):
// we wanted to use As{Mut,Ref} here, but they doesn't work // we wanted to use As{Mut,Ref} here, but they doesn't work
// because of https://github.com/rust-lang/rust/issues/77010 // because of https://github.com/rust-lang/rust/issues/77010
{ {
/// Type of the payload contained. /// A type of the payload contained.
type Payload: Payload; type Payload: Payload;
/// Gain mutable access to the underlying payload. /// Gain mutable access to the underlying payload.

View file

@ -6,11 +6,9 @@ use crate::{
RequestError, RequestError,
}; };
/// Ready-to-send telegram request. /// A ready-to-send Telegram request whose payload is sent using [JSON].
/// ///
/// Note: payload will be sent to telegram using [`json`] /// [JSON]: https://core.telegram.org/bots/api#making-requests
///
/// [`json`]: https://core.telegram.org/bots/api#making-requests
#[must_use = "requests do nothing until sent"] #[must_use = "requests do nothing until sent"]
pub struct JsonRequest<P> { pub struct JsonRequest<P> {
bot: Bot, bot: Bot,

View file

@ -8,8 +8,7 @@ pub use self::{
/// A type that is returned after making a request to Telegram. /// A type that is returned after making a request to Telegram.
pub type ResponseResult<T> = Result<T, crate::RequestError>; pub type ResponseResult<T> = Result<T, crate::RequestError>;
/// Output of a [`Payload`] in [`HasPayload`]. Alias to /// An output type of [`Payload`] in [`HasPayload`].
/// `<<T as HasPayload>::Payload as Payload>::Output`.
pub type Output<T> = <<T as HasPayload>::Payload as Payload>::Output; pub type Output<T> = <<T as HasPayload>::Payload as Payload>::Output;
mod has_payload; mod has_payload;

View file

@ -6,11 +6,10 @@ use crate::{
RequestError, RequestError,
}; };
/// Ready-to-send telegram request. /// A ready-to-send Telegram request whose payload is sent using
/// [multipart/form-data].
/// ///
/// Note: payload will be sent to telegram using [`multipart/form-data`] /// [multipart/form-data]: https://core.telegram.org/bots/api#making-requests
///
/// [`multipart/form-data`]: https://core.telegram.org/bots/api#making-requests
#[must_use = "requests do nothing until sent"] #[must_use = "requests do nothing until sent"]
pub struct MultipartRequest<P> { pub struct MultipartRequest<P> {
bot: Bot, bot: Bot,

View file

@ -1,20 +1,24 @@
/// Payload of a request. /// Payload of a request.
/// ///
/// Simply speaking structs implementing this trait represent arguments of /// Simply speaking, structures implementing this trait represent arguments of
/// a telegram bot API method. /// a Telegram bot API method.
/// ///
/// This trait provides some additional information needed for sending request /// Also, this trait provides some additional information needed for sending a
/// to the telegram. /// request to Telegram.
#[cfg_attr(all(docsrs, feature = "nightly"), doc(spotlight))] #[cfg_attr(all(docsrs, feature = "nightly"), doc(spotlight))]
pub trait Payload { pub trait Payload {
/// Return type of the telegram method. /// A return type of a Telegram method.
/// ///
/// Note: that should not include result wrappers (e.g. it should be simply /// Note: it should not include `Result` wrappers (e.g. it should be simply
/// `Message`, `True` or something else) /// [`Message`], [`True`] or something else).
///
/// [`Message`]: crate::types::Message
/// [`True`]: crate::types::True
type Output; type Output;
/// Name of the telegram method. Case insensitive, though must not include /// Name of a Telegram method.
/// underscores. (e.g.: `GetMe`, `GETME`, `getme`, `getMe` are ok, but ///
/// `get_me` is not ok) /// It is case insensitive, though must not include underscores. (e.g.
/// `GetMe`, `GETME`, `getme`, `getMe` are ok, but `get_me` is not ok).
const NAME: &'static str; const NAME: &'static str;
} }

View file

@ -2,7 +2,7 @@ use std::future::Future;
use crate::requests::{HasPayload, Output}; use crate::requests::{HasPayload, Output};
/// A ready-to-send telegram request. /// A ready-to-send Telegram request.
// FIXME(waffle): Write better doc for the trait // FIXME(waffle): Write better doc for the trait
/// ///
/// ## Implementation notes /// ## Implementation notes
@ -23,19 +23,20 @@ pub trait Request: HasPayload {
* use it before it's integrated in async/await * use it before it's integrated in async/await
*/ */
/// Type of error that may happen during sending the request to telegram. /// A type of an error that may happen while sending a request to Telegram.
type Err: std::error::Error + Send; type Err: std::error::Error + Send;
/// Type of future returned by [`send`](Request::send) method. /// A type of the future returned by the [`send`](Request::send) method.
type Send: Future<Output = Result<Output<Self>, Self::Err>> + Send; type Send: Future<Output = Result<Output<Self>, Self::Err>> + Send;
/// Type of future returned by [`send_ref`](Request::send_ref) method. /// A type of the future returned by the [`send_ref`](Request::send_ref)
/// method.
/// ///
/// NOTE: it intentionally forbids borrowing from self /// Note: it intentionally forbids borrowing from `self` though anyway we
// though anyway we couldn't allow borrowing without GATs :sob: /// couldn't allow borrowing without GATs.
type SendRef: Future<Output = Result<Output<Self>, Self::Err>> + Send; type SendRef: Future<Output = Result<Output<Self>, Self::Err>> + Send;
/// Send the request. /// Send this request.
/// ///
/// ## Examples /// ## Examples
// FIXME(waffle): ignored until full request redesign lands // FIXME(waffle): ignored until full request redesign lands
@ -51,15 +52,15 @@ pub trait Request: HasPayload {
/// ``` /// ```
fn send(self) -> Self::Send; fn send(self) -> Self::Send;
/// Send the request. /// Send this request by reference.
/// ///
/// This method is analogous to [`send`](Request::send), but it doesn't take /// This method is analogous to [`send`](Request::send), but it doesn't take
/// the ownership of `self`. This allows to send the same (or slightly /// the ownership of `self`. This allows to send the same (or slightly
/// different) requests over and over. /// different) requests over and over.
/// ///
/// _Also_ it is expected that calling this method is better than just /// Also, it is expected that calling this method is better than just
/// `clone`ing the requests. (because instead of copying all the data /// cloning requests. (Because instead of copying all the data
/// and then serializing it, this method should just serialize the data) /// and then serializing it, this method should just serialize the data.)
/// ///
/// ## Examples /// ## Examples
// FIXME(waffle): ignored until full request redesign lands // FIXME(waffle): ignored until full request redesign lands

View file

@ -8,8 +8,9 @@ use crate::{
}, },
}; };
/// The trait implemented by all bots & bot adaptors. /// Methods for building requests.
/// Essentially a request builder factory (?). ///
/// This trait is implemented by all bots & bot adaptors.
/// ///
/// _This trait is included in the crate's [`prelude`](crate::prelude)_. /// _This trait is included in the crate's [`prelude`](crate::prelude)_.
#[cfg_attr(all(docsrs, feature = "nightly"), doc(spotlight))] #[cfg_attr(all(docsrs, feature = "nightly"), doc(spotlight))]
@ -22,12 +23,12 @@ pub trait Requester {
type GetUpdates: Request<Payload = GetUpdates, Err = Self::Err>; type GetUpdates: Request<Payload = GetUpdates, Err = Self::Err>;
/// For telegram documentation see [`GetUpdates`] /// For Telegram documentation see [`GetUpdates`].
fn get_updates(&self) -> Self::GetUpdates; fn get_updates(&self) -> Self::GetUpdates;
type SetWebhook: Request<Payload = SetWebhook, Err = Self::Err>; type SetWebhook: Request<Payload = SetWebhook, Err = Self::Err>;
/// For telegram documentation see [`SetWebhook`] /// For Telegram documentation see [`SetWebhook`].
fn set_webhook<U, A>(&self, url: U, allowed_updates: A) -> Self::SetWebhook fn set_webhook<U, A>(&self, url: U, allowed_updates: A) -> Self::SetWebhook
where where
U: Into<String>, U: Into<String>,
@ -35,22 +36,22 @@ pub trait Requester {
type DeleteWebhook: Request<Payload = DeleteWebhook, Err = Self::Err>; type DeleteWebhook: Request<Payload = DeleteWebhook, Err = Self::Err>;
/// For telegram documentation see [`DeleteWebhook`] /// For Telegram documentation see [`DeleteWebhook`].
fn delete_webhook(&self) -> Self::DeleteWebhook; fn delete_webhook(&self) -> Self::DeleteWebhook;
type GetWebhookInfo: Request<Payload = GetWebhookInfo, Err = Self::Err>; type GetWebhookInfo: Request<Payload = GetWebhookInfo, Err = Self::Err>;
/// For telegram documentation see [`GetWebhookInfo`] /// For Telegram documentation see [`GetWebhookInfo`].
fn get_webhook_info(&self) -> Self::GetWebhookInfo; fn get_webhook_info(&self) -> Self::GetWebhookInfo;
type GetMe: Request<Payload = GetMe, Err = Self::Err>; type GetMe: Request<Payload = GetMe, Err = Self::Err>;
/// For telegram documentation see [`GetMe`] /// For Telegram documentation see [`GetMe`].
fn get_me(&self) -> Self::GetMe; fn get_me(&self) -> Self::GetMe;
type SendMessage: Request<Payload = SendMessage, Err = Self::Err>; type SendMessage: Request<Payload = SendMessage, Err = Self::Err>;
/// For telegram documentation see [`SendMessage`] /// For Telegram documentation see [`SendMessage`].
fn send_message<C, T>(&self, chat_id: C, text: T) -> Self::SendMessage fn send_message<C, T>(&self, chat_id: C, text: T) -> Self::SendMessage
where where
C: Into<ChatId>, C: Into<ChatId>,
@ -58,7 +59,7 @@ pub trait Requester {
type ForwardMessage: Request<Payload = ForwardMessage, Err = Self::Err>; type ForwardMessage: Request<Payload = ForwardMessage, Err = Self::Err>;
/// For telegram documentation see [`ForwardMessage`] /// For Telegram documentation see [`ForwardMessage`].
fn forward_message<C, F>( fn forward_message<C, F>(
&self, &self,
chat_id: C, chat_id: C,
@ -71,7 +72,7 @@ pub trait Requester {
type SendPhoto: Request<Payload = SendPhoto, Err = Self::Err>; type SendPhoto: Request<Payload = SendPhoto, Err = Self::Err>;
/// For telegram documentation see [`SendPhoto`] /// For Telegram documentation see [`SendPhoto`].
fn send_photo<Ch, Ca>(&self, chat_id: Ch, photo: InputFile, caption: Ca) -> Self::SendPhoto fn send_photo<Ch, Ca>(&self, chat_id: Ch, photo: InputFile, caption: Ca) -> Self::SendPhoto
where where
Ch: Into<ChatId>, Ch: Into<ChatId>,
@ -79,7 +80,7 @@ pub trait Requester {
type SendAudio: Request<Payload = SendAudio, Err = Self::Err>; type SendAudio: Request<Payload = SendAudio, Err = Self::Err>;
/// For telegram documentation see [`SendAudio`] /// For Telegram documentation see [`SendAudio`].
fn send_audio<Ch, Ca>(&self, chat_id: Ch, audio: InputFile, caption: Ca) -> Self::SendAudio fn send_audio<Ch, Ca>(&self, chat_id: Ch, audio: InputFile, caption: Ca) -> Self::SendAudio
where where
Ch: Into<ChatId>, Ch: Into<ChatId>,
@ -87,7 +88,7 @@ pub trait Requester {
type SendDocument: Request<Payload = SendDocument, Err = Self::Err>; type SendDocument: Request<Payload = SendDocument, Err = Self::Err>;
/// For telegram documentation see [`SendDocument`] /// For Telegram documentation see [`SendDocument`].
fn send_document<Ch, Ca>( fn send_document<Ch, Ca>(
&self, &self,
chat_id: Ch, chat_id: Ch,
@ -100,7 +101,7 @@ pub trait Requester {
type SendVideo: Request<Payload = SendVideo, Err = Self::Err>; type SendVideo: Request<Payload = SendVideo, Err = Self::Err>;
/// For telegram documentation see [`SendVideo`] /// For Telegram documentation see [`SendVideo`].
fn send_video<Ch, Ca>(&self, chat_id: Ch, video: InputFile, caption: Ca) -> Self::SendVideo fn send_video<Ch, Ca>(&self, chat_id: Ch, video: InputFile, caption: Ca) -> Self::SendVideo
where where
Ch: Into<ChatId>, Ch: Into<ChatId>,
@ -108,7 +109,7 @@ pub trait Requester {
type SendAnimation: Request<Payload = SendAnimation, Err = Self::Err>; type SendAnimation: Request<Payload = SendAnimation, Err = Self::Err>;
/// For telegram documentation see [`SendAnimation`] /// For Telegram documentation see [`SendAnimation`].
fn send_animation<Ch, Ca>( fn send_animation<Ch, Ca>(
&self, &self,
chat_id: Ch, chat_id: Ch,
@ -121,7 +122,7 @@ pub trait Requester {
type SendVoice: Request<Payload = SendVoice, Err = Self::Err>; type SendVoice: Request<Payload = SendVoice, Err = Self::Err>;
/// For telegram documentation see [`SendVoice`] /// For Telegram documentation see [`SendVoice`].
fn send_voice<Ch, Ca>(&self, chat_id: Ch, voice: InputFile, caption: Ca) -> Self::SendVoice fn send_voice<Ch, Ca>(&self, chat_id: Ch, voice: InputFile, caption: Ca) -> Self::SendVoice
where where
Ch: Into<ChatId>, Ch: Into<ChatId>,
@ -129,14 +130,14 @@ pub trait Requester {
type SendVideoNote: Request<Payload = SendVideoNote, Err = Self::Err>; type SendVideoNote: Request<Payload = SendVideoNote, Err = Self::Err>;
/// For telegram documentation see [`SendVideoNote`] /// For Telegram documentation see [`SendVideoNote`].
fn send_video_note<C>(&self, chat_id: C, video_note: InputFile) -> Self::SendVideoNote fn send_video_note<C>(&self, chat_id: C, video_note: InputFile) -> Self::SendVideoNote
where where
C: Into<ChatId>; C: Into<ChatId>;
type SendMediaGroup: Request<Payload = SendMediaGroup, Err = Self::Err>; type SendMediaGroup: Request<Payload = SendMediaGroup, Err = Self::Err>;
/// For telegram documentation see [`SendMediaGroup`] /// For Telegram documentation see [`SendMediaGroup`].
fn send_media_group<C, M>(&self, chat_id: C, media: M) -> Self::SendMediaGroup fn send_media_group<C, M>(&self, chat_id: C, media: M) -> Self::SendMediaGroup
where where
C: Into<ChatId>, C: Into<ChatId>,
@ -144,7 +145,7 @@ pub trait Requester {
type SendLocation: Request<Payload = SendLocation, Err = Self::Err>; type SendLocation: Request<Payload = SendLocation, Err = Self::Err>;
/// For telegram documentation see [`SendLocation`] /// For Telegram documentation see [`SendLocation`].
fn send_location<C>( fn send_location<C>(
&self, &self,
chat_id: C, chat_id: C,
@ -157,7 +158,7 @@ pub trait Requester {
type EditMessageLiveLocation: Request<Payload = EditMessageLiveLocation, Err = Self::Err>; type EditMessageLiveLocation: Request<Payload = EditMessageLiveLocation, Err = Self::Err>;
/// For telegram documentation see [`EditMessageLiveLocation`] /// For Telegram documentation see [`EditMessageLiveLocation`].
fn edit_message_live_location<C>( fn edit_message_live_location<C>(
&self, &self,
chat_id: C, chat_id: C,
@ -173,7 +174,7 @@ pub trait Requester {
Err = Self::Err, Err = Self::Err,
>; >;
/// For telegram documentation see [`EditMessageLiveLocationInline`] /// For Telegram documentation see [`EditMessageLiveLocationInline`].
fn edit_message_live_location_inline<I>( fn edit_message_live_location_inline<I>(
&self, &self,
inline_message_id: I, inline_message_id: I,
@ -185,7 +186,7 @@ pub trait Requester {
type StopMessageLiveLocation: Request<Payload = StopMessageLiveLocation, Err = Self::Err>; type StopMessageLiveLocation: Request<Payload = StopMessageLiveLocation, Err = Self::Err>;
/// For telegram documentation see [`StopMessageLiveLocation`] /// For Telegram documentation see [`StopMessageLiveLocation`].
fn stop_message_live_location<C>( fn stop_message_live_location<C>(
&self, &self,
chat_id: C, chat_id: C,
@ -201,7 +202,7 @@ pub trait Requester {
Err = Self::Err, Err = Self::Err,
>; >;
/// For telegram documentation see [`StopMessageLiveLocationInline`] /// For Telegram documentation see [`StopMessageLiveLocationInline`].
fn stop_message_live_location_inline<I>( fn stop_message_live_location_inline<I>(
&self, &self,
inline_message_id: I, inline_message_id: I,
@ -213,7 +214,7 @@ pub trait Requester {
type SendVenue: Request<Payload = SendVenue, Err = Self::Err>; type SendVenue: Request<Payload = SendVenue, Err = Self::Err>;
/// For telegram documentation see [`SendVenue`] /// For Telegram documentation see [`SendVenue`].
fn send_venue<C, T, A>( fn send_venue<C, T, A>(
&self, &self,
chat_id: C, chat_id: C,
@ -229,14 +230,14 @@ pub trait Requester {
type SendContact: Request<Payload = SendContact, Err = Self::Err>; type SendContact: Request<Payload = SendContact, Err = Self::Err>;
/// For telegram documentation see [`SendContact`] /// 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>(&self, chat_id: C, phone_number: f64, first_name: f64) -> Self::SendContact
where where
C: Into<ChatId>; C: Into<ChatId>;
type SendPoll: Request<Payload = SendPoll, Err = Self::Err>; type SendPoll: Request<Payload = SendPoll, Err = Self::Err>;
/// For telegram documentation see [`SendPoll`] /// For Telegram documentation see [`SendPoll`].
fn send_poll<C, Q, O>( fn send_poll<C, Q, O>(
&self, &self,
chat_id: C, chat_id: C,
@ -251,47 +252,47 @@ pub trait Requester {
type SendDice: Request<Payload = SendDice, Err = Self::Err>; type SendDice: Request<Payload = SendDice, Err = Self::Err>;
/// For telegram documentation see [`SendDice`] /// For Telegram documentation see [`SendDice`].
fn send_dice<C>(&self, chat_id: C, emoji: DiceEmoji) -> Self::SendDice fn send_dice<C>(&self, chat_id: C, emoji: DiceEmoji) -> Self::SendDice
where where
C: Into<ChatId>; C: Into<ChatId>;
type SendChatAction: Request<Payload = SendChatAction, Err = Self::Err>; type SendChatAction: Request<Payload = SendChatAction, Err = Self::Err>;
/// For telegram documentation see [`SendChatAction`] /// For Telegram documentation see [`SendChatAction`].
fn send_chat_action<C>(&self, chat_id: C, action: ChatAction) -> Self::SendChatAction fn send_chat_action<C>(&self, chat_id: C, action: ChatAction) -> Self::SendChatAction
where where
C: Into<ChatId>; C: Into<ChatId>;
type GetUserProfilePhotos: Request<Payload = GetUserProfilePhotos, Err = Self::Err>; type GetUserProfilePhotos: Request<Payload = GetUserProfilePhotos, Err = Self::Err>;
/// For telegram documentation see [`GetUserProfilePhotos`] /// For Telegram documentation see [`GetUserProfilePhotos`].
fn get_user_profile_photos(&self, user_id: i32) -> Self::GetUserProfilePhotos; fn get_user_profile_photos(&self, user_id: i32) -> Self::GetUserProfilePhotos;
type GetFile: Request<Payload = GetFile, Err = Self::Err>; type GetFile: Request<Payload = GetFile, Err = Self::Err>;
/// For telegram documentation see [`GetFile`] /// For Telegram documentation see [`GetFile`].
fn get_file<F>(&self, file_id: F) -> Self::GetFile fn get_file<F>(&self, file_id: F) -> Self::GetFile
where where
F: Into<String>; F: Into<String>;
type KickChatMember: Request<Payload = KickChatMember, Err = Self::Err>; type KickChatMember: Request<Payload = KickChatMember, Err = Self::Err>;
/// For telegram documentation see [`KickChatMember`] /// For Telegram documentation see [`KickChatMember`].
fn kick_chat_member<C>(&self, chat_id: C, user_id: i32) -> Self::KickChatMember fn kick_chat_member<C>(&self, chat_id: C, user_id: i32) -> Self::KickChatMember
where where
C: Into<ChatId>; C: Into<ChatId>;
type UnbanChatMember: Request<Payload = UnbanChatMember, Err = Self::Err>; type UnbanChatMember: Request<Payload = UnbanChatMember, Err = Self::Err>;
/// For telegram documentation see [`UnbanChatMember`] /// For Telegram documentation see [`UnbanChatMember`].
fn unban_chat_member<C>(&self, chat_id: C, user_id: i32) -> Self::UnbanChatMember fn unban_chat_member<C>(&self, chat_id: C, user_id: i32) -> Self::UnbanChatMember
where where
C: Into<ChatId>; C: Into<ChatId>;
type RestrictChatMember: Request<Payload = RestrictChatMember, Err = Self::Err>; type RestrictChatMember: Request<Payload = RestrictChatMember, Err = Self::Err>;
/// For telegram documentation see [`RestrictChatMember`] /// For Telegram documentation see [`RestrictChatMember`].
fn restrict_chat_member<C>( fn restrict_chat_member<C>(
&self, &self,
chat_id: C, chat_id: C,
@ -303,7 +304,7 @@ pub trait Requester {
type PromoteChatMember: Request<Payload = PromoteChatMember, Err = Self::Err>; type PromoteChatMember: Request<Payload = PromoteChatMember, Err = Self::Err>;
/// For telegram documentation see [`PromoteChatMember`] /// For Telegram documentation see [`PromoteChatMember`].
fn promote_chat_member<C>(&self, chat_id: C, user_id: i32) -> Self::PromoteChatMember fn promote_chat_member<C>(&self, chat_id: C, user_id: i32) -> Self::PromoteChatMember
where where
C: Into<ChatId>; C: Into<ChatId>;
@ -313,7 +314,7 @@ pub trait Requester {
Err = Self::Err, Err = Self::Err,
>; >;
/// For telegram documentation see [`SetChatAdministratorCustomTitle`] /// For Telegram documentation see [`SetChatAdministratorCustomTitle`].
fn set_chat_administrator_custom_title<Ch, Cu>( fn set_chat_administrator_custom_title<Ch, Cu>(
&self, &self,
chat_id: Ch, chat_id: Ch,
@ -326,7 +327,7 @@ pub trait Requester {
type SetChatPermissions: Request<Payload = SetChatPermissions, Err = Self::Err>; type SetChatPermissions: Request<Payload = SetChatPermissions, Err = Self::Err>;
/// For telegram documentation see [`SetChatPermissions`] /// For Telegram documentation see [`SetChatPermissions`].
fn set_chat_permissions<C>( fn set_chat_permissions<C>(
&self, &self,
chat_id: C, chat_id: C,
@ -337,28 +338,28 @@ pub trait Requester {
type ExportChatInviteLink: Request<Payload = ExportChatInviteLink, Err = Self::Err>; type ExportChatInviteLink: Request<Payload = ExportChatInviteLink, Err = Self::Err>;
/// For telegram documentation see [`ExportChatInviteLink`] /// For Telegram documentation see [`ExportChatInviteLink`].
fn export_chat_invite_link<C>(&self, chat_id: C) -> Self::ExportChatInviteLink fn export_chat_invite_link<C>(&self, chat_id: C) -> Self::ExportChatInviteLink
where where
C: Into<ChatId>; C: Into<ChatId>;
type SetChatPhoto: Request<Payload = SetChatPhoto, Err = Self::Err>; type SetChatPhoto: Request<Payload = SetChatPhoto, Err = Self::Err>;
/// For telegram documentation see [`SetChatPhoto`] /// For Telegram documentation see [`SetChatPhoto`].
fn set_chat_photo<C>(&self, chat_id: C, photo: InputFile) -> Self::SetChatPhoto fn set_chat_photo<C>(&self, chat_id: C, photo: InputFile) -> Self::SetChatPhoto
where where
C: Into<ChatId>; C: Into<ChatId>;
type DeleteChatPhoto: Request<Payload = DeleteChatPhoto, Err = Self::Err>; type DeleteChatPhoto: Request<Payload = DeleteChatPhoto, Err = Self::Err>;
/// For telegram documentation see [`DeleteChatPhoto`] /// For Telegram documentation see [`DeleteChatPhoto`].
fn delete_chat_photo<C>(&self, chat_id: C) -> Self::DeleteChatPhoto fn delete_chat_photo<C>(&self, chat_id: C) -> Self::DeleteChatPhoto
where where
C: Into<ChatId>; C: Into<ChatId>;
type SetChatTitle: Request<Payload = SetChatTitle, Err = Self::Err>; type SetChatTitle: Request<Payload = SetChatTitle, Err = Self::Err>;
/// For telegram documentation see [`SetChatTitle`] /// For Telegram documentation see [`SetChatTitle`].
fn set_chat_title<C, T>(&self, chat_id: C, title: T) -> Self::SetChatTitle fn set_chat_title<C, T>(&self, chat_id: C, title: T) -> Self::SetChatTitle
where where
C: Into<ChatId>, C: Into<ChatId>,
@ -366,63 +367,63 @@ pub trait Requester {
type SetChatDescription: Request<Payload = SetChatDescription, Err = Self::Err>; type SetChatDescription: Request<Payload = SetChatDescription, Err = Self::Err>;
/// For telegram documentation see [`SetChatDescription`] /// For Telegram documentation see [`SetChatDescription`].
fn set_chat_description<C>(&self, chat_id: C) -> Self::SetChatDescription fn set_chat_description<C>(&self, chat_id: C) -> Self::SetChatDescription
where where
C: Into<ChatId>; C: Into<ChatId>;
type PinChatMessage: Request<Payload = PinChatMessage, Err = Self::Err>; type PinChatMessage: Request<Payload = PinChatMessage, Err = Self::Err>;
/// For telegram documentation see [`PinChatMessage`] /// For Telegram documentation see [`PinChatMessage`].
fn pin_chat_message<C>(&self, chat_id: C, message_id: i32) -> Self::PinChatMessage fn pin_chat_message<C>(&self, chat_id: C, message_id: i32) -> Self::PinChatMessage
where where
C: Into<ChatId>; C: Into<ChatId>;
type UnpinChatMessage: Request<Payload = UnpinChatMessage, Err = Self::Err>; type UnpinChatMessage: Request<Payload = UnpinChatMessage, Err = Self::Err>;
/// For telegram documentation see [`UnpinChatMessage`] /// For Telegram documentation see [`UnpinChatMessage`].
fn unpin_chat_message<C>(&self, chat_id: C) -> Self::UnpinChatMessage fn unpin_chat_message<C>(&self, chat_id: C) -> Self::UnpinChatMessage
where where
C: Into<ChatId>; C: Into<ChatId>;
type LeaveChat: Request<Payload = LeaveChat, Err = Self::Err>; type LeaveChat: Request<Payload = LeaveChat, Err = Self::Err>;
/// For telegram documentation see [`LeaveChat`] /// For Telegram documentation see [`LeaveChat`].
fn leave_chat<C>(&self, chat_id: C) -> Self::LeaveChat fn leave_chat<C>(&self, chat_id: C) -> Self::LeaveChat
where where
C: Into<ChatId>; C: Into<ChatId>;
type GetChat: Request<Payload = GetChat, Err = Self::Err>; type GetChat: Request<Payload = GetChat, Err = Self::Err>;
/// For telegram documentation see [`GetChat`] /// For Telegram documentation see [`GetChat`].
fn get_chat<C>(&self, chat_id: C) -> Self::GetChat fn get_chat<C>(&self, chat_id: C) -> Self::GetChat
where where
C: Into<ChatId>; C: Into<ChatId>;
type GetChatAdministrators: Request<Payload = GetChatAdministrators, Err = Self::Err>; type GetChatAdministrators: Request<Payload = GetChatAdministrators, Err = Self::Err>;
/// For telegram documentation see [`GetChatAdministrators`] /// For Telegram documentation see [`GetChatAdministrators`].
fn get_chat_administrators<C>(&self, chat_id: C) -> Self::GetChatAdministrators fn get_chat_administrators<C>(&self, chat_id: C) -> Self::GetChatAdministrators
where where
C: Into<ChatId>; C: Into<ChatId>;
type GetChatMembersCount: Request<Payload = GetChatMembersCount, Err = Self::Err>; type GetChatMembersCount: Request<Payload = GetChatMembersCount, Err = Self::Err>;
/// For telegram documentation see [`GetChatMembersCount`] /// For Telegram documentation see [`GetChatMembersCount`].
fn get_chat_members_count<C>(&self, chat_id: C) -> Self::GetChatMembersCount fn get_chat_members_count<C>(&self, chat_id: C) -> Self::GetChatMembersCount
where where
C: Into<ChatId>; C: Into<ChatId>;
type GetChatMember: Request<Payload = GetChatMember, Err = Self::Err>; type GetChatMember: Request<Payload = GetChatMember, Err = Self::Err>;
/// For telegram documentation see [`GetChatMember`] /// For Telegram documentation see [`GetChatMember`].
fn get_chat_member<C>(&self, chat_id: C, user_id: i32) -> Self::GetChatMember fn get_chat_member<C>(&self, chat_id: C, user_id: i32) -> Self::GetChatMember
where where
C: Into<ChatId>; C: Into<ChatId>;
type SetChatStickerSet: Request<Payload = SetChatStickerSet, Err = Self::Err>; type SetChatStickerSet: Request<Payload = SetChatStickerSet, Err = Self::Err>;
/// For telegram documentation see [`SetChatStickerSet`] /// For Telegram documentation see [`SetChatStickerSet`].
fn set_chat_sticker_set<C, S>( fn set_chat_sticker_set<C, S>(
&self, &self,
chat_id: C, chat_id: C,
@ -434,33 +435,33 @@ pub trait Requester {
type DeleteChatStickerSet: Request<Payload = DeleteChatStickerSet, Err = Self::Err>; type DeleteChatStickerSet: Request<Payload = DeleteChatStickerSet, Err = Self::Err>;
/// For telegram documentation see [`DeleteChatStickerSet`] /// For Telegram documentation see [`DeleteChatStickerSet`].
fn delete_chat_sticker_set<C>(&self, chat_id: C) -> Self::DeleteChatStickerSet fn delete_chat_sticker_set<C>(&self, chat_id: C) -> Self::DeleteChatStickerSet
where where
C: Into<ChatId>; C: Into<ChatId>;
type AnswerCallbackQuery: Request<Payload = AnswerCallbackQuery, Err = Self::Err>; type AnswerCallbackQuery: Request<Payload = AnswerCallbackQuery, Err = Self::Err>;
/// For telegram documentation see [`AnswerCallbackQuery`] /// For Telegram documentation see [`AnswerCallbackQuery`].
fn answer_callback_query<C>(&self, callback_query_id: C) -> Self::AnswerCallbackQuery fn answer_callback_query<C>(&self, callback_query_id: C) -> Self::AnswerCallbackQuery
where where
C: Into<String>; C: Into<String>;
type SetMyCommands: Request<Payload = SetMyCommands, Err = Self::Err>; type SetMyCommands: Request<Payload = SetMyCommands, Err = Self::Err>;
/// For telegram documentation see [`SetMyCommands`] /// For Telegram documentation see [`SetMyCommands`].
fn set_my_commands<C>(&self, commands: C) -> Self::SetMyCommands fn set_my_commands<C>(&self, commands: C) -> Self::SetMyCommands
where where
C: IntoIterator<Item = BotCommand>; C: IntoIterator<Item = BotCommand>;
type GetMyCommands: Request<Payload = GetMyCommands, Err = Self::Err>; type GetMyCommands: Request<Payload = GetMyCommands, Err = Self::Err>;
/// For telegram documentation see [`GetMyCommands`] /// For Telegram documentation see [`GetMyCommands`].
fn get_my_commands(&self) -> Self::GetMyCommands; fn get_my_commands(&self) -> Self::GetMyCommands;
type AnswerInlineQuery: Request<Payload = AnswerInlineQuery, Err = Self::Err>; type AnswerInlineQuery: Request<Payload = AnswerInlineQuery, Err = Self::Err>;
/// For telegram documentation see [`AnswerInlineQuery`] /// For Telegram documentation see [`AnswerInlineQuery`].
fn answer_inline_query<I, R>(&self, inline_query_id: I, results: R) -> Self::AnswerInlineQuery fn answer_inline_query<I, R>(&self, inline_query_id: I, results: R) -> Self::AnswerInlineQuery
where where
I: Into<String>, I: Into<String>,
@ -468,7 +469,7 @@ pub trait Requester {
type EditMessageText: Request<Payload = EditMessageText, Err = Self::Err>; type EditMessageText: Request<Payload = EditMessageText, Err = Self::Err>;
/// For telegram documentation see [`EditMessageText`] /// For Telegram documentation see [`EditMessageText`].
fn edit_message_text<C, T>( fn edit_message_text<C, T>(
&self, &self,
chat_id: C, chat_id: C,
@ -481,7 +482,7 @@ pub trait Requester {
type EditMessageTextInline: Request<Payload = EditMessageTextInline, Err = Self::Err>; type EditMessageTextInline: Request<Payload = EditMessageTextInline, Err = Self::Err>;
/// For telegram documentation see [`EditMessageTextInline`] /// For Telegram documentation see [`EditMessageTextInline`].
fn edit_message_text_inline<I, T>( fn edit_message_text_inline<I, T>(
&self, &self,
inline_message_id: I, inline_message_id: I,
@ -493,7 +494,7 @@ pub trait Requester {
type EditMessageCaption: Request<Payload = EditMessageCaption, Err = Self::Err>; type EditMessageCaption: Request<Payload = EditMessageCaption, Err = Self::Err>;
/// For telegram documentation see [`EditMessageCaption`] /// For Telegram documentation see [`EditMessageCaption`].
fn edit_message_caption<Ch, Ca>( fn edit_message_caption<Ch, Ca>(
&self, &self,
chat_id: Ch, chat_id: Ch,
@ -506,7 +507,7 @@ pub trait Requester {
type EditMessageCaptionInline: Request<Payload = EditMessageCaptionInline, Err = Self::Err>; type EditMessageCaptionInline: Request<Payload = EditMessageCaptionInline, Err = Self::Err>;
/// For telegram documentation see [`EditMessageCaptionInline`] /// For Telegram documentation see [`EditMessageCaptionInline`].
fn edit_message_caption_inline<I, C>( fn edit_message_caption_inline<I, C>(
&self, &self,
inline_message_id: I, inline_message_id: I,
@ -518,7 +519,7 @@ pub trait Requester {
type EditMessageMedia: Request<Payload = EditMessageMedia, Err = Self::Err>; type EditMessageMedia: Request<Payload = EditMessageMedia, Err = Self::Err>;
/// For telegram documentation see [`EditMessageMedia`] /// For Telegram documentation see [`EditMessageMedia`].
fn edit_message_media<C>( fn edit_message_media<C>(
&self, &self,
chat_id: C, chat_id: C,
@ -530,7 +531,7 @@ pub trait Requester {
type EditMessageMediaInline: Request<Payload = EditMessageMediaInline, Err = Self::Err>; type EditMessageMediaInline: Request<Payload = EditMessageMediaInline, Err = Self::Err>;
/// For telegram documentation see [`EditMessageMediaInline`] /// For Telegram documentation see [`EditMessageMediaInline`].
fn edit_message_media_inline<I>( fn edit_message_media_inline<I>(
&self, &self,
inline_message_id: I, inline_message_id: I,
@ -541,7 +542,7 @@ pub trait Requester {
type EditMessageReplyMarkup: Request<Payload = EditMessageReplyMarkup, Err = Self::Err>; type EditMessageReplyMarkup: Request<Payload = EditMessageReplyMarkup, Err = Self::Err>;
/// For telegram documentation see [`EditMessageReplyMarkup`] /// For Telegram documentation see [`EditMessageReplyMarkup`].
fn edit_message_reply_markup<C>( fn edit_message_reply_markup<C>(
&self, &self,
chat_id: C, chat_id: C,
@ -555,7 +556,7 @@ pub trait Requester {
Err = Self::Err, Err = Self::Err,
>; >;
/// For telegram documentation see [`EditMessageReplyMarkupInline`] /// For Telegram documentation see [`EditMessageReplyMarkupInline`].
fn edit_message_reply_markup_inline<I>( fn edit_message_reply_markup_inline<I>(
&self, &self,
inline_message_id: I, inline_message_id: I,
@ -565,40 +566,40 @@ pub trait Requester {
type StopPoll: Request<Payload = StopPoll, Err = Self::Err>; type StopPoll: Request<Payload = StopPoll, Err = Self::Err>;
/// For telegram documentation see [`StopPoll`] /// For Telegram documentation see [`StopPoll`].
fn stop_poll<C>(&self, chat_id: C, message_id: i32) -> Self::StopPoll fn stop_poll<C>(&self, chat_id: C, message_id: i32) -> Self::StopPoll
where where
C: Into<ChatId>; C: Into<ChatId>;
type DeleteMessage: Request<Payload = DeleteMessage, Err = Self::Err>; type DeleteMessage: Request<Payload = DeleteMessage, Err = Self::Err>;
/// For telegram documentation see [`DeleteMessage`] /// For Telegram documentation see [`DeleteMessage`].
fn delete_message<C>(&self, chat_id: C, message_id: i32) -> Self::DeleteMessage fn delete_message<C>(&self, chat_id: C, message_id: i32) -> Self::DeleteMessage
where where
C: Into<ChatId>; C: Into<ChatId>;
type SendSticker: Request<Payload = SendSticker, Err = Self::Err>; type SendSticker: Request<Payload = SendSticker, Err = Self::Err>;
/// For telegram documentation see [`SendSticker`] /// For Telegram documentation see [`SendSticker`].
fn send_sticker<C>(&self, chat_id: C, sticker: InputFile) -> Self::SendSticker fn send_sticker<C>(&self, chat_id: C, sticker: InputFile) -> Self::SendSticker
where where
C: Into<ChatId>; C: Into<ChatId>;
type GetStickerSet: Request<Payload = GetStickerSet, Err = Self::Err>; type GetStickerSet: Request<Payload = GetStickerSet, Err = Self::Err>;
/// For telegram documentation see [`GetStickerSet`] /// For Telegram documentation see [`GetStickerSet`].
fn get_sticker_set<N>(&self, name: N) -> Self::GetStickerSet fn get_sticker_set<N>(&self, name: N) -> Self::GetStickerSet
where where
N: Into<String>; N: Into<String>;
type UploadStickerFile: Request<Payload = UploadStickerFile, Err = Self::Err>; type UploadStickerFile: Request<Payload = UploadStickerFile, Err = Self::Err>;
/// For telegram documentation see [`UploadStickerFile`] /// For Telegram documentation see [`UploadStickerFile`].
fn upload_sticker_file(&self, user_id: i32, png_sticker: InputFile) -> Self::UploadStickerFile; fn upload_sticker_file(&self, user_id: i32, png_sticker: InputFile) -> Self::UploadStickerFile;
type CreateNewStickerSet: Request<Payload = CreateNewStickerSet, Err = Self::Err>; type CreateNewStickerSet: Request<Payload = CreateNewStickerSet, Err = Self::Err>;
/// For telegram documentation see [`CreateNewStickerSet`] /// For Telegram documentation see [`CreateNewStickerSet`].
fn create_new_sticker_set<N, T, E>( fn create_new_sticker_set<N, T, E>(
&self, &self,
user_id: i32, user_id: i32,
@ -613,7 +614,7 @@ pub trait Requester {
type AddStickerToSet: Request<Payload = AddStickerToSet, Err = Self::Err>; type AddStickerToSet: Request<Payload = AddStickerToSet, Err = Self::Err>;
/// For telegram documentation see [`AddStickerToSet`] /// For Telegram documentation see [`AddStickerToSet`].
fn add_sticker_to_set<N, E>( fn add_sticker_to_set<N, E>(
&self, &self,
user_id: i32, user_id: i32,
@ -627,7 +628,7 @@ pub trait Requester {
type SetStickerPositionInSet: Request<Payload = SetStickerPositionInSet, Err = Self::Err>; type SetStickerPositionInSet: Request<Payload = SetStickerPositionInSet, Err = Self::Err>;
/// For telegram documentation see [`SetStickerPositionInSet`] /// For Telegram documentation see [`SetStickerPositionInSet`].
fn set_sticker_position_in_set<S>( fn set_sticker_position_in_set<S>(
&self, &self,
sticker: S, sticker: S,
@ -638,21 +639,21 @@ pub trait Requester {
type DeleteStickerFromSet: Request<Payload = DeleteStickerFromSet, Err = Self::Err>; type DeleteStickerFromSet: Request<Payload = DeleteStickerFromSet, Err = Self::Err>;
/// For telegram documentation see [`DeleteStickerFromSet`] /// For Telegram documentation see [`DeleteStickerFromSet`].
fn delete_sticker_from_set<S>(&self, sticker: S) -> Self::DeleteStickerFromSet fn delete_sticker_from_set<S>(&self, sticker: S) -> Self::DeleteStickerFromSet
where where
S: Into<String>; S: Into<String>;
type SetStickerSetThumb: Request<Payload = SetStickerSetThumb, Err = Self::Err>; type SetStickerSetThumb: Request<Payload = SetStickerSetThumb, Err = Self::Err>;
/// For telegram documentation see [`SetStickerSetThumb`] /// For Telegram documentation see [`SetStickerSetThumb`].
fn set_sticker_set_thumb<N>(&self, name: N, user_id: i32) -> Self::SetStickerSetThumb fn set_sticker_set_thumb<N>(&self, name: N, user_id: i32) -> Self::SetStickerSetThumb
where where
N: Into<String>; N: Into<String>;
type SendInvoice: Request<Payload = SendInvoice, Err = Self::Err>; type SendInvoice: Request<Payload = SendInvoice, Err = Self::Err>;
/// For telegram documentation see [`SendInvoice`] /// For Telegram documentation see [`SendInvoice`].
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
fn send_invoice<T, D, Pa, P, S, C, Pri>( fn send_invoice<T, D, Pa, P, S, C, Pri>(
&self, &self,
@ -676,14 +677,14 @@ pub trait Requester {
type AnswerShippingQuery: Request<Payload = AnswerShippingQuery, Err = Self::Err>; type AnswerShippingQuery: Request<Payload = AnswerShippingQuery, Err = Self::Err>;
/// For telegram documentation see [`AnswerShippingQuery`] /// For Telegram documentation see [`AnswerShippingQuery`].
fn answer_shipping_query<S>(&self, shipping_query_id: S, ok: bool) -> Self::AnswerShippingQuery fn answer_shipping_query<S>(&self, shipping_query_id: S, ok: bool) -> Self::AnswerShippingQuery
where where
S: Into<String>; S: Into<String>;
type AnswerPreCheckoutQuery: Request<Payload = AnswerPreCheckoutQuery, Err = Self::Err>; type AnswerPreCheckoutQuery: Request<Payload = AnswerPreCheckoutQuery, Err = Self::Err>;
/// For telegram documentation see [`AnswerPreCheckoutQuery`] /// For Telegram documentation see [`AnswerPreCheckoutQuery`].
fn answer_pre_checkout_query<P>( fn answer_pre_checkout_query<P>(
&self, &self,
pre_checkout_query_id: P, pre_checkout_query_id: P,
@ -694,7 +695,7 @@ pub trait Requester {
type SetPassportDataErrors: Request<Payload = SetPassportDataErrors, Err = Self::Err>; type SetPassportDataErrors: Request<Payload = SetPassportDataErrors, Err = Self::Err>;
/// For telegram documentation see [`SetPassportDataErrors`] /// For Telegram documentation see [`SetPassportDataErrors`].
fn set_passport_data_errors<E>(&self, user_id: i32, errors: E) -> Self::SetPassportDataErrors fn set_passport_data_errors<E>(&self, user_id: i32, errors: E) -> Self::SetPassportDataErrors
where where
E: IntoIterator<Item = PassportElementError>; E: IntoIterator<Item = PassportElementError>;

View file

@ -9,6 +9,7 @@ use crate::adaptors::AutoSend;
#[cfg(feature = "throttle")] #[cfg(feature = "throttle")]
use crate::adaptors::throttle::{Limits, Throttle}; use crate::adaptors::throttle::{Limits, Throttle};
/// Extensions methods for [`Requester`].
pub trait RequesterExt: Requester { pub trait RequesterExt: Requester {
/// Add `get_me` caching ability, see [`CacheMe`] for more. /// Add `get_me` caching ability, see [`CacheMe`] for more.
/// ///