Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add logOut method #250

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions raw/src/requests/log_out.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use crate::requests::*;

/// Use this method to log out from the cloud Bot API server before launching the bot locally.
/// You must log out the bot before running it locally,
/// therwise there is no guarantee that the bot will receive updates.
/// After a successful call, you can immediately log in on a local server,
/// but will not be able to log in back to the cloud Bot API server for 10 minutes.
/// Returns True on success. Requires no parameters.
#[derive(Debug, Clone, PartialEq, PartialOrd, Serialize)]
#[must_use = "requests do nothing unless sent"]
pub struct LogOut;

impl Request for LogOut {
type Type = JsonRequestType<Self>;
type Response = JsonIdResponse<bool>;

fn serialize(&self) -> Result<HttpRequest, Error> {
Self::Type::serialize(RequestUrl::method("logOut"), self)
}
}
2 changes: 2 additions & 0 deletions raw/src/requests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub mod get_updates;
pub mod get_user_profile_photos;
pub mod kick_chat_member;
pub mod leave_chat;
pub mod log_out;
pub mod pin_chat_message;
pub mod send_audio;
pub mod send_chat_action;
Expand Down Expand Up @@ -55,6 +56,7 @@ pub use self::get_updates::*;
pub use self::get_user_profile_photos::*;
pub use self::kick_chat_member::*;
pub use self::leave_chat::*;
pub use self::log_out::*;
pub use self::pin_chat_message::*;
pub use self::send_audio::*;
pub use self::send_chat_action::*;
Expand Down