IgAuthenticator

Trait IgAuthenticator 

Source
pub trait IgAuthenticator: Send + Sync {
    // Required methods
    fn login<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<IgSession, AuthError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn refresh<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session: &'life1 IgSession,
    ) -> Pin<Box<dyn Future<Output = Result<IgSession, AuthError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn switch_account<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        session: &'life1 IgSession,
        account_id: &'life2 str,
        default_account: Option<bool>,
    ) -> Pin<Box<dyn Future<Output = Result<IgSession, AuthError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Trait for authenticating with the IG Markets API

Required Methods§

Source

fn login<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<IgSession, AuthError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Logs in to the IG Markets API and returns a new session

Source

fn refresh<'life0, 'life1, 'async_trait>( &'life0 self, session: &'life1 IgSession, ) -> Pin<Box<dyn Future<Output = Result<IgSession, AuthError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Refreshes an existing session with the IG Markets API

Source

fn switch_account<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, session: &'life1 IgSession, account_id: &'life2 str, default_account: Option<bool>, ) -> Pin<Box<dyn Future<Output = Result<IgSession, AuthError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Switches the active account for the current session

§Arguments
  • session - The current session
  • account_id - The ID of the account to switch to
  • default_account - Whether to set this account as the default (optional)
§Returns
  • A new session with the updated account ID

Implementors§