pub async fn new(app_id: &str) -> Self {
        let response = Token::get(app_id).await;
        let content = Token::parse(response).await;
        let value = content.get("token");
        match value {
            Some(token) => Token {
                value: token.clone(),
                created_at: SystemTime::now(),
            },
            None => panic!("Failed to retrieve a token from RARBG API."),
        }
    }
/// Create a Token with the value obtained from the API.
/// This token can be use to make requests to the API.
///
/// # Panics
///
/// Panics if a token cannot be retrieve from the API.
///
/// # Example
///
/// ```no_run
/// use rarbg_api::token::Token;
///
/// #[tokio::main]
/// async fn main() {
///     let token = Token::new("RustExample").await;
/// }
/// ```
Create a Token with the value obtained from the API.
This token can be use to make requests to the API.
Create a Token with the value obtained from the API . This token can be use to make requests to the API .
pub async fn new(app_id: &str) -> Self {
        let response = Token::get(app_id).await;
        let content = Token::parse(response).await;
        let value = content.get("token");
        match value {
            Some(token) => Token {
                value: token.clone(),
                created_at: SystemTime::now(),
            },
            None => panic!("Failed to retrieve a token from RARBG API."),
        }
    }
pub async fn new ( app_id : & str ) -> Self { let response = Token :: get ( app_id ) . await ; let content = Token :: parse ( response ) . await ; let value = content . get ( " " ) ; match value { Some ( token ) => Token { value : token . clone ( ) , created_at : SystemTime :: now ( ) , } , None => panic ! ( " " ) , } }
Create a Token with the value obtained from the API.
Create a Token with the value obtained from the API .
app_id
&str
panics
Panics if a token cannot be retrieve from the API.
Panics if a token cannot be retrieve from the API .
example
```no_run
use rarbg_api::token::Token.
` ` ` no_run use rarbg_api :: token :: Token .
[tokio::main]
async fn main() {
let token = Token::new("RustExample").await;
}
```
async fn main () { let token = Token :: new ( " RustExample " ) . await ; } ` ` `