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