1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum CreateOrganizationError {
22 Status400(models::ErrorGeneric),
23 Status403(models::ErrorGeneric),
24 Status409(models::ErrorGeneric),
25 DefaultResponse(models::ErrorGeneric),
26 UnknownValue(serde_json::Value),
27}
28
29#[derive(Debug, Clone, Serialize, Deserialize)]
31#[serde(untagged)]
32pub enum CreateOrganizationOnboardingPortalLinkError {
33 DefaultResponse(models::ErrorGeneric),
34 UnknownValue(serde_json::Value),
35}
36
37#[derive(Debug, Clone, Serialize, Deserialize)]
39#[serde(untagged)]
40pub enum CreateProjectError {
41 Status401(models::ErrorGeneric),
42 Status403(models::ErrorGeneric),
43 Status404(models::ErrorGeneric),
44 DefaultResponse(models::ErrorGeneric),
45 UnknownValue(serde_json::Value),
46}
47
48#[derive(Debug, Clone, Serialize, Deserialize)]
50#[serde(untagged)]
51pub enum CreateProjectApiKeyError {
52 DefaultResponse(models::ErrorGeneric),
53 UnknownValue(serde_json::Value),
54}
55
56#[derive(Debug, Clone, Serialize, Deserialize)]
58#[serde(untagged)]
59pub enum DeleteOrganizationError {
60 Status400(models::ErrorGeneric),
61 Status403(models::ErrorGeneric),
62 Status404(models::ErrorGeneric),
63 Status409(models::ErrorGeneric),
64 DefaultResponse(models::ErrorGeneric),
65 UnknownValue(serde_json::Value),
66}
67
68#[derive(Debug, Clone, Serialize, Deserialize)]
70#[serde(untagged)]
71pub enum DeleteOrganizationOnboardingPortalLinkError {
72 Status400(models::ErrorGeneric),
73 Status403(models::ErrorGeneric),
74 DefaultResponse(models::ErrorGeneric),
75 UnknownValue(serde_json::Value),
76}
77
78#[derive(Debug, Clone, Serialize, Deserialize)]
80#[serde(untagged)]
81pub enum DeleteProjectApiKeyError {
82 DefaultResponse(models::ErrorGeneric),
83 UnknownValue(serde_json::Value),
84}
85
86#[derive(Debug, Clone, Serialize, Deserialize)]
88#[serde(untagged)]
89pub enum GetOrganizationError {
90 Status400(models::ErrorGeneric),
91 Status403(models::ErrorGeneric),
92 DefaultResponse(models::ErrorGeneric),
93 UnknownValue(serde_json::Value),
94}
95
96#[derive(Debug, Clone, Serialize, Deserialize)]
98#[serde(untagged)]
99pub enum GetOrganizationOnboardingPortalLinksError {
100 Status400(models::ErrorGeneric),
101 Status403(models::ErrorGeneric),
102 DefaultResponse(models::ErrorGeneric),
103 UnknownValue(serde_json::Value),
104}
105
106#[derive(Debug, Clone, Serialize, Deserialize)]
108#[serde(untagged)]
109pub enum GetProjectError {
110 Status401(models::ErrorGeneric),
111 Status403(models::ErrorGeneric),
112 Status404(models::ErrorGeneric),
113 DefaultResponse(models::ErrorGeneric),
114 UnknownValue(serde_json::Value),
115}
116
117#[derive(Debug, Clone, Serialize, Deserialize)]
119#[serde(untagged)]
120pub enum GetProjectMembersError {
121 Status401(models::GenericError),
122 Status406(models::GenericError),
123 DefaultResponse(models::GenericError),
124 UnknownValue(serde_json::Value),
125}
126
127#[derive(Debug, Clone, Serialize, Deserialize)]
129#[serde(untagged)]
130pub enum ListOrganizationsError {
131 Status400(models::ErrorGeneric),
132 Status403(models::ErrorGeneric),
133 DefaultResponse(models::ErrorGeneric),
134 UnknownValue(serde_json::Value),
135}
136
137#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum ListProjectApiKeysError {
141 DefaultResponse(models::ErrorGeneric),
142 UnknownValue(serde_json::Value),
143}
144
145#[derive(Debug, Clone, Serialize, Deserialize)]
147#[serde(untagged)]
148pub enum ListProjectsError {
149 Status401(models::ErrorGeneric),
150 Status403(models::ErrorGeneric),
151 Status404(models::ErrorGeneric),
152 DefaultResponse(models::ErrorGeneric),
153 UnknownValue(serde_json::Value),
154}
155
156#[derive(Debug, Clone, Serialize, Deserialize)]
158#[serde(untagged)]
159pub enum PatchProjectError {
160 Status400(models::ErrorGeneric),
161 Status401(models::ErrorGeneric),
162 Status403(models::ErrorGeneric),
163 Status404(models::ErrorGeneric),
164 DefaultResponse(models::ErrorGeneric),
165 UnknownValue(serde_json::Value),
166}
167
168#[derive(Debug, Clone, Serialize, Deserialize)]
170#[serde(untagged)]
171pub enum PatchProjectWithRevisionError {
172 Status400(models::ErrorGeneric),
173 Status401(models::ErrorGeneric),
174 Status403(models::ErrorGeneric),
175 Status404(models::ErrorGeneric),
176 Status409(models::ErrorGeneric),
177 DefaultResponse(models::ErrorGeneric),
178 UnknownValue(serde_json::Value),
179}
180
181#[derive(Debug, Clone, Serialize, Deserialize)]
183#[serde(untagged)]
184pub enum PurgeProjectError {
185 Status401(models::GenericError),
186 Status403(models::GenericError),
187 Status404(models::GenericError),
188 DefaultResponse(models::GenericError),
189 UnknownValue(serde_json::Value),
190}
191
192#[derive(Debug, Clone, Serialize, Deserialize)]
194#[serde(untagged)]
195pub enum RemoveProjectMemberError {
196 Status401(models::GenericError),
197 Status406(models::GenericError),
198 DefaultResponse(models::GenericError),
199 UnknownValue(serde_json::Value),
200}
201
202#[derive(Debug, Clone, Serialize, Deserialize)]
204#[serde(untagged)]
205pub enum SetProjectError {
206 Status400(models::ErrorGeneric),
207 Status401(models::ErrorGeneric),
208 Status403(models::ErrorGeneric),
209 Status404(models::ErrorGeneric),
210 DefaultResponse(models::ErrorGeneric),
211 UnknownValue(serde_json::Value),
212}
213
214#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum UpdateOrganizationError {
218 Status400(models::ErrorGeneric),
219 Status403(models::ErrorGeneric),
220 Status404(models::ErrorGeneric),
221 Status409(models::ErrorGeneric),
222 DefaultResponse(models::ErrorGeneric),
223 UnknownValue(serde_json::Value),
224}
225
226#[derive(Debug, Clone, Serialize, Deserialize)]
228#[serde(untagged)]
229pub enum UpdateOrganizationOnboardingPortalLinkError {
230 DefaultResponse(models::ErrorGeneric),
231 UnknownValue(serde_json::Value),
232}
233
234
235pub async fn create_organization(configuration: &configuration::Configuration, project_id: &str, organization_body: Option<models::OrganizationBody>) -> Result<models::Organization, Error<CreateOrganizationError>> {
237 let p_project_id = project_id;
239 let p_organization_body = organization_body;
240
241 let uri_str = format!("{}/projects/{project_id}/organizations", configuration.base_path, project_id=crate::apis::urlencode(p_project_id));
242 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
243
244 if let Some(ref user_agent) = configuration.user_agent {
245 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
246 }
247 if let Some(ref token) = configuration.bearer_access_token {
248 req_builder = req_builder.bearer_auth(token.to_owned());
249 };
250 req_builder = req_builder.json(&p_organization_body);
251
252 let req = req_builder.build()?;
253 let resp = configuration.client.execute(req).await?;
254
255 let status = resp.status();
256 let content_type = resp
257 .headers()
258 .get("content-type")
259 .and_then(|v| v.to_str().ok())
260 .unwrap_or("application/octet-stream");
261 let content_type = super::ContentType::from(content_type);
262
263 if !status.is_client_error() && !status.is_server_error() {
264 let content = resp.text().await?;
265 match content_type {
266 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
267 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Organization`"))),
268 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::Organization`")))),
269 }
270 } else {
271 let content = resp.text().await?;
272 let entity: Option<CreateOrganizationError> = serde_json::from_str(&content).ok();
273 Err(Error::ResponseError(ResponseContent { status, content, entity }))
274 }
275}
276
277pub async fn create_organization_onboarding_portal_link(configuration: &configuration::Configuration, project_id: &str, organization_id: &str, create_organization_onboarding_portal_link_body: Option<models::CreateOrganizationOnboardingPortalLinkBody>) -> Result<models::OnboardingPortalLink, Error<CreateOrganizationOnboardingPortalLinkError>> {
279 let p_project_id = project_id;
281 let p_organization_id = organization_id;
282 let p_create_organization_onboarding_portal_link_body = create_organization_onboarding_portal_link_body;
283
284 let uri_str = format!("{}/projects/{project_id}/organizations/{organization_id}/onboarding-portal-links", configuration.base_path, project_id=crate::apis::urlencode(p_project_id), organization_id=crate::apis::urlencode(p_organization_id));
285 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
286
287 if let Some(ref user_agent) = configuration.user_agent {
288 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
289 }
290 if let Some(ref token) = configuration.bearer_access_token {
291 req_builder = req_builder.bearer_auth(token.to_owned());
292 };
293 req_builder = req_builder.json(&p_create_organization_onboarding_portal_link_body);
294
295 let req = req_builder.build()?;
296 let resp = configuration.client.execute(req).await?;
297
298 let status = resp.status();
299 let content_type = resp
300 .headers()
301 .get("content-type")
302 .and_then(|v| v.to_str().ok())
303 .unwrap_or("application/octet-stream");
304 let content_type = super::ContentType::from(content_type);
305
306 if !status.is_client_error() && !status.is_server_error() {
307 let content = resp.text().await?;
308 match content_type {
309 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
310 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OnboardingPortalLink`"))),
311 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::OnboardingPortalLink`")))),
312 }
313 } else {
314 let content = resp.text().await?;
315 let entity: Option<CreateOrganizationOnboardingPortalLinkError> = serde_json::from_str(&content).ok();
316 Err(Error::ResponseError(ResponseContent { status, content, entity }))
317 }
318}
319
320pub async fn create_project(configuration: &configuration::Configuration, create_project_body: Option<models::CreateProjectBody>) -> Result<models::Project, Error<CreateProjectError>> {
322 let p_create_project_body = create_project_body;
324
325 let uri_str = format!("{}/projects", configuration.base_path);
326 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
327
328 if let Some(ref user_agent) = configuration.user_agent {
329 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
330 }
331 if let Some(ref token) = configuration.bearer_access_token {
332 req_builder = req_builder.bearer_auth(token.to_owned());
333 };
334 req_builder = req_builder.json(&p_create_project_body);
335
336 let req = req_builder.build()?;
337 let resp = configuration.client.execute(req).await?;
338
339 let status = resp.status();
340 let content_type = resp
341 .headers()
342 .get("content-type")
343 .and_then(|v| v.to_str().ok())
344 .unwrap_or("application/octet-stream");
345 let content_type = super::ContentType::from(content_type);
346
347 if !status.is_client_error() && !status.is_server_error() {
348 let content = resp.text().await?;
349 match content_type {
350 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
351 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Project`"))),
352 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::Project`")))),
353 }
354 } else {
355 let content = resp.text().await?;
356 let entity: Option<CreateProjectError> = serde_json::from_str(&content).ok();
357 Err(Error::ResponseError(ResponseContent { status, content, entity }))
358 }
359}
360
361pub async fn create_project_api_key(configuration: &configuration::Configuration, project: &str, create_project_api_key_request: Option<models::CreateProjectApiKeyRequest>) -> Result<models::ProjectApiKey, Error<CreateProjectApiKeyError>> {
363 let p_project = project;
365 let p_create_project_api_key_request = create_project_api_key_request;
366
367 let uri_str = format!("{}/projects/{project}/tokens", configuration.base_path, project=crate::apis::urlencode(p_project));
368 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
369
370 if let Some(ref user_agent) = configuration.user_agent {
371 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
372 }
373 if let Some(ref token) = configuration.bearer_access_token {
374 req_builder = req_builder.bearer_auth(token.to_owned());
375 };
376 req_builder = req_builder.json(&p_create_project_api_key_request);
377
378 let req = req_builder.build()?;
379 let resp = configuration.client.execute(req).await?;
380
381 let status = resp.status();
382 let content_type = resp
383 .headers()
384 .get("content-type")
385 .and_then(|v| v.to_str().ok())
386 .unwrap_or("application/octet-stream");
387 let content_type = super::ContentType::from(content_type);
388
389 if !status.is_client_error() && !status.is_server_error() {
390 let content = resp.text().await?;
391 match content_type {
392 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
393 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ProjectApiKey`"))),
394 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::ProjectApiKey`")))),
395 }
396 } else {
397 let content = resp.text().await?;
398 let entity: Option<CreateProjectApiKeyError> = serde_json::from_str(&content).ok();
399 Err(Error::ResponseError(ResponseContent { status, content, entity }))
400 }
401}
402
403pub async fn delete_organization(configuration: &configuration::Configuration, project_id: &str, organization_id: &str) -> Result<(), Error<DeleteOrganizationError>> {
405 let p_project_id = project_id;
407 let p_organization_id = organization_id;
408
409 let uri_str = format!("{}/projects/{project_id}/organizations/{organization_id}", configuration.base_path, project_id=crate::apis::urlencode(p_project_id), organization_id=crate::apis::urlencode(p_organization_id));
410 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
411
412 if let Some(ref user_agent) = configuration.user_agent {
413 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
414 }
415 if let Some(ref token) = configuration.bearer_access_token {
416 req_builder = req_builder.bearer_auth(token.to_owned());
417 };
418
419 let req = req_builder.build()?;
420 let resp = configuration.client.execute(req).await?;
421
422 let status = resp.status();
423
424 if !status.is_client_error() && !status.is_server_error() {
425 Ok(())
426 } else {
427 let content = resp.text().await?;
428 let entity: Option<DeleteOrganizationError> = serde_json::from_str(&content).ok();
429 Err(Error::ResponseError(ResponseContent { status, content, entity }))
430 }
431}
432
433pub async fn delete_organization_onboarding_portal_link(configuration: &configuration::Configuration, project_id: &str, organization_id: &str, onboarding_portal_link_id: &str) -> Result<(), Error<DeleteOrganizationOnboardingPortalLinkError>> {
435 let p_project_id = project_id;
437 let p_organization_id = organization_id;
438 let p_onboarding_portal_link_id = onboarding_portal_link_id;
439
440 let uri_str = format!("{}/projects/{project_id}/organizations/{organization_id}/onboarding-portal-links/{onboarding_portal_link_id}", configuration.base_path, project_id=crate::apis::urlencode(p_project_id), organization_id=crate::apis::urlencode(p_organization_id), onboarding_portal_link_id=crate::apis::urlencode(p_onboarding_portal_link_id));
441 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
442
443 if let Some(ref user_agent) = configuration.user_agent {
444 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
445 }
446 if let Some(ref token) = configuration.bearer_access_token {
447 req_builder = req_builder.bearer_auth(token.to_owned());
448 };
449
450 let req = req_builder.build()?;
451 let resp = configuration.client.execute(req).await?;
452
453 let status = resp.status();
454
455 if !status.is_client_error() && !status.is_server_error() {
456 Ok(())
457 } else {
458 let content = resp.text().await?;
459 let entity: Option<DeleteOrganizationOnboardingPortalLinkError> = serde_json::from_str(&content).ok();
460 Err(Error::ResponseError(ResponseContent { status, content, entity }))
461 }
462}
463
464pub async fn delete_project_api_key(configuration: &configuration::Configuration, project: &str, token_id: &str) -> Result<(), Error<DeleteProjectApiKeyError>> {
466 let p_project = project;
468 let p_token_id = token_id;
469
470 let uri_str = format!("{}/projects/{project}/tokens/{token_id}", configuration.base_path, project=crate::apis::urlencode(p_project), token_id=crate::apis::urlencode(p_token_id));
471 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &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.bearer_access_token {
477 req_builder = req_builder.bearer_auth(token.to_owned());
478 };
479
480 let req = req_builder.build()?;
481 let resp = configuration.client.execute(req).await?;
482
483 let status = resp.status();
484
485 if !status.is_client_error() && !status.is_server_error() {
486 Ok(())
487 } else {
488 let content = resp.text().await?;
489 let entity: Option<DeleteProjectApiKeyError> = serde_json::from_str(&content).ok();
490 Err(Error::ResponseError(ResponseContent { status, content, entity }))
491 }
492}
493
494pub async fn get_organization(configuration: &configuration::Configuration, project_id: &str, organization_id: &str) -> Result<models::GetOrganizationResponse, Error<GetOrganizationError>> {
496 let p_project_id = project_id;
498 let p_organization_id = organization_id;
499
500 let uri_str = format!("{}/projects/{project_id}/organizations/{organization_id}", configuration.base_path, project_id=crate::apis::urlencode(p_project_id), organization_id=crate::apis::urlencode(p_organization_id));
501 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
502
503 if let Some(ref user_agent) = configuration.user_agent {
504 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
505 }
506 if let Some(ref token) = configuration.bearer_access_token {
507 req_builder = req_builder.bearer_auth(token.to_owned());
508 };
509
510 let req = req_builder.build()?;
511 let resp = configuration.client.execute(req).await?;
512
513 let status = resp.status();
514 let content_type = resp
515 .headers()
516 .get("content-type")
517 .and_then(|v| v.to_str().ok())
518 .unwrap_or("application/octet-stream");
519 let content_type = super::ContentType::from(content_type);
520
521 if !status.is_client_error() && !status.is_server_error() {
522 let content = resp.text().await?;
523 match content_type {
524 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
525 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetOrganizationResponse`"))),
526 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::GetOrganizationResponse`")))),
527 }
528 } else {
529 let content = resp.text().await?;
530 let entity: Option<GetOrganizationError> = serde_json::from_str(&content).ok();
531 Err(Error::ResponseError(ResponseContent { status, content, entity }))
532 }
533}
534
535pub async fn get_organization_onboarding_portal_links(configuration: &configuration::Configuration, project_id: &str, organization_id: &str) -> Result<models::OrganizationOnboardingPortalLinksResponse, Error<GetOrganizationOnboardingPortalLinksError>> {
537 let p_project_id = project_id;
539 let p_organization_id = organization_id;
540
541 let uri_str = format!("{}/projects/{project_id}/organizations/{organization_id}/onboarding-portal-links", configuration.base_path, project_id=crate::apis::urlencode(p_project_id), organization_id=crate::apis::urlencode(p_organization_id));
542 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
543
544 if let Some(ref user_agent) = configuration.user_agent {
545 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
546 }
547 if let Some(ref token) = configuration.bearer_access_token {
548 req_builder = req_builder.bearer_auth(token.to_owned());
549 };
550
551 let req = req_builder.build()?;
552 let resp = configuration.client.execute(req).await?;
553
554 let status = resp.status();
555 let content_type = resp
556 .headers()
557 .get("content-type")
558 .and_then(|v| v.to_str().ok())
559 .unwrap_or("application/octet-stream");
560 let content_type = super::ContentType::from(content_type);
561
562 if !status.is_client_error() && !status.is_server_error() {
563 let content = resp.text().await?;
564 match content_type {
565 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
566 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OrganizationOnboardingPortalLinksResponse`"))),
567 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::OrganizationOnboardingPortalLinksResponse`")))),
568 }
569 } else {
570 let content = resp.text().await?;
571 let entity: Option<GetOrganizationOnboardingPortalLinksError> = serde_json::from_str(&content).ok();
572 Err(Error::ResponseError(ResponseContent { status, content, entity }))
573 }
574}
575
576pub async fn get_project(configuration: &configuration::Configuration, project_id: &str) -> Result<models::Project, Error<GetProjectError>> {
578 let p_project_id = project_id;
580
581 let uri_str = format!("{}/projects/{project_id}", configuration.base_path, project_id=crate::apis::urlencode(p_project_id));
582 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
583
584 if let Some(ref user_agent) = configuration.user_agent {
585 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
586 }
587 if let Some(ref token) = configuration.bearer_access_token {
588 req_builder = req_builder.bearer_auth(token.to_owned());
589 };
590
591 let req = req_builder.build()?;
592 let resp = configuration.client.execute(req).await?;
593
594 let status = resp.status();
595 let content_type = resp
596 .headers()
597 .get("content-type")
598 .and_then(|v| v.to_str().ok())
599 .unwrap_or("application/octet-stream");
600 let content_type = super::ContentType::from(content_type);
601
602 if !status.is_client_error() && !status.is_server_error() {
603 let content = resp.text().await?;
604 match content_type {
605 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
606 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Project`"))),
607 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::Project`")))),
608 }
609 } else {
610 let content = resp.text().await?;
611 let entity: Option<GetProjectError> = serde_json::from_str(&content).ok();
612 Err(Error::ResponseError(ResponseContent { status, content, entity }))
613 }
614}
615
616pub async fn get_project_members(configuration: &configuration::Configuration, project: &str) -> Result<Vec<models::ProjectMember>, Error<GetProjectMembersError>> {
618 let p_project = project;
620
621 let uri_str = format!("{}/projects/{project}/members", configuration.base_path, project=crate::apis::urlencode(p_project));
622 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
623
624 if let Some(ref user_agent) = configuration.user_agent {
625 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
626 }
627 if let Some(ref token) = configuration.bearer_access_token {
628 req_builder = req_builder.bearer_auth(token.to_owned());
629 };
630
631 let req = req_builder.build()?;
632 let resp = configuration.client.execute(req).await?;
633
634 let status = resp.status();
635 let content_type = resp
636 .headers()
637 .get("content-type")
638 .and_then(|v| v.to_str().ok())
639 .unwrap_or("application/octet-stream");
640 let content_type = super::ContentType::from(content_type);
641
642 if !status.is_client_error() && !status.is_server_error() {
643 let content = resp.text().await?;
644 match content_type {
645 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
646 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::ProjectMember>`"))),
647 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::ProjectMember>`")))),
648 }
649 } else {
650 let content = resp.text().await?;
651 let entity: Option<GetProjectMembersError> = serde_json::from_str(&content).ok();
652 Err(Error::ResponseError(ResponseContent { status, content, entity }))
653 }
654}
655
656pub async fn list_organizations(configuration: &configuration::Configuration, project_id: &str, page_size: Option<i64>, page_token: Option<&str>, domain: Option<&str>) -> Result<models::ListOrganizationsResponse, Error<ListOrganizationsError>> {
658 let p_project_id = project_id;
660 let p_page_size = page_size;
661 let p_page_token = page_token;
662 let p_domain = domain;
663
664 let uri_str = format!("{}/projects/{project_id}/organizations", configuration.base_path, project_id=crate::apis::urlencode(p_project_id));
665 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
666
667 if let Some(ref param_value) = p_page_size {
668 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
669 }
670 if let Some(ref param_value) = p_page_token {
671 req_builder = req_builder.query(&[("page_token", ¶m_value.to_string())]);
672 }
673 if let Some(ref param_value) = p_domain {
674 req_builder = req_builder.query(&[("domain", ¶m_value.to_string())]);
675 }
676 if let Some(ref user_agent) = configuration.user_agent {
677 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
678 }
679 if let Some(ref token) = configuration.bearer_access_token {
680 req_builder = req_builder.bearer_auth(token.to_owned());
681 };
682
683 let req = req_builder.build()?;
684 let resp = configuration.client.execute(req).await?;
685
686 let status = resp.status();
687 let content_type = resp
688 .headers()
689 .get("content-type")
690 .and_then(|v| v.to_str().ok())
691 .unwrap_or("application/octet-stream");
692 let content_type = super::ContentType::from(content_type);
693
694 if !status.is_client_error() && !status.is_server_error() {
695 let content = resp.text().await?;
696 match content_type {
697 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
698 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ListOrganizationsResponse`"))),
699 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::ListOrganizationsResponse`")))),
700 }
701 } else {
702 let content = resp.text().await?;
703 let entity: Option<ListOrganizationsError> = serde_json::from_str(&content).ok();
704 Err(Error::ResponseError(ResponseContent { status, content, entity }))
705 }
706}
707
708pub async fn list_project_api_keys(configuration: &configuration::Configuration, project: &str) -> Result<Vec<models::ProjectApiKey>, Error<ListProjectApiKeysError>> {
710 let p_project = project;
712
713 let uri_str = format!("{}/projects/{project}/tokens", configuration.base_path, project=crate::apis::urlencode(p_project));
714 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
715
716 if let Some(ref user_agent) = configuration.user_agent {
717 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
718 }
719 if let Some(ref token) = configuration.bearer_access_token {
720 req_builder = req_builder.bearer_auth(token.to_owned());
721 };
722
723 let req = req_builder.build()?;
724 let resp = configuration.client.execute(req).await?;
725
726 let status = resp.status();
727 let content_type = resp
728 .headers()
729 .get("content-type")
730 .and_then(|v| v.to_str().ok())
731 .unwrap_or("application/octet-stream");
732 let content_type = super::ContentType::from(content_type);
733
734 if !status.is_client_error() && !status.is_server_error() {
735 let content = resp.text().await?;
736 match content_type {
737 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
738 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::ProjectApiKey>`"))),
739 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::ProjectApiKey>`")))),
740 }
741 } else {
742 let content = resp.text().await?;
743 let entity: Option<ListProjectApiKeysError> = serde_json::from_str(&content).ok();
744 Err(Error::ResponseError(ResponseContent { status, content, entity }))
745 }
746}
747
748pub async fn list_projects(configuration: &configuration::Configuration, ) -> Result<Vec<models::ProjectMetadata>, Error<ListProjectsError>> {
750
751 let uri_str = format!("{}/projects", configuration.base_path);
752 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
753
754 if let Some(ref user_agent) = configuration.user_agent {
755 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
756 }
757 if let Some(ref token) = configuration.bearer_access_token {
758 req_builder = req_builder.bearer_auth(token.to_owned());
759 };
760
761 let req = req_builder.build()?;
762 let resp = configuration.client.execute(req).await?;
763
764 let status = resp.status();
765 let content_type = resp
766 .headers()
767 .get("content-type")
768 .and_then(|v| v.to_str().ok())
769 .unwrap_or("application/octet-stream");
770 let content_type = super::ContentType::from(content_type);
771
772 if !status.is_client_error() && !status.is_server_error() {
773 let content = resp.text().await?;
774 match content_type {
775 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
776 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::ProjectMetadata>`"))),
777 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::ProjectMetadata>`")))),
778 }
779 } else {
780 let content = resp.text().await?;
781 let entity: Option<ListProjectsError> = serde_json::from_str(&content).ok();
782 Err(Error::ResponseError(ResponseContent { status, content, entity }))
783 }
784}
785
786pub async fn patch_project(configuration: &configuration::Configuration, project_id: &str, json_patch: Option<Vec<models::JsonPatch>>) -> Result<models::SuccessfulProjectUpdate, Error<PatchProjectError>> {
788 let p_project_id = project_id;
790 let p_json_patch = json_patch;
791
792 let uri_str = format!("{}/projects/{project_id}", configuration.base_path, project_id=crate::apis::urlencode(p_project_id));
793 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
794
795 if let Some(ref user_agent) = configuration.user_agent {
796 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
797 }
798 if let Some(ref token) = configuration.bearer_access_token {
799 req_builder = req_builder.bearer_auth(token.to_owned());
800 };
801 req_builder = req_builder.json(&p_json_patch);
802
803 let req = req_builder.build()?;
804 let resp = configuration.client.execute(req).await?;
805
806 let status = resp.status();
807 let content_type = resp
808 .headers()
809 .get("content-type")
810 .and_then(|v| v.to_str().ok())
811 .unwrap_or("application/octet-stream");
812 let content_type = super::ContentType::from(content_type);
813
814 if !status.is_client_error() && !status.is_server_error() {
815 let content = resp.text().await?;
816 match content_type {
817 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
818 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SuccessfulProjectUpdate`"))),
819 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::SuccessfulProjectUpdate`")))),
820 }
821 } else {
822 let content = resp.text().await?;
823 let entity: Option<PatchProjectError> = serde_json::from_str(&content).ok();
824 Err(Error::ResponseError(ResponseContent { status, content, entity }))
825 }
826}
827
828pub async fn patch_project_with_revision(configuration: &configuration::Configuration, project_id: &str, revision_id: &str, json_patch: Option<Vec<models::JsonPatch>>) -> Result<models::SuccessfulProjectUpdate, Error<PatchProjectWithRevisionError>> {
830 let p_project_id = project_id;
832 let p_revision_id = revision_id;
833 let p_json_patch = json_patch;
834
835 let uri_str = format!("{}/projects/{project_id}/revision/{revision_id}", configuration.base_path, project_id=crate::apis::urlencode(p_project_id), revision_id=crate::apis::urlencode(p_revision_id));
836 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
837
838 if let Some(ref user_agent) = configuration.user_agent {
839 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
840 }
841 if let Some(ref token) = configuration.bearer_access_token {
842 req_builder = req_builder.bearer_auth(token.to_owned());
843 };
844 req_builder = req_builder.json(&p_json_patch);
845
846 let req = req_builder.build()?;
847 let resp = configuration.client.execute(req).await?;
848
849 let status = resp.status();
850 let content_type = resp
851 .headers()
852 .get("content-type")
853 .and_then(|v| v.to_str().ok())
854 .unwrap_or("application/octet-stream");
855 let content_type = super::ContentType::from(content_type);
856
857 if !status.is_client_error() && !status.is_server_error() {
858 let content = resp.text().await?;
859 match content_type {
860 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
861 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SuccessfulProjectUpdate`"))),
862 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::SuccessfulProjectUpdate`")))),
863 }
864 } else {
865 let content = resp.text().await?;
866 let entity: Option<PatchProjectWithRevisionError> = serde_json::from_str(&content).ok();
867 Err(Error::ResponseError(ResponseContent { status, content, entity }))
868 }
869}
870
871pub async fn purge_project(configuration: &configuration::Configuration, project_id: &str) -> Result<(), Error<PurgeProjectError>> {
873 let p_project_id = project_id;
875
876 let uri_str = format!("{}/projects/{project_id}", configuration.base_path, project_id=crate::apis::urlencode(p_project_id));
877 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
878
879 if let Some(ref user_agent) = configuration.user_agent {
880 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
881 }
882 if let Some(ref token) = configuration.bearer_access_token {
883 req_builder = req_builder.bearer_auth(token.to_owned());
884 };
885
886 let req = req_builder.build()?;
887 let resp = configuration.client.execute(req).await?;
888
889 let status = resp.status();
890
891 if !status.is_client_error() && !status.is_server_error() {
892 Ok(())
893 } else {
894 let content = resp.text().await?;
895 let entity: Option<PurgeProjectError> = serde_json::from_str(&content).ok();
896 Err(Error::ResponseError(ResponseContent { status, content, entity }))
897 }
898}
899
900pub async fn remove_project_member(configuration: &configuration::Configuration, project: &str, member: &str) -> Result<(), Error<RemoveProjectMemberError>> {
902 let p_project = project;
904 let p_member = member;
905
906 let uri_str = format!("{}/projects/{project}/members/{member}", configuration.base_path, project=crate::apis::urlencode(p_project), member=crate::apis::urlencode(p_member));
907 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
908
909 if let Some(ref user_agent) = configuration.user_agent {
910 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
911 }
912 if let Some(ref token) = configuration.bearer_access_token {
913 req_builder = req_builder.bearer_auth(token.to_owned());
914 };
915
916 let req = req_builder.build()?;
917 let resp = configuration.client.execute(req).await?;
918
919 let status = resp.status();
920
921 if !status.is_client_error() && !status.is_server_error() {
922 Ok(())
923 } else {
924 let content = resp.text().await?;
925 let entity: Option<RemoveProjectMemberError> = serde_json::from_str(&content).ok();
926 Err(Error::ResponseError(ResponseContent { status, content, entity }))
927 }
928}
929
930pub async fn set_project(configuration: &configuration::Configuration, project_id: &str, set_project: Option<models::SetProject>) -> Result<models::SuccessfulProjectUpdate, Error<SetProjectError>> {
932 let p_project_id = project_id;
934 let p_set_project = set_project;
935
936 let uri_str = format!("{}/projects/{project_id}", configuration.base_path, project_id=crate::apis::urlencode(p_project_id));
937 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
938
939 if let Some(ref user_agent) = configuration.user_agent {
940 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
941 }
942 if let Some(ref token) = configuration.bearer_access_token {
943 req_builder = req_builder.bearer_auth(token.to_owned());
944 };
945 req_builder = req_builder.json(&p_set_project);
946
947 let req = req_builder.build()?;
948 let resp = configuration.client.execute(req).await?;
949
950 let status = resp.status();
951 let content_type = resp
952 .headers()
953 .get("content-type")
954 .and_then(|v| v.to_str().ok())
955 .unwrap_or("application/octet-stream");
956 let content_type = super::ContentType::from(content_type);
957
958 if !status.is_client_error() && !status.is_server_error() {
959 let content = resp.text().await?;
960 match content_type {
961 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
962 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SuccessfulProjectUpdate`"))),
963 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::SuccessfulProjectUpdate`")))),
964 }
965 } else {
966 let content = resp.text().await?;
967 let entity: Option<SetProjectError> = serde_json::from_str(&content).ok();
968 Err(Error::ResponseError(ResponseContent { status, content, entity }))
969 }
970}
971
972pub async fn update_organization(configuration: &configuration::Configuration, project_id: &str, organization_id: &str, organization_body: Option<models::OrganizationBody>) -> Result<models::Organization, Error<UpdateOrganizationError>> {
974 let p_project_id = project_id;
976 let p_organization_id = organization_id;
977 let p_organization_body = organization_body;
978
979 let uri_str = format!("{}/projects/{project_id}/organizations/{organization_id}", configuration.base_path, project_id=crate::apis::urlencode(p_project_id), organization_id=crate::apis::urlencode(p_organization_id));
980 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
981
982 if let Some(ref user_agent) = configuration.user_agent {
983 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
984 }
985 if let Some(ref token) = configuration.bearer_access_token {
986 req_builder = req_builder.bearer_auth(token.to_owned());
987 };
988 req_builder = req_builder.json(&p_organization_body);
989
990 let req = req_builder.build()?;
991 let resp = configuration.client.execute(req).await?;
992
993 let status = resp.status();
994 let content_type = resp
995 .headers()
996 .get("content-type")
997 .and_then(|v| v.to_str().ok())
998 .unwrap_or("application/octet-stream");
999 let content_type = super::ContentType::from(content_type);
1000
1001 if !status.is_client_error() && !status.is_server_error() {
1002 let content = resp.text().await?;
1003 match content_type {
1004 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1005 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Organization`"))),
1006 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::Organization`")))),
1007 }
1008 } else {
1009 let content = resp.text().await?;
1010 let entity: Option<UpdateOrganizationError> = serde_json::from_str(&content).ok();
1011 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1012 }
1013}
1014
1015pub async fn update_organization_onboarding_portal_link(configuration: &configuration::Configuration, project_id: &str, organization_id: &str, onboarding_portal_link_id: &str, update_organization_onboarding_portal_link_body: Option<models::UpdateOrganizationOnboardingPortalLinkBody>) -> Result<models::OnboardingPortalLink, Error<UpdateOrganizationOnboardingPortalLinkError>> {
1017 let p_project_id = project_id;
1019 let p_organization_id = organization_id;
1020 let p_onboarding_portal_link_id = onboarding_portal_link_id;
1021 let p_update_organization_onboarding_portal_link_body = update_organization_onboarding_portal_link_body;
1022
1023 let uri_str = format!("{}/projects/{project_id}/organizations/{organization_id}/onboarding-portal-links/{onboarding_portal_link_id}", configuration.base_path, project_id=crate::apis::urlencode(p_project_id), organization_id=crate::apis::urlencode(p_organization_id), onboarding_portal_link_id=crate::apis::urlencode(p_onboarding_portal_link_id));
1024 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1025
1026 if let Some(ref user_agent) = configuration.user_agent {
1027 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1028 }
1029 if let Some(ref token) = configuration.bearer_access_token {
1030 req_builder = req_builder.bearer_auth(token.to_owned());
1031 };
1032 req_builder = req_builder.json(&p_update_organization_onboarding_portal_link_body);
1033
1034 let req = req_builder.build()?;
1035 let resp = configuration.client.execute(req).await?;
1036
1037 let status = resp.status();
1038 let content_type = resp
1039 .headers()
1040 .get("content-type")
1041 .and_then(|v| v.to_str().ok())
1042 .unwrap_or("application/octet-stream");
1043 let content_type = super::ContentType::from(content_type);
1044
1045 if !status.is_client_error() && !status.is_server_error() {
1046 let content = resp.text().await?;
1047 match content_type {
1048 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1049 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OnboardingPortalLink`"))),
1050 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::OnboardingPortalLink`")))),
1051 }
1052 } else {
1053 let content = resp.text().await?;
1054 let entity: Option<UpdateOrganizationOnboardingPortalLinkError> = serde_json::from_str(&content).ok();
1055 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1056 }
1057}
1058