1use super::{configuration, ContentType, Error};
12use crate::{apis::ResponseContent, models};
13use reqwest;
14use serde::{de::Error as _, Deserialize, Serialize};
15
16#[derive(Debug, Clone, Serialize, Deserialize)]
18#[serde(untagged)]
19pub enum OrganizationsDeleteOrganizationMembershipError {
20 Status400(serde_json::Value),
21 Status401(serde_json::Value),
22 Status403(serde_json::Value),
23 Status404(serde_json::Value),
24 Status405(serde_json::Value),
25 UnknownValue(serde_json::Value),
26}
27
28#[derive(Debug, Clone, Serialize, Deserialize)]
30#[serde(untagged)]
31pub enum OrganizationsDeleteProjectMembershipError {
32 Status400(serde_json::Value),
33 Status401(serde_json::Value),
34 Status403(serde_json::Value),
35 Status404(serde_json::Value),
36 Status405(serde_json::Value),
37 UnknownValue(serde_json::Value),
38}
39
40#[derive(Debug, Clone, Serialize, Deserialize)]
42#[serde(untagged)]
43pub enum OrganizationsGetOrganizationMembershipsError {
44 Status400(serde_json::Value),
45 Status401(serde_json::Value),
46 Status403(serde_json::Value),
47 Status404(serde_json::Value),
48 Status405(serde_json::Value),
49 UnknownValue(serde_json::Value),
50}
51
52#[derive(Debug, Clone, Serialize, Deserialize)]
54#[serde(untagged)]
55pub enum OrganizationsGetOrganizationProjectsError {
56 Status400(serde_json::Value),
57 Status401(serde_json::Value),
58 Status403(serde_json::Value),
59 Status404(serde_json::Value),
60 Status405(serde_json::Value),
61 UnknownValue(serde_json::Value),
62}
63
64#[derive(Debug, Clone, Serialize, Deserialize)]
66#[serde(untagged)]
67pub enum OrganizationsGetProjectMembershipsError {
68 Status400(serde_json::Value),
69 Status401(serde_json::Value),
70 Status403(serde_json::Value),
71 Status404(serde_json::Value),
72 Status405(serde_json::Value),
73 UnknownValue(serde_json::Value),
74}
75
76#[derive(Debug, Clone, Serialize, Deserialize)]
78#[serde(untagged)]
79pub enum OrganizationsUpdateOrganizationMembershipError {
80 Status400(serde_json::Value),
81 Status401(serde_json::Value),
82 Status403(serde_json::Value),
83 Status404(serde_json::Value),
84 Status405(serde_json::Value),
85 UnknownValue(serde_json::Value),
86}
87
88#[derive(Debug, Clone, Serialize, Deserialize)]
90#[serde(untagged)]
91pub enum OrganizationsUpdateProjectMembershipError {
92 Status400(serde_json::Value),
93 Status401(serde_json::Value),
94 Status403(serde_json::Value),
95 Status404(serde_json::Value),
96 Status405(serde_json::Value),
97 UnknownValue(serde_json::Value),
98}
99
100#[bon::builder]
102pub async fn organizations_delete_organization_membership(
103 configuration: &configuration::Configuration,
104 delete_membership_request: models::DeleteMembershipRequest,
105) -> Result<models::MembershipDeletionResponse, Error<OrganizationsDeleteOrganizationMembershipError>>
106{
107 let p_body_delete_membership_request = delete_membership_request;
109
110 let uri_str = format!(
111 "{}/api/public/organizations/memberships",
112 configuration.base_path
113 );
114 let mut req_builder = configuration
115 .client
116 .request(reqwest::Method::DELETE, &uri_str);
117
118 if let Some(ref user_agent) = configuration.user_agent {
119 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
120 }
121 if let Some(ref auth_conf) = configuration.basic_auth {
122 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
123 };
124 req_builder = req_builder.json(&p_body_delete_membership_request);
125
126 let req = req_builder.build()?;
127 let resp = configuration.client.execute(req).await?;
128
129 let status = resp.status();
130 let content_type = resp
131 .headers()
132 .get("content-type")
133 .and_then(|v| v.to_str().ok())
134 .unwrap_or("application/octet-stream");
135 let content_type = super::ContentType::from(content_type);
136
137 if !status.is_client_error() && !status.is_server_error() {
138 let content = resp.text().await?;
139 match content_type {
140 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
141 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MembershipDeletionResponse`"))),
142 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::MembershipDeletionResponse`")))),
143 }
144 } else {
145 let content = resp.text().await?;
146 let entity: Option<OrganizationsDeleteOrganizationMembershipError> =
147 serde_json::from_str(&content).ok();
148 Err(Error::ResponseError(ResponseContent {
149 status,
150 content,
151 entity,
152 }))
153 }
154}
155
156#[bon::builder]
158pub async fn organizations_delete_project_membership(
159 configuration: &configuration::Configuration,
160 project_id: &str,
161 delete_membership_request: models::DeleteMembershipRequest,
162) -> Result<models::MembershipDeletionResponse, Error<OrganizationsDeleteProjectMembershipError>> {
163 let p_path_project_id = project_id;
165 let p_body_delete_membership_request = delete_membership_request;
166
167 let uri_str = format!(
168 "{}/api/public/projects/{projectId}/memberships",
169 configuration.base_path,
170 projectId = crate::apis::urlencode(p_path_project_id)
171 );
172 let mut req_builder = configuration
173 .client
174 .request(reqwest::Method::DELETE, &uri_str);
175
176 if let Some(ref user_agent) = configuration.user_agent {
177 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
178 }
179 if let Some(ref auth_conf) = configuration.basic_auth {
180 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
181 };
182 req_builder = req_builder.json(&p_body_delete_membership_request);
183
184 let req = req_builder.build()?;
185 let resp = configuration.client.execute(req).await?;
186
187 let status = resp.status();
188 let content_type = resp
189 .headers()
190 .get("content-type")
191 .and_then(|v| v.to_str().ok())
192 .unwrap_or("application/octet-stream");
193 let content_type = super::ContentType::from(content_type);
194
195 if !status.is_client_error() && !status.is_server_error() {
196 let content = resp.text().await?;
197 match content_type {
198 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
199 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MembershipDeletionResponse`"))),
200 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::MembershipDeletionResponse`")))),
201 }
202 } else {
203 let content = resp.text().await?;
204 let entity: Option<OrganizationsDeleteProjectMembershipError> =
205 serde_json::from_str(&content).ok();
206 Err(Error::ResponseError(ResponseContent {
207 status,
208 content,
209 entity,
210 }))
211 }
212}
213
214#[bon::builder]
216pub async fn organizations_get_organization_memberships(
217 configuration: &configuration::Configuration,
218) -> Result<models::MembershipsResponse, Error<OrganizationsGetOrganizationMembershipsError>> {
219 let uri_str = format!(
220 "{}/api/public/organizations/memberships",
221 configuration.base_path
222 );
223 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
224
225 if let Some(ref user_agent) = configuration.user_agent {
226 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
227 }
228 if let Some(ref auth_conf) = configuration.basic_auth {
229 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
230 };
231
232 let req = req_builder.build()?;
233 let resp = configuration.client.execute(req).await?;
234
235 let status = resp.status();
236 let content_type = resp
237 .headers()
238 .get("content-type")
239 .and_then(|v| v.to_str().ok())
240 .unwrap_or("application/octet-stream");
241 let content_type = super::ContentType::from(content_type);
242
243 if !status.is_client_error() && !status.is_server_error() {
244 let content = resp.text().await?;
245 match content_type {
246 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
247 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MembershipsResponse`"))),
248 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::MembershipsResponse`")))),
249 }
250 } else {
251 let content = resp.text().await?;
252 let entity: Option<OrganizationsGetOrganizationMembershipsError> =
253 serde_json::from_str(&content).ok();
254 Err(Error::ResponseError(ResponseContent {
255 status,
256 content,
257 entity,
258 }))
259 }
260}
261
262#[bon::builder]
264pub async fn organizations_get_organization_projects(
265 configuration: &configuration::Configuration,
266) -> Result<models::OrganizationProjectsResponse, Error<OrganizationsGetOrganizationProjectsError>>
267{
268 let uri_str = format!(
269 "{}/api/public/organizations/projects",
270 configuration.base_path
271 );
272 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
273
274 if let Some(ref user_agent) = configuration.user_agent {
275 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
276 }
277 if let Some(ref auth_conf) = configuration.basic_auth {
278 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
279 };
280
281 let req = req_builder.build()?;
282 let resp = configuration.client.execute(req).await?;
283
284 let status = resp.status();
285 let content_type = resp
286 .headers()
287 .get("content-type")
288 .and_then(|v| v.to_str().ok())
289 .unwrap_or("application/octet-stream");
290 let content_type = super::ContentType::from(content_type);
291
292 if !status.is_client_error() && !status.is_server_error() {
293 let content = resp.text().await?;
294 match content_type {
295 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
296 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OrganizationProjectsResponse`"))),
297 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::OrganizationProjectsResponse`")))),
298 }
299 } else {
300 let content = resp.text().await?;
301 let entity: Option<OrganizationsGetOrganizationProjectsError> =
302 serde_json::from_str(&content).ok();
303 Err(Error::ResponseError(ResponseContent {
304 status,
305 content,
306 entity,
307 }))
308 }
309}
310
311#[bon::builder]
313pub async fn organizations_get_project_memberships(
314 configuration: &configuration::Configuration,
315 project_id: &str,
316) -> Result<models::MembershipsResponse, Error<OrganizationsGetProjectMembershipsError>> {
317 let p_path_project_id = project_id;
319
320 let uri_str = format!(
321 "{}/api/public/projects/{projectId}/memberships",
322 configuration.base_path,
323 projectId = crate::apis::urlencode(p_path_project_id)
324 );
325 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
326
327 if let Some(ref user_agent) = configuration.user_agent {
328 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
329 }
330 if let Some(ref auth_conf) = configuration.basic_auth {
331 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
332 };
333
334 let req = req_builder.build()?;
335 let resp = configuration.client.execute(req).await?;
336
337 let status = resp.status();
338 let content_type = resp
339 .headers()
340 .get("content-type")
341 .and_then(|v| v.to_str().ok())
342 .unwrap_or("application/octet-stream");
343 let content_type = super::ContentType::from(content_type);
344
345 if !status.is_client_error() && !status.is_server_error() {
346 let content = resp.text().await?;
347 match content_type {
348 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
349 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MembershipsResponse`"))),
350 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::MembershipsResponse`")))),
351 }
352 } else {
353 let content = resp.text().await?;
354 let entity: Option<OrganizationsGetProjectMembershipsError> =
355 serde_json::from_str(&content).ok();
356 Err(Error::ResponseError(ResponseContent {
357 status,
358 content,
359 entity,
360 }))
361 }
362}
363
364#[bon::builder]
366pub async fn organizations_update_organization_membership(
367 configuration: &configuration::Configuration,
368 membership_request: models::MembershipRequest,
369) -> Result<models::MembershipResponse, Error<OrganizationsUpdateOrganizationMembershipError>> {
370 let p_body_membership_request = membership_request;
372
373 let uri_str = format!(
374 "{}/api/public/organizations/memberships",
375 configuration.base_path
376 );
377 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
378
379 if let Some(ref user_agent) = configuration.user_agent {
380 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
381 }
382 if let Some(ref auth_conf) = configuration.basic_auth {
383 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
384 };
385 req_builder = req_builder.json(&p_body_membership_request);
386
387 let req = req_builder.build()?;
388 let resp = configuration.client.execute(req).await?;
389
390 let status = resp.status();
391 let content_type = resp
392 .headers()
393 .get("content-type")
394 .and_then(|v| v.to_str().ok())
395 .unwrap_or("application/octet-stream");
396 let content_type = super::ContentType::from(content_type);
397
398 if !status.is_client_error() && !status.is_server_error() {
399 let content = resp.text().await?;
400 match content_type {
401 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
402 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MembershipResponse`"))),
403 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::MembershipResponse`")))),
404 }
405 } else {
406 let content = resp.text().await?;
407 let entity: Option<OrganizationsUpdateOrganizationMembershipError> =
408 serde_json::from_str(&content).ok();
409 Err(Error::ResponseError(ResponseContent {
410 status,
411 content,
412 entity,
413 }))
414 }
415}
416
417#[bon::builder]
419pub async fn organizations_update_project_membership(
420 configuration: &configuration::Configuration,
421 project_id: &str,
422 membership_request: models::MembershipRequest,
423) -> Result<models::MembershipResponse, Error<OrganizationsUpdateProjectMembershipError>> {
424 let p_path_project_id = project_id;
426 let p_body_membership_request = membership_request;
427
428 let uri_str = format!(
429 "{}/api/public/projects/{projectId}/memberships",
430 configuration.base_path,
431 projectId = crate::apis::urlencode(p_path_project_id)
432 );
433 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &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 auth_conf) = configuration.basic_auth {
439 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
440 };
441 req_builder = req_builder.json(&p_body_membership_request);
442
443 let req = req_builder.build()?;
444 let resp = configuration.client.execute(req).await?;
445
446 let status = resp.status();
447 let content_type = resp
448 .headers()
449 .get("content-type")
450 .and_then(|v| v.to_str().ok())
451 .unwrap_or("application/octet-stream");
452 let content_type = super::ContentType::from(content_type);
453
454 if !status.is_client_error() && !status.is_server_error() {
455 let content = resp.text().await?;
456 match content_type {
457 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
458 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MembershipResponse`"))),
459 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::MembershipResponse`")))),
460 }
461 } else {
462 let content = resp.text().await?;
463 let entity: Option<OrganizationsUpdateProjectMembershipError> =
464 serde_json::from_str(&content).ok();
465 Err(Error::ResponseError(ResponseContent {
466 status,
467 content,
468 entity,
469 }))
470 }
471}