pub enum APIEndpoint {
GetUpdates,
GetMe,
LogOut,
Close,
SendMessage,
SetMyCommands,
GetMyCommands,
SetChatMenuButton,
GetChatMenuButton,
SetMyDefaultAdministratorRights,
GetMyDefaultAdministratorRights,
DeleteMyCommands,
ForwardMessage,
CopyMessage,
SendPhoto,
SendAudio,
SendDocument,
SendVideo,
SendAnimation,
SendVoice,
SendVideoNote,
SendMediaGroup,
SendLocation,
EditMessageLiveLocation,
StopMessageLiveLocation,
SendVenue,
SendContact,
SendPoll,
SendDice,
SendChatAction,
GetUserProfilePhotos,
GetFile,
BanChatMember,
UnbanChatMember,
RestrictChatMember,
PromoteChatMember,
SetChatAdministratorCustomTitle,
BanChatSenderChat,
UnbanChatSenderChat,
SetChatPermissions,
ExportChatInviteLink,
CreateChatInviteLink,
EditChatInviteLink,
RevokeChatInviteLink,
ApproveChatJoinRequest,
DeclineChatJoinRequest,
SetChatPhoto,
DeleteChatPhoto,
SetChatTitle,
SetChatDescription,
PinChatMessage,
UnpinChatMessage,
UnpinAllChatMessages,
LeaveChat,
GetChat,
GetChatAdministrators,
GetChatMemberCount,
GetChatMember,
SetChatStickerSet,
DeleteChatStickerSet,
GetForumTopicIconStickers,
CreateForumTopic,
EditForumTopic,
CloseForumTopic,
ReopenForumTopic,
DeleteForumTopic,
EditGeneralForumTopic,
CloseGeneralForumTopic,
ReopenGeneralForumTopic,
HideGeneralForumTopic,
UnhideGeneralForumTopic,
UnpinAllForumTopicMessages,
AnswerCallbackQuery,
EditMessageText,
EditMessageCaption,
EditMessageMedia,
EditMessageReplyMarkup,
StopPoll,
DeleteMessage,
SendSticker,
GetStickerSet,
GetCustomEmojiStickers,
UploadStickerFile,
CreateNewStickerSet,
AddStickerToSet,
SetStickerPositionInSet,
DeleteStickerFromSet,
SetStickerSetThumb,
AnswerInlineQuery,
AnswerWebAppQuery,
SendInvoice,
CreateInvoiceLink,
AnswerShippingQuery,
AnswerPreCheckoutQuery,
SendGame,
SetGameScore,
GetGameHighScores,
SetWebhook,
SetPassportDataErrors,
DeleteWebhook,
GetWebhookInfo,
Other(String),
}
impl APIEndpoint {
pub fn as_str(&self) -> &str {
match *self {
Self::GetUpdates => "getUpdates",
Self::GetMe => "getMe",
Self::LogOut => "logOut",
Self::Close => "close",
Self::SendMessage => "sendMessage",
Self::SetMyCommands => "setMyCommands",
Self::GetMyCommands => "getMyCommands",
Self::SetChatMenuButton => "setChatMenuButton",
Self::GetChatMenuButton => "getChatMenuButton",
Self::SetMyDefaultAdministratorRights => "setMyDefaultAdministratorRights",
Self::GetMyDefaultAdministratorRights => "getMyDefaultAdministratorRights",
Self::DeleteMyCommands => "deleteMyCommands",
Self::CopyMessage => "copyMessage",
Self::ForwardMessage => "forwardMessage",
Self::SendPhoto => "sendPhoto",
Self::SendAudio => "sendAudio",
Self::SendDocument => "sendDocument",
Self::SendVideo => "sendVideo",
Self::SendAnimation => "sendAnimation",
Self::SendVoice => "sendVoice",
Self::SendVideoNote => "sendVideoNote",
Self::SendMediaGroup => "sendMediaGroup",
Self::SendLocation => "sendLocation",
Self::EditMessageLiveLocation => "editMessageLiveLocation",
Self::StopMessageLiveLocation => "stopMessageLiveLocation",
Self::SendVenue => "sendVenue",
Self::SendContact => "sendContact",
Self::SendPoll => "sendPoll",
Self::SendDice => "sendDice",
Self::SendChatAction => "sendChatAction",
Self::GetUserProfilePhotos => "getUserProfilePhotos",
Self::GetFile => "getFile",
Self::BanChatMember => "banChatMember",
Self::UnbanChatMember => "unbanChatMember",
Self::RestrictChatMember => "restrictChatMember",
Self::PromoteChatMember => "promoteChatMember",
Self::SetChatAdministratorCustomTitle => "setChatAdministratorCustomTitle",
Self::BanChatSenderChat => "banChatSenderChat",
Self::UnbanChatSenderChat => "unbanChatSenderChat",
Self::SetChatPermissions => "setChatPermissions",
Self::ExportChatInviteLink => "exportChatInviteLink",
Self::CreateChatInviteLink => "createChatInviteLink",
Self::EditChatInviteLink => "editChatInviteLink",
Self::RevokeChatInviteLink => "revokeChatInviteLink",
Self::ApproveChatJoinRequest => "approveChatJoinRequest",
Self::DeclineChatJoinRequest => "declineChatJoinRequest",
Self::SetChatPhoto => "setChatPhoto",
Self::DeleteChatPhoto => "deleteChatPhoto",
Self::SetChatTitle => "setChatTitle",
Self::SetChatDescription => "setChatDescription",
Self::PinChatMessage => "pinChatMessage",
Self::UnpinChatMessage => "unpinChatMessage",
Self::UnpinAllChatMessages => "unpinAllChatMessages",
Self::LeaveChat => "leaveChat",
Self::GetChat => "getChat",
Self::GetChatAdministrators => "getChatAdministrators",
Self::GetChatMemberCount => "getChatMemberCount",
Self::GetChatMember => "getChatMember",
Self::SetChatStickerSet => "setChatStickerSet",
Self::DeleteChatStickerSet => "deleteChatStickerSet",
Self::GetForumTopicIconStickers => "getForumTopicIconStickers",
Self::CreateForumTopic => "createForumTopic",
Self::EditForumTopic => "editForumTopic",
Self::CloseForumTopic => "closeForumTopic",
Self::ReopenForumTopic => "reopenForumTopic",
Self::DeleteForumTopic => "deleteForumTopic",
Self::UnpinAllForumTopicMessages => "unpinAllForumTopicMessages",
Self::EditGeneralForumTopic => "editGeneralForumTopic",
Self::CloseGeneralForumTopic => "closeGeneralForumTopic",
Self::ReopenGeneralForumTopic => "reopenGeneralForumTopic",
Self::HideGeneralForumTopic => "hideGeneralForumTopic",
Self::UnhideGeneralForumTopic => "unhideGeneralForumTopic",
Self::AnswerCallbackQuery => "answerCallbackQuery",
Self::EditMessageText => "editMessageText",
Self::EditMessageCaption => "editMessageCaption",
Self::EditMessageMedia => "editMessageMedia",
Self::EditMessageReplyMarkup => "editMessageReplyMarkup",
Self::StopPoll => "stopPoll",
Self::DeleteMessage => "deleteMessage",
Self::SendSticker => "sendSticker",
Self::GetStickerSet => "getStickerSet",
Self::GetCustomEmojiStickers => "getCustomEmojiStickers",
Self::UploadStickerFile => "uploadStickerFile",
Self::CreateNewStickerSet => "createNewStickerSet",
Self::AddStickerToSet => "addStickerToSet",
Self::SetStickerPositionInSet => "setStickerPositionInSet",
Self::DeleteStickerFromSet => "deleteStickerFromSet",
Self::SetStickerSetThumb => "setStickerSetThumb",
Self::AnswerInlineQuery => "answerInlineQuery",
Self::AnswerWebAppQuery => "answerWebAppQuery",
Self::SendGame => "sendGame",
Self::SetGameScore => "setGameScore",
Self::GetGameHighScores => "getGameHighScores",
Self::SendInvoice => "sendInvoice",
Self::CreateInvoiceLink => "createInvoiceLink",
Self::AnswerShippingQuery => "answerShippingQuery",
Self::AnswerPreCheckoutQuery => "answerPreCheckoutQuery",
Self::SetWebhook => "setWebHook",
Self::SetPassportDataErrors => "setPassportDataErrors",
Self::DeleteWebhook => "deleteWebhook",
Self::GetWebhookInfo => "getWebhookInfo",
Self::Other(ref e) => e,
}
}
}
impl std::fmt::Display for APIEndpoint {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}
impl std::fmt::Debug for APIEndpoint {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_tuple("telegram::APIEndpoint")
.field(&self.as_str().to_owned())
.finish()
}
}
impl From<String> for APIEndpoint {
fn from(string: String) -> APIEndpoint {
APIEndpoint::Other(string)
}
}