Struct sf_api::session::CharacterSession
source · pub struct CharacterSession { /* private fields */ }
Implementations§
source§impl CharacterSession
impl CharacterSession
pub fn new(username: &str, password: &str, server: ServerConnection) -> Self
pub fn new_hashed( username: &str, pw_hash: PWHash, server: ServerConnection ) -> Self
pub fn server_url(&self) -> &Url
sourcepub fn has_session_id(&self) -> bool
pub fn has_session_id(&self) -> bool
Checks if this session has ever been able to successfully login to the
server to establish a session id. You should not need to check this, as
login()
should return error on unsuccessfull logins, but if you want
to make sure, you can make sure here
sourcepub async fn login(&mut self) -> Result<Response, SFError>
pub async fn login(&mut self) -> Result<Response, SFError>
Clears the current session and sends a login request to the server. Returns the parsed response from the server.
sourcepub async fn register(
username: &str,
password: &str,
server: ServerConnection,
gender: Gender,
race: Race,
class: Class
) -> Result<(Self, Response), SFError>
pub async fn register( username: &str, password: &str, server: ServerConnection, gender: Gender, race: Race, class: Class ) -> Result<(Self, Response), SFError>
Registers a new character on the server. If everything works, the logged in character session and its login response will be returned
sourcepub async fn send_command_raw(
&self,
command: &Command
) -> Result<Response, SFError>
pub async fn send_command_raw( &self, command: &Command ) -> Result<Response, SFError>
The internal version send_command
. It allows you to send requests
with only a normal ref, because this version does not update the
cryptography settings of this session, if the server responds with them.
If you do not expect the server to send you new crypto settings, because
you only do predictable simple requests (no login, etc), or you
want to update them yourself, because that is easier to handle for you,
you can use this function to increase your commands/account/sec speed
sourcepub async fn send_command(
&mut self,
command: &Command
) -> Result<Response, SFError>
pub async fn send_command( &mut self, command: &Command ) -> Result<Response, SFError>
Encode and send a command to the server, decrypts and parses its response and returns the response. When this returns an error, the Session might be in an invalid state, so you should login again just to be safe
pub fn update(&mut self, res: &Response)
pub fn username(&self) -> &str
sourcepub async fn renew_sso_creds(&mut self) -> Result<(), SFError>
pub async fn renew_sso_creds(&mut self) -> Result<(), SFError>
Retrieves new sso credentials from its sf account. If the account already has new creds stored, these are read, otherwise the account will be logged in again
Trait Implementations§
source§impl Clone for CharacterSession
impl Clone for CharacterSession
source§fn clone(&self) -> CharacterSession
fn clone(&self) -> CharacterSession
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more