Skip to main content

bitwarden_api_api/apis/
organization_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 OrganizationBillingVNextApi: Send + Sync {
29    /// POST /organizations/{organizationId}/billing/vnext/credit/bitpay
30    async fn add_credit_via_bit_pay<'a>(
31        &self,
32        organization_id: &'a str,
33        bit_pay_credit_request: Option<models::BitPayCreditRequest>,
34    ) -> Result<(), Error>;
35
36    /// GET /organizations/{organizationId}/billing/vnext/address
37    async fn get_billing_address<'a>(&self, organization_id: &'a str) -> Result<(), Error>;
38
39    /// GET /organizations/{organizationId}/billing/vnext/credit
40    async fn get_credit<'a>(&self, organization_id: &'a str) -> Result<(), Error>;
41
42    /// GET /organizations/{organizationId}/billing/vnext/metadata
43    async fn get_metadata<'a>(&self, organization_id: &'a str) -> Result<(), Error>;
44
45    /// GET /organizations/{organizationId}/billing/vnext/payment-method
46    async fn get_payment_method<'a>(&self, organization_id: &'a str) -> Result<(), Error>;
47
48    /// GET /organizations/{organizationId}/billing/vnext/warnings
49    async fn get_warnings<'a>(&self, organization_id: &'a str) -> Result<(), Error>;
50
51    /// POST /organizations/{organizationId}/billing/vnext/subscription/restart
52    async fn restart_subscription<'a>(
53        &self,
54        organization_id: &'a str,
55        restart_subscription_request: Option<models::RestartSubscriptionRequest>,
56    ) -> Result<(), Error>;
57
58    /// PUT /organizations/{organizationId}/billing/vnext/address
59    async fn update_billing_address<'a>(
60        &self,
61        organization_id: &'a str,
62        billing_address_request: Option<models::BillingAddressRequest>,
63    ) -> Result<(), Error>;
64
65    /// PUT /organizations/{organizationId}/billing/vnext/payment-method
66    async fn update_payment_method<'a>(
67        &self,
68        organization_id: &'a str,
69        tokenized_payment_method_request: Option<models::TokenizedPaymentMethodRequest>,
70    ) -> Result<(), Error>;
71}
72
73pub struct OrganizationBillingVNextApiClient {
74    configuration: Arc<configuration::Configuration>,
75}
76
77impl OrganizationBillingVNextApiClient {
78    pub fn new(configuration: Arc<configuration::Configuration>) -> Self {
79        Self { configuration }
80    }
81}
82
83#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
84#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
85impl OrganizationBillingVNextApi for OrganizationBillingVNextApiClient {
86    async fn add_credit_via_bit_pay<'a>(
87        &self,
88        organization_id: &'a str,
89        bit_pay_credit_request: Option<models::BitPayCreditRequest>,
90    ) -> Result<(), Error> {
91        let local_var_configuration = &self.configuration;
92
93        let local_var_client = &local_var_configuration.client;
94
95        let local_var_uri_str = format!(
96            "{}/organizations/{organizationId}/billing/vnext/credit/bitpay",
97            local_var_configuration.base_path,
98            organizationId = crate::apis::urlencode(organization_id)
99        );
100        let mut local_var_req_builder =
101            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
102
103        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
104        local_var_req_builder = local_var_req_builder.json(&bit_pay_credit_request);
105
106        bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
107    }
108
109    async fn get_billing_address<'a>(&self, organization_id: &'a str) -> Result<(), Error> {
110        let local_var_configuration = &self.configuration;
111
112        let local_var_client = &local_var_configuration.client;
113
114        let local_var_uri_str = format!(
115            "{}/organizations/{organizationId}/billing/vnext/address",
116            local_var_configuration.base_path,
117            organizationId = crate::apis::urlencode(organization_id)
118        );
119        let mut local_var_req_builder =
120            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
121
122        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
123
124        bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
125    }
126
127    async fn get_credit<'a>(&self, organization_id: &'a str) -> Result<(), Error> {
128        let local_var_configuration = &self.configuration;
129
130        let local_var_client = &local_var_configuration.client;
131
132        let local_var_uri_str = format!(
133            "{}/organizations/{organizationId}/billing/vnext/credit",
134            local_var_configuration.base_path,
135            organizationId = crate::apis::urlencode(organization_id)
136        );
137        let mut local_var_req_builder =
138            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
139
140        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
141
142        bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
143    }
144
145    async fn get_metadata<'a>(&self, organization_id: &'a str) -> Result<(), Error> {
146        let local_var_configuration = &self.configuration;
147
148        let local_var_client = &local_var_configuration.client;
149
150        let local_var_uri_str = format!(
151            "{}/organizations/{organizationId}/billing/vnext/metadata",
152            local_var_configuration.base_path,
153            organizationId = crate::apis::urlencode(organization_id)
154        );
155        let mut local_var_req_builder =
156            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
157
158        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
159
160        bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
161    }
162
163    async fn get_payment_method<'a>(&self, organization_id: &'a str) -> Result<(), Error> {
164        let local_var_configuration = &self.configuration;
165
166        let local_var_client = &local_var_configuration.client;
167
168        let local_var_uri_str = format!(
169            "{}/organizations/{organizationId}/billing/vnext/payment-method",
170            local_var_configuration.base_path,
171            organizationId = crate::apis::urlencode(organization_id)
172        );
173        let mut local_var_req_builder =
174            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
175
176        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
177
178        bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
179    }
180
181    async fn get_warnings<'a>(&self, organization_id: &'a str) -> Result<(), Error> {
182        let local_var_configuration = &self.configuration;
183
184        let local_var_client = &local_var_configuration.client;
185
186        let local_var_uri_str = format!(
187            "{}/organizations/{organizationId}/billing/vnext/warnings",
188            local_var_configuration.base_path,
189            organizationId = crate::apis::urlencode(organization_id)
190        );
191        let mut local_var_req_builder =
192            local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
193
194        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
195
196        bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
197    }
198
199    async fn restart_subscription<'a>(
200        &self,
201        organization_id: &'a str,
202        restart_subscription_request: Option<models::RestartSubscriptionRequest>,
203    ) -> Result<(), Error> {
204        let local_var_configuration = &self.configuration;
205
206        let local_var_client = &local_var_configuration.client;
207
208        let local_var_uri_str = format!(
209            "{}/organizations/{organizationId}/billing/vnext/subscription/restart",
210            local_var_configuration.base_path,
211            organizationId = crate::apis::urlencode(organization_id)
212        );
213        let mut local_var_req_builder =
214            local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
215
216        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
217        local_var_req_builder = local_var_req_builder.json(&restart_subscription_request);
218
219        bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
220    }
221
222    async fn update_billing_address<'a>(
223        &self,
224        organization_id: &'a str,
225        billing_address_request: Option<models::BillingAddressRequest>,
226    ) -> Result<(), Error> {
227        let local_var_configuration = &self.configuration;
228
229        let local_var_client = &local_var_configuration.client;
230
231        let local_var_uri_str = format!(
232            "{}/organizations/{organizationId}/billing/vnext/address",
233            local_var_configuration.base_path,
234            organizationId = crate::apis::urlencode(organization_id)
235        );
236        let mut local_var_req_builder =
237            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
238
239        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
240        local_var_req_builder = local_var_req_builder.json(&billing_address_request);
241
242        bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
243    }
244
245    async fn update_payment_method<'a>(
246        &self,
247        organization_id: &'a str,
248        tokenized_payment_method_request: Option<models::TokenizedPaymentMethodRequest>,
249    ) -> Result<(), Error> {
250        let local_var_configuration = &self.configuration;
251
252        let local_var_client = &local_var_configuration.client;
253
254        let local_var_uri_str = format!(
255            "{}/organizations/{organizationId}/billing/vnext/payment-method",
256            local_var_configuration.base_path,
257            organizationId = crate::apis::urlencode(organization_id)
258        );
259        let mut local_var_req_builder =
260            local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
261
262        local_var_req_builder = local_var_req_builder.with_extension(AuthRequired::Bearer);
263        local_var_req_builder = local_var_req_builder.json(&tokenized_payment_method_request);
264
265        bitwarden_api_base::process_with_empty_response(local_var_req_builder).await
266    }
267}