bitwarden_api_api/apis/
organization_export_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 [`organizations_organization_id_export_get`]
18#[derive(Debug, Clone, Serialize, Deserialize)]
19#[serde(untagged)]
20pub enum OrganizationsOrganizationIdExportGetError {
21    UnknownValue(serde_json::Value),
22}
23
24pub async fn organizations_organization_id_export_get(
25    configuration: &configuration::Configuration,
26    organization_id: uuid::Uuid,
27) -> Result<(), Error<OrganizationsOrganizationIdExportGetError>> {
28    // add a prefix to parameters to efficiently prevent name collisions
29    let p_organization_id = organization_id;
30
31    let uri_str = format!(
32        "{}/organizations/{organizationId}/export",
33        configuration.base_path,
34        organizationId = crate::apis::urlencode(p_organization_id.to_string())
35    );
36    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
37
38    if let Some(ref user_agent) = configuration.user_agent {
39        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
40    }
41    if let Some(ref token) = configuration.oauth_access_token {
42        req_builder = req_builder.bearer_auth(token.to_owned());
43    };
44
45    let req = req_builder.build()?;
46    let resp = configuration.client.execute(req).await?;
47
48    let status = resp.status();
49
50    if !status.is_client_error() && !status.is_server_error() {
51        Ok(())
52    } else {
53        let content = resp.text().await?;
54        let entity: Option<OrganizationsOrganizationIdExportGetError> =
55            serde_json::from_str(&content).ok();
56        Err(Error::ResponseError(ResponseContent {
57            status,
58            content,
59            entity,
60        }))
61    }
62}