photon_api/apis/
configuration.rs

1/*
2 * photon-indexer
3 *
4 * Solana indexer for general compression
5 *
6 * The version of the OpenAPI document: 0.50.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11#[derive(Debug, Clone)]
12pub struct Configuration {
13    pub base_path: String,
14    pub user_agent: Option<String>,
15    pub client: reqwest::Client,
16    pub basic_auth: Option<BasicAuth>,
17    pub oauth_access_token: Option<String>,
18    pub bearer_access_token: Option<String>,
19    pub api_key: Option<ApiKey>,
20    // TODO: take an oauth2 token source, similar to the go one
21}
22
23pub type BasicAuth = (String, Option<String>);
24
25#[derive(Debug, Clone)]
26pub struct ApiKey {
27    pub prefix: Option<String>,
28    pub key: String,
29}
30
31impl Configuration {
32    pub fn new() -> Configuration {
33        Configuration::default()
34    }
35
36    pub fn new_with_api(url: String, api_key: Option<String>) -> Configuration {
37        Configuration {
38            base_path: url,
39            api_key: api_key.map(|key| ApiKey {
40                prefix: Some("api-key".to_string()),
41                key,
42            }),
43            ..Default::default()
44        }
45    }
46}
47
48impl Default for Configuration {
49    fn default() -> Self {
50        Configuration {
51            base_path: "https://devnet.helius-rpc.com?api-key=<api_key>".to_owned(),
52            user_agent: Some("OpenAPI-Generator/0.50.0/rust".to_owned()),
53            client: reqwest::Client::new(),
54            basic_auth: None,
55            oauth_access_token: None,
56            bearer_access_token: None,
57            api_key: None,
58        }
59    }
60}