Fix doc links...

This commit is contained in:
Waffle 2020-11-27 02:13:50 +03:00
parent 1882ff0bc4
commit 3491a668b2
7 changed files with 84 additions and 85 deletions

View file

@ -10,7 +10,7 @@ use crate::{
impl Bot {
/// Download a file from Telegram into `destination`.
///
/// `path` can be obtained from [`Bot::get_file`].
/// `path` can be obtained from [`GetFile`].
///
/// To download as a stream of chunks, see [`Bot::download_file_stream`].
///
@ -33,7 +33,7 @@ impl Bot {
/// # Ok(()) }
/// ```
///
/// [`Bot::get_file`]: crate::Bot::get_file
/// [`GetFile`]: crate::payloads::GetFile
/// [`Bot::download_file_stream`]: crate::Bot::download_file_stream
pub async fn download_file<D>(
&self,
@ -48,12 +48,12 @@ impl Bot {
/// Download a file from Telegram.
///
/// `path` can be obtained from the [`Bot::get_file`].
/// `path` can be obtained from the [`GetFile`].
///
/// To download into [`AsyncWrite`] (e.g. [`tokio::fs::File`]), see
/// [`Bot::download_file`].
///
/// [`Bot::get_file`]: crate::bot::Bot::get_file
/// [`GetFile`]: crate::payloads::GetFile
/// [`AsyncWrite`]: tokio::io::AsyncWrite
/// [`tokio::fs::File`]: tokio::fs::File
/// [`Bot::download_file`]: crate::Bot::download_file

View file

@ -70,7 +70,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`EditMessageText`]
///
/// [`EditMessageText`]: crate::requests::EditMessageText
/// [`EditMessageText`]: crate::payloads::EditMessageText
#[serde(rename = "Bad Request: message is not modified: specified new message content and \
reply markup are exactly the same as a current content and reply markup \
of the message")]
@ -82,8 +82,8 @@ pub enum ApiError {
/// 1. [`ForwardMessage`]
/// 2. [`DeleteMessage`]
///
/// [`ForwardMessage`]: crate::requests::ForwardMessage
/// [`DeleteMessage`]: crate::requests::DeleteMessage
/// [`ForwardMessage`]: crate::payloads::ForwardMessage
/// [`DeleteMessage`]: crate::payloads::DeleteMessage
#[serde(rename = "Bad Request: MESSAGE_ID_INVALID")]
MessageIdInvalid,
@ -92,7 +92,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`ForwardMessage`]
///
/// [`ForwardMessage`]: crate::requests::ForwardMessage
/// [`ForwardMessage`]: crate::payloads::ForwardMessage
#[serde(rename = "Bad Request: message to forward not found")]
MessageToForwardNotFound,
@ -101,7 +101,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`DeleteMessage`]
///
/// [`DeleteMessage`]: crate::requests::DeleteMessage
/// [`DeleteMessage`]: crate::payloads::DeleteMessage
#[serde(rename = "Bad Request: message to delete not found")]
MessageToDeleteNotFound,
@ -110,7 +110,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`SendMessage`]
///
/// [`SendMessage`]: crate::requests::SendMessage
/// [`SendMessage`]: crate::payloads::SendMessage
#[serde(rename = "Bad Request: message text is empty")]
MessageTextIsEmpty,
@ -119,7 +119,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`EditMessageText`]
///
/// [`EditMessageText`]: crate::requests::EditMessageText
/// [`EditMessageText`]: crate::payloads::EditMessageText
#[serde(rename = "Bad Request: message can't be edited")]
MessageCantBeEdited,
@ -129,7 +129,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`DeleteMessage`]
///
/// [`DeleteMessage`]: crate::requests::DeleteMessage
/// [`DeleteMessage`]: crate::payloads::DeleteMessage
#[serde(rename = "Bad Request: message can't be deleted")]
MessageCantBeDeleted,
@ -138,7 +138,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`EditMessageText`]
///
/// [`EditMessageText`]: crate::requests::EditMessageText
/// [`EditMessageText`]: crate::payloads::EditMessageText
#[serde(rename = "Bad Request: message to edit not found")]
MessageToEditNotFound,
@ -147,7 +147,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`SendMessage`]
///
/// [`SendMessage`]: crate::requests::SendMessage
/// [`SendMessage`]: crate::payloads::SendMessage
#[serde(rename = "Bad Request: reply message not found")]
MessageToReplyNotFound,
@ -161,7 +161,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`SendMessage`]
///
/// [`SendMessage`]: crate::requests::SendMessage
/// [`SendMessage`]: crate::payloads::SendMessage
#[serde(rename = "Bad Request: message is too long")]
MessageIsTooLong,
@ -170,7 +170,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`SendMediaGroup`]
///
/// [`SendMediaGroup`]: crate::requests::SendMediaGroup
/// [`SendMediaGroup`]: crate::payloads::SendMediaGroup
#[serde(rename = "Bad Request: Too much messages to send as an album")]
ToMuchMessages,
@ -179,7 +179,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`SendPoll`]
///
/// [`SendPoll`]: crate::requests::SendPoll
/// [`SendPoll`]: crate::payloads::SendPoll
#[serde(rename = "Bad Request: poll has already been closed")]
PollHasAlreadyClosed,
@ -188,7 +188,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`SendPoll`]
///
/// [`SendPoll`]: crate::requests::SendPoll
/// [`SendPoll`]: crate::payloads::SendPoll
#[serde(rename = "Bad Request: poll must have at least 2 option")]
PollMustHaveMoreOptions,
@ -197,7 +197,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`SendPoll`]
///
/// [`SendPoll`]: crate::requests::SendPoll
/// [`SendPoll`]: crate::payloads::SendPoll
#[serde(rename = "Bad Request: poll can't have more than 10 options")]
PollCantHaveMoreOptions,
@ -206,7 +206,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`SendPoll`]
///
/// [`SendPoll`]: crate::requests::SendPoll
/// [`SendPoll`]: crate::payloads::SendPoll
#[serde(rename = "Bad Request: poll options must be non-empty")]
PollOptionsMustBeNonEmpty,
@ -215,7 +215,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`SendPoll`]
///
/// [`SendPoll`]: crate::requests::SendPoll
/// [`SendPoll`]: crate::payloads::SendPoll
#[serde(rename = "Bad Request: poll question must be non-empty")]
PollQuestionMustBeNonEmpty,
@ -225,7 +225,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`SendPoll`]
///
/// [`SendPoll`]: crate::requests::SendPoll
/// [`SendPoll`]: crate::payloads::SendPoll
#[serde(rename = "Bad Request: poll options length must not exceed 100")]
PollOptionsLengthTooLong,
@ -235,7 +235,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`SendPoll`]
///
/// [`SendPoll`]: crate::requests::SendPoll
/// [`SendPoll`]: crate::payloads::SendPoll
#[serde(rename = "Bad Request: poll question length must not exceed 255")]
PollQuestionLengthTooLong,
@ -244,7 +244,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`StopPoll`]
///
/// [`StopPoll`]: crate::requests::StopPoll
/// [`StopPoll`]: crate::payloads::StopPoll
#[serde(rename = "Bad Request: message with poll to stop not found")]
MessageWithPollNotFound,
@ -253,7 +253,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`StopPoll`]
///
/// [`StopPoll`]: crate::requests::StopPoll
/// [`StopPoll`]: crate::payloads::StopPoll
#[serde(rename = "Bad Request: message is not a poll")]
MessageIsNotAPoll,
@ -263,7 +263,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`SendMessage`]
///
/// [`SendMessage`]: crate::requests::SendMessage
/// [`SendMessage`]: crate::payloads::SendMessage
#[serde(rename = "Bad Request: chat not found")]
ChatNotFound,
@ -273,7 +273,7 @@ pub enum ApiError {
/// 1. [`getUserProfilePhotos`]
///
/// [`getUserProfilePhotos`]:
/// crate::requests::GetUserProfilePhotos
/// crate::payloads::GetUserProfilePhotos
#[serde(rename = "Bad Request: user not found")]
UserNotFound,
@ -283,7 +283,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`SetChatDescription`]
///
/// [`SetChatDescription`]: crate::requests::SetChatDescription
/// [`SetChatDescription`]: crate::payloads::SetChatDescription
#[serde(rename = "Bad Request: chat description is not modified")]
ChatDescriptionIsNotModified,
@ -292,7 +292,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`AnswerCallbackQuery`]
///
/// [`AnswerCallbackQuery`]: crate::requests::AnswerCallbackQuery
/// [`AnswerCallbackQuery`]: crate::payloads::AnswerCallbackQuery
#[serde(rename = "Bad Request: query is too old and response timeout expired or query id is \
invalid")]
InvalidQueryID,
@ -303,7 +303,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`SendMessage`]
///
/// [`SendMessage`]: crate::requests::SendMessage
/// [`SendMessage`]: crate::payloads::SendMessage
#[serde(rename = "Bad Request: BUTTON_URL_INVALID")]
ButtonURLInvalid,
@ -312,7 +312,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`SendMessage`]
///
/// [`SendMessage`]: crate::requests::SendMessage
/// [`SendMessage`]: crate::payloads::SendMessage
#[serde(rename = "Bad Request: BUTTON_DATA_INVALID")]
ButtonDataInvalid,
@ -321,7 +321,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`SendMessage`]
///
/// [`SendMessage`]: crate::requests::SendMessage
/// [`SendMessage`]: crate::payloads::SendMessage
#[serde(rename = "Bad Request: can't parse inline keyboard button: Text buttons are \
unallowed in the inline keyboard")]
TextButtonsAreUnallowed,
@ -331,7 +331,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`GetFile`]
///
/// [`GetFile`]: crate::requests::GetFile
/// [`GetFile`]: crate::payloads::GetFile
#[serde(rename = "Bad Request: wrong file id")]
WrongFileID,
@ -344,7 +344,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`SetChatPhoto`]
///
/// [`SetChatPhoto`]: crate::requests::SetChatPhoto
/// [`SetChatPhoto`]: crate::payloads::SetChatPhoto
#[serde(rename = "Bad Request: Photo should be uploaded as an InputFile")]
PhotoAsInputFileRequired,
@ -353,7 +353,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`AddStickerToSet`]
///
/// [`AddStickerToSet`]: crate::requests::AddStickerToSet
/// [`AddStickerToSet`]: crate::payloads::AddStickerToSet
#[serde(rename = "Bad Request: STICKERSET_INVALID")]
InvalidStickersSet,
@ -363,7 +363,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`PinChatMessage`]
///
/// [`PinChatMessage`]: crate::requests::PinChatMessage
/// [`PinChatMessage`]: crate::payloads::PinChatMessage
#[serde(rename = "Bad Request: not enough rights to pin a message")]
NotEnoughRightsToPinMessage,
@ -377,7 +377,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`PromoteChatMember`]
///
/// [`PromoteChatMember`]: crate::requests::PromoteChatMember
/// [`PromoteChatMember`]: crate::payloads::PromoteChatMember
#[serde(rename = "Bad Request: can't demote chat creator")]
CantDemoteChatCreator,
@ -386,7 +386,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`RestrictChatMember`]
///
/// [`RestrictChatMember`]: crate::requests::RestrictChatMember
/// [`RestrictChatMember`]: crate::payloads::RestrictChatMember
#[serde(rename = "Bad Request: can't restrict self")]
CantRestrictSelf,
@ -396,7 +396,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`RestrictChatMember`]
///
/// [`RestrictChatMember`]: crate::requests::RestrictChatMember
/// [`RestrictChatMember`]: crate::payloads::RestrictChatMember
#[serde(rename = "Bad Request: not enough rights to restrict/unrestrict chat member")]
NotEnoughRightsToRestrict,
@ -405,7 +405,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`SetWebhook`]
///
/// [`SetWebhook`]: crate::requests::SetWebhook
/// [`SetWebhook`]: crate::payloads::SetWebhook
#[serde(rename = "Bad Request: bad webhook: HTTPS url must be provided for webhook")]
WebhookRequireHTTPS,
@ -415,7 +415,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`SetWebhook`]
///
/// [`SetWebhook`]: crate::requests::SetWebhook
/// [`SetWebhook`]: crate::payloads::SetWebhook
#[serde(rename = "Bad Request: bad webhook: Webhook can be set up only on ports 80, 88, 443 \
or 8443")]
BadWebhookPort,
@ -425,7 +425,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`SetWebhook`]
///
/// [`SetWebhook`]: crate::requests::SetWebhook
/// [`SetWebhook`]: crate::payloads::SetWebhook
#[serde(rename = "Bad Request: bad webhook: Failed to resolve host: Name or service not known")]
UnknownHost,
@ -434,7 +434,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`SetWebhook`]
///
/// [`SetWebhook`]: crate::requests::SetWebhook
/// [`SetWebhook`]: crate::payloads::SetWebhook
#[serde(rename = "Bad Request: can't parse URL")]
CantParseUrl,
@ -443,7 +443,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`SendMessage`]
///
/// [`SendMessage`]: crate::requests::SendMessage
/// [`SendMessage`]: crate::payloads::SendMessage
#[serde(rename = "Bad Request: can't parse entities")]
CantParseEntities,
@ -452,7 +452,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`GetUpdates`]
///
/// [`GetUpdates`]: crate::requests::GetUpdates
/// [`GetUpdates`]: crate::payloads::GetUpdates
#[serde(rename = "can't use getUpdates method while webhook is active")]
CantGetUpdates,
@ -461,7 +461,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`SendMessage`]
///
/// [`SendMessage`]: crate::requests::SendMessage
/// [`SendMessage`]: crate::payloads::SendMessage
#[serde(rename = "Unauthorized: bot was kicked from a chat")]
BotKicked,
@ -470,7 +470,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`SendMessage`]
///
/// [`SendMessage`]: crate::requests::SendMessage
/// [`SendMessage`]: crate::payloads::SendMessage
#[serde(rename = "Unauthorized: user is deactivated")]
UserDeactivated,
@ -479,7 +479,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`SendMessage`]
///
/// [`SendMessage`]: crate::requests::SendMessage
/// [`SendMessage`]: crate::payloads::SendMessage
#[serde(rename = "Unauthorized: bot can't initiate conversation with a user")]
CantInitiateConversation,
@ -488,7 +488,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`SendMessage`]
///
/// [`SendMessage`]: crate::requests::SendMessage
/// [`SendMessage`]: crate::payloads::SendMessage
#[serde(rename = "Unauthorized: bot can't send messages to bots")]
CantTalkWithBots,
@ -497,7 +497,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`SendMessage`]
///
/// [`SendMessage`]: crate::requests::SendMessage
/// [`SendMessage`]: crate::payloads::SendMessage
#[serde(rename = "Bad Request: wrong HTTP URL")]
WrongHTTPurl,
@ -507,7 +507,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`GetUpdates`]
///
/// [`GetUpdates`]: crate::requests::GetUpdates
/// [`GetUpdates`]: crate::payloads::GetUpdates
#[serde(rename = "Conflict: terminated by other getUpdates request; make sure that only one \
bot instance is running")]
TerminatedByOtherGetUpdates,
@ -517,7 +517,7 @@ pub enum ApiError {
/// May happen in methods:
/// 1. [`GetFile`]
///
/// [`GetFile`]: crate::requests::GetFile
/// [`GetFile`]: crate::payloads::GetFile
#[serde(rename = "Bad Request: invalid file id")]
FileIdInvalid,

View file

@ -18,9 +18,9 @@ pub struct Chat {
#[serde(flatten)]
pub kind: ChatKind,
/// A chat photo. Returned only in [`Bot::get_chat`].
/// A chat photo. Returned only in [`GetChat`].
///
/// [`Bot::get_chat`]: crate::Bot::get_chat
/// [`GetChat`]: crate::payloads::GetChat
pub photo: Option<ChatPhoto>,
}
@ -63,27 +63,27 @@ pub struct ChatPublic {
pub kind: PublicChatKind,
/// A description, for groups, supergroups and channel chats. Returned
/// only in [`Bot::get_chat`].
/// only in [`GetChat`].
///
/// [`Bot::get_chat`]: crate::Bot::get_chat
/// [`GetChat`]: crate::payloads::GetChat
pub description: Option<String>,
/// A chat invite link, for groups, supergroups and channel chats. Each
/// administrator in a chat generates their own invite links, so the
/// bot must first generate the link using
/// [`Bot::export_chat_invite_link`]. Returned only in
/// [`Bot::get_chat`].
/// [`ExportChatInviteLink`]. Returned only in
/// [`GetChat`].
///
/// [`Bot::export_chat_invite_link`]:
/// crate::Bot::export_chat_invite_link
/// [`ExportChatInviteLink`]:
/// crate::payloads::ExportChatInviteLink
///
/// [`Bot::get_chat`]: crate::Bot::get_chat
/// [`GetChat`]: crate::payloads::GetChat
pub invite_link: Option<String>,
/// Pinned message, for groups, supergroups and channels. Returned only
/// in [`Bot::get_chat`].
/// in [`GetChat`].
///
/// [`Bot::get_chat`]: crate::Bot::get_chat
/// [`GetChat`]: crate::payloads::GetChat
pub pinned_message: Option<Box<Message>>,
}
@ -199,9 +199,9 @@ impl PublicChatChannel {
#[derive(Clone, Default, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
pub struct PublicChatGroup {
/// A default chat member permissions, for groups and supergroups. Returned
/// only from [`Bot::get_chat`].
/// only from [`GetChat`].
///
/// [`Bot::get_chat`]: crate::Bot::get_chat
/// [`GetChat`]: crate::payloads::GetChat
pub permissions: Option<ChatPermissions>,
}
@ -219,27 +219,27 @@ pub struct PublicChatSupergroup {
pub username: Option<String>,
/// For supergroups, name of group sticker set. Returned only from
/// [`Bot::get_chat`].
/// [`GetChat`].
///
/// [`Bot::get_chat`]: crate::Bot::get_chat
/// [`GetChat`]: crate::payloads::GetChat
pub sticker_set_name: Option<String>,
/// `true`, if the bot can change the group sticker set. Returned only
/// from [`Bot::get_chat`].
/// from [`GetChat`].
///
/// [`Bot::get_chat`]: crate::Bot::get_chat
/// [`GetChat`]: crate::payloads::GetChat
pub can_set_sticker_set: Option<bool>,
/// A default chat member permissions, for groups and supergroups.
/// Returned only from [`Bot::get_chat`].
/// Returned only from [`GetChat`].
///
/// [`Bot::get_chat`]: crate::Bot::get_chat
/// [`GetChat`]: crate::payloads::GetChat
pub permissions: Option<ChatPermissions>,
/// The minimum allowed delay between consecutive messages sent by each
/// unpriviledged user. Returned only from [`Bot::get_chat`].
/// unpriviledged user. Returned only from [`GetChat`].
///
/// [`Bot::get_chat`]: crate::Bot::get_chat
/// [`GetChat`]: crate::payloads::GetChat
pub slow_mode_delay: Option<i32>,
}

View file

@ -4,11 +4,11 @@ use serde::{Deserialize, Serialize};
///
/// The file can be downloaded via the link `https://api.telegram.org/file/bot<token>/<file_path>`.
/// It is guaranteed that the link will be valid for at least 1 hour. When the
/// link expires, a new one can be requested by calling [`Bot::get_file`].
/// link expires, a new one can be requested by calling [`GetFile`].
///
/// [The official docs](https://core.telegram.org/bots/api#file).
///
/// [`Bot::get_file`]: crate::Bot::get_file
/// [`GetFile`]: crate::payloads::GetFile
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
pub struct File {
/// Identifier for this file.

View file

@ -20,14 +20,15 @@ pub struct Game {
/// Photo that will be displayed in the game message in chats.
pub photo: Vec<PhotoSize>,
// FIXME(waffle): SetGameScore method is missing for some reason O_o
#[allow(broken_intra_doc_links)]
/// Brief description of the game or high scores included in the game
/// message. Can be automatically edited to include current high scores
/// for the game when the bot calls [`Bot::set_game_score`], or manually
/// edited using [`Bot::edit_message_text`]. 0-4096 characters.
/// for the game when the bot calls [`SetGameScore`], or manually
/// edited using [`EditMessageText`]. 0-4096 characters.
///
/// [`Bot::set_game_score`]: crate::Bot::set_game_score
///
/// [`Bot::edit_message_text`]: crate::Bot::edit_message_text
/// [`SetGameScore`]: crate::payloads::SetGameScore
/// [`EditMessageText`]: crate::payloads::EditMessageText
pub text: Option<String>,
/// Special entities that appear in text, such as usernames, URLs, bot

View file

@ -1,9 +1,9 @@
use crate::types::User;
use serde::{Deserialize, Serialize};
/// Returned only in [`Bot::get_me`].
/// Returned only in [`GetMe`].
///
/// [`Bot::get_me`]: crate::Bot::get_me
/// [`GetMe`]: crate::payloads::GetMe
#[derive(Clone, Debug, Eq, Hash, PartialEq, Serialize, Deserialize)]
pub struct Me {
#[serde(flatten)]

View file

@ -16,13 +16,11 @@ use crate::types::{
pub struct Update {
/// The updates unique identifier. Update identifiers start from a certain
/// positive number and increase sequentially. This ID becomes especially
/// handy if youre using [Webhooks], since it allows you to ignore
/// handy if youre using webhooks, since it allows you to ignore
/// repeated updates or to restore the correct update sequence, should
/// they get out of order. If there are no new updates for at least a
/// week, then identifier of the next update will be chosen randomly
/// instead of sequentially.
///
/// [Webhooks]: crate::Bot::set_webhook
#[serde(rename = "update_id")]
pub id: i32,