golem_gateway_client/
context.rs

1use reqwest::Client;
2use reqwest::Url;
3
4#[derive(Debug, Clone)]
5pub enum Security {
6    Empty,
7    Bearer(String),
8}
9
10impl Security {
11    pub fn bearer<S: Into<String>>(s: S) -> Security { Security::Bearer(s.into()) }
12}
13
14#[derive(Debug, Clone)]
15pub struct Context {
16    pub client: Client,
17    pub base_url: Url,
18    pub security_token: Security,
19}
20
21impl Context {
22    pub fn bearer_token(&self) -> Option<&str> {
23        match &self.security_token{
24            Security::Empty => None,
25            Security::Bearer(token) => Some(token),
26        }
27    }
28}