pub async fn store_session_token(&mut self) -> Result<(), ApiError> {
        if self.authentication_data.using_token() {
            debug!("Using personal access token; getting a session token is a no-op");
            return Ok(());
        }
        debug!("Getting a session token from login_id and password");
        let url = format!("{}/api/v4/users/login", self.instance_url);
        let resp = self
            .client
            .post(&url)
            .json(&json!({
                "login_id": self.authentication_data.login_id.as_ref().unwrap(),
                "password": self.authentication_data.password.as_ref().unwrap(),
            }))
            .send()
            .await?;
        let session_token = resp
            .headers()
            .get("Token")
            .ok_or_else(|| ApiError::CouldNotGetToken(resp.status().as_u16()))?;
        self.auth_token = Some(session_token.to_str()?.to_string());
        debug!("Session token retrieved and stored");
        Ok(())
    }
/// Get a session token from the stored login_id and password.
/// Required when using login_id and password authentication,
/// before making any calls to the instance API.
///
/// Does nothing if the `AuthenticationData` this struct instance
/// was created with used a personal access token.
///
/// # Example
///
/// ```rust,no_run
/// use mattermost_api::prelude::*;
/// # async fn run() {
/// let auth = AuthenticationData::from_password("you@example.com", "password");
/// let mut api = Mattermost::new("https://your-mattermost-instance.com", auth);
/// api.store_session_token().await.unwrap();
/// # }
/// ```
Get a session token from the stored login_id and password.
Required when using login_id and password authentication,
before making any calls to the instance API.

Does nothing if the `AuthenticationData` this struct instance
was created with used a personal access token.
Get a session token from the stored login_id and password . Required when using login_id and password authentication before making any calls to the instance API . Does nothing if the ` AuthenticationData ` this struct instance was created with used a personal access token .
pub async fn store_session_token(&mut self) -> Result<(), ApiError> {
        if self.authentication_data.using_token() {
            debug!("Using personal access token; getting a session token is a no-op");
            return Ok(());
        }
        debug!("Getting a session token from login_id and password");
        let url = format!("{}/api/v4/users/login", self.instance_url);
        let resp = self
            .client
            .post(&url)
            .json(&json!({
                "login_id": self.authentication_data.login_id.as_ref().unwrap(),
                "password": self.authentication_data.password.as_ref().unwrap(),
            }))
            .send()
            .await?;
        let session_token = resp
            .headers()
            .get("Token")
            .ok_or_else(|| ApiError::CouldNotGetToken(resp.status().as_u16()))?;
        self.auth_token = Some(session_token.to_str()?.to_string());
        debug!("Session token retrieved and stored");
        Ok(())
    }
pub async fn store_session_token ( & mut self ) -> Result < ( ) , ApiError > { if self . authentication_data . using_token ( ) { debug ! ( " " ) ; return Ok ( ( ) ) ; } debug ! ( " " ) ; let url = format ! ( " " self instance_url ) ; let resp = self . client . post ( & url ) . json ( & json ! ( { " " self authentication_data login_id as_ref ( ) unwrap ( ) " " self authentication_data password as_ref ( ) unwrap ( ) } ) ) . send ( ) . await ? ; let session_token = resp . headers ( ) . get ( " " ) . ok_or_else ( | | ApiError :: CouldNotGetToken ( resp . status ( ) . as_u16 ( ) ) ) ? ; self . auth_token = Some ( session_token . to_str ( ) ? . to_string ( ) ) ; debug ! ( " " ) ; Ok ( ( ) ) }
Get a session token from the stored login_id and password.
Get a session token from the stored login_id and password .
&mut self
&mut self
example
```rust,no_run
use mattermost_api::prelude::*.
` ` ` rust no_run use mattermost_api :: prelude :: * .
async fn run() {
None
}
None