golem-gateway-client 0.0.58

Client for Golem Cloud's REST API
Documentation
use reqwest::Client;
use reqwest::Url;

#[derive(Debug, Clone)]
pub enum Security {
    Empty,
    Bearer(String),
}

impl Security {
    pub fn bearer<S: Into<String>>(s: S) -> Security { Security::Bearer(s.into()) }
}

#[derive(Debug, Clone)]
pub struct Context {
    pub client: Client,
    pub base_url: Url,
    pub security_token: Security,
}

impl Context {
    pub fn bearer_token(&self) -> Option<&str> {
        match &self.security_token{
            Security::Empty => None,
            Security::Bearer(token) => Some(token),
        }
    }
}