bitwarden_api_api/apis/
self_hosted_organization_sponsorships_api.rs1use reqwest;
12use serde::{de::Error as _, Deserialize, Serialize};
13
14use super::{configuration, ContentType, Error};
15use crate::{apis::ResponseContent, models};
16
17#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum OrganizationSponsorshipSelfHostedSponsoringOrgIdDeleteError {
22 UnknownValue(serde_json::Value),
23}
24
25#[derive(Debug, Clone, Serialize, Deserialize)]
28#[serde(untagged)]
29pub enum OrganizationSponsorshipSelfHostedSponsoringOrgIdDeletePostError {
30 UnknownValue(serde_json::Value),
31}
32
33#[derive(Debug, Clone, Serialize, Deserialize)]
36#[serde(untagged)]
37pub enum OrganizationSponsorshipSelfHostedSponsoringOrgIdFamiliesForEnterprisePostError {
38 UnknownValue(serde_json::Value),
39}
40
41pub async fn organization_sponsorship_self_hosted_sponsoring_org_id_delete(
42 configuration: &configuration::Configuration,
43 sponsoring_org_id: uuid::Uuid,
44) -> Result<(), Error<OrganizationSponsorshipSelfHostedSponsoringOrgIdDeleteError>> {
45 let p_sponsoring_org_id = sponsoring_org_id;
47
48 let uri_str = format!(
49 "{}/organization/sponsorship/self-hosted/{sponsoringOrgId}",
50 configuration.base_path,
51 sponsoringOrgId = crate::apis::urlencode(p_sponsoring_org_id.to_string())
52 );
53 let mut req_builder = configuration
54 .client
55 .request(reqwest::Method::DELETE, &uri_str);
56
57 if let Some(ref user_agent) = configuration.user_agent {
58 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
59 }
60 if let Some(ref token) = configuration.oauth_access_token {
61 req_builder = req_builder.bearer_auth(token.to_owned());
62 };
63
64 let req = req_builder.build()?;
65 let resp = configuration.client.execute(req).await?;
66
67 let status = resp.status();
68
69 if !status.is_client_error() && !status.is_server_error() {
70 Ok(())
71 } else {
72 let content = resp.text().await?;
73 let entity: Option<OrganizationSponsorshipSelfHostedSponsoringOrgIdDeleteError> =
74 serde_json::from_str(&content).ok();
75 Err(Error::ResponseError(ResponseContent {
76 status,
77 content,
78 entity,
79 }))
80 }
81}
82
83pub async fn organization_sponsorship_self_hosted_sponsoring_org_id_delete_post(
84 configuration: &configuration::Configuration,
85 sponsoring_org_id: uuid::Uuid,
86) -> Result<(), Error<OrganizationSponsorshipSelfHostedSponsoringOrgIdDeletePostError>> {
87 let p_sponsoring_org_id = sponsoring_org_id;
89
90 let uri_str = format!(
91 "{}/organization/sponsorship/self-hosted/{sponsoringOrgId}/delete",
92 configuration.base_path,
93 sponsoringOrgId = crate::apis::urlencode(p_sponsoring_org_id.to_string())
94 );
95 let mut req_builder = configuration
96 .client
97 .request(reqwest::Method::POST, &uri_str);
98
99 if let Some(ref user_agent) = configuration.user_agent {
100 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
101 }
102 if let Some(ref token) = configuration.oauth_access_token {
103 req_builder = req_builder.bearer_auth(token.to_owned());
104 };
105
106 let req = req_builder.build()?;
107 let resp = configuration.client.execute(req).await?;
108
109 let status = resp.status();
110
111 if !status.is_client_error() && !status.is_server_error() {
112 Ok(())
113 } else {
114 let content = resp.text().await?;
115 let entity: Option<OrganizationSponsorshipSelfHostedSponsoringOrgIdDeletePostError> =
116 serde_json::from_str(&content).ok();
117 Err(Error::ResponseError(ResponseContent {
118 status,
119 content,
120 entity,
121 }))
122 }
123}
124
125pub async fn organization_sponsorship_self_hosted_sponsoring_org_id_families_for_enterprise_post(
126 configuration: &configuration::Configuration,
127 sponsoring_org_id: uuid::Uuid,
128 organization_sponsorship_create_request_model: Option<
129 models::OrganizationSponsorshipCreateRequestModel,
130 >,
131) -> Result<(), Error<OrganizationSponsorshipSelfHostedSponsoringOrgIdFamiliesForEnterprisePostError>>
132{
133 let p_sponsoring_org_id = sponsoring_org_id;
135 let p_organization_sponsorship_create_request_model =
136 organization_sponsorship_create_request_model;
137
138 let uri_str = format!(
139 "{}/organization/sponsorship/self-hosted/{sponsoringOrgId}/families-for-enterprise",
140 configuration.base_path,
141 sponsoringOrgId = crate::apis::urlencode(p_sponsoring_org_id.to_string())
142 );
143 let mut req_builder = configuration
144 .client
145 .request(reqwest::Method::POST, &uri_str);
146
147 if let Some(ref user_agent) = configuration.user_agent {
148 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
149 }
150 if let Some(ref token) = configuration.oauth_access_token {
151 req_builder = req_builder.bearer_auth(token.to_owned());
152 };
153 req_builder = req_builder.json(&p_organization_sponsorship_create_request_model);
154
155 let req = req_builder.build()?;
156 let resp = configuration.client.execute(req).await?;
157
158 let status = resp.status();
159
160 if !status.is_client_error() && !status.is_server_error() {
161 Ok(())
162 } else {
163 let content = resp.text().await?;
164 let entity: Option<
165 OrganizationSponsorshipSelfHostedSponsoringOrgIdFamiliesForEnterprisePostError,
166 > = serde_json::from_str(&content).ok();
167 Err(Error::ResponseError(ResponseContent {
168 status,
169 content,
170 entity,
171 }))
172 }
173}