Skip to main content

ory_client/apis/
project_api.rs

1/*
2 * Ory APIs
3 *
4 * # Introduction Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers.  ## SDKs This document describes the APIs available in the Ory Network. The APIs are available as SDKs for the following languages:  | Language       | Download SDK                                                     | Documentation                                                                        | | -------------- | ---------------------------------------------------------------- | ------------------------------------------------------------------------------------ | | Dart           | [pub.dev](https://pub.dev/packages/ory_client)                   | [README](https://github.com/ory/sdk/blob/master/clients/client/dart/README.md)       | | .NET           | [nuget.org](https://www.nuget.org/packages/Ory.Client/)          | [README](https://github.com/ory/sdk/blob/master/clients/client/dotnet/README.md)     | | Elixir         | [hex.pm](https://hex.pm/packages/ory_client)                     | [README](https://github.com/ory/sdk/blob/master/clients/client/elixir/README.md)     | | Go             | [github.com](https://github.com/ory/client-go)                   | [README](https://github.com/ory/sdk/blob/master/clients/client/go/README.md)         | | Java           | [maven.org](https://search.maven.org/artifact/sh.ory/ory-client) | [README](https://github.com/ory/sdk/blob/master/clients/client/java/README.md)       | | JavaScript     | [npmjs.com](https://www.npmjs.com/package/@ory/client)           | [README](https://github.com/ory/sdk/blob/master/clients/client/typescript/README.md) | | JavaScript (With fetch) | [npmjs.com](https://www.npmjs.com/package/@ory/client-fetch)           | [README](https://github.com/ory/sdk/blob/master/clients/client/typescript-fetch/README.md) |  | PHP            | [packagist.org](https://packagist.org/packages/ory/client)       | [README](https://github.com/ory/sdk/blob/master/clients/client/php/README.md)        | | Python         | [pypi.org](https://pypi.org/project/ory-client/)                 | [README](https://github.com/ory/sdk/blob/master/clients/client/python/README.md)     | | Ruby           | [rubygems.org](https://rubygems.org/gems/ory-client)             | [README](https://github.com/ory/sdk/blob/master/clients/client/ruby/README.md)       | | Rust           | [crates.io](https://crates.io/crates/ory-client)                 | [README](https://github.com/ory/sdk/blob/master/clients/client/rust/README.md)       | 
5 *
6 * The version of the OpenAPI document: v1.22.26
7 * Contact: support@ory.sh
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18/// struct for typed errors of method [`create_organization`]
19#[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/// struct for typed errors of method [`create_organization_onboarding_portal_link`]
30#[derive(Debug, Clone, Serialize, Deserialize)]
31#[serde(untagged)]
32pub enum CreateOrganizationOnboardingPortalLinkError {
33    DefaultResponse(models::ErrorGeneric),
34    UnknownValue(serde_json::Value),
35}
36
37/// struct for typed errors of method [`create_project`]
38#[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/// struct for typed errors of method [`create_project_api_key`]
49#[derive(Debug, Clone, Serialize, Deserialize)]
50#[serde(untagged)]
51pub enum CreateProjectApiKeyError {
52    DefaultResponse(models::ErrorGeneric),
53    UnknownValue(serde_json::Value),
54}
55
56/// struct for typed errors of method [`delete_organization`]
57#[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/// struct for typed errors of method [`delete_organization_onboarding_portal_link`]
69#[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/// struct for typed errors of method [`delete_project_api_key`]
79#[derive(Debug, Clone, Serialize, Deserialize)]
80#[serde(untagged)]
81pub enum DeleteProjectApiKeyError {
82    DefaultResponse(models::ErrorGeneric),
83    UnknownValue(serde_json::Value),
84}
85
86/// struct for typed errors of method [`get_organization`]
87#[derive(Debug, Clone, Serialize, Deserialize)]
88#[serde(untagged)]
89pub enum GetOrganizationError {
90    Status400(models::ErrorGeneric),
91    Status403(models::ErrorGeneric),
92    Status404(models::ErrorGeneric),
93    DefaultResponse(models::ErrorGeneric),
94    UnknownValue(serde_json::Value),
95}
96
97/// struct for typed errors of method [`get_organization_onboarding_portal_links`]
98#[derive(Debug, Clone, Serialize, Deserialize)]
99#[serde(untagged)]
100pub enum GetOrganizationOnboardingPortalLinksError {
101    Status400(models::ErrorGeneric),
102    Status403(models::ErrorGeneric),
103    DefaultResponse(models::ErrorGeneric),
104    UnknownValue(serde_json::Value),
105}
106
107/// struct for typed errors of method [`get_project`]
108#[derive(Debug, Clone, Serialize, Deserialize)]
109#[serde(untagged)]
110pub enum GetProjectError {
111    Status401(models::ErrorGeneric),
112    Status403(models::ErrorGeneric),
113    Status404(models::ErrorGeneric),
114    DefaultResponse(models::ErrorGeneric),
115    UnknownValue(serde_json::Value),
116}
117
118/// struct for typed errors of method [`get_project_members`]
119#[derive(Debug, Clone, Serialize, Deserialize)]
120#[serde(untagged)]
121pub enum GetProjectMembersError {
122    Status401(models::GenericError),
123    Status406(models::GenericError),
124    DefaultResponse(models::GenericError),
125    UnknownValue(serde_json::Value),
126}
127
128/// struct for typed errors of method [`list_organizations`]
129#[derive(Debug, Clone, Serialize, Deserialize)]
130#[serde(untagged)]
131pub enum ListOrganizationsError {
132    Status400(models::ErrorGeneric),
133    Status403(models::ErrorGeneric),
134    DefaultResponse(models::ErrorGeneric),
135    UnknownValue(serde_json::Value),
136}
137
138/// struct for typed errors of method [`list_project_api_keys`]
139#[derive(Debug, Clone, Serialize, Deserialize)]
140#[serde(untagged)]
141pub enum ListProjectApiKeysError {
142    DefaultResponse(models::ErrorGeneric),
143    UnknownValue(serde_json::Value),
144}
145
146/// struct for typed errors of method [`list_projects`]
147#[derive(Debug, Clone, Serialize, Deserialize)]
148#[serde(untagged)]
149pub enum ListProjectsError {
150    Status401(models::ErrorGeneric),
151    Status403(models::ErrorGeneric),
152    Status404(models::ErrorGeneric),
153    DefaultResponse(models::ErrorGeneric),
154    UnknownValue(serde_json::Value),
155}
156
157/// struct for typed errors of method [`patch_project`]
158#[derive(Debug, Clone, Serialize, Deserialize)]
159#[serde(untagged)]
160pub enum PatchProjectError {
161    Status400(models::ErrorGeneric),
162    Status401(models::ErrorGeneric),
163    Status403(models::ErrorGeneric),
164    Status404(models::ErrorGeneric),
165    DefaultResponse(models::ErrorGeneric),
166    UnknownValue(serde_json::Value),
167}
168
169/// struct for typed errors of method [`patch_project_with_revision`]
170#[derive(Debug, Clone, Serialize, Deserialize)]
171#[serde(untagged)]
172pub enum PatchProjectWithRevisionError {
173    Status400(models::ErrorGeneric),
174    Status401(models::ErrorGeneric),
175    Status403(models::ErrorGeneric),
176    Status404(models::ErrorGeneric),
177    Status409(models::ErrorGeneric),
178    DefaultResponse(models::ErrorGeneric),
179    UnknownValue(serde_json::Value),
180}
181
182/// struct for typed errors of method [`purge_project`]
183#[derive(Debug, Clone, Serialize, Deserialize)]
184#[serde(untagged)]
185pub enum PurgeProjectError {
186    Status401(models::GenericError),
187    Status403(models::GenericError),
188    Status404(models::GenericError),
189    DefaultResponse(models::GenericError),
190    UnknownValue(serde_json::Value),
191}
192
193/// struct for typed errors of method [`remove_project_member`]
194#[derive(Debug, Clone, Serialize, Deserialize)]
195#[serde(untagged)]
196pub enum RemoveProjectMemberError {
197    Status401(models::GenericError),
198    Status406(models::GenericError),
199    DefaultResponse(models::GenericError),
200    UnknownValue(serde_json::Value),
201}
202
203/// struct for typed errors of method [`set_project`]
204#[derive(Debug, Clone, Serialize, Deserialize)]
205#[serde(untagged)]
206pub enum SetProjectError {
207    Status400(models::ErrorGeneric),
208    Status401(models::ErrorGeneric),
209    Status403(models::ErrorGeneric),
210    Status404(models::ErrorGeneric),
211    DefaultResponse(models::ErrorGeneric),
212    UnknownValue(serde_json::Value),
213}
214
215/// struct for typed errors of method [`update_organization`]
216#[derive(Debug, Clone, Serialize, Deserialize)]
217#[serde(untagged)]
218pub enum UpdateOrganizationError {
219    Status400(models::ErrorGeneric),
220    Status403(models::ErrorGeneric),
221    Status404(models::ErrorGeneric),
222    Status409(models::ErrorGeneric),
223    DefaultResponse(models::ErrorGeneric),
224    UnknownValue(serde_json::Value),
225}
226
227/// struct for typed errors of method [`update_organization_onboarding_portal_link`]
228#[derive(Debug, Clone, Serialize, Deserialize)]
229#[serde(untagged)]
230pub enum UpdateOrganizationOnboardingPortalLinkError {
231    DefaultResponse(models::ErrorGeneric),
232    UnknownValue(serde_json::Value),
233}
234
235
236/// Deprecated: use setProject or patchProjectWithRevision instead  Creates an Enterprise SSO Organization in a project.
237pub async fn create_organization(configuration: &configuration::Configuration, project_id: &str, organization_body: Option<models::OrganizationBody>) -> Result<models::Organization, Error<CreateOrganizationError>> {
238    // add a prefix to parameters to efficiently prevent name collisions
239    let p_path_project_id = project_id;
240    let p_body_organization_body = organization_body;
241
242    let uri_str = format!("{}/projects/{project_id}/organizations", configuration.base_path, project_id=crate::apis::urlencode(p_path_project_id));
243    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
244
245    if let Some(ref user_agent) = configuration.user_agent {
246        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
247    }
248    if let Some(ref token) = configuration.bearer_access_token {
249        req_builder = req_builder.bearer_auth(token.to_owned());
250    };
251    req_builder = req_builder.json(&p_body_organization_body);
252
253    let req = req_builder.build()?;
254    let resp = configuration.client.execute(req).await?;
255
256    let status = resp.status();
257    let content_type = resp
258        .headers()
259        .get("content-type")
260        .and_then(|v| v.to_str().ok())
261        .unwrap_or("application/octet-stream");
262    let content_type = super::ContentType::from(content_type);
263
264    if !status.is_client_error() && !status.is_server_error() {
265        let content = resp.text().await?;
266        match content_type {
267            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
268            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Organization`"))),
269            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`")))),
270        }
271    } else {
272        let content = resp.text().await?;
273        let entity: Option<CreateOrganizationError> = serde_json::from_str(&content).ok();
274        Err(Error::ResponseError(ResponseContent { status, content, entity }))
275    }
276}
277
278/// Create a onboarding portal link for an organization.
279pub 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>> {
280    // add a prefix to parameters to efficiently prevent name collisions
281    let p_path_project_id = project_id;
282    let p_path_organization_id = organization_id;
283    let p_body_create_organization_onboarding_portal_link_body = create_organization_onboarding_portal_link_body;
284
285    let uri_str = format!("{}/projects/{project_id}/organizations/{organization_id}/onboarding-portal-links", configuration.base_path, project_id=crate::apis::urlencode(p_path_project_id), organization_id=crate::apis::urlencode(p_path_organization_id));
286    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
287
288    if let Some(ref user_agent) = configuration.user_agent {
289        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
290    }
291    if let Some(ref token) = configuration.bearer_access_token {
292        req_builder = req_builder.bearer_auth(token.to_owned());
293    };
294    req_builder = req_builder.json(&p_body_create_organization_onboarding_portal_link_body);
295
296    let req = req_builder.build()?;
297    let resp = configuration.client.execute(req).await?;
298
299    let status = resp.status();
300    let content_type = resp
301        .headers()
302        .get("content-type")
303        .and_then(|v| v.to_str().ok())
304        .unwrap_or("application/octet-stream");
305    let content_type = super::ContentType::from(content_type);
306
307    if !status.is_client_error() && !status.is_server_error() {
308        let content = resp.text().await?;
309        match content_type {
310            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
311            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OnboardingPortalLink`"))),
312            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`")))),
313        }
314    } else {
315        let content = resp.text().await?;
316        let entity: Option<CreateOrganizationOnboardingPortalLinkError> = serde_json::from_str(&content).ok();
317        Err(Error::ResponseError(ResponseContent { status, content, entity }))
318    }
319}
320
321/// Creates a new project.
322pub async fn create_project(configuration: &configuration::Configuration, create_project_body: Option<models::CreateProjectBody>) -> Result<models::Project, Error<CreateProjectError>> {
323    // add a prefix to parameters to efficiently prevent name collisions
324    let p_body_create_project_body = create_project_body;
325
326    let uri_str = format!("{}/projects", configuration.base_path);
327    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
328
329    if let Some(ref user_agent) = configuration.user_agent {
330        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
331    }
332    if let Some(ref token) = configuration.bearer_access_token {
333        req_builder = req_builder.bearer_auth(token.to_owned());
334    };
335    req_builder = req_builder.json(&p_body_create_project_body);
336
337    let req = req_builder.build()?;
338    let resp = configuration.client.execute(req).await?;
339
340    let status = resp.status();
341    let content_type = resp
342        .headers()
343        .get("content-type")
344        .and_then(|v| v.to_str().ok())
345        .unwrap_or("application/octet-stream");
346    let content_type = super::ContentType::from(content_type);
347
348    if !status.is_client_error() && !status.is_server_error() {
349        let content = resp.text().await?;
350        match content_type {
351            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
352            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Project`"))),
353            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`")))),
354        }
355    } else {
356        let content = resp.text().await?;
357        let entity: Option<CreateProjectError> = serde_json::from_str(&content).ok();
358        Err(Error::ResponseError(ResponseContent { status, content, entity }))
359    }
360}
361
362/// Create an API key for a project.
363pub async fn create_project_api_key(configuration: &configuration::Configuration, project: &str, create_project_api_key_request: Option<models::CreateProjectApiKeyRequest>) -> Result<models::ProjectApiKey, Error<CreateProjectApiKeyError>> {
364    // add a prefix to parameters to efficiently prevent name collisions
365    let p_path_project = project;
366    let p_body_create_project_api_key_request = create_project_api_key_request;
367
368    let uri_str = format!("{}/projects/{project}/tokens", configuration.base_path, project=crate::apis::urlencode(p_path_project));
369    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
370
371    if let Some(ref user_agent) = configuration.user_agent {
372        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
373    }
374    if let Some(ref token) = configuration.bearer_access_token {
375        req_builder = req_builder.bearer_auth(token.to_owned());
376    };
377    req_builder = req_builder.json(&p_body_create_project_api_key_request);
378
379    let req = req_builder.build()?;
380    let resp = configuration.client.execute(req).await?;
381
382    let status = resp.status();
383    let content_type = resp
384        .headers()
385        .get("content-type")
386        .and_then(|v| v.to_str().ok())
387        .unwrap_or("application/octet-stream");
388    let content_type = super::ContentType::from(content_type);
389
390    if !status.is_client_error() && !status.is_server_error() {
391        let content = resp.text().await?;
392        match content_type {
393            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
394            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ProjectApiKey`"))),
395            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`")))),
396        }
397    } else {
398        let content = resp.text().await?;
399        let entity: Option<CreateProjectApiKeyError> = serde_json::from_str(&content).ok();
400        Err(Error::ResponseError(ResponseContent { status, content, entity }))
401    }
402}
403
404/// Deprecated: use setProject or patchProjectWithRevision instead  Irrecoverably deletes an Enterprise SSO Organization in a project by its ID.
405pub async fn delete_organization(configuration: &configuration::Configuration, project_id: &str, organization_id: &str) -> Result<(), Error<DeleteOrganizationError>> {
406    // add a prefix to parameters to efficiently prevent name collisions
407    let p_path_project_id = project_id;
408    let p_path_organization_id = organization_id;
409
410    let uri_str = format!("{}/projects/{project_id}/organizations/{organization_id}", configuration.base_path, project_id=crate::apis::urlencode(p_path_project_id), organization_id=crate::apis::urlencode(p_path_organization_id));
411    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
412
413    if let Some(ref user_agent) = configuration.user_agent {
414        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
415    }
416    if let Some(ref token) = configuration.bearer_access_token {
417        req_builder = req_builder.bearer_auth(token.to_owned());
418    };
419
420    let req = req_builder.build()?;
421    let resp = configuration.client.execute(req).await?;
422
423    let status = resp.status();
424
425    if !status.is_client_error() && !status.is_server_error() {
426        Ok(())
427    } else {
428        let content = resp.text().await?;
429        let entity: Option<DeleteOrganizationError> = serde_json::from_str(&content).ok();
430        Err(Error::ResponseError(ResponseContent { status, content, entity }))
431    }
432}
433
434/// Deletes a onboarding portal link for an organization.
435pub async fn delete_organization_onboarding_portal_link(configuration: &configuration::Configuration, project_id: &str, organization_id: &str, onboarding_portal_link_id: &str) -> Result<(), Error<DeleteOrganizationOnboardingPortalLinkError>> {
436    // add a prefix to parameters to efficiently prevent name collisions
437    let p_path_project_id = project_id;
438    let p_path_organization_id = organization_id;
439    let p_path_onboarding_portal_link_id = onboarding_portal_link_id;
440
441    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_path_project_id), organization_id=crate::apis::urlencode(p_path_organization_id), onboarding_portal_link_id=crate::apis::urlencode(p_path_onboarding_portal_link_id));
442    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
443
444    if let Some(ref user_agent) = configuration.user_agent {
445        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
446    }
447    if let Some(ref token) = configuration.bearer_access_token {
448        req_builder = req_builder.bearer_auth(token.to_owned());
449    };
450
451    let req = req_builder.build()?;
452    let resp = configuration.client.execute(req).await?;
453
454    let status = resp.status();
455
456    if !status.is_client_error() && !status.is_server_error() {
457        Ok(())
458    } else {
459        let content = resp.text().await?;
460        let entity: Option<DeleteOrganizationOnboardingPortalLinkError> = serde_json::from_str(&content).ok();
461        Err(Error::ResponseError(ResponseContent { status, content, entity }))
462    }
463}
464
465/// Deletes an API key and immediately removes it.
466pub async fn delete_project_api_key(configuration: &configuration::Configuration, project: &str, token_id: &str) -> Result<(), Error<DeleteProjectApiKeyError>> {
467    // add a prefix to parameters to efficiently prevent name collisions
468    let p_path_project = project;
469    let p_path_token_id = token_id;
470
471    let uri_str = format!("{}/projects/{project}/tokens/{token_id}", configuration.base_path, project=crate::apis::urlencode(p_path_project), token_id=crate::apis::urlencode(p_path_token_id));
472    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
473
474    if let Some(ref user_agent) = configuration.user_agent {
475        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
476    }
477    if let Some(ref token) = configuration.bearer_access_token {
478        req_builder = req_builder.bearer_auth(token.to_owned());
479    };
480
481    let req = req_builder.build()?;
482    let resp = configuration.client.execute(req).await?;
483
484    let status = resp.status();
485
486    if !status.is_client_error() && !status.is_server_error() {
487        Ok(())
488    } else {
489        let content = resp.text().await?;
490        let entity: Option<DeleteProjectApiKeyError> = serde_json::from_str(&content).ok();
491        Err(Error::ResponseError(ResponseContent { status, content, entity }))
492    }
493}
494
495/// Deprecated: use getProject instead  Retrieves an Enterprise SSO Organization for a project by its ID
496pub async fn get_organization(configuration: &configuration::Configuration, project_id: &str, organization_id: &str) -> Result<models::GetOrganizationResponse, Error<GetOrganizationError>> {
497    // add a prefix to parameters to efficiently prevent name collisions
498    let p_path_project_id = project_id;
499    let p_path_organization_id = organization_id;
500
501    let uri_str = format!("{}/projects/{project_id}/organizations/{organization_id}", configuration.base_path, project_id=crate::apis::urlencode(p_path_project_id), organization_id=crate::apis::urlencode(p_path_organization_id));
502    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
503
504    if let Some(ref user_agent) = configuration.user_agent {
505        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
506    }
507    if let Some(ref token) = configuration.bearer_access_token {
508        req_builder = req_builder.bearer_auth(token.to_owned());
509    };
510
511    let req = req_builder.build()?;
512    let resp = configuration.client.execute(req).await?;
513
514    let status = resp.status();
515    let content_type = resp
516        .headers()
517        .get("content-type")
518        .and_then(|v| v.to_str().ok())
519        .unwrap_or("application/octet-stream");
520    let content_type = super::ContentType::from(content_type);
521
522    if !status.is_client_error() && !status.is_server_error() {
523        let content = resp.text().await?;
524        match content_type {
525            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
526            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetOrganizationResponse`"))),
527            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`")))),
528        }
529    } else {
530        let content = resp.text().await?;
531        let entity: Option<GetOrganizationError> = serde_json::from_str(&content).ok();
532        Err(Error::ResponseError(ResponseContent { status, content, entity }))
533    }
534}
535
536/// Retrieves the organization onboarding portal links.
537pub async fn get_organization_onboarding_portal_links(configuration: &configuration::Configuration, project_id: &str, organization_id: &str) -> Result<models::OrganizationOnboardingPortalLinksResponse, Error<GetOrganizationOnboardingPortalLinksError>> {
538    // add a prefix to parameters to efficiently prevent name collisions
539    let p_path_project_id = project_id;
540    let p_path_organization_id = organization_id;
541
542    let uri_str = format!("{}/projects/{project_id}/organizations/{organization_id}/onboarding-portal-links", configuration.base_path, project_id=crate::apis::urlencode(p_path_project_id), organization_id=crate::apis::urlencode(p_path_organization_id));
543    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
544
545    if let Some(ref user_agent) = configuration.user_agent {
546        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
547    }
548    if let Some(ref token) = configuration.bearer_access_token {
549        req_builder = req_builder.bearer_auth(token.to_owned());
550    };
551
552    let req = req_builder.build()?;
553    let resp = configuration.client.execute(req).await?;
554
555    let status = resp.status();
556    let content_type = resp
557        .headers()
558        .get("content-type")
559        .and_then(|v| v.to_str().ok())
560        .unwrap_or("application/octet-stream");
561    let content_type = super::ContentType::from(content_type);
562
563    if !status.is_client_error() && !status.is_server_error() {
564        let content = resp.text().await?;
565        match content_type {
566            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
567            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OrganizationOnboardingPortalLinksResponse`"))),
568            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`")))),
569        }
570    } else {
571        let content = resp.text().await?;
572        let entity: Option<GetOrganizationOnboardingPortalLinksError> = serde_json::from_str(&content).ok();
573        Err(Error::ResponseError(ResponseContent { status, content, entity }))
574    }
575}
576
577/// Get a project you have access to by its ID.
578pub async fn get_project(configuration: &configuration::Configuration, project_id: &str) -> Result<models::Project, Error<GetProjectError>> {
579    // add a prefix to parameters to efficiently prevent name collisions
580    let p_path_project_id = project_id;
581
582    let uri_str = format!("{}/projects/{project_id}", configuration.base_path, project_id=crate::apis::urlencode(p_path_project_id));
583    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
584
585    if let Some(ref user_agent) = configuration.user_agent {
586        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
587    }
588    if let Some(ref token) = configuration.bearer_access_token {
589        req_builder = req_builder.bearer_auth(token.to_owned());
590    };
591
592    let req = req_builder.build()?;
593    let resp = configuration.client.execute(req).await?;
594
595    let status = resp.status();
596    let content_type = resp
597        .headers()
598        .get("content-type")
599        .and_then(|v| v.to_str().ok())
600        .unwrap_or("application/octet-stream");
601    let content_type = super::ContentType::from(content_type);
602
603    if !status.is_client_error() && !status.is_server_error() {
604        let content = resp.text().await?;
605        match content_type {
606            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
607            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Project`"))),
608            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`")))),
609        }
610    } else {
611        let content = resp.text().await?;
612        let entity: Option<GetProjectError> = serde_json::from_str(&content).ok();
613        Err(Error::ResponseError(ResponseContent { status, content, entity }))
614    }
615}
616
617/// This endpoint requires the user to be a member of the project with the role `OWNER` or `DEVELOPER`.
618pub async fn get_project_members(configuration: &configuration::Configuration, project: &str) -> Result<Vec<models::ProjectMember>, Error<GetProjectMembersError>> {
619    // add a prefix to parameters to efficiently prevent name collisions
620    let p_path_project = project;
621
622    let uri_str = format!("{}/projects/{project}/members", configuration.base_path, project=crate::apis::urlencode(p_path_project));
623    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
624
625    if let Some(ref user_agent) = configuration.user_agent {
626        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
627    }
628    if let Some(ref token) = configuration.bearer_access_token {
629        req_builder = req_builder.bearer_auth(token.to_owned());
630    };
631
632    let req = req_builder.build()?;
633    let resp = configuration.client.execute(req).await?;
634
635    let status = resp.status();
636    let content_type = resp
637        .headers()
638        .get("content-type")
639        .and_then(|v| v.to_str().ok())
640        .unwrap_or("application/octet-stream");
641    let content_type = super::ContentType::from(content_type);
642
643    if !status.is_client_error() && !status.is_server_error() {
644        let content = resp.text().await?;
645        match content_type {
646            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
647            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::ProjectMember&gt;`"))),
648            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&lt;models::ProjectMember&gt;`")))),
649        }
650    } else {
651        let content = resp.text().await?;
652        let entity: Option<GetProjectMembersError> = serde_json::from_str(&content).ok();
653        Err(Error::ResponseError(ResponseContent { status, content, entity }))
654    }
655}
656
657/// Deprecated: use getProject instead  Lists all Enterprise SSO organizations in a project.
658pub 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>> {
659    // add a prefix to parameters to efficiently prevent name collisions
660    let p_path_project_id = project_id;
661    let p_query_page_size = page_size;
662    let p_query_page_token = page_token;
663    let p_query_domain = domain;
664
665    let uri_str = format!("{}/projects/{project_id}/organizations", configuration.base_path, project_id=crate::apis::urlencode(p_path_project_id));
666    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
667
668    if let Some(ref param_value) = p_query_page_size {
669        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
670    }
671    if let Some(ref param_value) = p_query_page_token {
672        req_builder = req_builder.query(&[("page_token", &param_value.to_string())]);
673    }
674    if let Some(ref param_value) = p_query_domain {
675        req_builder = req_builder.query(&[("domain", &param_value.to_string())]);
676    }
677    if let Some(ref user_agent) = configuration.user_agent {
678        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
679    }
680    if let Some(ref token) = configuration.bearer_access_token {
681        req_builder = req_builder.bearer_auth(token.to_owned());
682    };
683
684    let req = req_builder.build()?;
685    let resp = configuration.client.execute(req).await?;
686
687    let status = resp.status();
688    let content_type = resp
689        .headers()
690        .get("content-type")
691        .and_then(|v| v.to_str().ok())
692        .unwrap_or("application/octet-stream");
693    let content_type = super::ContentType::from(content_type);
694
695    if !status.is_client_error() && !status.is_server_error() {
696        let content = resp.text().await?;
697        match content_type {
698            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
699            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ListOrganizationsResponse`"))),
700            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`")))),
701        }
702    } else {
703        let content = resp.text().await?;
704        let entity: Option<ListOrganizationsError> = serde_json::from_str(&content).ok();
705        Err(Error::ResponseError(ResponseContent { status, content, entity }))
706    }
707}
708
709/// A list of all the project's API keys.
710pub async fn list_project_api_keys(configuration: &configuration::Configuration, project: &str) -> Result<Vec<models::ProjectApiKey>, Error<ListProjectApiKeysError>> {
711    // add a prefix to parameters to efficiently prevent name collisions
712    let p_path_project = project;
713
714    let uri_str = format!("{}/projects/{project}/tokens", configuration.base_path, project=crate::apis::urlencode(p_path_project));
715    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
716
717    if let Some(ref user_agent) = configuration.user_agent {
718        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
719    }
720    if let Some(ref token) = configuration.bearer_access_token {
721        req_builder = req_builder.bearer_auth(token.to_owned());
722    };
723
724    let req = req_builder.build()?;
725    let resp = configuration.client.execute(req).await?;
726
727    let status = resp.status();
728    let content_type = resp
729        .headers()
730        .get("content-type")
731        .and_then(|v| v.to_str().ok())
732        .unwrap_or("application/octet-stream");
733    let content_type = super::ContentType::from(content_type);
734
735    if !status.is_client_error() && !status.is_server_error() {
736        let content = resp.text().await?;
737        match content_type {
738            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
739            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::ProjectApiKey&gt;`"))),
740            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&lt;models::ProjectApiKey&gt;`")))),
741        }
742    } else {
743        let content = resp.text().await?;
744        let entity: Option<ListProjectApiKeysError> = serde_json::from_str(&content).ok();
745        Err(Error::ResponseError(ResponseContent { status, content, entity }))
746    }
747}
748
749/// Lists all projects you have access to.
750pub async fn list_projects(configuration: &configuration::Configuration, ) -> Result<Vec<models::ProjectMetadata>, Error<ListProjectsError>> {
751
752    let uri_str = format!("{}/projects", configuration.base_path);
753    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
754
755    if let Some(ref user_agent) = configuration.user_agent {
756        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
757    }
758    if let Some(ref token) = configuration.bearer_access_token {
759        req_builder = req_builder.bearer_auth(token.to_owned());
760    };
761
762    let req = req_builder.build()?;
763    let resp = configuration.client.execute(req).await?;
764
765    let status = resp.status();
766    let content_type = resp
767        .headers()
768        .get("content-type")
769        .and_then(|v| v.to_str().ok())
770        .unwrap_or("application/octet-stream");
771    let content_type = super::ContentType::from(content_type);
772
773    if !status.is_client_error() && !status.is_server_error() {
774        let content = resp.text().await?;
775        match content_type {
776            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
777            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;models::ProjectMetadata&gt;`"))),
778            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&lt;models::ProjectMetadata&gt;`")))),
779        }
780    } else {
781        let content = resp.text().await?;
782        let entity: Option<ListProjectsError> = serde_json::from_str(&content).ok();
783        Err(Error::ResponseError(ResponseContent { status, content, entity }))
784    }
785}
786
787/// Deprecated: Use the `patchProjectWithRevision` endpoint instead to specify the exact revision the patch was generated for.  This endpoints allows you to patch individual Ory Network project configuration keys for Ory's services (identity, permission, ...). The configuration format is fully compatible with the open source projects for the respective services (e.g. Ory Kratos for Identity, Ory Keto for Permissions).  This endpoint expects the `version` key to be set in the payload. If it is unset, it will try to import the config as if it is from the most recent version.  If you have an older version of a configuration, you should set the version key in the payload!  While this endpoint is able to process all configuration items related to features (e.g. password reset), it does not support operational configuration items (e.g. port, tracing, logging) otherwise available in the open source.  For configuration items that can not be translated to the Ory Network, this endpoint will return a list of warnings to help you understand which parts of your config could not be processed.
788pub async fn patch_project(configuration: &configuration::Configuration, project_id: &str, json_patch: Option<Vec<models::JsonPatch>>) -> Result<models::SuccessfulProjectUpdate, Error<PatchProjectError>> {
789    // add a prefix to parameters to efficiently prevent name collisions
790    let p_path_project_id = project_id;
791    let p_body_json_patch = json_patch;
792
793    let uri_str = format!("{}/projects/{project_id}", configuration.base_path, project_id=crate::apis::urlencode(p_path_project_id));
794    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
795
796    if let Some(ref user_agent) = configuration.user_agent {
797        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
798    }
799    if let Some(ref token) = configuration.bearer_access_token {
800        req_builder = req_builder.bearer_auth(token.to_owned());
801    };
802    req_builder = req_builder.json(&p_body_json_patch);
803
804    let req = req_builder.build()?;
805    let resp = configuration.client.execute(req).await?;
806
807    let status = resp.status();
808    let content_type = resp
809        .headers()
810        .get("content-type")
811        .and_then(|v| v.to_str().ok())
812        .unwrap_or("application/octet-stream");
813    let content_type = super::ContentType::from(content_type);
814
815    if !status.is_client_error() && !status.is_server_error() {
816        let content = resp.text().await?;
817        match content_type {
818            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
819            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SuccessfulProjectUpdate`"))),
820            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`")))),
821        }
822    } else {
823        let content = resp.text().await?;
824        let entity: Option<PatchProjectError> = serde_json::from_str(&content).ok();
825        Err(Error::ResponseError(ResponseContent { status, content, entity }))
826    }
827}
828
829/// This endpoints allows you to patch individual Ory Network Project configuration keys for Ory's services (identity, permission, ...). The configuration format is fully compatible with the open source projects for the respective services (e.g. Ory Kratos for Identity, Ory Keto for Permissions).  This endpoint expects the `version` key to be set in the payload. If it is unset, it will try to import the config as if it is from the most recent version.  If you have an older version of a configuration, you should set the version key in the payload!  While this endpoint is able to process all configuration items related to features (e.g. password reset), it does not support operational configuration items (e.g. port, tracing, logging) otherwise available in the open source.  For configuration items that can not be translated to the Ory Network, this endpoint will return a list of warnings to help you understand which parts of your config could not be processed.
830pub 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>> {
831    // add a prefix to parameters to efficiently prevent name collisions
832    let p_path_project_id = project_id;
833    let p_path_revision_id = revision_id;
834    let p_body_json_patch = json_patch;
835
836    let uri_str = format!("{}/projects/{project_id}/revision/{revision_id}", configuration.base_path, project_id=crate::apis::urlencode(p_path_project_id), revision_id=crate::apis::urlencode(p_path_revision_id));
837    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
838
839    if let Some(ref user_agent) = configuration.user_agent {
840        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
841    }
842    if let Some(ref token) = configuration.bearer_access_token {
843        req_builder = req_builder.bearer_auth(token.to_owned());
844    };
845    req_builder = req_builder.json(&p_body_json_patch);
846
847    let req = req_builder.build()?;
848    let resp = configuration.client.execute(req).await?;
849
850    let status = resp.status();
851    let content_type = resp
852        .headers()
853        .get("content-type")
854        .and_then(|v| v.to_str().ok())
855        .unwrap_or("application/octet-stream");
856    let content_type = super::ContentType::from(content_type);
857
858    if !status.is_client_error() && !status.is_server_error() {
859        let content = resp.text().await?;
860        match content_type {
861            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
862            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SuccessfulProjectUpdate`"))),
863            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`")))),
864        }
865    } else {
866        let content = resp.text().await?;
867        let entity: Option<PatchProjectWithRevisionError> = serde_json::from_str(&content).ok();
868        Err(Error::ResponseError(ResponseContent { status, content, entity }))
869    }
870}
871
872/// !! Use with extreme caution !!  Using this API endpoint you can purge (completely delete) a project and its data. This action can not be undone and will delete ALL your data.  Calling this endpoint will additionally delete custom domains and other related data.  If the project is linked to a subscription, the subscription needs to be unlinked first.
873pub async fn purge_project(configuration: &configuration::Configuration, project_id: &str) -> Result<(), Error<PurgeProjectError>> {
874    // add a prefix to parameters to efficiently prevent name collisions
875    let p_path_project_id = project_id;
876
877    let uri_str = format!("{}/projects/{project_id}", configuration.base_path, project_id=crate::apis::urlencode(p_path_project_id));
878    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
879
880    if let Some(ref user_agent) = configuration.user_agent {
881        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
882    }
883    if let Some(ref token) = configuration.bearer_access_token {
884        req_builder = req_builder.bearer_auth(token.to_owned());
885    };
886
887    let req = req_builder.build()?;
888    let resp = configuration.client.execute(req).await?;
889
890    let status = resp.status();
891
892    if !status.is_client_error() && !status.is_server_error() {
893        Ok(())
894    } else {
895        let content = resp.text().await?;
896        let entity: Option<PurgeProjectError> = serde_json::from_str(&content).ok();
897        Err(Error::ResponseError(ResponseContent { status, content, entity }))
898    }
899}
900
901/// This also sets their invite status to `REMOVED`. This endpoint requires the user to be a member of the project with the role `OWNER`.
902pub async fn remove_project_member(configuration: &configuration::Configuration, project: &str, member: &str) -> Result<(), Error<RemoveProjectMemberError>> {
903    // add a prefix to parameters to efficiently prevent name collisions
904    let p_path_project = project;
905    let p_path_member = member;
906
907    let uri_str = format!("{}/projects/{project}/members/{member}", configuration.base_path, project=crate::apis::urlencode(p_path_project), member=crate::apis::urlencode(p_path_member));
908    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
909
910    if let Some(ref user_agent) = configuration.user_agent {
911        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
912    }
913    if let Some(ref token) = configuration.bearer_access_token {
914        req_builder = req_builder.bearer_auth(token.to_owned());
915    };
916
917    let req = req_builder.build()?;
918    let resp = configuration.client.execute(req).await?;
919
920    let status = resp.status();
921
922    if !status.is_client_error() && !status.is_server_error() {
923        Ok(())
924    } else {
925        let content = resp.text().await?;
926        let entity: Option<RemoveProjectMemberError> = serde_json::from_str(&content).ok();
927        Err(Error::ResponseError(ResponseContent { status, content, entity }))
928    }
929}
930
931/// This endpoints allows you to update the Ory Network project configuration for individual services (identity, permission, ...). The configuration is fully compatible with the open source projects for the respective services (e.g. Ory Kratos for Identity, Ory Keto for Permissions).  This endpoint expects the `version` key to be set in the payload. If it is unset, it will try to import the config as if it is from the most recent version.  If you have an older version of a configuration, you should set the version key in the payload!  While this endpoint is able to process all configuration items related to features (e.g. password reset), it does not support operational configuration items (e.g. port, tracing, logging) otherwise available in the open source.  For configuration items that can not be translated to the Ory Network, this endpoint will return a list of warnings to help you understand which parts of your config could not be processed.  Be aware that updating any service's configuration will completely override your current configuration for that service!
932pub async fn set_project(configuration: &configuration::Configuration, project_id: &str, set_project: Option<models::SetProject>) -> Result<models::SuccessfulProjectUpdate, Error<SetProjectError>> {
933    // add a prefix to parameters to efficiently prevent name collisions
934    let p_path_project_id = project_id;
935    let p_body_set_project = set_project;
936
937    let uri_str = format!("{}/projects/{project_id}", configuration.base_path, project_id=crate::apis::urlencode(p_path_project_id));
938    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
939
940    if let Some(ref user_agent) = configuration.user_agent {
941        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
942    }
943    if let Some(ref token) = configuration.bearer_access_token {
944        req_builder = req_builder.bearer_auth(token.to_owned());
945    };
946    req_builder = req_builder.json(&p_body_set_project);
947
948    let req = req_builder.build()?;
949    let resp = configuration.client.execute(req).await?;
950
951    let status = resp.status();
952    let content_type = resp
953        .headers()
954        .get("content-type")
955        .and_then(|v| v.to_str().ok())
956        .unwrap_or("application/octet-stream");
957    let content_type = super::ContentType::from(content_type);
958
959    if !status.is_client_error() && !status.is_server_error() {
960        let content = resp.text().await?;
961        match content_type {
962            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
963            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SuccessfulProjectUpdate`"))),
964            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`")))),
965        }
966    } else {
967        let content = resp.text().await?;
968        let entity: Option<SetProjectError> = serde_json::from_str(&content).ok();
969        Err(Error::ResponseError(ResponseContent { status, content, entity }))
970    }
971}
972
973/// Deprecated: use setProject or patchProjectWithRevision instead  Updates an Enterprise SSO Organization in a project by its ID.
974pub async fn update_organization(configuration: &configuration::Configuration, project_id: &str, organization_id: &str, organization_body: Option<models::OrganizationBody>) -> Result<models::Organization, Error<UpdateOrganizationError>> {
975    // add a prefix to parameters to efficiently prevent name collisions
976    let p_path_project_id = project_id;
977    let p_path_organization_id = organization_id;
978    let p_body_organization_body = organization_body;
979
980    let uri_str = format!("{}/projects/{project_id}/organizations/{organization_id}", configuration.base_path, project_id=crate::apis::urlencode(p_path_project_id), organization_id=crate::apis::urlencode(p_path_organization_id));
981    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
982
983    if let Some(ref user_agent) = configuration.user_agent {
984        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
985    }
986    if let Some(ref token) = configuration.bearer_access_token {
987        req_builder = req_builder.bearer_auth(token.to_owned());
988    };
989    req_builder = req_builder.json(&p_body_organization_body);
990
991    let req = req_builder.build()?;
992    let resp = configuration.client.execute(req).await?;
993
994    let status = resp.status();
995    let content_type = resp
996        .headers()
997        .get("content-type")
998        .and_then(|v| v.to_str().ok())
999        .unwrap_or("application/octet-stream");
1000    let content_type = super::ContentType::from(content_type);
1001
1002    if !status.is_client_error() && !status.is_server_error() {
1003        let content = resp.text().await?;
1004        match content_type {
1005            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1006            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Organization`"))),
1007            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`")))),
1008        }
1009    } else {
1010        let content = resp.text().await?;
1011        let entity: Option<UpdateOrganizationError> = serde_json::from_str(&content).ok();
1012        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1013    }
1014}
1015
1016/// Update a onboarding portal link for an organization.
1017pub 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>> {
1018    // add a prefix to parameters to efficiently prevent name collisions
1019    let p_path_project_id = project_id;
1020    let p_path_organization_id = organization_id;
1021    let p_path_onboarding_portal_link_id = onboarding_portal_link_id;
1022    let p_body_update_organization_onboarding_portal_link_body = update_organization_onboarding_portal_link_body;
1023
1024    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_path_project_id), organization_id=crate::apis::urlencode(p_path_organization_id), onboarding_portal_link_id=crate::apis::urlencode(p_path_onboarding_portal_link_id));
1025    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1026
1027    if let Some(ref user_agent) = configuration.user_agent {
1028        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1029    }
1030    if let Some(ref token) = configuration.bearer_access_token {
1031        req_builder = req_builder.bearer_auth(token.to_owned());
1032    };
1033    req_builder = req_builder.json(&p_body_update_organization_onboarding_portal_link_body);
1034
1035    let req = req_builder.build()?;
1036    let resp = configuration.client.execute(req).await?;
1037
1038    let status = resp.status();
1039    let content_type = resp
1040        .headers()
1041        .get("content-type")
1042        .and_then(|v| v.to_str().ok())
1043        .unwrap_or("application/octet-stream");
1044    let content_type = super::ContentType::from(content_type);
1045
1046    if !status.is_client_error() && !status.is_server_error() {
1047        let content = resp.text().await?;
1048        match content_type {
1049            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1050            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OnboardingPortalLink`"))),
1051            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`")))),
1052        }
1053    } else {
1054        let content = resp.text().await?;
1055        let entity: Option<UpdateOrganizationOnboardingPortalLinkError> = serde_json::from_str(&content).ok();
1056        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1057    }
1058}
1059