bitwarden_api_api/apis/
ciphers_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::{de::Error as _, Deserialize, Serialize};
13
14use super::{configuration, ContentType, Error};
15use crate::{apis::ResponseContent, models};
16
17/// struct for typed errors of method [`ciphers_admin_delete`]
18#[derive(Debug, Clone, Serialize, Deserialize)]
19#[serde(untagged)]
20pub enum CiphersAdminDeleteError {
21    UnknownValue(serde_json::Value),
22}
23
24/// struct for typed errors of method [`ciphers_admin_post`]
25#[derive(Debug, Clone, Serialize, Deserialize)]
26#[serde(untagged)]
27pub enum CiphersAdminPostError {
28    UnknownValue(serde_json::Value),
29}
30
31/// struct for typed errors of method [`ciphers_attachment_validate_azure_post`]
32#[derive(Debug, Clone, Serialize, Deserialize)]
33#[serde(untagged)]
34pub enum CiphersAttachmentValidateAzurePostError {
35    UnknownValue(serde_json::Value),
36}
37
38/// struct for typed errors of method [`ciphers_bulk_collections_post`]
39#[derive(Debug, Clone, Serialize, Deserialize)]
40#[serde(untagged)]
41pub enum CiphersBulkCollectionsPostError {
42    UnknownValue(serde_json::Value),
43}
44
45/// struct for typed errors of method [`ciphers_create_post`]
46#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum CiphersCreatePostError {
49    UnknownValue(serde_json::Value),
50}
51
52/// struct for typed errors of method [`ciphers_delete`]
53#[derive(Debug, Clone, Serialize, Deserialize)]
54#[serde(untagged)]
55pub enum CiphersDeleteError {
56    UnknownValue(serde_json::Value),
57}
58
59/// struct for typed errors of method [`ciphers_delete_admin_post`]
60#[derive(Debug, Clone, Serialize, Deserialize)]
61#[serde(untagged)]
62pub enum CiphersDeleteAdminPostError {
63    UnknownValue(serde_json::Value),
64}
65
66/// struct for typed errors of method [`ciphers_delete_admin_put`]
67#[derive(Debug, Clone, Serialize, Deserialize)]
68#[serde(untagged)]
69pub enum CiphersDeleteAdminPutError {
70    UnknownValue(serde_json::Value),
71}
72
73/// struct for typed errors of method [`ciphers_delete_post`]
74#[derive(Debug, Clone, Serialize, Deserialize)]
75#[serde(untagged)]
76pub enum CiphersDeletePostError {
77    UnknownValue(serde_json::Value),
78}
79
80/// struct for typed errors of method [`ciphers_delete_put`]
81#[derive(Debug, Clone, Serialize, Deserialize)]
82#[serde(untagged)]
83pub enum CiphersDeletePutError {
84    UnknownValue(serde_json::Value),
85}
86
87/// struct for typed errors of method [`ciphers_get`]
88#[derive(Debug, Clone, Serialize, Deserialize)]
89#[serde(untagged)]
90pub enum CiphersGetError {
91    UnknownValue(serde_json::Value),
92}
93
94/// struct for typed errors of method [`ciphers_id_admin_delete`]
95#[derive(Debug, Clone, Serialize, Deserialize)]
96#[serde(untagged)]
97pub enum CiphersIdAdminDeleteError {
98    UnknownValue(serde_json::Value),
99}
100
101/// struct for typed errors of method [`ciphers_id_admin_get`]
102#[derive(Debug, Clone, Serialize, Deserialize)]
103#[serde(untagged)]
104pub enum CiphersIdAdminGetError {
105    UnknownValue(serde_json::Value),
106}
107
108/// struct for typed errors of method [`ciphers_id_admin_post`]
109#[derive(Debug, Clone, Serialize, Deserialize)]
110#[serde(untagged)]
111pub enum CiphersIdAdminPostError {
112    UnknownValue(serde_json::Value),
113}
114
115/// struct for typed errors of method [`ciphers_id_admin_put`]
116#[derive(Debug, Clone, Serialize, Deserialize)]
117#[serde(untagged)]
118pub enum CiphersIdAdminPutError {
119    UnknownValue(serde_json::Value),
120}
121
122/// struct for typed errors of method [`ciphers_id_attachment_admin_post`]
123#[derive(Debug, Clone, Serialize, Deserialize)]
124#[serde(untagged)]
125pub enum CiphersIdAttachmentAdminPostError {
126    UnknownValue(serde_json::Value),
127}
128
129/// struct for typed errors of method [`ciphers_id_attachment_attachment_id_admin_delete`]
130#[derive(Debug, Clone, Serialize, Deserialize)]
131#[serde(untagged)]
132pub enum CiphersIdAttachmentAttachmentIdAdminDeleteError {
133    UnknownValue(serde_json::Value),
134}
135
136/// struct for typed errors of method [`ciphers_id_attachment_attachment_id_delete`]
137#[derive(Debug, Clone, Serialize, Deserialize)]
138#[serde(untagged)]
139pub enum CiphersIdAttachmentAttachmentIdDeleteError {
140    UnknownValue(serde_json::Value),
141}
142
143/// struct for typed errors of method [`ciphers_id_attachment_attachment_id_delete_admin_post`]
144#[derive(Debug, Clone, Serialize, Deserialize)]
145#[serde(untagged)]
146pub enum CiphersIdAttachmentAttachmentIdDeleteAdminPostError {
147    UnknownValue(serde_json::Value),
148}
149
150/// struct for typed errors of method [`ciphers_id_attachment_attachment_id_delete_post`]
151#[derive(Debug, Clone, Serialize, Deserialize)]
152#[serde(untagged)]
153pub enum CiphersIdAttachmentAttachmentIdDeletePostError {
154    UnknownValue(serde_json::Value),
155}
156
157/// struct for typed errors of method [`ciphers_id_attachment_attachment_id_get`]
158#[derive(Debug, Clone, Serialize, Deserialize)]
159#[serde(untagged)]
160pub enum CiphersIdAttachmentAttachmentIdGetError {
161    UnknownValue(serde_json::Value),
162}
163
164/// struct for typed errors of method [`ciphers_id_attachment_attachment_id_post`]
165#[derive(Debug, Clone, Serialize, Deserialize)]
166#[serde(untagged)]
167pub enum CiphersIdAttachmentAttachmentIdPostError {
168    UnknownValue(serde_json::Value),
169}
170
171/// struct for typed errors of method [`ciphers_id_attachment_attachment_id_renew_get`]
172#[derive(Debug, Clone, Serialize, Deserialize)]
173#[serde(untagged)]
174pub enum CiphersIdAttachmentAttachmentIdRenewGetError {
175    UnknownValue(serde_json::Value),
176}
177
178/// struct for typed errors of method [`ciphers_id_attachment_attachment_id_share_post`]
179#[derive(Debug, Clone, Serialize, Deserialize)]
180#[serde(untagged)]
181pub enum CiphersIdAttachmentAttachmentIdSharePostError {
182    UnknownValue(serde_json::Value),
183}
184
185/// struct for typed errors of method [`ciphers_id_attachment_post`]
186#[derive(Debug, Clone, Serialize, Deserialize)]
187#[serde(untagged)]
188pub enum CiphersIdAttachmentPostError {
189    UnknownValue(serde_json::Value),
190}
191
192/// struct for typed errors of method [`ciphers_id_attachment_v2_post`]
193#[derive(Debug, Clone, Serialize, Deserialize)]
194#[serde(untagged)]
195pub enum CiphersIdAttachmentV2PostError {
196    UnknownValue(serde_json::Value),
197}
198
199/// struct for typed errors of method [`ciphers_id_collections_admin_post`]
200#[derive(Debug, Clone, Serialize, Deserialize)]
201#[serde(untagged)]
202pub enum CiphersIdCollectionsAdminPostError {
203    UnknownValue(serde_json::Value),
204}
205
206/// struct for typed errors of method [`ciphers_id_collections_admin_put`]
207#[derive(Debug, Clone, Serialize, Deserialize)]
208#[serde(untagged)]
209pub enum CiphersIdCollectionsAdminPutError {
210    UnknownValue(serde_json::Value),
211}
212
213/// struct for typed errors of method [`ciphers_id_collections_post`]
214#[derive(Debug, Clone, Serialize, Deserialize)]
215#[serde(untagged)]
216pub enum CiphersIdCollectionsPostError {
217    UnknownValue(serde_json::Value),
218}
219
220/// struct for typed errors of method [`ciphers_id_collections_put`]
221#[derive(Debug, Clone, Serialize, Deserialize)]
222#[serde(untagged)]
223pub enum CiphersIdCollectionsPutError {
224    UnknownValue(serde_json::Value),
225}
226
227/// struct for typed errors of method [`ciphers_id_collections_v2_post`]
228#[derive(Debug, Clone, Serialize, Deserialize)]
229#[serde(untagged)]
230pub enum CiphersIdCollectionsV2PostError {
231    UnknownValue(serde_json::Value),
232}
233
234/// struct for typed errors of method [`ciphers_id_collections_v2_put`]
235#[derive(Debug, Clone, Serialize, Deserialize)]
236#[serde(untagged)]
237pub enum CiphersIdCollectionsV2PutError {
238    UnknownValue(serde_json::Value),
239}
240
241/// struct for typed errors of method [`ciphers_id_delete`]
242#[derive(Debug, Clone, Serialize, Deserialize)]
243#[serde(untagged)]
244pub enum CiphersIdDeleteError {
245    UnknownValue(serde_json::Value),
246}
247
248/// struct for typed errors of method [`ciphers_id_delete_admin_post`]
249#[derive(Debug, Clone, Serialize, Deserialize)]
250#[serde(untagged)]
251pub enum CiphersIdDeleteAdminPostError {
252    UnknownValue(serde_json::Value),
253}
254
255/// struct for typed errors of method [`ciphers_id_delete_admin_put`]
256#[derive(Debug, Clone, Serialize, Deserialize)]
257#[serde(untagged)]
258pub enum CiphersIdDeleteAdminPutError {
259    UnknownValue(serde_json::Value),
260}
261
262/// struct for typed errors of method [`ciphers_id_delete_post`]
263#[derive(Debug, Clone, Serialize, Deserialize)]
264#[serde(untagged)]
265pub enum CiphersIdDeletePostError {
266    UnknownValue(serde_json::Value),
267}
268
269/// struct for typed errors of method [`ciphers_id_delete_put`]
270#[derive(Debug, Clone, Serialize, Deserialize)]
271#[serde(untagged)]
272pub enum CiphersIdDeletePutError {
273    UnknownValue(serde_json::Value),
274}
275
276/// struct for typed errors of method [`ciphers_id_details_get`]
277#[derive(Debug, Clone, Serialize, Deserialize)]
278#[serde(untagged)]
279pub enum CiphersIdDetailsGetError {
280    UnknownValue(serde_json::Value),
281}
282
283/// struct for typed errors of method [`ciphers_id_full_details_get`]
284#[derive(Debug, Clone, Serialize, Deserialize)]
285#[serde(untagged)]
286pub enum CiphersIdFullDetailsGetError {
287    UnknownValue(serde_json::Value),
288}
289
290/// struct for typed errors of method [`ciphers_id_get`]
291#[derive(Debug, Clone, Serialize, Deserialize)]
292#[serde(untagged)]
293pub enum CiphersIdGetError {
294    UnknownValue(serde_json::Value),
295}
296
297/// struct for typed errors of method [`ciphers_id_partial_post`]
298#[derive(Debug, Clone, Serialize, Deserialize)]
299#[serde(untagged)]
300pub enum CiphersIdPartialPostError {
301    UnknownValue(serde_json::Value),
302}
303
304/// struct for typed errors of method [`ciphers_id_partial_put`]
305#[derive(Debug, Clone, Serialize, Deserialize)]
306#[serde(untagged)]
307pub enum CiphersIdPartialPutError {
308    UnknownValue(serde_json::Value),
309}
310
311/// struct for typed errors of method [`ciphers_id_post`]
312#[derive(Debug, Clone, Serialize, Deserialize)]
313#[serde(untagged)]
314pub enum CiphersIdPostError {
315    UnknownValue(serde_json::Value),
316}
317
318/// struct for typed errors of method [`ciphers_id_put`]
319#[derive(Debug, Clone, Serialize, Deserialize)]
320#[serde(untagged)]
321pub enum CiphersIdPutError {
322    UnknownValue(serde_json::Value),
323}
324
325/// struct for typed errors of method [`ciphers_id_restore_admin_put`]
326#[derive(Debug, Clone, Serialize, Deserialize)]
327#[serde(untagged)]
328pub enum CiphersIdRestoreAdminPutError {
329    UnknownValue(serde_json::Value),
330}
331
332/// struct for typed errors of method [`ciphers_id_restore_put`]
333#[derive(Debug, Clone, Serialize, Deserialize)]
334#[serde(untagged)]
335pub enum CiphersIdRestorePutError {
336    UnknownValue(serde_json::Value),
337}
338
339/// struct for typed errors of method [`ciphers_id_share_post`]
340#[derive(Debug, Clone, Serialize, Deserialize)]
341#[serde(untagged)]
342pub enum CiphersIdSharePostError {
343    UnknownValue(serde_json::Value),
344}
345
346/// struct for typed errors of method [`ciphers_id_share_put`]
347#[derive(Debug, Clone, Serialize, Deserialize)]
348#[serde(untagged)]
349pub enum CiphersIdSharePutError {
350    UnknownValue(serde_json::Value),
351}
352
353/// struct for typed errors of method [`ciphers_move_post`]
354#[derive(Debug, Clone, Serialize, Deserialize)]
355#[serde(untagged)]
356pub enum CiphersMovePostError {
357    UnknownValue(serde_json::Value),
358}
359
360/// struct for typed errors of method [`ciphers_move_put`]
361#[derive(Debug, Clone, Serialize, Deserialize)]
362#[serde(untagged)]
363pub enum CiphersMovePutError {
364    UnknownValue(serde_json::Value),
365}
366
367/// struct for typed errors of method [`ciphers_organization_details_assigned_get`]
368#[derive(Debug, Clone, Serialize, Deserialize)]
369#[serde(untagged)]
370pub enum CiphersOrganizationDetailsAssignedGetError {
371    UnknownValue(serde_json::Value),
372}
373
374/// struct for typed errors of method [`ciphers_organization_details_get`]
375#[derive(Debug, Clone, Serialize, Deserialize)]
376#[serde(untagged)]
377pub enum CiphersOrganizationDetailsGetError {
378    UnknownValue(serde_json::Value),
379}
380
381/// struct for typed errors of method [`ciphers_post`]
382#[derive(Debug, Clone, Serialize, Deserialize)]
383#[serde(untagged)]
384pub enum CiphersPostError {
385    UnknownValue(serde_json::Value),
386}
387
388/// struct for typed errors of method [`ciphers_purge_post`]
389#[derive(Debug, Clone, Serialize, Deserialize)]
390#[serde(untagged)]
391pub enum CiphersPurgePostError {
392    UnknownValue(serde_json::Value),
393}
394
395/// struct for typed errors of method [`ciphers_restore_admin_put`]
396#[derive(Debug, Clone, Serialize, Deserialize)]
397#[serde(untagged)]
398pub enum CiphersRestoreAdminPutError {
399    UnknownValue(serde_json::Value),
400}
401
402/// struct for typed errors of method [`ciphers_restore_put`]
403#[derive(Debug, Clone, Serialize, Deserialize)]
404#[serde(untagged)]
405pub enum CiphersRestorePutError {
406    UnknownValue(serde_json::Value),
407}
408
409/// struct for typed errors of method [`ciphers_share_post`]
410#[derive(Debug, Clone, Serialize, Deserialize)]
411#[serde(untagged)]
412pub enum CiphersSharePostError {
413    UnknownValue(serde_json::Value),
414}
415
416/// struct for typed errors of method [`ciphers_share_put`]
417#[derive(Debug, Clone, Serialize, Deserialize)]
418#[serde(untagged)]
419pub enum CiphersSharePutError {
420    UnknownValue(serde_json::Value),
421}
422
423pub async fn ciphers_admin_delete(
424    configuration: &configuration::Configuration,
425    cipher_bulk_delete_request_model: Option<models::CipherBulkDeleteRequestModel>,
426) -> Result<(), Error<CiphersAdminDeleteError>> {
427    // add a prefix to parameters to efficiently prevent name collisions
428    let p_cipher_bulk_delete_request_model = cipher_bulk_delete_request_model;
429
430    let uri_str = format!("{}/ciphers/admin", configuration.base_path);
431    let mut req_builder = configuration
432        .client
433        .request(reqwest::Method::DELETE, &uri_str);
434
435    if let Some(ref user_agent) = configuration.user_agent {
436        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
437    }
438    if let Some(ref token) = configuration.oauth_access_token {
439        req_builder = req_builder.bearer_auth(token.to_owned());
440    };
441    req_builder = req_builder.json(&p_cipher_bulk_delete_request_model);
442
443    let req = req_builder.build()?;
444    let resp = configuration.client.execute(req).await?;
445
446    let status = resp.status();
447
448    if !status.is_client_error() && !status.is_server_error() {
449        Ok(())
450    } else {
451        let content = resp.text().await?;
452        let entity: Option<CiphersAdminDeleteError> = serde_json::from_str(&content).ok();
453        Err(Error::ResponseError(ResponseContent {
454            status,
455            content,
456            entity,
457        }))
458    }
459}
460
461pub async fn ciphers_admin_post(
462    configuration: &configuration::Configuration,
463    cipher_create_request_model: Option<models::CipherCreateRequestModel>,
464) -> Result<models::CipherMiniResponseModel, Error<CiphersAdminPostError>> {
465    // add a prefix to parameters to efficiently prevent name collisions
466    let p_cipher_create_request_model = cipher_create_request_model;
467
468    let uri_str = format!("{}/ciphers/admin", configuration.base_path);
469    let mut req_builder = configuration
470        .client
471        .request(reqwest::Method::POST, &uri_str);
472
473    if let Some(ref user_agent) = configuration.user_agent {
474        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
475    }
476    if let Some(ref token) = configuration.oauth_access_token {
477        req_builder = req_builder.bearer_auth(token.to_owned());
478    };
479    req_builder = req_builder.json(&p_cipher_create_request_model);
480
481    let req = req_builder.build()?;
482    let resp = configuration.client.execute(req).await?;
483
484    let status = resp.status();
485    let content_type = resp
486        .headers()
487        .get("content-type")
488        .and_then(|v| v.to_str().ok())
489        .unwrap_or("application/octet-stream");
490    let content_type = super::ContentType::from(content_type);
491
492    if !status.is_client_error() && !status.is_server_error() {
493        let content = resp.text().await?;
494        match content_type {
495            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
496            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherMiniResponseModel`"))),
497            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CipherMiniResponseModel`")))),
498        }
499    } else {
500        let content = resp.text().await?;
501        let entity: Option<CiphersAdminPostError> = serde_json::from_str(&content).ok();
502        Err(Error::ResponseError(ResponseContent {
503            status,
504            content,
505            entity,
506        }))
507    }
508}
509
510pub async fn ciphers_attachment_validate_azure_post(
511    configuration: &configuration::Configuration,
512) -> Result<(), Error<CiphersAttachmentValidateAzurePostError>> {
513    let uri_str = format!(
514        "{}/ciphers/attachment/validate/azure",
515        configuration.base_path
516    );
517    let mut req_builder = configuration
518        .client
519        .request(reqwest::Method::POST, &uri_str);
520
521    if let Some(ref user_agent) = configuration.user_agent {
522        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
523    }
524    if let Some(ref token) = configuration.oauth_access_token {
525        req_builder = req_builder.bearer_auth(token.to_owned());
526    };
527
528    let req = req_builder.build()?;
529    let resp = configuration.client.execute(req).await?;
530
531    let status = resp.status();
532
533    if !status.is_client_error() && !status.is_server_error() {
534        Ok(())
535    } else {
536        let content = resp.text().await?;
537        let entity: Option<CiphersAttachmentValidateAzurePostError> =
538            serde_json::from_str(&content).ok();
539        Err(Error::ResponseError(ResponseContent {
540            status,
541            content,
542            entity,
543        }))
544    }
545}
546
547pub async fn ciphers_bulk_collections_post(
548    configuration: &configuration::Configuration,
549    cipher_bulk_update_collections_request_model: Option<
550        models::CipherBulkUpdateCollectionsRequestModel,
551    >,
552) -> Result<(), Error<CiphersBulkCollectionsPostError>> {
553    // add a prefix to parameters to efficiently prevent name collisions
554    let p_cipher_bulk_update_collections_request_model =
555        cipher_bulk_update_collections_request_model;
556
557    let uri_str = format!("{}/ciphers/bulk-collections", configuration.base_path);
558    let mut req_builder = configuration
559        .client
560        .request(reqwest::Method::POST, &uri_str);
561
562    if let Some(ref user_agent) = configuration.user_agent {
563        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
564    }
565    if let Some(ref token) = configuration.oauth_access_token {
566        req_builder = req_builder.bearer_auth(token.to_owned());
567    };
568    req_builder = req_builder.json(&p_cipher_bulk_update_collections_request_model);
569
570    let req = req_builder.build()?;
571    let resp = configuration.client.execute(req).await?;
572
573    let status = resp.status();
574
575    if !status.is_client_error() && !status.is_server_error() {
576        Ok(())
577    } else {
578        let content = resp.text().await?;
579        let entity: Option<CiphersBulkCollectionsPostError> = serde_json::from_str(&content).ok();
580        Err(Error::ResponseError(ResponseContent {
581            status,
582            content,
583            entity,
584        }))
585    }
586}
587
588pub async fn ciphers_create_post(
589    configuration: &configuration::Configuration,
590    cipher_create_request_model: Option<models::CipherCreateRequestModel>,
591) -> Result<models::CipherResponseModel, Error<CiphersCreatePostError>> {
592    // add a prefix to parameters to efficiently prevent name collisions
593    let p_cipher_create_request_model = cipher_create_request_model;
594
595    let uri_str = format!("{}/ciphers/create", configuration.base_path);
596    let mut req_builder = configuration
597        .client
598        .request(reqwest::Method::POST, &uri_str);
599
600    if let Some(ref user_agent) = configuration.user_agent {
601        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
602    }
603    if let Some(ref token) = configuration.oauth_access_token {
604        req_builder = req_builder.bearer_auth(token.to_owned());
605    };
606    req_builder = req_builder.json(&p_cipher_create_request_model);
607
608    let req = req_builder.build()?;
609    let resp = configuration.client.execute(req).await?;
610
611    let status = resp.status();
612    let content_type = resp
613        .headers()
614        .get("content-type")
615        .and_then(|v| v.to_str().ok())
616        .unwrap_or("application/octet-stream");
617    let content_type = super::ContentType::from(content_type);
618
619    if !status.is_client_error() && !status.is_server_error() {
620        let content = resp.text().await?;
621        match content_type {
622            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
623            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`"))),
624            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CipherResponseModel`")))),
625        }
626    } else {
627        let content = resp.text().await?;
628        let entity: Option<CiphersCreatePostError> = serde_json::from_str(&content).ok();
629        Err(Error::ResponseError(ResponseContent {
630            status,
631            content,
632            entity,
633        }))
634    }
635}
636
637pub async fn ciphers_delete(
638    configuration: &configuration::Configuration,
639    cipher_bulk_delete_request_model: Option<models::CipherBulkDeleteRequestModel>,
640) -> Result<(), Error<CiphersDeleteError>> {
641    // add a prefix to parameters to efficiently prevent name collisions
642    let p_cipher_bulk_delete_request_model = cipher_bulk_delete_request_model;
643
644    let uri_str = format!("{}/ciphers", configuration.base_path);
645    let mut req_builder = configuration
646        .client
647        .request(reqwest::Method::DELETE, &uri_str);
648
649    if let Some(ref user_agent) = configuration.user_agent {
650        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
651    }
652    if let Some(ref token) = configuration.oauth_access_token {
653        req_builder = req_builder.bearer_auth(token.to_owned());
654    };
655    req_builder = req_builder.json(&p_cipher_bulk_delete_request_model);
656
657    let req = req_builder.build()?;
658    let resp = configuration.client.execute(req).await?;
659
660    let status = resp.status();
661
662    if !status.is_client_error() && !status.is_server_error() {
663        Ok(())
664    } else {
665        let content = resp.text().await?;
666        let entity: Option<CiphersDeleteError> = serde_json::from_str(&content).ok();
667        Err(Error::ResponseError(ResponseContent {
668            status,
669            content,
670            entity,
671        }))
672    }
673}
674
675pub async fn ciphers_delete_admin_post(
676    configuration: &configuration::Configuration,
677    cipher_bulk_delete_request_model: Option<models::CipherBulkDeleteRequestModel>,
678) -> Result<(), Error<CiphersDeleteAdminPostError>> {
679    // add a prefix to parameters to efficiently prevent name collisions
680    let p_cipher_bulk_delete_request_model = cipher_bulk_delete_request_model;
681
682    let uri_str = format!("{}/ciphers/delete-admin", configuration.base_path);
683    let mut req_builder = configuration
684        .client
685        .request(reqwest::Method::POST, &uri_str);
686
687    if let Some(ref user_agent) = configuration.user_agent {
688        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
689    }
690    if let Some(ref token) = configuration.oauth_access_token {
691        req_builder = req_builder.bearer_auth(token.to_owned());
692    };
693    req_builder = req_builder.json(&p_cipher_bulk_delete_request_model);
694
695    let req = req_builder.build()?;
696    let resp = configuration.client.execute(req).await?;
697
698    let status = resp.status();
699
700    if !status.is_client_error() && !status.is_server_error() {
701        Ok(())
702    } else {
703        let content = resp.text().await?;
704        let entity: Option<CiphersDeleteAdminPostError> = serde_json::from_str(&content).ok();
705        Err(Error::ResponseError(ResponseContent {
706            status,
707            content,
708            entity,
709        }))
710    }
711}
712
713pub async fn ciphers_delete_admin_put(
714    configuration: &configuration::Configuration,
715    cipher_bulk_delete_request_model: Option<models::CipherBulkDeleteRequestModel>,
716) -> Result<(), Error<CiphersDeleteAdminPutError>> {
717    // add a prefix to parameters to efficiently prevent name collisions
718    let p_cipher_bulk_delete_request_model = cipher_bulk_delete_request_model;
719
720    let uri_str = format!("{}/ciphers/delete-admin", configuration.base_path);
721    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
722
723    if let Some(ref user_agent) = configuration.user_agent {
724        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
725    }
726    if let Some(ref token) = configuration.oauth_access_token {
727        req_builder = req_builder.bearer_auth(token.to_owned());
728    };
729    req_builder = req_builder.json(&p_cipher_bulk_delete_request_model);
730
731    let req = req_builder.build()?;
732    let resp = configuration.client.execute(req).await?;
733
734    let status = resp.status();
735
736    if !status.is_client_error() && !status.is_server_error() {
737        Ok(())
738    } else {
739        let content = resp.text().await?;
740        let entity: Option<CiphersDeleteAdminPutError> = serde_json::from_str(&content).ok();
741        Err(Error::ResponseError(ResponseContent {
742            status,
743            content,
744            entity,
745        }))
746    }
747}
748
749pub async fn ciphers_delete_post(
750    configuration: &configuration::Configuration,
751    cipher_bulk_delete_request_model: Option<models::CipherBulkDeleteRequestModel>,
752) -> Result<(), Error<CiphersDeletePostError>> {
753    // add a prefix to parameters to efficiently prevent name collisions
754    let p_cipher_bulk_delete_request_model = cipher_bulk_delete_request_model;
755
756    let uri_str = format!("{}/ciphers/delete", configuration.base_path);
757    let mut req_builder = configuration
758        .client
759        .request(reqwest::Method::POST, &uri_str);
760
761    if let Some(ref user_agent) = configuration.user_agent {
762        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
763    }
764    if let Some(ref token) = configuration.oauth_access_token {
765        req_builder = req_builder.bearer_auth(token.to_owned());
766    };
767    req_builder = req_builder.json(&p_cipher_bulk_delete_request_model);
768
769    let req = req_builder.build()?;
770    let resp = configuration.client.execute(req).await?;
771
772    let status = resp.status();
773
774    if !status.is_client_error() && !status.is_server_error() {
775        Ok(())
776    } else {
777        let content = resp.text().await?;
778        let entity: Option<CiphersDeletePostError> = serde_json::from_str(&content).ok();
779        Err(Error::ResponseError(ResponseContent {
780            status,
781            content,
782            entity,
783        }))
784    }
785}
786
787pub async fn ciphers_delete_put(
788    configuration: &configuration::Configuration,
789    cipher_bulk_delete_request_model: Option<models::CipherBulkDeleteRequestModel>,
790) -> Result<(), Error<CiphersDeletePutError>> {
791    // add a prefix to parameters to efficiently prevent name collisions
792    let p_cipher_bulk_delete_request_model = cipher_bulk_delete_request_model;
793
794    let uri_str = format!("{}/ciphers/delete", configuration.base_path);
795    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
796
797    if let Some(ref user_agent) = configuration.user_agent {
798        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
799    }
800    if let Some(ref token) = configuration.oauth_access_token {
801        req_builder = req_builder.bearer_auth(token.to_owned());
802    };
803    req_builder = req_builder.json(&p_cipher_bulk_delete_request_model);
804
805    let req = req_builder.build()?;
806    let resp = configuration.client.execute(req).await?;
807
808    let status = resp.status();
809
810    if !status.is_client_error() && !status.is_server_error() {
811        Ok(())
812    } else {
813        let content = resp.text().await?;
814        let entity: Option<CiphersDeletePutError> = serde_json::from_str(&content).ok();
815        Err(Error::ResponseError(ResponseContent {
816            status,
817            content,
818            entity,
819        }))
820    }
821}
822
823pub async fn ciphers_get(
824    configuration: &configuration::Configuration,
825) -> Result<models::CipherDetailsResponseModelListResponseModel, Error<CiphersGetError>> {
826    let uri_str = format!("{}/ciphers", configuration.base_path);
827    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
828
829    if let Some(ref user_agent) = configuration.user_agent {
830        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
831    }
832    if let Some(ref token) = configuration.oauth_access_token {
833        req_builder = req_builder.bearer_auth(token.to_owned());
834    };
835
836    let req = req_builder.build()?;
837    let resp = configuration.client.execute(req).await?;
838
839    let status = resp.status();
840    let content_type = resp
841        .headers()
842        .get("content-type")
843        .and_then(|v| v.to_str().ok())
844        .unwrap_or("application/octet-stream");
845    let content_type = super::ContentType::from(content_type);
846
847    if !status.is_client_error() && !status.is_server_error() {
848        let content = resp.text().await?;
849        match content_type {
850            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
851            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherDetailsResponseModelListResponseModel`"))),
852            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CipherDetailsResponseModelListResponseModel`")))),
853        }
854    } else {
855        let content = resp.text().await?;
856        let entity: Option<CiphersGetError> = serde_json::from_str(&content).ok();
857        Err(Error::ResponseError(ResponseContent {
858            status,
859            content,
860            entity,
861        }))
862    }
863}
864
865pub async fn ciphers_id_admin_delete(
866    configuration: &configuration::Configuration,
867    id: &str,
868) -> Result<(), Error<CiphersIdAdminDeleteError>> {
869    // add a prefix to parameters to efficiently prevent name collisions
870    let p_id = id;
871
872    let uri_str = format!(
873        "{}/ciphers/{id}/admin",
874        configuration.base_path,
875        id = crate::apis::urlencode(p_id)
876    );
877    let mut req_builder = configuration
878        .client
879        .request(reqwest::Method::DELETE, &uri_str);
880
881    if let Some(ref user_agent) = configuration.user_agent {
882        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
883    }
884    if let Some(ref token) = configuration.oauth_access_token {
885        req_builder = req_builder.bearer_auth(token.to_owned());
886    };
887
888    let req = req_builder.build()?;
889    let resp = configuration.client.execute(req).await?;
890
891    let status = resp.status();
892
893    if !status.is_client_error() && !status.is_server_error() {
894        Ok(())
895    } else {
896        let content = resp.text().await?;
897        let entity: Option<CiphersIdAdminDeleteError> = serde_json::from_str(&content).ok();
898        Err(Error::ResponseError(ResponseContent {
899            status,
900            content,
901            entity,
902        }))
903    }
904}
905
906pub async fn ciphers_id_admin_get(
907    configuration: &configuration::Configuration,
908    id: &str,
909) -> Result<models::CipherMiniResponseModel, Error<CiphersIdAdminGetError>> {
910    // add a prefix to parameters to efficiently prevent name collisions
911    let p_id = id;
912
913    let uri_str = format!(
914        "{}/ciphers/{id}/admin",
915        configuration.base_path,
916        id = crate::apis::urlencode(p_id)
917    );
918    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
919
920    if let Some(ref user_agent) = configuration.user_agent {
921        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
922    }
923    if let Some(ref token) = configuration.oauth_access_token {
924        req_builder = req_builder.bearer_auth(token.to_owned());
925    };
926
927    let req = req_builder.build()?;
928    let resp = configuration.client.execute(req).await?;
929
930    let status = resp.status();
931    let content_type = resp
932        .headers()
933        .get("content-type")
934        .and_then(|v| v.to_str().ok())
935        .unwrap_or("application/octet-stream");
936    let content_type = super::ContentType::from(content_type);
937
938    if !status.is_client_error() && !status.is_server_error() {
939        let content = resp.text().await?;
940        match content_type {
941            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
942            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherMiniResponseModel`"))),
943            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CipherMiniResponseModel`")))),
944        }
945    } else {
946        let content = resp.text().await?;
947        let entity: Option<CiphersIdAdminGetError> = serde_json::from_str(&content).ok();
948        Err(Error::ResponseError(ResponseContent {
949            status,
950            content,
951            entity,
952        }))
953    }
954}
955
956pub async fn ciphers_id_admin_post(
957    configuration: &configuration::Configuration,
958    id: uuid::Uuid,
959    cipher_request_model: Option<models::CipherRequestModel>,
960) -> Result<models::CipherMiniResponseModel, Error<CiphersIdAdminPostError>> {
961    // add a prefix to parameters to efficiently prevent name collisions
962    let p_id = id;
963    let p_cipher_request_model = cipher_request_model;
964
965    let uri_str = format!(
966        "{}/ciphers/{id}/admin",
967        configuration.base_path,
968        id = crate::apis::urlencode(p_id.to_string())
969    );
970    let mut req_builder = configuration
971        .client
972        .request(reqwest::Method::POST, &uri_str);
973
974    if let Some(ref user_agent) = configuration.user_agent {
975        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
976    }
977    if let Some(ref token) = configuration.oauth_access_token {
978        req_builder = req_builder.bearer_auth(token.to_owned());
979    };
980    req_builder = req_builder.json(&p_cipher_request_model);
981
982    let req = req_builder.build()?;
983    let resp = configuration.client.execute(req).await?;
984
985    let status = resp.status();
986    let content_type = resp
987        .headers()
988        .get("content-type")
989        .and_then(|v| v.to_str().ok())
990        .unwrap_or("application/octet-stream");
991    let content_type = super::ContentType::from(content_type);
992
993    if !status.is_client_error() && !status.is_server_error() {
994        let content = resp.text().await?;
995        match content_type {
996            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
997            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherMiniResponseModel`"))),
998            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CipherMiniResponseModel`")))),
999        }
1000    } else {
1001        let content = resp.text().await?;
1002        let entity: Option<CiphersIdAdminPostError> = serde_json::from_str(&content).ok();
1003        Err(Error::ResponseError(ResponseContent {
1004            status,
1005            content,
1006            entity,
1007        }))
1008    }
1009}
1010
1011pub async fn ciphers_id_admin_put(
1012    configuration: &configuration::Configuration,
1013    id: uuid::Uuid,
1014    cipher_request_model: Option<models::CipherRequestModel>,
1015) -> Result<models::CipherMiniResponseModel, Error<CiphersIdAdminPutError>> {
1016    // add a prefix to parameters to efficiently prevent name collisions
1017    let p_id = id;
1018    let p_cipher_request_model = cipher_request_model;
1019
1020    let uri_str = format!(
1021        "{}/ciphers/{id}/admin",
1022        configuration.base_path,
1023        id = crate::apis::urlencode(p_id.to_string())
1024    );
1025    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1026
1027    if let Some(ref user_agent) = configuration.user_agent {
1028        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1029    }
1030    if let Some(ref token) = configuration.oauth_access_token {
1031        req_builder = req_builder.bearer_auth(token.to_owned());
1032    };
1033    req_builder = req_builder.json(&p_cipher_request_model);
1034
1035    let req = req_builder.build()?;
1036    let resp = configuration.client.execute(req).await?;
1037
1038    let status = resp.status();
1039    let content_type = resp
1040        .headers()
1041        .get("content-type")
1042        .and_then(|v| v.to_str().ok())
1043        .unwrap_or("application/octet-stream");
1044    let content_type = super::ContentType::from(content_type);
1045
1046    if !status.is_client_error() && !status.is_server_error() {
1047        let content = resp.text().await?;
1048        match content_type {
1049            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1050            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherMiniResponseModel`"))),
1051            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CipherMiniResponseModel`")))),
1052        }
1053    } else {
1054        let content = resp.text().await?;
1055        let entity: Option<CiphersIdAdminPutError> = serde_json::from_str(&content).ok();
1056        Err(Error::ResponseError(ResponseContent {
1057            status,
1058            content,
1059            entity,
1060        }))
1061    }
1062}
1063
1064pub async fn ciphers_id_attachment_admin_post(
1065    configuration: &configuration::Configuration,
1066    id: &str,
1067) -> Result<models::CipherMiniResponseModel, Error<CiphersIdAttachmentAdminPostError>> {
1068    // add a prefix to parameters to efficiently prevent name collisions
1069    let p_id = id;
1070
1071    let uri_str = format!(
1072        "{}/ciphers/{id}/attachment-admin",
1073        configuration.base_path,
1074        id = crate::apis::urlencode(p_id)
1075    );
1076    let mut req_builder = configuration
1077        .client
1078        .request(reqwest::Method::POST, &uri_str);
1079
1080    if let Some(ref user_agent) = configuration.user_agent {
1081        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1082    }
1083    if let Some(ref token) = configuration.oauth_access_token {
1084        req_builder = req_builder.bearer_auth(token.to_owned());
1085    };
1086
1087    let req = req_builder.build()?;
1088    let resp = configuration.client.execute(req).await?;
1089
1090    let status = resp.status();
1091    let content_type = resp
1092        .headers()
1093        .get("content-type")
1094        .and_then(|v| v.to_str().ok())
1095        .unwrap_or("application/octet-stream");
1096    let content_type = super::ContentType::from(content_type);
1097
1098    if !status.is_client_error() && !status.is_server_error() {
1099        let content = resp.text().await?;
1100        match content_type {
1101            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1102            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherMiniResponseModel`"))),
1103            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CipherMiniResponseModel`")))),
1104        }
1105    } else {
1106        let content = resp.text().await?;
1107        let entity: Option<CiphersIdAttachmentAdminPostError> = serde_json::from_str(&content).ok();
1108        Err(Error::ResponseError(ResponseContent {
1109            status,
1110            content,
1111            entity,
1112        }))
1113    }
1114}
1115
1116pub async fn ciphers_id_attachment_attachment_id_admin_delete(
1117    configuration: &configuration::Configuration,
1118    id: &str,
1119    attachment_id: &str,
1120) -> Result<(), Error<CiphersIdAttachmentAttachmentIdAdminDeleteError>> {
1121    // add a prefix to parameters to efficiently prevent name collisions
1122    let p_id = id;
1123    let p_attachment_id = attachment_id;
1124
1125    let uri_str = format!(
1126        "{}/ciphers/{id}/attachment/{attachmentId}/admin",
1127        configuration.base_path,
1128        id = crate::apis::urlencode(p_id),
1129        attachmentId = crate::apis::urlencode(p_attachment_id)
1130    );
1131    let mut req_builder = configuration
1132        .client
1133        .request(reqwest::Method::DELETE, &uri_str);
1134
1135    if let Some(ref user_agent) = configuration.user_agent {
1136        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1137    }
1138    if let Some(ref token) = configuration.oauth_access_token {
1139        req_builder = req_builder.bearer_auth(token.to_owned());
1140    };
1141
1142    let req = req_builder.build()?;
1143    let resp = configuration.client.execute(req).await?;
1144
1145    let status = resp.status();
1146
1147    if !status.is_client_error() && !status.is_server_error() {
1148        Ok(())
1149    } else {
1150        let content = resp.text().await?;
1151        let entity: Option<CiphersIdAttachmentAttachmentIdAdminDeleteError> =
1152            serde_json::from_str(&content).ok();
1153        Err(Error::ResponseError(ResponseContent {
1154            status,
1155            content,
1156            entity,
1157        }))
1158    }
1159}
1160
1161pub async fn ciphers_id_attachment_attachment_id_delete(
1162    configuration: &configuration::Configuration,
1163    id: uuid::Uuid,
1164    attachment_id: &str,
1165) -> Result<models::DeleteAttachmentResponseData, Error<CiphersIdAttachmentAttachmentIdDeleteError>>
1166{
1167    // add a prefix to parameters to efficiently prevent name collisions
1168    let p_id = id;
1169    let p_attachment_id = attachment_id;
1170
1171    let uri_str = format!(
1172        "{}/ciphers/{id}/attachment/{attachmentId}",
1173        configuration.base_path,
1174        id = crate::apis::urlencode(p_id.to_string()),
1175        attachmentId = crate::apis::urlencode(p_attachment_id)
1176    );
1177    let mut req_builder = configuration
1178        .client
1179        .request(reqwest::Method::DELETE, &uri_str);
1180
1181    if let Some(ref user_agent) = configuration.user_agent {
1182        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1183    }
1184    if let Some(ref token) = configuration.oauth_access_token {
1185        req_builder = req_builder.bearer_auth(token.to_owned());
1186    };
1187
1188    let req = req_builder.build()?;
1189    let resp = configuration.client.execute(req).await?;
1190
1191    let status = resp.status();
1192    let content_type = resp
1193        .headers()
1194        .get("content-type")
1195        .and_then(|v| v.to_str().ok())
1196        .unwrap_or("application/octet-stream");
1197    let content_type = super::ContentType::from(content_type);
1198
1199    if !status.is_client_error() && !status.is_server_error() {
1200        let content = resp.text().await?;
1201        match content_type {
1202            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1203            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeleteAttachmentResponseData`"))),
1204            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DeleteAttachmentResponseData`")))),
1205        }
1206    } else {
1207        let content = resp.text().await?;
1208        let entity: Option<CiphersIdAttachmentAttachmentIdDeleteError> =
1209            serde_json::from_str(&content).ok();
1210        Err(Error::ResponseError(ResponseContent {
1211            status,
1212            content,
1213            entity,
1214        }))
1215    }
1216}
1217
1218pub async fn ciphers_id_attachment_attachment_id_delete_admin_post(
1219    configuration: &configuration::Configuration,
1220    id: &str,
1221    attachment_id: &str,
1222) -> Result<(), Error<CiphersIdAttachmentAttachmentIdDeleteAdminPostError>> {
1223    // add a prefix to parameters to efficiently prevent name collisions
1224    let p_id = id;
1225    let p_attachment_id = attachment_id;
1226
1227    let uri_str = format!(
1228        "{}/ciphers/{id}/attachment/{attachmentId}/delete-admin",
1229        configuration.base_path,
1230        id = crate::apis::urlencode(p_id),
1231        attachmentId = crate::apis::urlencode(p_attachment_id)
1232    );
1233    let mut req_builder = configuration
1234        .client
1235        .request(reqwest::Method::POST, &uri_str);
1236
1237    if let Some(ref user_agent) = configuration.user_agent {
1238        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1239    }
1240    if let Some(ref token) = configuration.oauth_access_token {
1241        req_builder = req_builder.bearer_auth(token.to_owned());
1242    };
1243
1244    let req = req_builder.build()?;
1245    let resp = configuration.client.execute(req).await?;
1246
1247    let status = resp.status();
1248
1249    if !status.is_client_error() && !status.is_server_error() {
1250        Ok(())
1251    } else {
1252        let content = resp.text().await?;
1253        let entity: Option<CiphersIdAttachmentAttachmentIdDeleteAdminPostError> =
1254            serde_json::from_str(&content).ok();
1255        Err(Error::ResponseError(ResponseContent {
1256            status,
1257            content,
1258            entity,
1259        }))
1260    }
1261}
1262
1263pub async fn ciphers_id_attachment_attachment_id_delete_post(
1264    configuration: &configuration::Configuration,
1265    id: uuid::Uuid,
1266    attachment_id: &str,
1267) -> Result<
1268    models::DeleteAttachmentResponseData,
1269    Error<CiphersIdAttachmentAttachmentIdDeletePostError>,
1270> {
1271    // add a prefix to parameters to efficiently prevent name collisions
1272    let p_id = id;
1273    let p_attachment_id = attachment_id;
1274
1275    let uri_str = format!(
1276        "{}/ciphers/{id}/attachment/{attachmentId}/delete",
1277        configuration.base_path,
1278        id = crate::apis::urlencode(p_id.to_string()),
1279        attachmentId = crate::apis::urlencode(p_attachment_id)
1280    );
1281    let mut req_builder = configuration
1282        .client
1283        .request(reqwest::Method::POST, &uri_str);
1284
1285    if let Some(ref user_agent) = configuration.user_agent {
1286        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1287    }
1288    if let Some(ref token) = configuration.oauth_access_token {
1289        req_builder = req_builder.bearer_auth(token.to_owned());
1290    };
1291
1292    let req = req_builder.build()?;
1293    let resp = configuration.client.execute(req).await?;
1294
1295    let status = resp.status();
1296    let content_type = resp
1297        .headers()
1298        .get("content-type")
1299        .and_then(|v| v.to_str().ok())
1300        .unwrap_or("application/octet-stream");
1301    let content_type = super::ContentType::from(content_type);
1302
1303    if !status.is_client_error() && !status.is_server_error() {
1304        let content = resp.text().await?;
1305        match content_type {
1306            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1307            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::DeleteAttachmentResponseData`"))),
1308            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::DeleteAttachmentResponseData`")))),
1309        }
1310    } else {
1311        let content = resp.text().await?;
1312        let entity: Option<CiphersIdAttachmentAttachmentIdDeletePostError> =
1313            serde_json::from_str(&content).ok();
1314        Err(Error::ResponseError(ResponseContent {
1315            status,
1316            content,
1317            entity,
1318        }))
1319    }
1320}
1321
1322pub async fn ciphers_id_attachment_attachment_id_get(
1323    configuration: &configuration::Configuration,
1324    id: uuid::Uuid,
1325    attachment_id: &str,
1326) -> Result<models::AttachmentResponseModel, Error<CiphersIdAttachmentAttachmentIdGetError>> {
1327    // add a prefix to parameters to efficiently prevent name collisions
1328    let p_id = id;
1329    let p_attachment_id = attachment_id;
1330
1331    let uri_str = format!(
1332        "{}/ciphers/{id}/attachment/{attachmentId}",
1333        configuration.base_path,
1334        id = crate::apis::urlencode(p_id.to_string()),
1335        attachmentId = crate::apis::urlencode(p_attachment_id)
1336    );
1337    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1338
1339    if let Some(ref user_agent) = configuration.user_agent {
1340        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1341    }
1342    if let Some(ref token) = configuration.oauth_access_token {
1343        req_builder = req_builder.bearer_auth(token.to_owned());
1344    };
1345
1346    let req = req_builder.build()?;
1347    let resp = configuration.client.execute(req).await?;
1348
1349    let status = resp.status();
1350    let content_type = resp
1351        .headers()
1352        .get("content-type")
1353        .and_then(|v| v.to_str().ok())
1354        .unwrap_or("application/octet-stream");
1355    let content_type = super::ContentType::from(content_type);
1356
1357    if !status.is_client_error() && !status.is_server_error() {
1358        let content = resp.text().await?;
1359        match content_type {
1360            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1361            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AttachmentResponseModel`"))),
1362            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::AttachmentResponseModel`")))),
1363        }
1364    } else {
1365        let content = resp.text().await?;
1366        let entity: Option<CiphersIdAttachmentAttachmentIdGetError> =
1367            serde_json::from_str(&content).ok();
1368        Err(Error::ResponseError(ResponseContent {
1369            status,
1370            content,
1371            entity,
1372        }))
1373    }
1374}
1375
1376pub async fn ciphers_id_attachment_attachment_id_post(
1377    configuration: &configuration::Configuration,
1378    id: uuid::Uuid,
1379    attachment_id: &str,
1380) -> Result<(), Error<CiphersIdAttachmentAttachmentIdPostError>> {
1381    // add a prefix to parameters to efficiently prevent name collisions
1382    let p_id = id;
1383    let p_attachment_id = attachment_id;
1384
1385    let uri_str = format!(
1386        "{}/ciphers/{id}/attachment/{attachmentId}",
1387        configuration.base_path,
1388        id = crate::apis::urlencode(p_id.to_string()),
1389        attachmentId = crate::apis::urlencode(p_attachment_id)
1390    );
1391    let mut req_builder = configuration
1392        .client
1393        .request(reqwest::Method::POST, &uri_str);
1394
1395    if let Some(ref user_agent) = configuration.user_agent {
1396        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1397    }
1398    if let Some(ref token) = configuration.oauth_access_token {
1399        req_builder = req_builder.bearer_auth(token.to_owned());
1400    };
1401
1402    let req = req_builder.build()?;
1403    let resp = configuration.client.execute(req).await?;
1404
1405    let status = resp.status();
1406
1407    if !status.is_client_error() && !status.is_server_error() {
1408        Ok(())
1409    } else {
1410        let content = resp.text().await?;
1411        let entity: Option<CiphersIdAttachmentAttachmentIdPostError> =
1412            serde_json::from_str(&content).ok();
1413        Err(Error::ResponseError(ResponseContent {
1414            status,
1415            content,
1416            entity,
1417        }))
1418    }
1419}
1420
1421pub async fn ciphers_id_attachment_attachment_id_renew_get(
1422    configuration: &configuration::Configuration,
1423    id: uuid::Uuid,
1424    attachment_id: &str,
1425) -> Result<
1426    models::AttachmentUploadDataResponseModel,
1427    Error<CiphersIdAttachmentAttachmentIdRenewGetError>,
1428> {
1429    // add a prefix to parameters to efficiently prevent name collisions
1430    let p_id = id;
1431    let p_attachment_id = attachment_id;
1432
1433    let uri_str = format!(
1434        "{}/ciphers/{id}/attachment/{attachmentId}/renew",
1435        configuration.base_path,
1436        id = crate::apis::urlencode(p_id.to_string()),
1437        attachmentId = crate::apis::urlencode(p_attachment_id)
1438    );
1439    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
1440
1441    if let Some(ref user_agent) = configuration.user_agent {
1442        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1443    }
1444    if let Some(ref token) = configuration.oauth_access_token {
1445        req_builder = req_builder.bearer_auth(token.to_owned());
1446    };
1447
1448    let req = req_builder.build()?;
1449    let resp = configuration.client.execute(req).await?;
1450
1451    let status = resp.status();
1452    let content_type = resp
1453        .headers()
1454        .get("content-type")
1455        .and_then(|v| v.to_str().ok())
1456        .unwrap_or("application/octet-stream");
1457    let content_type = super::ContentType::from(content_type);
1458
1459    if !status.is_client_error() && !status.is_server_error() {
1460        let content = resp.text().await?;
1461        match content_type {
1462            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1463            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AttachmentUploadDataResponseModel`"))),
1464            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::AttachmentUploadDataResponseModel`")))),
1465        }
1466    } else {
1467        let content = resp.text().await?;
1468        let entity: Option<CiphersIdAttachmentAttachmentIdRenewGetError> =
1469            serde_json::from_str(&content).ok();
1470        Err(Error::ResponseError(ResponseContent {
1471            status,
1472            content,
1473            entity,
1474        }))
1475    }
1476}
1477
1478pub async fn ciphers_id_attachment_attachment_id_share_post(
1479    configuration: &configuration::Configuration,
1480    id: &str,
1481    attachment_id: &str,
1482    organization_id: Option<uuid::Uuid>,
1483) -> Result<(), Error<CiphersIdAttachmentAttachmentIdSharePostError>> {
1484    // add a prefix to parameters to efficiently prevent name collisions
1485    let p_id = id;
1486    let p_attachment_id = attachment_id;
1487    let p_organization_id = organization_id;
1488
1489    let uri_str = format!(
1490        "{}/ciphers/{id}/attachment/{attachmentId}/share",
1491        configuration.base_path,
1492        id = crate::apis::urlencode(p_id),
1493        attachmentId = crate::apis::urlencode(p_attachment_id)
1494    );
1495    let mut req_builder = configuration
1496        .client
1497        .request(reqwest::Method::POST, &uri_str);
1498
1499    if let Some(ref param_value) = p_organization_id {
1500        req_builder = req_builder.query(&[("organizationId", &param_value.to_string())]);
1501    }
1502    if let Some(ref user_agent) = configuration.user_agent {
1503        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1504    }
1505    if let Some(ref token) = configuration.oauth_access_token {
1506        req_builder = req_builder.bearer_auth(token.to_owned());
1507    };
1508
1509    let req = req_builder.build()?;
1510    let resp = configuration.client.execute(req).await?;
1511
1512    let status = resp.status();
1513
1514    if !status.is_client_error() && !status.is_server_error() {
1515        Ok(())
1516    } else {
1517        let content = resp.text().await?;
1518        let entity: Option<CiphersIdAttachmentAttachmentIdSharePostError> =
1519            serde_json::from_str(&content).ok();
1520        Err(Error::ResponseError(ResponseContent {
1521            status,
1522            content,
1523            entity,
1524        }))
1525    }
1526}
1527
1528pub async fn ciphers_id_attachment_post(
1529    configuration: &configuration::Configuration,
1530    id: uuid::Uuid,
1531) -> Result<models::CipherResponseModel, Error<CiphersIdAttachmentPostError>> {
1532    // add a prefix to parameters to efficiently prevent name collisions
1533    let p_id = id;
1534
1535    let uri_str = format!(
1536        "{}/ciphers/{id}/attachment",
1537        configuration.base_path,
1538        id = crate::apis::urlencode(p_id.to_string())
1539    );
1540    let mut req_builder = configuration
1541        .client
1542        .request(reqwest::Method::POST, &uri_str);
1543
1544    if let Some(ref user_agent) = configuration.user_agent {
1545        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1546    }
1547    if let Some(ref token) = configuration.oauth_access_token {
1548        req_builder = req_builder.bearer_auth(token.to_owned());
1549    };
1550
1551    let req = req_builder.build()?;
1552    let resp = configuration.client.execute(req).await?;
1553
1554    let status = resp.status();
1555    let content_type = resp
1556        .headers()
1557        .get("content-type")
1558        .and_then(|v| v.to_str().ok())
1559        .unwrap_or("application/octet-stream");
1560    let content_type = super::ContentType::from(content_type);
1561
1562    if !status.is_client_error() && !status.is_server_error() {
1563        let content = resp.text().await?;
1564        match content_type {
1565            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1566            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`"))),
1567            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CipherResponseModel`")))),
1568        }
1569    } else {
1570        let content = resp.text().await?;
1571        let entity: Option<CiphersIdAttachmentPostError> = serde_json::from_str(&content).ok();
1572        Err(Error::ResponseError(ResponseContent {
1573            status,
1574            content,
1575            entity,
1576        }))
1577    }
1578}
1579
1580pub async fn ciphers_id_attachment_v2_post(
1581    configuration: &configuration::Configuration,
1582    id: uuid::Uuid,
1583    attachment_request_model: Option<models::AttachmentRequestModel>,
1584) -> Result<models::AttachmentUploadDataResponseModel, Error<CiphersIdAttachmentV2PostError>> {
1585    // add a prefix to parameters to efficiently prevent name collisions
1586    let p_id = id;
1587    let p_attachment_request_model = attachment_request_model;
1588
1589    let uri_str = format!(
1590        "{}/ciphers/{id}/attachment/v2",
1591        configuration.base_path,
1592        id = crate::apis::urlencode(p_id.to_string())
1593    );
1594    let mut req_builder = configuration
1595        .client
1596        .request(reqwest::Method::POST, &uri_str);
1597
1598    if let Some(ref user_agent) = configuration.user_agent {
1599        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1600    }
1601    if let Some(ref token) = configuration.oauth_access_token {
1602        req_builder = req_builder.bearer_auth(token.to_owned());
1603    };
1604    req_builder = req_builder.json(&p_attachment_request_model);
1605
1606    let req = req_builder.build()?;
1607    let resp = configuration.client.execute(req).await?;
1608
1609    let status = resp.status();
1610    let content_type = resp
1611        .headers()
1612        .get("content-type")
1613        .and_then(|v| v.to_str().ok())
1614        .unwrap_or("application/octet-stream");
1615    let content_type = super::ContentType::from(content_type);
1616
1617    if !status.is_client_error() && !status.is_server_error() {
1618        let content = resp.text().await?;
1619        match content_type {
1620            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1621            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AttachmentUploadDataResponseModel`"))),
1622            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::AttachmentUploadDataResponseModel`")))),
1623        }
1624    } else {
1625        let content = resp.text().await?;
1626        let entity: Option<CiphersIdAttachmentV2PostError> = serde_json::from_str(&content).ok();
1627        Err(Error::ResponseError(ResponseContent {
1628            status,
1629            content,
1630            entity,
1631        }))
1632    }
1633}
1634
1635pub async fn ciphers_id_collections_admin_post(
1636    configuration: &configuration::Configuration,
1637    id: &str,
1638    cipher_collections_request_model: Option<models::CipherCollectionsRequestModel>,
1639) -> Result<models::CipherMiniDetailsResponseModel, Error<CiphersIdCollectionsAdminPostError>> {
1640    // add a prefix to parameters to efficiently prevent name collisions
1641    let p_id = id;
1642    let p_cipher_collections_request_model = cipher_collections_request_model;
1643
1644    let uri_str = format!(
1645        "{}/ciphers/{id}/collections-admin",
1646        configuration.base_path,
1647        id = crate::apis::urlencode(p_id)
1648    );
1649    let mut req_builder = configuration
1650        .client
1651        .request(reqwest::Method::POST, &uri_str);
1652
1653    if let Some(ref user_agent) = configuration.user_agent {
1654        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1655    }
1656    if let Some(ref token) = configuration.oauth_access_token {
1657        req_builder = req_builder.bearer_auth(token.to_owned());
1658    };
1659    req_builder = req_builder.json(&p_cipher_collections_request_model);
1660
1661    let req = req_builder.build()?;
1662    let resp = configuration.client.execute(req).await?;
1663
1664    let status = resp.status();
1665    let content_type = resp
1666        .headers()
1667        .get("content-type")
1668        .and_then(|v| v.to_str().ok())
1669        .unwrap_or("application/octet-stream");
1670    let content_type = super::ContentType::from(content_type);
1671
1672    if !status.is_client_error() && !status.is_server_error() {
1673        let content = resp.text().await?;
1674        match content_type {
1675            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1676            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherMiniDetailsResponseModel`"))),
1677            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CipherMiniDetailsResponseModel`")))),
1678        }
1679    } else {
1680        let content = resp.text().await?;
1681        let entity: Option<CiphersIdCollectionsAdminPostError> =
1682            serde_json::from_str(&content).ok();
1683        Err(Error::ResponseError(ResponseContent {
1684            status,
1685            content,
1686            entity,
1687        }))
1688    }
1689}
1690
1691pub async fn ciphers_id_collections_admin_put(
1692    configuration: &configuration::Configuration,
1693    id: &str,
1694    cipher_collections_request_model: Option<models::CipherCollectionsRequestModel>,
1695) -> Result<models::CipherMiniDetailsResponseModel, Error<CiphersIdCollectionsAdminPutError>> {
1696    // add a prefix to parameters to efficiently prevent name collisions
1697    let p_id = id;
1698    let p_cipher_collections_request_model = cipher_collections_request_model;
1699
1700    let uri_str = format!(
1701        "{}/ciphers/{id}/collections-admin",
1702        configuration.base_path,
1703        id = crate::apis::urlencode(p_id)
1704    );
1705    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1706
1707    if let Some(ref user_agent) = configuration.user_agent {
1708        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1709    }
1710    if let Some(ref token) = configuration.oauth_access_token {
1711        req_builder = req_builder.bearer_auth(token.to_owned());
1712    };
1713    req_builder = req_builder.json(&p_cipher_collections_request_model);
1714
1715    let req = req_builder.build()?;
1716    let resp = configuration.client.execute(req).await?;
1717
1718    let status = resp.status();
1719    let content_type = resp
1720        .headers()
1721        .get("content-type")
1722        .and_then(|v| v.to_str().ok())
1723        .unwrap_or("application/octet-stream");
1724    let content_type = super::ContentType::from(content_type);
1725
1726    if !status.is_client_error() && !status.is_server_error() {
1727        let content = resp.text().await?;
1728        match content_type {
1729            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1730            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherMiniDetailsResponseModel`"))),
1731            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CipherMiniDetailsResponseModel`")))),
1732        }
1733    } else {
1734        let content = resp.text().await?;
1735        let entity: Option<CiphersIdCollectionsAdminPutError> = serde_json::from_str(&content).ok();
1736        Err(Error::ResponseError(ResponseContent {
1737            status,
1738            content,
1739            entity,
1740        }))
1741    }
1742}
1743
1744pub async fn ciphers_id_collections_post(
1745    configuration: &configuration::Configuration,
1746    id: uuid::Uuid,
1747    cipher_collections_request_model: Option<models::CipherCollectionsRequestModel>,
1748) -> Result<models::CipherDetailsResponseModel, Error<CiphersIdCollectionsPostError>> {
1749    // add a prefix to parameters to efficiently prevent name collisions
1750    let p_id = id;
1751    let p_cipher_collections_request_model = cipher_collections_request_model;
1752
1753    let uri_str = format!(
1754        "{}/ciphers/{id}/collections",
1755        configuration.base_path,
1756        id = crate::apis::urlencode(p_id.to_string())
1757    );
1758    let mut req_builder = configuration
1759        .client
1760        .request(reqwest::Method::POST, &uri_str);
1761
1762    if let Some(ref user_agent) = configuration.user_agent {
1763        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1764    }
1765    if let Some(ref token) = configuration.oauth_access_token {
1766        req_builder = req_builder.bearer_auth(token.to_owned());
1767    };
1768    req_builder = req_builder.json(&p_cipher_collections_request_model);
1769
1770    let req = req_builder.build()?;
1771    let resp = configuration.client.execute(req).await?;
1772
1773    let status = resp.status();
1774    let content_type = resp
1775        .headers()
1776        .get("content-type")
1777        .and_then(|v| v.to_str().ok())
1778        .unwrap_or("application/octet-stream");
1779    let content_type = super::ContentType::from(content_type);
1780
1781    if !status.is_client_error() && !status.is_server_error() {
1782        let content = resp.text().await?;
1783        match content_type {
1784            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1785            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherDetailsResponseModel`"))),
1786            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CipherDetailsResponseModel`")))),
1787        }
1788    } else {
1789        let content = resp.text().await?;
1790        let entity: Option<CiphersIdCollectionsPostError> = serde_json::from_str(&content).ok();
1791        Err(Error::ResponseError(ResponseContent {
1792            status,
1793            content,
1794            entity,
1795        }))
1796    }
1797}
1798
1799pub async fn ciphers_id_collections_put(
1800    configuration: &configuration::Configuration,
1801    id: uuid::Uuid,
1802    cipher_collections_request_model: Option<models::CipherCollectionsRequestModel>,
1803) -> Result<models::CipherDetailsResponseModel, Error<CiphersIdCollectionsPutError>> {
1804    // add a prefix to parameters to efficiently prevent name collisions
1805    let p_id = id;
1806    let p_cipher_collections_request_model = cipher_collections_request_model;
1807
1808    let uri_str = format!(
1809        "{}/ciphers/{id}/collections",
1810        configuration.base_path,
1811        id = crate::apis::urlencode(p_id.to_string())
1812    );
1813    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1814
1815    if let Some(ref user_agent) = configuration.user_agent {
1816        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1817    }
1818    if let Some(ref token) = configuration.oauth_access_token {
1819        req_builder = req_builder.bearer_auth(token.to_owned());
1820    };
1821    req_builder = req_builder.json(&p_cipher_collections_request_model);
1822
1823    let req = req_builder.build()?;
1824    let resp = configuration.client.execute(req).await?;
1825
1826    let status = resp.status();
1827    let content_type = resp
1828        .headers()
1829        .get("content-type")
1830        .and_then(|v| v.to_str().ok())
1831        .unwrap_or("application/octet-stream");
1832    let content_type = super::ContentType::from(content_type);
1833
1834    if !status.is_client_error() && !status.is_server_error() {
1835        let content = resp.text().await?;
1836        match content_type {
1837            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1838            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherDetailsResponseModel`"))),
1839            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CipherDetailsResponseModel`")))),
1840        }
1841    } else {
1842        let content = resp.text().await?;
1843        let entity: Option<CiphersIdCollectionsPutError> = serde_json::from_str(&content).ok();
1844        Err(Error::ResponseError(ResponseContent {
1845            status,
1846            content,
1847            entity,
1848        }))
1849    }
1850}
1851
1852pub async fn ciphers_id_collections_v2_post(
1853    configuration: &configuration::Configuration,
1854    id: uuid::Uuid,
1855    cipher_collections_request_model: Option<models::CipherCollectionsRequestModel>,
1856) -> Result<models::OptionalCipherDetailsResponseModel, Error<CiphersIdCollectionsV2PostError>> {
1857    // add a prefix to parameters to efficiently prevent name collisions
1858    let p_id = id;
1859    let p_cipher_collections_request_model = cipher_collections_request_model;
1860
1861    let uri_str = format!(
1862        "{}/ciphers/{id}/collections_v2",
1863        configuration.base_path,
1864        id = crate::apis::urlencode(p_id.to_string())
1865    );
1866    let mut req_builder = configuration
1867        .client
1868        .request(reqwest::Method::POST, &uri_str);
1869
1870    if let Some(ref user_agent) = configuration.user_agent {
1871        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1872    }
1873    if let Some(ref token) = configuration.oauth_access_token {
1874        req_builder = req_builder.bearer_auth(token.to_owned());
1875    };
1876    req_builder = req_builder.json(&p_cipher_collections_request_model);
1877
1878    let req = req_builder.build()?;
1879    let resp = configuration.client.execute(req).await?;
1880
1881    let status = resp.status();
1882    let content_type = resp
1883        .headers()
1884        .get("content-type")
1885        .and_then(|v| v.to_str().ok())
1886        .unwrap_or("application/octet-stream");
1887    let content_type = super::ContentType::from(content_type);
1888
1889    if !status.is_client_error() && !status.is_server_error() {
1890        let content = resp.text().await?;
1891        match content_type {
1892            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1893            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OptionalCipherDetailsResponseModel`"))),
1894            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::OptionalCipherDetailsResponseModel`")))),
1895        }
1896    } else {
1897        let content = resp.text().await?;
1898        let entity: Option<CiphersIdCollectionsV2PostError> = serde_json::from_str(&content).ok();
1899        Err(Error::ResponseError(ResponseContent {
1900            status,
1901            content,
1902            entity,
1903        }))
1904    }
1905}
1906
1907pub async fn ciphers_id_collections_v2_put(
1908    configuration: &configuration::Configuration,
1909    id: uuid::Uuid,
1910    cipher_collections_request_model: Option<models::CipherCollectionsRequestModel>,
1911) -> Result<models::OptionalCipherDetailsResponseModel, Error<CiphersIdCollectionsV2PutError>> {
1912    // add a prefix to parameters to efficiently prevent name collisions
1913    let p_id = id;
1914    let p_cipher_collections_request_model = cipher_collections_request_model;
1915
1916    let uri_str = format!(
1917        "{}/ciphers/{id}/collections_v2",
1918        configuration.base_path,
1919        id = crate::apis::urlencode(p_id.to_string())
1920    );
1921    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1922
1923    if let Some(ref user_agent) = configuration.user_agent {
1924        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1925    }
1926    if let Some(ref token) = configuration.oauth_access_token {
1927        req_builder = req_builder.bearer_auth(token.to_owned());
1928    };
1929    req_builder = req_builder.json(&p_cipher_collections_request_model);
1930
1931    let req = req_builder.build()?;
1932    let resp = configuration.client.execute(req).await?;
1933
1934    let status = resp.status();
1935    let content_type = resp
1936        .headers()
1937        .get("content-type")
1938        .and_then(|v| v.to_str().ok())
1939        .unwrap_or("application/octet-stream");
1940    let content_type = super::ContentType::from(content_type);
1941
1942    if !status.is_client_error() && !status.is_server_error() {
1943        let content = resp.text().await?;
1944        match content_type {
1945            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1946            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OptionalCipherDetailsResponseModel`"))),
1947            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::OptionalCipherDetailsResponseModel`")))),
1948        }
1949    } else {
1950        let content = resp.text().await?;
1951        let entity: Option<CiphersIdCollectionsV2PutError> = serde_json::from_str(&content).ok();
1952        Err(Error::ResponseError(ResponseContent {
1953            status,
1954            content,
1955            entity,
1956        }))
1957    }
1958}
1959
1960pub async fn ciphers_id_delete(
1961    configuration: &configuration::Configuration,
1962    id: uuid::Uuid,
1963) -> Result<(), Error<CiphersIdDeleteError>> {
1964    // add a prefix to parameters to efficiently prevent name collisions
1965    let p_id = id;
1966
1967    let uri_str = format!(
1968        "{}/ciphers/{id}",
1969        configuration.base_path,
1970        id = crate::apis::urlencode(p_id.to_string())
1971    );
1972    let mut req_builder = configuration
1973        .client
1974        .request(reqwest::Method::DELETE, &uri_str);
1975
1976    if let Some(ref user_agent) = configuration.user_agent {
1977        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1978    }
1979    if let Some(ref token) = configuration.oauth_access_token {
1980        req_builder = req_builder.bearer_auth(token.to_owned());
1981    };
1982
1983    let req = req_builder.build()?;
1984    let resp = configuration.client.execute(req).await?;
1985
1986    let status = resp.status();
1987
1988    if !status.is_client_error() && !status.is_server_error() {
1989        Ok(())
1990    } else {
1991        let content = resp.text().await?;
1992        let entity: Option<CiphersIdDeleteError> = serde_json::from_str(&content).ok();
1993        Err(Error::ResponseError(ResponseContent {
1994            status,
1995            content,
1996            entity,
1997        }))
1998    }
1999}
2000
2001pub async fn ciphers_id_delete_admin_post(
2002    configuration: &configuration::Configuration,
2003    id: &str,
2004) -> Result<(), Error<CiphersIdDeleteAdminPostError>> {
2005    // add a prefix to parameters to efficiently prevent name collisions
2006    let p_id = id;
2007
2008    let uri_str = format!(
2009        "{}/ciphers/{id}/delete-admin",
2010        configuration.base_path,
2011        id = crate::apis::urlencode(p_id)
2012    );
2013    let mut req_builder = configuration
2014        .client
2015        .request(reqwest::Method::POST, &uri_str);
2016
2017    if let Some(ref user_agent) = configuration.user_agent {
2018        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2019    }
2020    if let Some(ref token) = configuration.oauth_access_token {
2021        req_builder = req_builder.bearer_auth(token.to_owned());
2022    };
2023
2024    let req = req_builder.build()?;
2025    let resp = configuration.client.execute(req).await?;
2026
2027    let status = resp.status();
2028
2029    if !status.is_client_error() && !status.is_server_error() {
2030        Ok(())
2031    } else {
2032        let content = resp.text().await?;
2033        let entity: Option<CiphersIdDeleteAdminPostError> = serde_json::from_str(&content).ok();
2034        Err(Error::ResponseError(ResponseContent {
2035            status,
2036            content,
2037            entity,
2038        }))
2039    }
2040}
2041
2042pub async fn ciphers_id_delete_admin_put(
2043    configuration: &configuration::Configuration,
2044    id: &str,
2045) -> Result<(), Error<CiphersIdDeleteAdminPutError>> {
2046    // add a prefix to parameters to efficiently prevent name collisions
2047    let p_id = id;
2048
2049    let uri_str = format!(
2050        "{}/ciphers/{id}/delete-admin",
2051        configuration.base_path,
2052        id = crate::apis::urlencode(p_id)
2053    );
2054    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2055
2056    if let Some(ref user_agent) = configuration.user_agent {
2057        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2058    }
2059    if let Some(ref token) = configuration.oauth_access_token {
2060        req_builder = req_builder.bearer_auth(token.to_owned());
2061    };
2062
2063    let req = req_builder.build()?;
2064    let resp = configuration.client.execute(req).await?;
2065
2066    let status = resp.status();
2067
2068    if !status.is_client_error() && !status.is_server_error() {
2069        Ok(())
2070    } else {
2071        let content = resp.text().await?;
2072        let entity: Option<CiphersIdDeleteAdminPutError> = serde_json::from_str(&content).ok();
2073        Err(Error::ResponseError(ResponseContent {
2074            status,
2075            content,
2076            entity,
2077        }))
2078    }
2079}
2080
2081pub async fn ciphers_id_delete_post(
2082    configuration: &configuration::Configuration,
2083    id: uuid::Uuid,
2084) -> Result<(), Error<CiphersIdDeletePostError>> {
2085    // add a prefix to parameters to efficiently prevent name collisions
2086    let p_id = id;
2087
2088    let uri_str = format!(
2089        "{}/ciphers/{id}/delete",
2090        configuration.base_path,
2091        id = crate::apis::urlencode(p_id.to_string())
2092    );
2093    let mut req_builder = configuration
2094        .client
2095        .request(reqwest::Method::POST, &uri_str);
2096
2097    if let Some(ref user_agent) = configuration.user_agent {
2098        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2099    }
2100    if let Some(ref token) = configuration.oauth_access_token {
2101        req_builder = req_builder.bearer_auth(token.to_owned());
2102    };
2103
2104    let req = req_builder.build()?;
2105    let resp = configuration.client.execute(req).await?;
2106
2107    let status = resp.status();
2108
2109    if !status.is_client_error() && !status.is_server_error() {
2110        Ok(())
2111    } else {
2112        let content = resp.text().await?;
2113        let entity: Option<CiphersIdDeletePostError> = serde_json::from_str(&content).ok();
2114        Err(Error::ResponseError(ResponseContent {
2115            status,
2116            content,
2117            entity,
2118        }))
2119    }
2120}
2121
2122pub async fn ciphers_id_delete_put(
2123    configuration: &configuration::Configuration,
2124    id: uuid::Uuid,
2125) -> Result<(), Error<CiphersIdDeletePutError>> {
2126    // add a prefix to parameters to efficiently prevent name collisions
2127    let p_id = id;
2128
2129    let uri_str = format!(
2130        "{}/ciphers/{id}/delete",
2131        configuration.base_path,
2132        id = crate::apis::urlencode(p_id.to_string())
2133    );
2134    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2135
2136    if let Some(ref user_agent) = configuration.user_agent {
2137        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2138    }
2139    if let Some(ref token) = configuration.oauth_access_token {
2140        req_builder = req_builder.bearer_auth(token.to_owned());
2141    };
2142
2143    let req = req_builder.build()?;
2144    let resp = configuration.client.execute(req).await?;
2145
2146    let status = resp.status();
2147
2148    if !status.is_client_error() && !status.is_server_error() {
2149        Ok(())
2150    } else {
2151        let content = resp.text().await?;
2152        let entity: Option<CiphersIdDeletePutError> = serde_json::from_str(&content).ok();
2153        Err(Error::ResponseError(ResponseContent {
2154            status,
2155            content,
2156            entity,
2157        }))
2158    }
2159}
2160
2161pub async fn ciphers_id_details_get(
2162    configuration: &configuration::Configuration,
2163    id: uuid::Uuid,
2164) -> Result<models::CipherDetailsResponseModel, Error<CiphersIdDetailsGetError>> {
2165    // add a prefix to parameters to efficiently prevent name collisions
2166    let p_id = id;
2167
2168    let uri_str = format!(
2169        "{}/ciphers/{id}/details",
2170        configuration.base_path,
2171        id = crate::apis::urlencode(p_id.to_string())
2172    );
2173    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2174
2175    if let Some(ref user_agent) = configuration.user_agent {
2176        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2177    }
2178    if let Some(ref token) = configuration.oauth_access_token {
2179        req_builder = req_builder.bearer_auth(token.to_owned());
2180    };
2181
2182    let req = req_builder.build()?;
2183    let resp = configuration.client.execute(req).await?;
2184
2185    let status = resp.status();
2186    let content_type = resp
2187        .headers()
2188        .get("content-type")
2189        .and_then(|v| v.to_str().ok())
2190        .unwrap_or("application/octet-stream");
2191    let content_type = super::ContentType::from(content_type);
2192
2193    if !status.is_client_error() && !status.is_server_error() {
2194        let content = resp.text().await?;
2195        match content_type {
2196            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2197            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherDetailsResponseModel`"))),
2198            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CipherDetailsResponseModel`")))),
2199        }
2200    } else {
2201        let content = resp.text().await?;
2202        let entity: Option<CiphersIdDetailsGetError> = serde_json::from_str(&content).ok();
2203        Err(Error::ResponseError(ResponseContent {
2204            status,
2205            content,
2206            entity,
2207        }))
2208    }
2209}
2210
2211pub async fn ciphers_id_full_details_get(
2212    configuration: &configuration::Configuration,
2213    id: uuid::Uuid,
2214) -> Result<models::CipherDetailsResponseModel, Error<CiphersIdFullDetailsGetError>> {
2215    // add a prefix to parameters to efficiently prevent name collisions
2216    let p_id = id;
2217
2218    let uri_str = format!(
2219        "{}/ciphers/{id}/full-details",
2220        configuration.base_path,
2221        id = crate::apis::urlencode(p_id.to_string())
2222    );
2223    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2224
2225    if let Some(ref user_agent) = configuration.user_agent {
2226        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2227    }
2228    if let Some(ref token) = configuration.oauth_access_token {
2229        req_builder = req_builder.bearer_auth(token.to_owned());
2230    };
2231
2232    let req = req_builder.build()?;
2233    let resp = configuration.client.execute(req).await?;
2234
2235    let status = resp.status();
2236    let content_type = resp
2237        .headers()
2238        .get("content-type")
2239        .and_then(|v| v.to_str().ok())
2240        .unwrap_or("application/octet-stream");
2241    let content_type = super::ContentType::from(content_type);
2242
2243    if !status.is_client_error() && !status.is_server_error() {
2244        let content = resp.text().await?;
2245        match content_type {
2246            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2247            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherDetailsResponseModel`"))),
2248            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CipherDetailsResponseModel`")))),
2249        }
2250    } else {
2251        let content = resp.text().await?;
2252        let entity: Option<CiphersIdFullDetailsGetError> = serde_json::from_str(&content).ok();
2253        Err(Error::ResponseError(ResponseContent {
2254            status,
2255            content,
2256            entity,
2257        }))
2258    }
2259}
2260
2261pub async fn ciphers_id_get(
2262    configuration: &configuration::Configuration,
2263    id: uuid::Uuid,
2264) -> Result<models::CipherResponseModel, Error<CiphersIdGetError>> {
2265    // add a prefix to parameters to efficiently prevent name collisions
2266    let p_id = id;
2267
2268    let uri_str = format!(
2269        "{}/ciphers/{id}",
2270        configuration.base_path,
2271        id = crate::apis::urlencode(p_id.to_string())
2272    );
2273    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2274
2275    if let Some(ref user_agent) = configuration.user_agent {
2276        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2277    }
2278    if let Some(ref token) = configuration.oauth_access_token {
2279        req_builder = req_builder.bearer_auth(token.to_owned());
2280    };
2281
2282    let req = req_builder.build()?;
2283    let resp = configuration.client.execute(req).await?;
2284
2285    let status = resp.status();
2286    let content_type = resp
2287        .headers()
2288        .get("content-type")
2289        .and_then(|v| v.to_str().ok())
2290        .unwrap_or("application/octet-stream");
2291    let content_type = super::ContentType::from(content_type);
2292
2293    if !status.is_client_error() && !status.is_server_error() {
2294        let content = resp.text().await?;
2295        match content_type {
2296            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2297            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`"))),
2298            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CipherResponseModel`")))),
2299        }
2300    } else {
2301        let content = resp.text().await?;
2302        let entity: Option<CiphersIdGetError> = serde_json::from_str(&content).ok();
2303        Err(Error::ResponseError(ResponseContent {
2304            status,
2305            content,
2306            entity,
2307        }))
2308    }
2309}
2310
2311pub async fn ciphers_id_partial_post(
2312    configuration: &configuration::Configuration,
2313    id: uuid::Uuid,
2314    cipher_partial_request_model: Option<models::CipherPartialRequestModel>,
2315) -> Result<models::CipherResponseModel, Error<CiphersIdPartialPostError>> {
2316    // add a prefix to parameters to efficiently prevent name collisions
2317    let p_id = id;
2318    let p_cipher_partial_request_model = cipher_partial_request_model;
2319
2320    let uri_str = format!(
2321        "{}/ciphers/{id}/partial",
2322        configuration.base_path,
2323        id = crate::apis::urlencode(p_id.to_string())
2324    );
2325    let mut req_builder = configuration
2326        .client
2327        .request(reqwest::Method::POST, &uri_str);
2328
2329    if let Some(ref user_agent) = configuration.user_agent {
2330        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2331    }
2332    if let Some(ref token) = configuration.oauth_access_token {
2333        req_builder = req_builder.bearer_auth(token.to_owned());
2334    };
2335    req_builder = req_builder.json(&p_cipher_partial_request_model);
2336
2337    let req = req_builder.build()?;
2338    let resp = configuration.client.execute(req).await?;
2339
2340    let status = resp.status();
2341    let content_type = resp
2342        .headers()
2343        .get("content-type")
2344        .and_then(|v| v.to_str().ok())
2345        .unwrap_or("application/octet-stream");
2346    let content_type = super::ContentType::from(content_type);
2347
2348    if !status.is_client_error() && !status.is_server_error() {
2349        let content = resp.text().await?;
2350        match content_type {
2351            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2352            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`"))),
2353            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CipherResponseModel`")))),
2354        }
2355    } else {
2356        let content = resp.text().await?;
2357        let entity: Option<CiphersIdPartialPostError> = serde_json::from_str(&content).ok();
2358        Err(Error::ResponseError(ResponseContent {
2359            status,
2360            content,
2361            entity,
2362        }))
2363    }
2364}
2365
2366pub async fn ciphers_id_partial_put(
2367    configuration: &configuration::Configuration,
2368    id: uuid::Uuid,
2369    cipher_partial_request_model: Option<models::CipherPartialRequestModel>,
2370) -> Result<models::CipherResponseModel, Error<CiphersIdPartialPutError>> {
2371    // add a prefix to parameters to efficiently prevent name collisions
2372    let p_id = id;
2373    let p_cipher_partial_request_model = cipher_partial_request_model;
2374
2375    let uri_str = format!(
2376        "{}/ciphers/{id}/partial",
2377        configuration.base_path,
2378        id = crate::apis::urlencode(p_id.to_string())
2379    );
2380    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2381
2382    if let Some(ref user_agent) = configuration.user_agent {
2383        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2384    }
2385    if let Some(ref token) = configuration.oauth_access_token {
2386        req_builder = req_builder.bearer_auth(token.to_owned());
2387    };
2388    req_builder = req_builder.json(&p_cipher_partial_request_model);
2389
2390    let req = req_builder.build()?;
2391    let resp = configuration.client.execute(req).await?;
2392
2393    let status = resp.status();
2394    let content_type = resp
2395        .headers()
2396        .get("content-type")
2397        .and_then(|v| v.to_str().ok())
2398        .unwrap_or("application/octet-stream");
2399    let content_type = super::ContentType::from(content_type);
2400
2401    if !status.is_client_error() && !status.is_server_error() {
2402        let content = resp.text().await?;
2403        match content_type {
2404            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2405            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`"))),
2406            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CipherResponseModel`")))),
2407        }
2408    } else {
2409        let content = resp.text().await?;
2410        let entity: Option<CiphersIdPartialPutError> = serde_json::from_str(&content).ok();
2411        Err(Error::ResponseError(ResponseContent {
2412            status,
2413            content,
2414            entity,
2415        }))
2416    }
2417}
2418
2419pub async fn ciphers_id_post(
2420    configuration: &configuration::Configuration,
2421    id: uuid::Uuid,
2422    cipher_request_model: Option<models::CipherRequestModel>,
2423) -> Result<models::CipherResponseModel, Error<CiphersIdPostError>> {
2424    // add a prefix to parameters to efficiently prevent name collisions
2425    let p_id = id;
2426    let p_cipher_request_model = cipher_request_model;
2427
2428    let uri_str = format!(
2429        "{}/ciphers/{id}",
2430        configuration.base_path,
2431        id = crate::apis::urlencode(p_id.to_string())
2432    );
2433    let mut req_builder = configuration
2434        .client
2435        .request(reqwest::Method::POST, &uri_str);
2436
2437    if let Some(ref user_agent) = configuration.user_agent {
2438        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2439    }
2440    if let Some(ref token) = configuration.oauth_access_token {
2441        req_builder = req_builder.bearer_auth(token.to_owned());
2442    };
2443    req_builder = req_builder.json(&p_cipher_request_model);
2444
2445    let req = req_builder.build()?;
2446    let resp = configuration.client.execute(req).await?;
2447
2448    let status = resp.status();
2449    let content_type = resp
2450        .headers()
2451        .get("content-type")
2452        .and_then(|v| v.to_str().ok())
2453        .unwrap_or("application/octet-stream");
2454    let content_type = super::ContentType::from(content_type);
2455
2456    if !status.is_client_error() && !status.is_server_error() {
2457        let content = resp.text().await?;
2458        match content_type {
2459            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2460            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`"))),
2461            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CipherResponseModel`")))),
2462        }
2463    } else {
2464        let content = resp.text().await?;
2465        let entity: Option<CiphersIdPostError> = serde_json::from_str(&content).ok();
2466        Err(Error::ResponseError(ResponseContent {
2467            status,
2468            content,
2469            entity,
2470        }))
2471    }
2472}
2473
2474pub async fn ciphers_id_put(
2475    configuration: &configuration::Configuration,
2476    id: uuid::Uuid,
2477    cipher_request_model: Option<models::CipherRequestModel>,
2478) -> Result<models::CipherResponseModel, Error<CiphersIdPutError>> {
2479    // add a prefix to parameters to efficiently prevent name collisions
2480    let p_id = id;
2481    let p_cipher_request_model = cipher_request_model;
2482
2483    let uri_str = format!(
2484        "{}/ciphers/{id}",
2485        configuration.base_path,
2486        id = crate::apis::urlencode(p_id.to_string())
2487    );
2488    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2489
2490    if let Some(ref user_agent) = configuration.user_agent {
2491        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2492    }
2493    if let Some(ref token) = configuration.oauth_access_token {
2494        req_builder = req_builder.bearer_auth(token.to_owned());
2495    };
2496    req_builder = req_builder.json(&p_cipher_request_model);
2497
2498    let req = req_builder.build()?;
2499    let resp = configuration.client.execute(req).await?;
2500
2501    let status = resp.status();
2502    let content_type = resp
2503        .headers()
2504        .get("content-type")
2505        .and_then(|v| v.to_str().ok())
2506        .unwrap_or("application/octet-stream");
2507    let content_type = super::ContentType::from(content_type);
2508
2509    if !status.is_client_error() && !status.is_server_error() {
2510        let content = resp.text().await?;
2511        match content_type {
2512            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2513            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`"))),
2514            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CipherResponseModel`")))),
2515        }
2516    } else {
2517        let content = resp.text().await?;
2518        let entity: Option<CiphersIdPutError> = serde_json::from_str(&content).ok();
2519        Err(Error::ResponseError(ResponseContent {
2520            status,
2521            content,
2522            entity,
2523        }))
2524    }
2525}
2526
2527pub async fn ciphers_id_restore_admin_put(
2528    configuration: &configuration::Configuration,
2529    id: &str,
2530) -> Result<models::CipherMiniResponseModel, Error<CiphersIdRestoreAdminPutError>> {
2531    // add a prefix to parameters to efficiently prevent name collisions
2532    let p_id = id;
2533
2534    let uri_str = format!(
2535        "{}/ciphers/{id}/restore-admin",
2536        configuration.base_path,
2537        id = crate::apis::urlencode(p_id)
2538    );
2539    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2540
2541    if let Some(ref user_agent) = configuration.user_agent {
2542        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2543    }
2544    if let Some(ref token) = configuration.oauth_access_token {
2545        req_builder = req_builder.bearer_auth(token.to_owned());
2546    };
2547
2548    let req = req_builder.build()?;
2549    let resp = configuration.client.execute(req).await?;
2550
2551    let status = resp.status();
2552    let content_type = resp
2553        .headers()
2554        .get("content-type")
2555        .and_then(|v| v.to_str().ok())
2556        .unwrap_or("application/octet-stream");
2557    let content_type = super::ContentType::from(content_type);
2558
2559    if !status.is_client_error() && !status.is_server_error() {
2560        let content = resp.text().await?;
2561        match content_type {
2562            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2563            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherMiniResponseModel`"))),
2564            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CipherMiniResponseModel`")))),
2565        }
2566    } else {
2567        let content = resp.text().await?;
2568        let entity: Option<CiphersIdRestoreAdminPutError> = serde_json::from_str(&content).ok();
2569        Err(Error::ResponseError(ResponseContent {
2570            status,
2571            content,
2572            entity,
2573        }))
2574    }
2575}
2576
2577pub async fn ciphers_id_restore_put(
2578    configuration: &configuration::Configuration,
2579    id: uuid::Uuid,
2580) -> Result<models::CipherResponseModel, Error<CiphersIdRestorePutError>> {
2581    // add a prefix to parameters to efficiently prevent name collisions
2582    let p_id = id;
2583
2584    let uri_str = format!(
2585        "{}/ciphers/{id}/restore",
2586        configuration.base_path,
2587        id = crate::apis::urlencode(p_id.to_string())
2588    );
2589    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2590
2591    if let Some(ref user_agent) = configuration.user_agent {
2592        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2593    }
2594    if let Some(ref token) = configuration.oauth_access_token {
2595        req_builder = req_builder.bearer_auth(token.to_owned());
2596    };
2597
2598    let req = req_builder.build()?;
2599    let resp = configuration.client.execute(req).await?;
2600
2601    let status = resp.status();
2602    let content_type = resp
2603        .headers()
2604        .get("content-type")
2605        .and_then(|v| v.to_str().ok())
2606        .unwrap_or("application/octet-stream");
2607    let content_type = super::ContentType::from(content_type);
2608
2609    if !status.is_client_error() && !status.is_server_error() {
2610        let content = resp.text().await?;
2611        match content_type {
2612            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2613            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`"))),
2614            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CipherResponseModel`")))),
2615        }
2616    } else {
2617        let content = resp.text().await?;
2618        let entity: Option<CiphersIdRestorePutError> = serde_json::from_str(&content).ok();
2619        Err(Error::ResponseError(ResponseContent {
2620            status,
2621            content,
2622            entity,
2623        }))
2624    }
2625}
2626
2627pub async fn ciphers_id_share_post(
2628    configuration: &configuration::Configuration,
2629    id: uuid::Uuid,
2630    cipher_share_request_model: Option<models::CipherShareRequestModel>,
2631) -> Result<models::CipherResponseModel, Error<CiphersIdSharePostError>> {
2632    // add a prefix to parameters to efficiently prevent name collisions
2633    let p_id = id;
2634    let p_cipher_share_request_model = cipher_share_request_model;
2635
2636    let uri_str = format!(
2637        "{}/ciphers/{id}/share",
2638        configuration.base_path,
2639        id = crate::apis::urlencode(p_id.to_string())
2640    );
2641    let mut req_builder = configuration
2642        .client
2643        .request(reqwest::Method::POST, &uri_str);
2644
2645    if let Some(ref user_agent) = configuration.user_agent {
2646        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2647    }
2648    if let Some(ref token) = configuration.oauth_access_token {
2649        req_builder = req_builder.bearer_auth(token.to_owned());
2650    };
2651    req_builder = req_builder.json(&p_cipher_share_request_model);
2652
2653    let req = req_builder.build()?;
2654    let resp = configuration.client.execute(req).await?;
2655
2656    let status = resp.status();
2657    let content_type = resp
2658        .headers()
2659        .get("content-type")
2660        .and_then(|v| v.to_str().ok())
2661        .unwrap_or("application/octet-stream");
2662    let content_type = super::ContentType::from(content_type);
2663
2664    if !status.is_client_error() && !status.is_server_error() {
2665        let content = resp.text().await?;
2666        match content_type {
2667            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2668            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`"))),
2669            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CipherResponseModel`")))),
2670        }
2671    } else {
2672        let content = resp.text().await?;
2673        let entity: Option<CiphersIdSharePostError> = serde_json::from_str(&content).ok();
2674        Err(Error::ResponseError(ResponseContent {
2675            status,
2676            content,
2677            entity,
2678        }))
2679    }
2680}
2681
2682pub async fn ciphers_id_share_put(
2683    configuration: &configuration::Configuration,
2684    id: uuid::Uuid,
2685    cipher_share_request_model: Option<models::CipherShareRequestModel>,
2686) -> Result<models::CipherResponseModel, Error<CiphersIdSharePutError>> {
2687    // add a prefix to parameters to efficiently prevent name collisions
2688    let p_id = id;
2689    let p_cipher_share_request_model = cipher_share_request_model;
2690
2691    let uri_str = format!(
2692        "{}/ciphers/{id}/share",
2693        configuration.base_path,
2694        id = crate::apis::urlencode(p_id.to_string())
2695    );
2696    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2697
2698    if let Some(ref user_agent) = configuration.user_agent {
2699        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2700    }
2701    if let Some(ref token) = configuration.oauth_access_token {
2702        req_builder = req_builder.bearer_auth(token.to_owned());
2703    };
2704    req_builder = req_builder.json(&p_cipher_share_request_model);
2705
2706    let req = req_builder.build()?;
2707    let resp = configuration.client.execute(req).await?;
2708
2709    let status = resp.status();
2710    let content_type = resp
2711        .headers()
2712        .get("content-type")
2713        .and_then(|v| v.to_str().ok())
2714        .unwrap_or("application/octet-stream");
2715    let content_type = super::ContentType::from(content_type);
2716
2717    if !status.is_client_error() && !status.is_server_error() {
2718        let content = resp.text().await?;
2719        match content_type {
2720            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2721            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`"))),
2722            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CipherResponseModel`")))),
2723        }
2724    } else {
2725        let content = resp.text().await?;
2726        let entity: Option<CiphersIdSharePutError> = serde_json::from_str(&content).ok();
2727        Err(Error::ResponseError(ResponseContent {
2728            status,
2729            content,
2730            entity,
2731        }))
2732    }
2733}
2734
2735pub async fn ciphers_move_post(
2736    configuration: &configuration::Configuration,
2737    cipher_bulk_move_request_model: Option<models::CipherBulkMoveRequestModel>,
2738) -> Result<(), Error<CiphersMovePostError>> {
2739    // add a prefix to parameters to efficiently prevent name collisions
2740    let p_cipher_bulk_move_request_model = cipher_bulk_move_request_model;
2741
2742    let uri_str = format!("{}/ciphers/move", configuration.base_path);
2743    let mut req_builder = configuration
2744        .client
2745        .request(reqwest::Method::POST, &uri_str);
2746
2747    if let Some(ref user_agent) = configuration.user_agent {
2748        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2749    }
2750    if let Some(ref token) = configuration.oauth_access_token {
2751        req_builder = req_builder.bearer_auth(token.to_owned());
2752    };
2753    req_builder = req_builder.json(&p_cipher_bulk_move_request_model);
2754
2755    let req = req_builder.build()?;
2756    let resp = configuration.client.execute(req).await?;
2757
2758    let status = resp.status();
2759
2760    if !status.is_client_error() && !status.is_server_error() {
2761        Ok(())
2762    } else {
2763        let content = resp.text().await?;
2764        let entity: Option<CiphersMovePostError> = serde_json::from_str(&content).ok();
2765        Err(Error::ResponseError(ResponseContent {
2766            status,
2767            content,
2768            entity,
2769        }))
2770    }
2771}
2772
2773pub async fn ciphers_move_put(
2774    configuration: &configuration::Configuration,
2775    cipher_bulk_move_request_model: Option<models::CipherBulkMoveRequestModel>,
2776) -> Result<(), Error<CiphersMovePutError>> {
2777    // add a prefix to parameters to efficiently prevent name collisions
2778    let p_cipher_bulk_move_request_model = cipher_bulk_move_request_model;
2779
2780    let uri_str = format!("{}/ciphers/move", configuration.base_path);
2781    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
2782
2783    if let Some(ref user_agent) = configuration.user_agent {
2784        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2785    }
2786    if let Some(ref token) = configuration.oauth_access_token {
2787        req_builder = req_builder.bearer_auth(token.to_owned());
2788    };
2789    req_builder = req_builder.json(&p_cipher_bulk_move_request_model);
2790
2791    let req = req_builder.build()?;
2792    let resp = configuration.client.execute(req).await?;
2793
2794    let status = resp.status();
2795
2796    if !status.is_client_error() && !status.is_server_error() {
2797        Ok(())
2798    } else {
2799        let content = resp.text().await?;
2800        let entity: Option<CiphersMovePutError> = serde_json::from_str(&content).ok();
2801        Err(Error::ResponseError(ResponseContent {
2802            status,
2803            content,
2804            entity,
2805        }))
2806    }
2807}
2808
2809pub async fn ciphers_organization_details_assigned_get(
2810    configuration: &configuration::Configuration,
2811    organization_id: Option<uuid::Uuid>,
2812) -> Result<
2813    models::CipherDetailsResponseModelListResponseModel,
2814    Error<CiphersOrganizationDetailsAssignedGetError>,
2815> {
2816    // add a prefix to parameters to efficiently prevent name collisions
2817    let p_organization_id = organization_id;
2818
2819    let uri_str = format!(
2820        "{}/ciphers/organization-details/assigned",
2821        configuration.base_path
2822    );
2823    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2824
2825    if let Some(ref param_value) = p_organization_id {
2826        req_builder = req_builder.query(&[("organizationId", &param_value.to_string())]);
2827    }
2828    if let Some(ref user_agent) = configuration.user_agent {
2829        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2830    }
2831    if let Some(ref token) = configuration.oauth_access_token {
2832        req_builder = req_builder.bearer_auth(token.to_owned());
2833    };
2834
2835    let req = req_builder.build()?;
2836    let resp = configuration.client.execute(req).await?;
2837
2838    let status = resp.status();
2839    let content_type = resp
2840        .headers()
2841        .get("content-type")
2842        .and_then(|v| v.to_str().ok())
2843        .unwrap_or("application/octet-stream");
2844    let content_type = super::ContentType::from(content_type);
2845
2846    if !status.is_client_error() && !status.is_server_error() {
2847        let content = resp.text().await?;
2848        match content_type {
2849            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2850            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherDetailsResponseModelListResponseModel`"))),
2851            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CipherDetailsResponseModelListResponseModel`")))),
2852        }
2853    } else {
2854        let content = resp.text().await?;
2855        let entity: Option<CiphersOrganizationDetailsAssignedGetError> =
2856            serde_json::from_str(&content).ok();
2857        Err(Error::ResponseError(ResponseContent {
2858            status,
2859            content,
2860            entity,
2861        }))
2862    }
2863}
2864
2865pub async fn ciphers_organization_details_get(
2866    configuration: &configuration::Configuration,
2867    organization_id: Option<uuid::Uuid>,
2868) -> Result<
2869    models::CipherMiniDetailsResponseModelListResponseModel,
2870    Error<CiphersOrganizationDetailsGetError>,
2871> {
2872    // add a prefix to parameters to efficiently prevent name collisions
2873    let p_organization_id = organization_id;
2874
2875    let uri_str = format!("{}/ciphers/organization-details", configuration.base_path);
2876    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
2877
2878    if let Some(ref param_value) = p_organization_id {
2879        req_builder = req_builder.query(&[("organizationId", &param_value.to_string())]);
2880    }
2881    if let Some(ref user_agent) = configuration.user_agent {
2882        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2883    }
2884    if let Some(ref token) = configuration.oauth_access_token {
2885        req_builder = req_builder.bearer_auth(token.to_owned());
2886    };
2887
2888    let req = req_builder.build()?;
2889    let resp = configuration.client.execute(req).await?;
2890
2891    let status = resp.status();
2892    let content_type = resp
2893        .headers()
2894        .get("content-type")
2895        .and_then(|v| v.to_str().ok())
2896        .unwrap_or("application/octet-stream");
2897    let content_type = super::ContentType::from(content_type);
2898
2899    if !status.is_client_error() && !status.is_server_error() {
2900        let content = resp.text().await?;
2901        match content_type {
2902            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2903            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherMiniDetailsResponseModelListResponseModel`"))),
2904            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CipherMiniDetailsResponseModelListResponseModel`")))),
2905        }
2906    } else {
2907        let content = resp.text().await?;
2908        let entity: Option<CiphersOrganizationDetailsGetError> =
2909            serde_json::from_str(&content).ok();
2910        Err(Error::ResponseError(ResponseContent {
2911            status,
2912            content,
2913            entity,
2914        }))
2915    }
2916}
2917
2918pub async fn ciphers_post(
2919    configuration: &configuration::Configuration,
2920    cipher_request_model: Option<models::CipherRequestModel>,
2921) -> Result<models::CipherResponseModel, Error<CiphersPostError>> {
2922    // add a prefix to parameters to efficiently prevent name collisions
2923    let p_cipher_request_model = cipher_request_model;
2924
2925    let uri_str = format!("{}/ciphers", configuration.base_path);
2926    let mut req_builder = configuration
2927        .client
2928        .request(reqwest::Method::POST, &uri_str);
2929
2930    if let Some(ref user_agent) = configuration.user_agent {
2931        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2932    }
2933    if let Some(ref token) = configuration.oauth_access_token {
2934        req_builder = req_builder.bearer_auth(token.to_owned());
2935    };
2936    req_builder = req_builder.json(&p_cipher_request_model);
2937
2938    let req = req_builder.build()?;
2939    let resp = configuration.client.execute(req).await?;
2940
2941    let status = resp.status();
2942    let content_type = resp
2943        .headers()
2944        .get("content-type")
2945        .and_then(|v| v.to_str().ok())
2946        .unwrap_or("application/octet-stream");
2947    let content_type = super::ContentType::from(content_type);
2948
2949    if !status.is_client_error() && !status.is_server_error() {
2950        let content = resp.text().await?;
2951        match content_type {
2952            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
2953            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherResponseModel`"))),
2954            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CipherResponseModel`")))),
2955        }
2956    } else {
2957        let content = resp.text().await?;
2958        let entity: Option<CiphersPostError> = serde_json::from_str(&content).ok();
2959        Err(Error::ResponseError(ResponseContent {
2960            status,
2961            content,
2962            entity,
2963        }))
2964    }
2965}
2966
2967pub async fn ciphers_purge_post(
2968    configuration: &configuration::Configuration,
2969    organization_id: Option<&str>,
2970    secret_verification_request_model: Option<models::SecretVerificationRequestModel>,
2971) -> Result<(), Error<CiphersPurgePostError>> {
2972    // add a prefix to parameters to efficiently prevent name collisions
2973    let p_organization_id = organization_id;
2974    let p_secret_verification_request_model = secret_verification_request_model;
2975
2976    let uri_str = format!("{}/ciphers/purge", configuration.base_path);
2977    let mut req_builder = configuration
2978        .client
2979        .request(reqwest::Method::POST, &uri_str);
2980
2981    if let Some(ref param_value) = p_organization_id {
2982        req_builder = req_builder.query(&[("organizationId", &param_value.to_string())]);
2983    }
2984    if let Some(ref user_agent) = configuration.user_agent {
2985        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
2986    }
2987    if let Some(ref token) = configuration.oauth_access_token {
2988        req_builder = req_builder.bearer_auth(token.to_owned());
2989    };
2990    req_builder = req_builder.json(&p_secret_verification_request_model);
2991
2992    let req = req_builder.build()?;
2993    let resp = configuration.client.execute(req).await?;
2994
2995    let status = resp.status();
2996
2997    if !status.is_client_error() && !status.is_server_error() {
2998        Ok(())
2999    } else {
3000        let content = resp.text().await?;
3001        let entity: Option<CiphersPurgePostError> = serde_json::from_str(&content).ok();
3002        Err(Error::ResponseError(ResponseContent {
3003            status,
3004            content,
3005            entity,
3006        }))
3007    }
3008}
3009
3010pub async fn ciphers_restore_admin_put(
3011    configuration: &configuration::Configuration,
3012    cipher_bulk_restore_request_model: Option<models::CipherBulkRestoreRequestModel>,
3013) -> Result<models::CipherMiniResponseModelListResponseModel, Error<CiphersRestoreAdminPutError>> {
3014    // add a prefix to parameters to efficiently prevent name collisions
3015    let p_cipher_bulk_restore_request_model = cipher_bulk_restore_request_model;
3016
3017    let uri_str = format!("{}/ciphers/restore-admin", configuration.base_path);
3018    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
3019
3020    if let Some(ref user_agent) = configuration.user_agent {
3021        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3022    }
3023    if let Some(ref token) = configuration.oauth_access_token {
3024        req_builder = req_builder.bearer_auth(token.to_owned());
3025    };
3026    req_builder = req_builder.json(&p_cipher_bulk_restore_request_model);
3027
3028    let req = req_builder.build()?;
3029    let resp = configuration.client.execute(req).await?;
3030
3031    let status = resp.status();
3032    let content_type = resp
3033        .headers()
3034        .get("content-type")
3035        .and_then(|v| v.to_str().ok())
3036        .unwrap_or("application/octet-stream");
3037    let content_type = super::ContentType::from(content_type);
3038
3039    if !status.is_client_error() && !status.is_server_error() {
3040        let content = resp.text().await?;
3041        match content_type {
3042            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3043            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherMiniResponseModelListResponseModel`"))),
3044            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CipherMiniResponseModelListResponseModel`")))),
3045        }
3046    } else {
3047        let content = resp.text().await?;
3048        let entity: Option<CiphersRestoreAdminPutError> = serde_json::from_str(&content).ok();
3049        Err(Error::ResponseError(ResponseContent {
3050            status,
3051            content,
3052            entity,
3053        }))
3054    }
3055}
3056
3057pub async fn ciphers_restore_put(
3058    configuration: &configuration::Configuration,
3059    cipher_bulk_restore_request_model: Option<models::CipherBulkRestoreRequestModel>,
3060) -> Result<models::CipherMiniResponseModelListResponseModel, Error<CiphersRestorePutError>> {
3061    // add a prefix to parameters to efficiently prevent name collisions
3062    let p_cipher_bulk_restore_request_model = cipher_bulk_restore_request_model;
3063
3064    let uri_str = format!("{}/ciphers/restore", configuration.base_path);
3065    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
3066
3067    if let Some(ref user_agent) = configuration.user_agent {
3068        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3069    }
3070    if let Some(ref token) = configuration.oauth_access_token {
3071        req_builder = req_builder.bearer_auth(token.to_owned());
3072    };
3073    req_builder = req_builder.json(&p_cipher_bulk_restore_request_model);
3074
3075    let req = req_builder.build()?;
3076    let resp = configuration.client.execute(req).await?;
3077
3078    let status = resp.status();
3079    let content_type = resp
3080        .headers()
3081        .get("content-type")
3082        .and_then(|v| v.to_str().ok())
3083        .unwrap_or("application/octet-stream");
3084    let content_type = super::ContentType::from(content_type);
3085
3086    if !status.is_client_error() && !status.is_server_error() {
3087        let content = resp.text().await?;
3088        match content_type {
3089            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
3090            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::CipherMiniResponseModelListResponseModel`"))),
3091            ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::CipherMiniResponseModelListResponseModel`")))),
3092        }
3093    } else {
3094        let content = resp.text().await?;
3095        let entity: Option<CiphersRestorePutError> = serde_json::from_str(&content).ok();
3096        Err(Error::ResponseError(ResponseContent {
3097            status,
3098            content,
3099            entity,
3100        }))
3101    }
3102}
3103
3104pub async fn ciphers_share_post(
3105    configuration: &configuration::Configuration,
3106    cipher_bulk_share_request_model: Option<models::CipherBulkShareRequestModel>,
3107) -> Result<(), Error<CiphersSharePostError>> {
3108    // add a prefix to parameters to efficiently prevent name collisions
3109    let p_cipher_bulk_share_request_model = cipher_bulk_share_request_model;
3110
3111    let uri_str = format!("{}/ciphers/share", configuration.base_path);
3112    let mut req_builder = configuration
3113        .client
3114        .request(reqwest::Method::POST, &uri_str);
3115
3116    if let Some(ref user_agent) = configuration.user_agent {
3117        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3118    }
3119    if let Some(ref token) = configuration.oauth_access_token {
3120        req_builder = req_builder.bearer_auth(token.to_owned());
3121    };
3122    req_builder = req_builder.json(&p_cipher_bulk_share_request_model);
3123
3124    let req = req_builder.build()?;
3125    let resp = configuration.client.execute(req).await?;
3126
3127    let status = resp.status();
3128
3129    if !status.is_client_error() && !status.is_server_error() {
3130        Ok(())
3131    } else {
3132        let content = resp.text().await?;
3133        let entity: Option<CiphersSharePostError> = serde_json::from_str(&content).ok();
3134        Err(Error::ResponseError(ResponseContent {
3135            status,
3136            content,
3137            entity,
3138        }))
3139    }
3140}
3141
3142pub async fn ciphers_share_put(
3143    configuration: &configuration::Configuration,
3144    cipher_bulk_share_request_model: Option<models::CipherBulkShareRequestModel>,
3145) -> Result<(), Error<CiphersSharePutError>> {
3146    // add a prefix to parameters to efficiently prevent name collisions
3147    let p_cipher_bulk_share_request_model = cipher_bulk_share_request_model;
3148
3149    let uri_str = format!("{}/ciphers/share", configuration.base_path);
3150    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
3151
3152    if let Some(ref user_agent) = configuration.user_agent {
3153        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
3154    }
3155    if let Some(ref token) = configuration.oauth_access_token {
3156        req_builder = req_builder.bearer_auth(token.to_owned());
3157    };
3158    req_builder = req_builder.json(&p_cipher_bulk_share_request_model);
3159
3160    let req = req_builder.build()?;
3161    let resp = configuration.client.execute(req).await?;
3162
3163    let status = resp.status();
3164
3165    if !status.is_client_error() && !status.is_server_error() {
3166        Ok(())
3167    } else {
3168        let content = resp.text().await?;
3169        let entity: Option<CiphersSharePutError> = serde_json::from_str(&content).ok();
3170        Err(Error::ResponseError(ResponseContent {
3171            status,
3172            content,
3173            entity,
3174        }))
3175    }
3176}