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 OrganizationsGetOrganizationApiKeysError {
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 OrganizationsGetOrganizationMembershipsError {
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 OrganizationsGetOrganizationProjectsError {
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 OrganizationsGetProjectMembershipsError {
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 OrganizationsUpdateOrganizationMembershipError {
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#[derive(Debug, Clone, Serialize, Deserialize)]
102#[serde(untagged)]
103pub enum OrganizationsUpdateProjectMembershipError {
104 Status400(serde_json::Value),
105 Status401(serde_json::Value),
106 Status403(serde_json::Value),
107 Status404(serde_json::Value),
108 Status405(serde_json::Value),
109 UnknownValue(serde_json::Value),
110}
111
112#[bon::builder]
114pub async fn organizations_delete_organization_membership(
115 configuration: &configuration::Configuration,
116 delete_membership_request: models::DeleteMembershipRequest,
117) -> Result<models::MembershipDeletionResponse, Error<OrganizationsDeleteOrganizationMembershipError>>
118{
119 let p_body_delete_membership_request = delete_membership_request;
121
122 let uri_str = format!(
123 "{}/api/public/organizations/memberships",
124 configuration.base_path
125 );
126 let mut req_builder = configuration
127 .client
128 .request(reqwest::Method::DELETE, &uri_str);
129
130 if let Some(ref user_agent) = configuration.user_agent {
131 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
132 }
133 if let Some(ref auth_conf) = configuration.basic_auth {
134 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
135 };
136 req_builder = req_builder.json(&p_body_delete_membership_request);
137
138 let req = req_builder.build()?;
139 let resp = configuration.client.execute(req).await?;
140
141 let status = resp.status();
142 let content_type = resp
143 .headers()
144 .get("content-type")
145 .and_then(|v| v.to_str().ok())
146 .unwrap_or("application/octet-stream");
147 let content_type = super::ContentType::from(content_type);
148
149 if !status.is_client_error() && !status.is_server_error() {
150 let content = resp.text().await?;
151 match content_type {
152 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
153 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MembershipDeletionResponse`"))),
154 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`")))),
155 }
156 } else {
157 let content = resp.text().await?;
158 let entity: Option<OrganizationsDeleteOrganizationMembershipError> =
159 serde_json::from_str(&content).ok();
160 Err(Error::ResponseError(ResponseContent {
161 status,
162 content,
163 entity,
164 }))
165 }
166}
167
168#[bon::builder]
170pub async fn organizations_delete_project_membership(
171 configuration: &configuration::Configuration,
172 project_id: &str,
173 delete_membership_request: models::DeleteMembershipRequest,
174) -> Result<models::MembershipDeletionResponse, Error<OrganizationsDeleteProjectMembershipError>> {
175 let p_path_project_id = project_id;
177 let p_body_delete_membership_request = delete_membership_request;
178
179 let uri_str = format!(
180 "{}/api/public/projects/{projectId}/memberships",
181 configuration.base_path,
182 projectId = crate::apis::urlencode(p_path_project_id)
183 );
184 let mut req_builder = configuration
185 .client
186 .request(reqwest::Method::DELETE, &uri_str);
187
188 if let Some(ref user_agent) = configuration.user_agent {
189 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
190 }
191 if let Some(ref auth_conf) = configuration.basic_auth {
192 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
193 };
194 req_builder = req_builder.json(&p_body_delete_membership_request);
195
196 let req = req_builder.build()?;
197 let resp = configuration.client.execute(req).await?;
198
199 let status = resp.status();
200 let content_type = resp
201 .headers()
202 .get("content-type")
203 .and_then(|v| v.to_str().ok())
204 .unwrap_or("application/octet-stream");
205 let content_type = super::ContentType::from(content_type);
206
207 if !status.is_client_error() && !status.is_server_error() {
208 let content = resp.text().await?;
209 match content_type {
210 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
211 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MembershipDeletionResponse`"))),
212 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`")))),
213 }
214 } else {
215 let content = resp.text().await?;
216 let entity: Option<OrganizationsDeleteProjectMembershipError> =
217 serde_json::from_str(&content).ok();
218 Err(Error::ResponseError(ResponseContent {
219 status,
220 content,
221 entity,
222 }))
223 }
224}
225
226#[bon::builder]
228pub async fn organizations_get_organization_api_keys(
229 configuration: &configuration::Configuration,
230) -> Result<models::OrganizationApiKeysResponse, Error<OrganizationsGetOrganizationApiKeysError>> {
231 let uri_str = format!(
232 "{}/api/public/organizations/apiKeys",
233 configuration.base_path
234 );
235 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
236
237 if let Some(ref user_agent) = configuration.user_agent {
238 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
239 }
240 if let Some(ref auth_conf) = configuration.basic_auth {
241 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
242 };
243
244 let req = req_builder.build()?;
245 let resp = configuration.client.execute(req).await?;
246
247 let status = resp.status();
248 let content_type = resp
249 .headers()
250 .get("content-type")
251 .and_then(|v| v.to_str().ok())
252 .unwrap_or("application/octet-stream");
253 let content_type = super::ContentType::from(content_type);
254
255 if !status.is_client_error() && !status.is_server_error() {
256 let content = resp.text().await?;
257 match content_type {
258 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
259 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OrganizationApiKeysResponse`"))),
260 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::OrganizationApiKeysResponse`")))),
261 }
262 } else {
263 let content = resp.text().await?;
264 let entity: Option<OrganizationsGetOrganizationApiKeysError> =
265 serde_json::from_str(&content).ok();
266 Err(Error::ResponseError(ResponseContent {
267 status,
268 content,
269 entity,
270 }))
271 }
272}
273
274#[bon::builder]
276pub async fn organizations_get_organization_memberships(
277 configuration: &configuration::Configuration,
278) -> Result<models::MembershipsResponse, Error<OrganizationsGetOrganizationMembershipsError>> {
279 let uri_str = format!(
280 "{}/api/public/organizations/memberships",
281 configuration.base_path
282 );
283 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
284
285 if let Some(ref user_agent) = configuration.user_agent {
286 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
287 }
288 if let Some(ref auth_conf) = configuration.basic_auth {
289 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
290 };
291
292 let req = req_builder.build()?;
293 let resp = configuration.client.execute(req).await?;
294
295 let status = resp.status();
296 let content_type = resp
297 .headers()
298 .get("content-type")
299 .and_then(|v| v.to_str().ok())
300 .unwrap_or("application/octet-stream");
301 let content_type = super::ContentType::from(content_type);
302
303 if !status.is_client_error() && !status.is_server_error() {
304 let content = resp.text().await?;
305 match content_type {
306 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
307 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MembershipsResponse`"))),
308 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`")))),
309 }
310 } else {
311 let content = resp.text().await?;
312 let entity: Option<OrganizationsGetOrganizationMembershipsError> =
313 serde_json::from_str(&content).ok();
314 Err(Error::ResponseError(ResponseContent {
315 status,
316 content,
317 entity,
318 }))
319 }
320}
321
322#[bon::builder]
324pub async fn organizations_get_organization_projects(
325 configuration: &configuration::Configuration,
326) -> Result<models::OrganizationProjectsResponse, Error<OrganizationsGetOrganizationProjectsError>>
327{
328 let uri_str = format!(
329 "{}/api/public/organizations/projects",
330 configuration.base_path
331 );
332 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
333
334 if let Some(ref user_agent) = configuration.user_agent {
335 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
336 }
337 if let Some(ref auth_conf) = configuration.basic_auth {
338 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
339 };
340
341 let req = req_builder.build()?;
342 let resp = configuration.client.execute(req).await?;
343
344 let status = resp.status();
345 let content_type = resp
346 .headers()
347 .get("content-type")
348 .and_then(|v| v.to_str().ok())
349 .unwrap_or("application/octet-stream");
350 let content_type = super::ContentType::from(content_type);
351
352 if !status.is_client_error() && !status.is_server_error() {
353 let content = resp.text().await?;
354 match content_type {
355 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
356 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OrganizationProjectsResponse`"))),
357 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`")))),
358 }
359 } else {
360 let content = resp.text().await?;
361 let entity: Option<OrganizationsGetOrganizationProjectsError> =
362 serde_json::from_str(&content).ok();
363 Err(Error::ResponseError(ResponseContent {
364 status,
365 content,
366 entity,
367 }))
368 }
369}
370
371#[bon::builder]
373pub async fn organizations_get_project_memberships(
374 configuration: &configuration::Configuration,
375 project_id: &str,
376) -> Result<models::MembershipsResponse, Error<OrganizationsGetProjectMembershipsError>> {
377 let p_path_project_id = project_id;
379
380 let uri_str = format!(
381 "{}/api/public/projects/{projectId}/memberships",
382 configuration.base_path,
383 projectId = crate::apis::urlencode(p_path_project_id)
384 );
385 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
386
387 if let Some(ref user_agent) = configuration.user_agent {
388 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
389 }
390 if let Some(ref auth_conf) = configuration.basic_auth {
391 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
392 };
393
394 let req = req_builder.build()?;
395 let resp = configuration.client.execute(req).await?;
396
397 let status = resp.status();
398 let content_type = resp
399 .headers()
400 .get("content-type")
401 .and_then(|v| v.to_str().ok())
402 .unwrap_or("application/octet-stream");
403 let content_type = super::ContentType::from(content_type);
404
405 if !status.is_client_error() && !status.is_server_error() {
406 let content = resp.text().await?;
407 match content_type {
408 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
409 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MembershipsResponse`"))),
410 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`")))),
411 }
412 } else {
413 let content = resp.text().await?;
414 let entity: Option<OrganizationsGetProjectMembershipsError> =
415 serde_json::from_str(&content).ok();
416 Err(Error::ResponseError(ResponseContent {
417 status,
418 content,
419 entity,
420 }))
421 }
422}
423
424#[bon::builder]
426pub async fn organizations_update_organization_membership(
427 configuration: &configuration::Configuration,
428 membership_request: models::MembershipRequest,
429) -> Result<models::MembershipResponse, Error<OrganizationsUpdateOrganizationMembershipError>> {
430 let p_body_membership_request = membership_request;
432
433 let uri_str = format!(
434 "{}/api/public/organizations/memberships",
435 configuration.base_path
436 );
437 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
438
439 if let Some(ref user_agent) = configuration.user_agent {
440 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
441 }
442 if let Some(ref auth_conf) = configuration.basic_auth {
443 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
444 };
445 req_builder = req_builder.json(&p_body_membership_request);
446
447 let req = req_builder.build()?;
448 let resp = configuration.client.execute(req).await?;
449
450 let status = resp.status();
451 let content_type = resp
452 .headers()
453 .get("content-type")
454 .and_then(|v| v.to_str().ok())
455 .unwrap_or("application/octet-stream");
456 let content_type = super::ContentType::from(content_type);
457
458 if !status.is_client_error() && !status.is_server_error() {
459 let content = resp.text().await?;
460 match content_type {
461 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
462 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MembershipResponse`"))),
463 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`")))),
464 }
465 } else {
466 let content = resp.text().await?;
467 let entity: Option<OrganizationsUpdateOrganizationMembershipError> =
468 serde_json::from_str(&content).ok();
469 Err(Error::ResponseError(ResponseContent {
470 status,
471 content,
472 entity,
473 }))
474 }
475}
476
477#[bon::builder]
479pub async fn organizations_update_project_membership(
480 configuration: &configuration::Configuration,
481 project_id: &str,
482 membership_request: models::MembershipRequest,
483) -> Result<models::MembershipResponse, Error<OrganizationsUpdateProjectMembershipError>> {
484 let p_path_project_id = project_id;
486 let p_body_membership_request = membership_request;
487
488 let uri_str = format!(
489 "{}/api/public/projects/{projectId}/memberships",
490 configuration.base_path,
491 projectId = crate::apis::urlencode(p_path_project_id)
492 );
493 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
494
495 if let Some(ref user_agent) = configuration.user_agent {
496 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
497 }
498 if let Some(ref auth_conf) = configuration.basic_auth {
499 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
500 };
501 req_builder = req_builder.json(&p_body_membership_request);
502
503 let req = req_builder.build()?;
504 let resp = configuration.client.execute(req).await?;
505
506 let status = resp.status();
507 let content_type = resp
508 .headers()
509 .get("content-type")
510 .and_then(|v| v.to_str().ok())
511 .unwrap_or("application/octet-stream");
512 let content_type = super::ContentType::from(content_type);
513
514 if !status.is_client_error() && !status.is_server_error() {
515 let content = resp.text().await?;
516 match content_type {
517 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
518 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::MembershipResponse`"))),
519 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`")))),
520 }
521 } else {
522 let content = resp.text().await?;
523 let entity: Option<OrganizationsUpdateProjectMembershipError> =
524 serde_json::from_str(&content).ok();
525 Err(Error::ResponseError(ResponseContent {
526 status,
527 content,
528 entity,
529 }))
530 }
531}