Skip to main content

bitwarden_api_api/apis/
self_hosted_account_billing_v_next_api.rs

1/*
2 * Bitwarden Internal API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: latest
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use std::sync::Arc;
12
13use async_trait::async_trait;
14#[cfg(feature = "mockall")]
15use mockall::automock;
16use reqwest;
17use serde::{Deserialize, Serialize, de::Error as _};
18
19use super::{Error, configuration};
20use crate::{
21    apis::{AuthRequired, ContentType, ResponseContent},
22    models,
23};
24
25#[cfg_attr(feature = "mockall", automock)]
26#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
27#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
28pub trait SelfHostedAccountBillingVNextApi: Send + Sync {
29    /// POST /account/billing/vnext/self-host/license
30    async fn upload_license<'a>(&self, license: std::path::PathBuf) -> Result<(), Error>;
31}
32
33pub struct SelfHostedAccountBillingVNextApiClient {
34    configuration: Arc<configuration::Configuration>,
35}
36
37impl SelfHostedAccountBillingVNextApiClient {
38    pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
39        Self { configuration }
40    }
41}
42
43#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
44#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
45impl SelfHostedAccountBillingVNextApi for SelfHostedAccountBillingVNextApiClient {
46    async fn upload_license<'a>(&self, license: std::path::PathBuf) -> Result<(), Error> {
47        let local_var_configuration = &self.configuration;
48
49        let local_var_client = &local_var_configuration.client;
50
51        let local_var_uri_str = format!(
52            "{}/account/billing/vnext/self-host/license",
53            local_var_configuration.base_path
54        );
55        let mut local_var_req_builder =
56            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
57
58        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
59        let mut local_var_form = reqwest::multipart::Form::new();
60        // TODO: support file upload for 'license' parameter
61        local_var_req_builder = local_var_req_builder.multipart(local_var_form);
62
63        bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
64    }
65}