pub fn new<I, K, R, T, Q>(client_id: I, client_secret: K, redirect_uri: R, token: T, refresh_token: Q) -> Self
    where
        I: ToString,
        K: ToString,
        R: ToString,
        T: ToString,
        Q: ToString,
    {
        let client = Client::builder().build();
        match client {
            Ok(c) => {
                let g = Gusto {
                    client_id: client_id.to_string(),
                    client_secret: client_secret.to_string(),
                    redirect_uri: redirect_uri.to_string(),
                    token: token.to_string(),
                    refresh_token: refresh_token.to_string(),

                    client: Arc::new(c),
                };

                if g.token.is_empty() || g.refresh_token.is_empty() {
                    // This is super hacky and a work around since there is no way to
                    // auth without using the browser.
                    println!("gusto consent URL: {}", g.user_consent_url());
                }
                // We do not refresh the access token since we leave that up to the
                // user to do so they can re-save it to their database.

                g
            }
            Err(e) => panic!("creating client failed: {:?}", e),
        }
    }
/// Create a new Gusto client struct. It takes a type that can convert into
/// an &str (`String` or `Vec<u8>` for example). As long as the function is
/// given a valid API key your requests will work.
Create a new Gusto client struct. It takes a type that can convert into
an &str (`String` or `Vec` for example). As long as the function is
given a valid API key your requests will work.
Create a new Gusto client struct . It takes a type that can convert into an &str ( ` String ` or ` Vec ` for example ) . As long as the function is given a valid API key your requests will work .
pub fn new<I, K, R, T, Q>(client_id: I, client_secret: K, redirect_uri: R, token: T, refresh_token: Q) -> Self
    where
        I: ToString,
        K: ToString,
        R: ToString,
        T: ToString,
        Q: ToString,
    {
        let client = Client::builder().build();
        match client {
            Ok(c) => {
                let g = Gusto {
                    client_id: client_id.to_string(),
                    client_secret: client_secret.to_string(),
                    redirect_uri: redirect_uri.to_string(),
                    token: token.to_string(),
                    refresh_token: refresh_token.to_string(),
                    client: Arc::new(c),
                };
                if g.token.is_empty() || g.refresh_token.is_empty() {
                    // This is super hacky and a work around since there is no way to
                    // auth without using the browser.
                    println!("gusto consent URL: {}", g.user_consent_url());
                }
                // We do not refresh the access token since we leave that up to the
                // user to do so they can re-save it to their database.
                g
            }
            Err(e) => panic!("creating client failed: {:?}", e),
        }
    }
pub fn new < I , K , R , T , Q > ( client_id : I , client_secret : K , redirect_uri : R , token : T , refresh_token : Q ) -> Self where I : ToString , K : ToString , R : ToString , T : ToString , Q : ToString , { let client = Client :: builder ( ) . build ( ) ; match client { Ok ( c ) => { let g = Gusto { client_id : client_id . to_string ( ) , client_secret : client_secret . to_string ( ) , redirect_uri : redirect_uri . to_string ( ) , token : token . to_string ( ) , refresh_token : refresh_token . to_string ( ) , client : Arc :: new ( c ) , } ; if g . token . is_empty ( ) || g . refresh_token . is_empty ( ) { // This is super hacky and a work around since there is no way to // auth without using the browser. println ! ( " " g user_consent_url ( ) ) ; } // We do not refresh the access token since we leave that up to the // user to do so they can re-save it to their database. g } Err ( e ) => panic ! ( " " e ) , } }
Create a new Gusto client struct.
Create a new Gusto client struct .
client_id
I
client_secret
K
redirect_uri
R
token
T
refresh_token
Q
client_id
I
client_secret
K
redirect_uri
R
token
T
refresh_token
Q