1use reqwest;
13
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum CreatePaymentAccountError {
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
27#[serde(untagged)]
28pub enum CreatePaymentMethodError {
29 UnknownValue(serde_json::Value),
30}
31
32#[derive(Debug, Clone, Serialize, Deserialize)]
34#[serde(untagged)]
35pub enum CreateVatTypeError {
36 UnknownValue(serde_json::Value),
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum DeletePaymentAccountError {
43 UnknownValue(serde_json::Value),
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum DeletePaymentMethodError {
50 UnknownValue(serde_json::Value),
51}
52
53#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum DeleteVatTypeError {
57 UnknownValue(serde_json::Value),
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum GetPaymentAccountError {
64 UnknownValue(serde_json::Value),
65}
66
67#[derive(Debug, Clone, Serialize, Deserialize)]
69#[serde(untagged)]
70pub enum GetPaymentMethodError {
71 UnknownValue(serde_json::Value),
72}
73
74#[derive(Debug, Clone, Serialize, Deserialize)]
76#[serde(untagged)]
77pub enum GetVatTypeError {
78 UnknownValue(serde_json::Value),
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum ModifyPaymentAccountError {
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum ModifyPaymentMethodError {
92 UnknownValue(serde_json::Value),
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum ModifyVatTypeError {
99 UnknownValue(serde_json::Value),
100}
101
102
103pub async fn create_payment_account(configuration: &configuration::Configuration, company_id: i32, create_payment_account_request: Option<models::CreatePaymentAccountRequest>) -> Result<models::CreatePaymentAccountResponse, Error<CreatePaymentAccountError>> {
105 let local_var_configuration = configuration;
106
107 let local_var_client = &local_var_configuration.client;
108
109 let local_var_uri_str = format!("{}/c/{company_id}/settings/payment_accounts", local_var_configuration.base_path, company_id=company_id);
110 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
111
112 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
113 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
114 }
115 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
116 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
117 };
118 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
119 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
120 };
121 local_var_req_builder = local_var_req_builder.json(&create_payment_account_request);
122
123 let local_var_req = local_var_req_builder.build()?;
124 let local_var_resp = local_var_client.execute(local_var_req).await?;
125
126 let local_var_status = local_var_resp.status();
127 let local_var_content = local_var_resp.text().await?;
128
129 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
130 serde_json::from_str(&local_var_content).map_err(Error::from)
131 } else {
132 let local_var_entity: Option<CreatePaymentAccountError> = serde_json::from_str(&local_var_content).ok();
133 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
134 Err(Error::ResponseError(local_var_error))
135 }
136}
137
138pub async fn create_payment_method(configuration: &configuration::Configuration, company_id: i32, create_payment_method_request: Option<models::CreatePaymentMethodRequest>) -> Result<models::CreatePaymentMethodResponse, Error<CreatePaymentMethodError>> {
140 let local_var_configuration = configuration;
141
142 let local_var_client = &local_var_configuration.client;
143
144 let local_var_uri_str = format!("{}/c/{company_id}/settings/payment_methods", local_var_configuration.base_path, company_id=company_id);
145 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
146
147 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
148 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
149 }
150 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
151 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
152 };
153 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
154 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
155 };
156 local_var_req_builder = local_var_req_builder.json(&create_payment_method_request);
157
158 let local_var_req = local_var_req_builder.build()?;
159 let local_var_resp = local_var_client.execute(local_var_req).await?;
160
161 let local_var_status = local_var_resp.status();
162 let local_var_content = local_var_resp.text().await?;
163
164 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
165 serde_json::from_str(&local_var_content).map_err(Error::from)
166 } else {
167 let local_var_entity: Option<CreatePaymentMethodError> = serde_json::from_str(&local_var_content).ok();
168 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
169 Err(Error::ResponseError(local_var_error))
170 }
171}
172
173pub async fn create_vat_type(configuration: &configuration::Configuration, company_id: i32, create_vat_type_request: Option<models::CreateVatTypeRequest>) -> Result<models::CreateVatTypeResponse, Error<CreateVatTypeError>> {
175 let local_var_configuration = configuration;
176
177 let local_var_client = &local_var_configuration.client;
178
179 let local_var_uri_str = format!("{}/c/{company_id}/settings/vat_types", local_var_configuration.base_path, company_id=company_id);
180 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
181
182 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
183 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
184 }
185 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
186 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
187 };
188 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
189 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
190 };
191 local_var_req_builder = local_var_req_builder.json(&create_vat_type_request);
192
193 let local_var_req = local_var_req_builder.build()?;
194 let local_var_resp = local_var_client.execute(local_var_req).await?;
195
196 let local_var_status = local_var_resp.status();
197 let local_var_content = local_var_resp.text().await?;
198
199 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
200 serde_json::from_str(&local_var_content).map_err(Error::from)
201 } else {
202 let local_var_entity: Option<CreateVatTypeError> = serde_json::from_str(&local_var_content).ok();
203 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
204 Err(Error::ResponseError(local_var_error))
205 }
206}
207
208pub async fn delete_payment_account(configuration: &configuration::Configuration, company_id: i32, payment_account_id: i32) -> Result<(), Error<DeletePaymentAccountError>> {
210 let local_var_configuration = configuration;
211
212 let local_var_client = &local_var_configuration.client;
213
214 let local_var_uri_str = format!("{}/c/{company_id}/settings/payment_accounts/{payment_account_id}", local_var_configuration.base_path, company_id=company_id, payment_account_id=payment_account_id);
215 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
216
217 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
218 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
219 }
220 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
221 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
222 };
223 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
224 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
225 };
226
227 let local_var_req = local_var_req_builder.build()?;
228 let local_var_resp = local_var_client.execute(local_var_req).await?;
229
230 let local_var_status = local_var_resp.status();
231 let local_var_content = local_var_resp.text().await?;
232
233 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
234 Ok(())
235 } else {
236 let local_var_entity: Option<DeletePaymentAccountError> = serde_json::from_str(&local_var_content).ok();
237 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
238 Err(Error::ResponseError(local_var_error))
239 }
240}
241
242pub async fn delete_payment_method(configuration: &configuration::Configuration, company_id: i32, payment_method_id: i32) -> Result<(), Error<DeletePaymentMethodError>> {
244 let local_var_configuration = configuration;
245
246 let local_var_client = &local_var_configuration.client;
247
248 let local_var_uri_str = format!("{}/c/{company_id}/settings/payment_methods/{payment_method_id}", local_var_configuration.base_path, company_id=company_id, payment_method_id=payment_method_id);
249 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
250
251 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
252 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
253 }
254 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
255 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
256 };
257 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
258 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
259 };
260
261 let local_var_req = local_var_req_builder.build()?;
262 let local_var_resp = local_var_client.execute(local_var_req).await?;
263
264 let local_var_status = local_var_resp.status();
265 let local_var_content = local_var_resp.text().await?;
266
267 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
268 Ok(())
269 } else {
270 let local_var_entity: Option<DeletePaymentMethodError> = serde_json::from_str(&local_var_content).ok();
271 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
272 Err(Error::ResponseError(local_var_error))
273 }
274}
275
276pub async fn delete_vat_type(configuration: &configuration::Configuration, company_id: i32, vat_type_id: i32) -> Result<(), Error<DeleteVatTypeError>> {
278 let local_var_configuration = configuration;
279
280 let local_var_client = &local_var_configuration.client;
281
282 let local_var_uri_str = format!("{}/c/{company_id}/settings/vat_types/{vat_type_id}", local_var_configuration.base_path, company_id=company_id, vat_type_id=vat_type_id);
283 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
284
285 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
286 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
287 }
288 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
289 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
290 };
291 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
292 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
293 };
294
295 let local_var_req = local_var_req_builder.build()?;
296 let local_var_resp = local_var_client.execute(local_var_req).await?;
297
298 let local_var_status = local_var_resp.status();
299 let local_var_content = local_var_resp.text().await?;
300
301 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
302 Ok(())
303 } else {
304 let local_var_entity: Option<DeleteVatTypeError> = serde_json::from_str(&local_var_content).ok();
305 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
306 Err(Error::ResponseError(local_var_error))
307 }
308}
309
310pub async fn get_payment_account(configuration: &configuration::Configuration, company_id: i32, payment_account_id: i32, fields: Option<&str>, fieldset: Option<&str>) -> Result<models::GetPaymentAccountResponse, Error<GetPaymentAccountError>> {
312 let local_var_configuration = configuration;
313
314 let local_var_client = &local_var_configuration.client;
315
316 let local_var_uri_str = format!("{}/c/{company_id}/settings/payment_accounts/{payment_account_id}", local_var_configuration.base_path, company_id=company_id, payment_account_id=payment_account_id);
317 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
318
319 if let Some(ref local_var_str) = fields {
320 local_var_req_builder = local_var_req_builder.query(&[("fields", &local_var_str.to_string())]);
321 }
322 if let Some(ref local_var_str) = fieldset {
323 local_var_req_builder = local_var_req_builder.query(&[("fieldset", &local_var_str.to_string())]);
324 }
325 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
326 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
327 }
328 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
329 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
330 };
331 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
332 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
333 };
334
335 let local_var_req = local_var_req_builder.build()?;
336 let local_var_resp = local_var_client.execute(local_var_req).await?;
337
338 let local_var_status = local_var_resp.status();
339 let local_var_content = local_var_resp.text().await?;
340
341 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
342 serde_json::from_str(&local_var_content).map_err(Error::from)
343 } else {
344 let local_var_entity: Option<GetPaymentAccountError> = serde_json::from_str(&local_var_content).ok();
345 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
346 Err(Error::ResponseError(local_var_error))
347 }
348}
349
350pub async fn get_payment_method(configuration: &configuration::Configuration, company_id: i32, payment_method_id: i32, fields: Option<&str>, fieldset: Option<&str>) -> Result<models::GetPaymentMethodResponse, Error<GetPaymentMethodError>> {
352 let local_var_configuration = configuration;
353
354 let local_var_client = &local_var_configuration.client;
355
356 let local_var_uri_str = format!("{}/c/{company_id}/settings/payment_methods/{payment_method_id}", local_var_configuration.base_path, company_id=company_id, payment_method_id=payment_method_id);
357 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
358
359 if let Some(ref local_var_str) = fields {
360 local_var_req_builder = local_var_req_builder.query(&[("fields", &local_var_str.to_string())]);
361 }
362 if let Some(ref local_var_str) = fieldset {
363 local_var_req_builder = local_var_req_builder.query(&[("fieldset", &local_var_str.to_string())]);
364 }
365 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
366 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
367 }
368 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
369 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
370 };
371 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
372 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
373 };
374
375 let local_var_req = local_var_req_builder.build()?;
376 let local_var_resp = local_var_client.execute(local_var_req).await?;
377
378 let local_var_status = local_var_resp.status();
379 let local_var_content = local_var_resp.text().await?;
380
381 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
382 serde_json::from_str(&local_var_content).map_err(Error::from)
383 } else {
384 let local_var_entity: Option<GetPaymentMethodError> = serde_json::from_str(&local_var_content).ok();
385 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
386 Err(Error::ResponseError(local_var_error))
387 }
388}
389
390pub async fn get_vat_type(configuration: &configuration::Configuration, company_id: i32, vat_type_id: i32) -> Result<models::GetVatType, Error<GetVatTypeError>> {
392 let local_var_configuration = configuration;
393
394 let local_var_client = &local_var_configuration.client;
395
396 let local_var_uri_str = format!("{}/c/{company_id}/settings/vat_types/{vat_type_id}", local_var_configuration.base_path, company_id=company_id, vat_type_id=vat_type_id);
397 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
398
399 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
400 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
401 }
402 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
403 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
404 };
405 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
406 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
407 };
408
409 let local_var_req = local_var_req_builder.build()?;
410 let local_var_resp = local_var_client.execute(local_var_req).await?;
411
412 let local_var_status = local_var_resp.status();
413 let local_var_content = local_var_resp.text().await?;
414
415 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
416 serde_json::from_str(&local_var_content).map_err(Error::from)
417 } else {
418 let local_var_entity: Option<GetVatTypeError> = serde_json::from_str(&local_var_content).ok();
419 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
420 Err(Error::ResponseError(local_var_error))
421 }
422}
423
424pub async fn modify_payment_account(configuration: &configuration::Configuration, company_id: i32, payment_account_id: i32, modify_payment_account_request: Option<models::ModifyPaymentAccountRequest>) -> Result<models::ModifyPaymentAccountResponse, Error<ModifyPaymentAccountError>> {
426 let local_var_configuration = configuration;
427
428 let local_var_client = &local_var_configuration.client;
429
430 let local_var_uri_str = format!("{}/c/{company_id}/settings/payment_accounts/{payment_account_id}", local_var_configuration.base_path, company_id=company_id, payment_account_id=payment_account_id);
431 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
432
433 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
434 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
435 }
436 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
437 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
438 };
439 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
440 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
441 };
442 local_var_req_builder = local_var_req_builder.json(&modify_payment_account_request);
443
444 let local_var_req = local_var_req_builder.build()?;
445 let local_var_resp = local_var_client.execute(local_var_req).await?;
446
447 let local_var_status = local_var_resp.status();
448 let local_var_content = local_var_resp.text().await?;
449
450 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
451 serde_json::from_str(&local_var_content).map_err(Error::from)
452 } else {
453 let local_var_entity: Option<ModifyPaymentAccountError> = serde_json::from_str(&local_var_content).ok();
454 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
455 Err(Error::ResponseError(local_var_error))
456 }
457}
458
459pub async fn modify_payment_method(configuration: &configuration::Configuration, company_id: i32, payment_method_id: i32, modify_payment_method_request: Option<models::ModifyPaymentMethodRequest>) -> Result<models::ModifyPaymentMethodResponse, Error<ModifyPaymentMethodError>> {
461 let local_var_configuration = configuration;
462
463 let local_var_client = &local_var_configuration.client;
464
465 let local_var_uri_str = format!("{}/c/{company_id}/settings/payment_methods/{payment_method_id}", local_var_configuration.base_path, company_id=company_id, payment_method_id=payment_method_id);
466 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
467
468 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
469 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
470 }
471 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
472 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
473 };
474 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
475 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
476 };
477 local_var_req_builder = local_var_req_builder.json(&modify_payment_method_request);
478
479 let local_var_req = local_var_req_builder.build()?;
480 let local_var_resp = local_var_client.execute(local_var_req).await?;
481
482 let local_var_status = local_var_resp.status();
483 let local_var_content = local_var_resp.text().await?;
484
485 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
486 serde_json::from_str(&local_var_content).map_err(Error::from)
487 } else {
488 let local_var_entity: Option<ModifyPaymentMethodError> = serde_json::from_str(&local_var_content).ok();
489 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
490 Err(Error::ResponseError(local_var_error))
491 }
492}
493
494pub async fn modify_vat_type(configuration: &configuration::Configuration, company_id: i32, vat_type_id: i32, modify_vat_type_request: Option<models::ModifyVatTypeRequest>) -> Result<models::ModifyVatTypeResponse, Error<ModifyVatTypeError>> {
496 let local_var_configuration = configuration;
497
498 let local_var_client = &local_var_configuration.client;
499
500 let local_var_uri_str = format!("{}/c/{company_id}/settings/vat_types/{vat_type_id}", local_var_configuration.base_path, company_id=company_id, vat_type_id=vat_type_id);
501 let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
502
503 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
504 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
505 }
506 if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
507 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
508 };
509 if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
510 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
511 };
512 local_var_req_builder = local_var_req_builder.json(&modify_vat_type_request);
513
514 let local_var_req = local_var_req_builder.build()?;
515 let local_var_resp = local_var_client.execute(local_var_req).await?;
516
517 let local_var_status = local_var_resp.status();
518 let local_var_content = local_var_resp.text().await?;
519
520 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
521 serde_json::from_str(&local_var_content).map_err(Error::from)
522 } else {
523 let local_var_entity: Option<ModifyVatTypeError> = serde_json::from_str(&local_var_content).ok();
524 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
525 Err(Error::ResponseError(local_var_error))
526 }
527}
528