bitwarden_api_api/apis/
sends_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 reqwest;
12use serde::{Deserialize, Serialize};
13
14use super::{configuration, Error};
15use crate::{apis::ResponseContent, models};
16
17/// struct for typed errors of method [`sends_access_id_post`]
18#[derive(Debug, Clone, Serialize, Deserialize)]
19#[serde(untagged)]
20pub enum SendsAccessIdPostError {
21    UnknownValue(serde_json::Value),
22}
23
24/// struct for typed errors of method [`sends_encoded_send_id_access_file_file_id_post`]
25#[derive(Debug, Clone, Serialize, Deserialize)]
26#[serde(untagged)]
27pub enum SendsEncodedSendIdAccessFileFileIdPostError {
28    UnknownValue(serde_json::Value),
29}
30
31/// struct for typed errors of method [`sends_file_post`]
32#[derive(Debug, Clone, Serialize, Deserialize)]
33#[serde(untagged)]
34pub enum SendsFilePostError {
35    UnknownValue(serde_json::Value),
36}
37
38/// struct for typed errors of method [`sends_file_v2_post`]
39#[derive(Debug, Clone, Serialize, Deserialize)]
40#[serde(untagged)]
41pub enum SendsFileV2PostError {
42    UnknownValue(serde_json::Value),
43}
44
45/// struct for typed errors of method [`sends_file_validate_azure_post`]
46#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum SendsFileValidateAzurePostError {
49    UnknownValue(serde_json::Value),
50}
51
52/// struct for typed errors of method [`sends_get`]
53#[derive(Debug, Clone, Serialize, Deserialize)]
54#[serde(untagged)]
55pub enum SendsGetError {
56    UnknownValue(serde_json::Value),
57}
58
59/// struct for typed errors of method [`sends_id_delete`]
60#[derive(Debug, Clone, Serialize, Deserialize)]
61#[serde(untagged)]
62pub enum SendsIdDeleteError {
63    UnknownValue(serde_json::Value),
64}
65
66/// struct for typed errors of method [`sends_id_file_file_id_get`]
67#[derive(Debug, Clone, Serialize, Deserialize)]
68#[serde(untagged)]
69pub enum SendsIdFileFileIdGetError {
70    UnknownValue(serde_json::Value),
71}
72
73/// struct for typed errors of method [`sends_id_file_file_id_post`]
74#[derive(Debug, Clone, Serialize, Deserialize)]
75#[serde(untagged)]
76pub enum SendsIdFileFileIdPostError {
77    UnknownValue(serde_json::Value),
78}
79
80/// struct for typed errors of method [`sends_id_get`]
81#[derive(Debug, Clone, Serialize, Deserialize)]
82#[serde(untagged)]
83pub enum SendsIdGetError {
84    UnknownValue(serde_json::Value),
85}
86
87/// struct for typed errors of method [`sends_id_put`]
88#[derive(Debug, Clone, Serialize, Deserialize)]
89#[serde(untagged)]
90pub enum SendsIdPutError {
91    UnknownValue(serde_json::Value),
92}
93
94/// struct for typed errors of method [`sends_id_remove_password_put`]
95#[derive(Debug, Clone, Serialize, Deserialize)]
96#[serde(untagged)]
97pub enum SendsIdRemovePasswordPutError {
98    UnknownValue(serde_json::Value),
99}
100
101/// struct for typed errors of method [`sends_post`]
102#[derive(Debug, Clone, Serialize, Deserialize)]
103#[serde(untagged)]
104pub enum SendsPostError {
105    UnknownValue(serde_json::Value),
106}
107
108pub async fn sends_access_id_post(
109    configuration: &configuration::Configuration,
110    id: &str,
111    send_access_request_model: Option<models::SendAccessRequestModel>,
112) -> Result<(), Error<SendsAccessIdPostError>> {
113    let local_var_configuration = configuration;
114
115    let local_var_client = &local_var_configuration.client;
116
117    let local_var_uri_str = format!(
118        "{}/sends/access/{id}",
119        local_var_configuration.base_path,
120        id = crate::apis::urlencode(id)
121    );
122    let mut local_var_req_builder =
123        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
124
125    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
126        local_var_req_builder =
127            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
128    }
129    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
130        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
131    };
132    local_var_req_builder = local_var_req_builder.json(&send_access_request_model);
133
134    let local_var_req = local_var_req_builder.build()?;
135    let local_var_resp = local_var_client.execute(local_var_req).await?;
136
137    let local_var_status = local_var_resp.status();
138    let local_var_content = local_var_resp.text().await?;
139
140    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
141        Ok(())
142    } else {
143        let local_var_entity: Option<SendsAccessIdPostError> =
144            serde_json::from_str(&local_var_content).ok();
145        let local_var_error = ResponseContent {
146            status: local_var_status,
147            content: local_var_content,
148            entity: local_var_entity,
149        };
150        Err(Error::ResponseError(local_var_error))
151    }
152}
153
154pub async fn sends_encoded_send_id_access_file_file_id_post(
155    configuration: &configuration::Configuration,
156    encoded_send_id: &str,
157    file_id: &str,
158    send_access_request_model: Option<models::SendAccessRequestModel>,
159) -> Result<(), Error<SendsEncodedSendIdAccessFileFileIdPostError>> {
160    let local_var_configuration = configuration;
161
162    let local_var_client = &local_var_configuration.client;
163
164    let local_var_uri_str = format!(
165        "{}/sends/{encodedSendId}/access/file/{fileId}",
166        local_var_configuration.base_path,
167        encodedSendId = crate::apis::urlencode(encoded_send_id),
168        fileId = crate::apis::urlencode(file_id)
169    );
170    let mut local_var_req_builder =
171        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
172
173    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
174        local_var_req_builder =
175            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
176    }
177    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
178        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
179    };
180    local_var_req_builder = local_var_req_builder.json(&send_access_request_model);
181
182    let local_var_req = local_var_req_builder.build()?;
183    let local_var_resp = local_var_client.execute(local_var_req).await?;
184
185    let local_var_status = local_var_resp.status();
186    let local_var_content = local_var_resp.text().await?;
187
188    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
189        Ok(())
190    } else {
191        let local_var_entity: Option<SendsEncodedSendIdAccessFileFileIdPostError> =
192            serde_json::from_str(&local_var_content).ok();
193        let local_var_error = ResponseContent {
194            status: local_var_status,
195            content: local_var_content,
196            entity: local_var_entity,
197        };
198        Err(Error::ResponseError(local_var_error))
199    }
200}
201
202pub async fn sends_file_post(
203    configuration: &configuration::Configuration,
204) -> Result<models::SendResponseModel, Error<SendsFilePostError>> {
205    let local_var_configuration = configuration;
206
207    let local_var_client = &local_var_configuration.client;
208
209    let local_var_uri_str = format!("{}/sends/file", local_var_configuration.base_path);
210    let mut local_var_req_builder =
211        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
212
213    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
214        local_var_req_builder =
215            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
216    }
217    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
218        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
219    };
220
221    let local_var_req = local_var_req_builder.build()?;
222    let local_var_resp = local_var_client.execute(local_var_req).await?;
223
224    let local_var_status = local_var_resp.status();
225    let local_var_content = local_var_resp.text().await?;
226
227    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
228        serde_json::from_str(&local_var_content).map_err(Error::from)
229    } else {
230        let local_var_entity: Option<SendsFilePostError> =
231            serde_json::from_str(&local_var_content).ok();
232        let local_var_error = ResponseContent {
233            status: local_var_status,
234            content: local_var_content,
235            entity: local_var_entity,
236        };
237        Err(Error::ResponseError(local_var_error))
238    }
239}
240
241pub async fn sends_file_v2_post(
242    configuration: &configuration::Configuration,
243    send_request_model: Option<models::SendRequestModel>,
244) -> Result<models::SendFileUploadDataResponseModel, Error<SendsFileV2PostError>> {
245    let local_var_configuration = configuration;
246
247    let local_var_client = &local_var_configuration.client;
248
249    let local_var_uri_str = format!("{}/sends/file/v2", local_var_configuration.base_path);
250    let mut local_var_req_builder =
251        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
252
253    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
254        local_var_req_builder =
255            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
256    }
257    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
258        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
259    };
260    local_var_req_builder = local_var_req_builder.json(&send_request_model);
261
262    let local_var_req = local_var_req_builder.build()?;
263    let local_var_resp = local_var_client.execute(local_var_req).await?;
264
265    let local_var_status = local_var_resp.status();
266    let local_var_content = local_var_resp.text().await?;
267
268    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
269        serde_json::from_str(&local_var_content).map_err(Error::from)
270    } else {
271        let local_var_entity: Option<SendsFileV2PostError> =
272            serde_json::from_str(&local_var_content).ok();
273        let local_var_error = ResponseContent {
274            status: local_var_status,
275            content: local_var_content,
276            entity: local_var_entity,
277        };
278        Err(Error::ResponseError(local_var_error))
279    }
280}
281
282pub async fn sends_file_validate_azure_post(
283    configuration: &configuration::Configuration,
284) -> Result<(), Error<SendsFileValidateAzurePostError>> {
285    let local_var_configuration = configuration;
286
287    let local_var_client = &local_var_configuration.client;
288
289    let local_var_uri_str = format!(
290        "{}/sends/file/validate/azure",
291        local_var_configuration.base_path
292    );
293    let mut local_var_req_builder =
294        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
295
296    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
297        local_var_req_builder =
298            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
299    }
300    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
301        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
302    };
303
304    let local_var_req = local_var_req_builder.build()?;
305    let local_var_resp = local_var_client.execute(local_var_req).await?;
306
307    let local_var_status = local_var_resp.status();
308    let local_var_content = local_var_resp.text().await?;
309
310    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
311        Ok(())
312    } else {
313        let local_var_entity: Option<SendsFileValidateAzurePostError> =
314            serde_json::from_str(&local_var_content).ok();
315        let local_var_error = ResponseContent {
316            status: local_var_status,
317            content: local_var_content,
318            entity: local_var_entity,
319        };
320        Err(Error::ResponseError(local_var_error))
321    }
322}
323
324pub async fn sends_get(
325    configuration: &configuration::Configuration,
326) -> Result<models::SendResponseModelListResponseModel, Error<SendsGetError>> {
327    let local_var_configuration = configuration;
328
329    let local_var_client = &local_var_configuration.client;
330
331    let local_var_uri_str = format!("{}/sends", local_var_configuration.base_path);
332    let mut local_var_req_builder =
333        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
334
335    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
336        local_var_req_builder =
337            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
338    }
339    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
340        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
341    };
342
343    let local_var_req = local_var_req_builder.build()?;
344    let local_var_resp = local_var_client.execute(local_var_req).await?;
345
346    let local_var_status = local_var_resp.status();
347    let local_var_content = local_var_resp.text().await?;
348
349    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
350        serde_json::from_str(&local_var_content).map_err(Error::from)
351    } else {
352        let local_var_entity: Option<SendsGetError> = serde_json::from_str(&local_var_content).ok();
353        let local_var_error = ResponseContent {
354            status: local_var_status,
355            content: local_var_content,
356            entity: local_var_entity,
357        };
358        Err(Error::ResponseError(local_var_error))
359    }
360}
361
362pub async fn sends_id_delete(
363    configuration: &configuration::Configuration,
364    id: &str,
365) -> Result<(), Error<SendsIdDeleteError>> {
366    let local_var_configuration = configuration;
367
368    let local_var_client = &local_var_configuration.client;
369
370    let local_var_uri_str = format!(
371        "{}/sends/{id}",
372        local_var_configuration.base_path,
373        id = crate::apis::urlencode(id)
374    );
375    let mut local_var_req_builder =
376        local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
377
378    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
379        local_var_req_builder =
380            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
381    }
382    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
383        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
384    };
385
386    let local_var_req = local_var_req_builder.build()?;
387    let local_var_resp = local_var_client.execute(local_var_req).await?;
388
389    let local_var_status = local_var_resp.status();
390    let local_var_content = local_var_resp.text().await?;
391
392    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
393        Ok(())
394    } else {
395        let local_var_entity: Option<SendsIdDeleteError> =
396            serde_json::from_str(&local_var_content).ok();
397        let local_var_error = ResponseContent {
398            status: local_var_status,
399            content: local_var_content,
400            entity: local_var_entity,
401        };
402        Err(Error::ResponseError(local_var_error))
403    }
404}
405
406pub async fn sends_id_file_file_id_get(
407    configuration: &configuration::Configuration,
408    id: &str,
409    file_id: &str,
410) -> Result<models::SendFileUploadDataResponseModel, Error<SendsIdFileFileIdGetError>> {
411    let local_var_configuration = configuration;
412
413    let local_var_client = &local_var_configuration.client;
414
415    let local_var_uri_str = format!(
416        "{}/sends/{id}/file/{fileId}",
417        local_var_configuration.base_path,
418        id = crate::apis::urlencode(id),
419        fileId = crate::apis::urlencode(file_id)
420    );
421    let mut local_var_req_builder =
422        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
423
424    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
425        local_var_req_builder =
426            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
427    }
428    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
429        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
430    };
431
432    let local_var_req = local_var_req_builder.build()?;
433    let local_var_resp = local_var_client.execute(local_var_req).await?;
434
435    let local_var_status = local_var_resp.status();
436    let local_var_content = local_var_resp.text().await?;
437
438    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
439        serde_json::from_str(&local_var_content).map_err(Error::from)
440    } else {
441        let local_var_entity: Option<SendsIdFileFileIdGetError> =
442            serde_json::from_str(&local_var_content).ok();
443        let local_var_error = ResponseContent {
444            status: local_var_status,
445            content: local_var_content,
446            entity: local_var_entity,
447        };
448        Err(Error::ResponseError(local_var_error))
449    }
450}
451
452pub async fn sends_id_file_file_id_post(
453    configuration: &configuration::Configuration,
454    id: &str,
455    file_id: &str,
456) -> Result<(), Error<SendsIdFileFileIdPostError>> {
457    let local_var_configuration = configuration;
458
459    let local_var_client = &local_var_configuration.client;
460
461    let local_var_uri_str = format!(
462        "{}/sends/{id}/file/{fileId}",
463        local_var_configuration.base_path,
464        id = crate::apis::urlencode(id),
465        fileId = crate::apis::urlencode(file_id)
466    );
467    let mut local_var_req_builder =
468        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
469
470    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
471        local_var_req_builder =
472            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
473    }
474    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
475        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
476    };
477
478    let local_var_req = local_var_req_builder.build()?;
479    let local_var_resp = local_var_client.execute(local_var_req).await?;
480
481    let local_var_status = local_var_resp.status();
482    let local_var_content = local_var_resp.text().await?;
483
484    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
485        Ok(())
486    } else {
487        let local_var_entity: Option<SendsIdFileFileIdPostError> =
488            serde_json::from_str(&local_var_content).ok();
489        let local_var_error = ResponseContent {
490            status: local_var_status,
491            content: local_var_content,
492            entity: local_var_entity,
493        };
494        Err(Error::ResponseError(local_var_error))
495    }
496}
497
498pub async fn sends_id_get(
499    configuration: &configuration::Configuration,
500    id: &str,
501) -> Result<models::SendResponseModel, Error<SendsIdGetError>> {
502    let local_var_configuration = configuration;
503
504    let local_var_client = &local_var_configuration.client;
505
506    let local_var_uri_str = format!(
507        "{}/sends/{id}",
508        local_var_configuration.base_path,
509        id = crate::apis::urlencode(id)
510    );
511    let mut local_var_req_builder =
512        local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
513
514    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
515        local_var_req_builder =
516            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
517    }
518    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
519        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
520    };
521
522    let local_var_req = local_var_req_builder.build()?;
523    let local_var_resp = local_var_client.execute(local_var_req).await?;
524
525    let local_var_status = local_var_resp.status();
526    let local_var_content = local_var_resp.text().await?;
527
528    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
529        serde_json::from_str(&local_var_content).map_err(Error::from)
530    } else {
531        let local_var_entity: Option<SendsIdGetError> =
532            serde_json::from_str(&local_var_content).ok();
533        let local_var_error = ResponseContent {
534            status: local_var_status,
535            content: local_var_content,
536            entity: local_var_entity,
537        };
538        Err(Error::ResponseError(local_var_error))
539    }
540}
541
542pub async fn sends_id_put(
543    configuration: &configuration::Configuration,
544    id: &str,
545    send_request_model: Option<models::SendRequestModel>,
546) -> Result<models::SendResponseModel, Error<SendsIdPutError>> {
547    let local_var_configuration = configuration;
548
549    let local_var_client = &local_var_configuration.client;
550
551    let local_var_uri_str = format!(
552        "{}/sends/{id}",
553        local_var_configuration.base_path,
554        id = crate::apis::urlencode(id)
555    );
556    let mut local_var_req_builder =
557        local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
558
559    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
560        local_var_req_builder =
561            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
562    }
563    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
564        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
565    };
566    local_var_req_builder = local_var_req_builder.json(&send_request_model);
567
568    let local_var_req = local_var_req_builder.build()?;
569    let local_var_resp = local_var_client.execute(local_var_req).await?;
570
571    let local_var_status = local_var_resp.status();
572    let local_var_content = local_var_resp.text().await?;
573
574    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
575        serde_json::from_str(&local_var_content).map_err(Error::from)
576    } else {
577        let local_var_entity: Option<SendsIdPutError> =
578            serde_json::from_str(&local_var_content).ok();
579        let local_var_error = ResponseContent {
580            status: local_var_status,
581            content: local_var_content,
582            entity: local_var_entity,
583        };
584        Err(Error::ResponseError(local_var_error))
585    }
586}
587
588pub async fn sends_id_remove_password_put(
589    configuration: &configuration::Configuration,
590    id: &str,
591) -> Result<models::SendResponseModel, Error<SendsIdRemovePasswordPutError>> {
592    let local_var_configuration = configuration;
593
594    let local_var_client = &local_var_configuration.client;
595
596    let local_var_uri_str = format!(
597        "{}/sends/{id}/remove-password",
598        local_var_configuration.base_path,
599        id = crate::apis::urlencode(id)
600    );
601    let mut local_var_req_builder =
602        local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
603
604    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
605        local_var_req_builder =
606            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
607    }
608    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
609        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
610    };
611
612    let local_var_req = local_var_req_builder.build()?;
613    let local_var_resp = local_var_client.execute(local_var_req).await?;
614
615    let local_var_status = local_var_resp.status();
616    let local_var_content = local_var_resp.text().await?;
617
618    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
619        serde_json::from_str(&local_var_content).map_err(Error::from)
620    } else {
621        let local_var_entity: Option<SendsIdRemovePasswordPutError> =
622            serde_json::from_str(&local_var_content).ok();
623        let local_var_error = ResponseContent {
624            status: local_var_status,
625            content: local_var_content,
626            entity: local_var_entity,
627        };
628        Err(Error::ResponseError(local_var_error))
629    }
630}
631
632pub async fn sends_post(
633    configuration: &configuration::Configuration,
634    send_request_model: Option<models::SendRequestModel>,
635) -> Result<models::SendResponseModel, Error<SendsPostError>> {
636    let local_var_configuration = configuration;
637
638    let local_var_client = &local_var_configuration.client;
639
640    let local_var_uri_str = format!("{}/sends", local_var_configuration.base_path);
641    let mut local_var_req_builder =
642        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
643
644    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
645        local_var_req_builder =
646            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
647    }
648    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
649        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
650    };
651    local_var_req_builder = local_var_req_builder.json(&send_request_model);
652
653    let local_var_req = local_var_req_builder.build()?;
654    let local_var_resp = local_var_client.execute(local_var_req).await?;
655
656    let local_var_status = local_var_resp.status();
657    let local_var_content = local_var_resp.text().await?;
658
659    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
660        serde_json::from_str(&local_var_content).map_err(Error::from)
661    } else {
662        let local_var_entity: Option<SendsPostError> =
663            serde_json::from_str(&local_var_content).ok();
664        let local_var_error = ResponseContent {
665            status: local_var_status,
666            content: local_var_content,
667            entity: local_var_entity,
668        };
669        Err(Error::ResponseError(local_var_error))
670    }
671}