Skip to main content

rocie_client/apis/
configuration.rs

1// rocie - An enterprise grocery management system
2//
3// Copyright (C) 2026 Benedikt Peetz <benedikt.peetz@b-peetz.de>
4// SPDX-License-Identifier: GPL-3.0-or-later
5//
6// This file is part of Rocie.
7//
8// You should have received a copy of the License along with this program.
9// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
10
11/*
12 * rocie-server
13 *
14 * An enterprise grocery management system - server
15 *
16 * The version of the OpenAPI document: 0.1.0
17 * Contact: benedikt.peetz@b-peetz.de
18 * Generated by: https://openapi-generator.tech
19 */
20
21#[derive(Debug, Clone)]
22pub struct Configuration {
23    pub base_path: String,
24    pub user_agent: Option<String>,
25    pub client: reqwest::Client,
26    pub basic_auth: Option<BasicAuth>,
27    pub oauth_access_token: Option<String>,
28    pub bearer_access_token: Option<String>,
29    pub api_key: Option<ApiKey>,
30}
31
32pub type BasicAuth = (String, Option<String>);
33
34#[derive(Debug, Clone)]
35pub struct ApiKey {
36    pub prefix: Option<String>,
37    pub key: String,
38}
39
40impl Configuration {
41    pub fn new() -> Configuration {
42        Configuration::default()
43    }
44}
45
46impl Default for Configuration {
47    fn default() -> Self {
48        let client = {
49            let builder = reqwest::Client::builder();
50
51            // The browser handles cookies for us, so we don't need to have a storage for them.
52            #[cfg(not(any(target_arch = "wasm32", target_arch = "wasm64")))]
53            let builder = builder.cookie_store(true);
54
55            builder.build().expect("to be not missconfigured")
56        };
57
58        Configuration {
59            base_path: "http://localhost".to_owned(),
60            user_agent: Some("OpenAPI-Generator/0.1.0/rust".to_owned()),
61            client,
62            basic_auth: None,
63            oauth_access_token: None,
64            bearer_access_token: None,
65            api_key: None,
66        }
67    }
68}