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.98
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/// struct for typed errors of method [`validate_opl`]
237#[derive(Debug, Clone, Serialize, Deserialize)]
238#[serde(untagged)]
239pub enum ValidateOplError {
240    Status400(models::ErrorGeneric),
241    Status401(models::ErrorGeneric),
242    Status403(models::ErrorGeneric),
243    Status404(models::ErrorGeneric),
244    DefaultResponse(models::ErrorGeneric),
245    UnknownValue(serde_json::Value),
246}
247
248
249/// Deprecated: use setProject or patchProjectWithRevision instead  Creates an Enterprise SSO Organization in a project.
250pub async fn create_organization(configuration: &configuration::Configuration, project_id: &str, organization_body: Option<models::OrganizationBody>) -> Result<models::Organization, Error<CreateOrganizationError>> {
251    // add a prefix to parameters to efficiently prevent name collisions
252    let p_path_project_id = project_id;
253    let p_body_organization_body = organization_body;
254
255    let uri_str = format!("{}/projects/{project_id}/organizations", configuration.base_path, project_id=crate::apis::urlencode(p_path_project_id));
256    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
257
258    if let Some(ref user_agent) = configuration.user_agent {
259        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
260    }
261    if let Some(ref token) = configuration.bearer_access_token {
262        req_builder = req_builder.bearer_auth(token.to_owned());
263    };
264    req_builder = req_builder.json(&p_body_organization_body);
265
266    let req = req_builder.build()?;
267    let resp = configuration.client.execute(req).await?;
268
269    let status = resp.status();
270    let content_type = resp
271        .headers()
272        .get("content-type")
273        .and_then(|v| v.to_str().ok())
274        .unwrap_or("application/octet-stream");
275    let content_type = super::ContentType::from(content_type);
276
277    if !status.is_client_error() && !status.is_server_error() {
278        let content = resp.text().await?;
279        match content_type {
280            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
281            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Organization`"))),
282            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`")))),
283        }
284    } else {
285        let content = resp.text().await?;
286        let entity: Option<CreateOrganizationError> = serde_json::from_str(&content).ok();
287        Err(Error::ResponseError(ResponseContent { status, content, entity }))
288    }
289}
290
291/// Create a onboarding portal link for an organization.
292pub 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>> {
293    // add a prefix to parameters to efficiently prevent name collisions
294    let p_path_project_id = project_id;
295    let p_path_organization_id = organization_id;
296    let p_body_create_organization_onboarding_portal_link_body = create_organization_onboarding_portal_link_body;
297
298    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));
299    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
300
301    if let Some(ref user_agent) = configuration.user_agent {
302        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
303    }
304    if let Some(ref token) = configuration.bearer_access_token {
305        req_builder = req_builder.bearer_auth(token.to_owned());
306    };
307    req_builder = req_builder.json(&p_body_create_organization_onboarding_portal_link_body);
308
309    let req = req_builder.build()?;
310    let resp = configuration.client.execute(req).await?;
311
312    let status = resp.status();
313    let content_type = resp
314        .headers()
315        .get("content-type")
316        .and_then(|v| v.to_str().ok())
317        .unwrap_or("application/octet-stream");
318    let content_type = super::ContentType::from(content_type);
319
320    if !status.is_client_error() && !status.is_server_error() {
321        let content = resp.text().await?;
322        match content_type {
323            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
324            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OnboardingPortalLink`"))),
325            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`")))),
326        }
327    } else {
328        let content = resp.text().await?;
329        let entity: Option<CreateOrganizationOnboardingPortalLinkError> = serde_json::from_str(&content).ok();
330        Err(Error::ResponseError(ResponseContent { status, content, entity }))
331    }
332}
333
334/// Creates a new project.
335pub async fn create_project(configuration: &configuration::Configuration, create_project_body: Option<models::CreateProjectBody>) -> Result<models::Project, Error<CreateProjectError>> {
336    // add a prefix to parameters to efficiently prevent name collisions
337    let p_body_create_project_body = create_project_body;
338
339    let uri_str = format!("{}/projects", configuration.base_path);
340    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
341
342    if let Some(ref user_agent) = configuration.user_agent {
343        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
344    }
345    if let Some(ref token) = configuration.bearer_access_token {
346        req_builder = req_builder.bearer_auth(token.to_owned());
347    };
348    req_builder = req_builder.json(&p_body_create_project_body);
349
350    let req = req_builder.build()?;
351    let resp = configuration.client.execute(req).await?;
352
353    let status = resp.status();
354    let content_type = resp
355        .headers()
356        .get("content-type")
357        .and_then(|v| v.to_str().ok())
358        .unwrap_or("application/octet-stream");
359    let content_type = super::ContentType::from(content_type);
360
361    if !status.is_client_error() && !status.is_server_error() {
362        let content = resp.text().await?;
363        match content_type {
364            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
365            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Project`"))),
366            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`")))),
367        }
368    } else {
369        let content = resp.text().await?;
370        let entity: Option<CreateProjectError> = serde_json::from_str(&content).ok();
371        Err(Error::ResponseError(ResponseContent { status, content, entity }))
372    }
373}
374
375/// Create an API key for a project.
376pub async fn create_project_api_key(configuration: &configuration::Configuration, project: &str, create_project_api_key_body: Option<models::CreateProjectApiKeyBody>) -> Result<models::ProjectApiKey, Error<CreateProjectApiKeyError>> {
377    // add a prefix to parameters to efficiently prevent name collisions
378    let p_path_project = project;
379    let p_body_create_project_api_key_body = create_project_api_key_body;
380
381    let uri_str = format!("{}/projects/{project}/tokens", configuration.base_path, project=crate::apis::urlencode(p_path_project));
382    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
383
384    if let Some(ref user_agent) = configuration.user_agent {
385        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
386    }
387    if let Some(ref token) = configuration.bearer_access_token {
388        req_builder = req_builder.bearer_auth(token.to_owned());
389    };
390    req_builder = req_builder.json(&p_body_create_project_api_key_body);
391
392    let req = req_builder.build()?;
393    let resp = configuration.client.execute(req).await?;
394
395    let status = resp.status();
396    let content_type = resp
397        .headers()
398        .get("content-type")
399        .and_then(|v| v.to_str().ok())
400        .unwrap_or("application/octet-stream");
401    let content_type = super::ContentType::from(content_type);
402
403    if !status.is_client_error() && !status.is_server_error() {
404        let content = resp.text().await?;
405        match content_type {
406            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
407            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ProjectApiKey`"))),
408            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`")))),
409        }
410    } else {
411        let content = resp.text().await?;
412        let entity: Option<CreateProjectApiKeyError> = serde_json::from_str(&content).ok();
413        Err(Error::ResponseError(ResponseContent { status, content, entity }))
414    }
415}
416
417/// Deprecated: use setProject or patchProjectWithRevision instead  Irrecoverably deletes an Enterprise SSO Organization in a project by its ID.
418pub async fn delete_organization(configuration: &configuration::Configuration, project_id: &str, organization_id: &str) -> Result<(), Error<DeleteOrganizationError>> {
419    // add a prefix to parameters to efficiently prevent name collisions
420    let p_path_project_id = project_id;
421    let p_path_organization_id = organization_id;
422
423    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));
424    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
425
426    if let Some(ref user_agent) = configuration.user_agent {
427        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
428    }
429    if let Some(ref token) = configuration.bearer_access_token {
430        req_builder = req_builder.bearer_auth(token.to_owned());
431    };
432
433    let req = req_builder.build()?;
434    let resp = configuration.client.execute(req).await?;
435
436    let status = resp.status();
437
438    if !status.is_client_error() && !status.is_server_error() {
439        Ok(())
440    } else {
441        let content = resp.text().await?;
442        let entity: Option<DeleteOrganizationError> = serde_json::from_str(&content).ok();
443        Err(Error::ResponseError(ResponseContent { status, content, entity }))
444    }
445}
446
447/// Deletes a onboarding portal link for an organization.
448pub async fn delete_organization_onboarding_portal_link(configuration: &configuration::Configuration, project_id: &str, organization_id: &str, onboarding_portal_link_id: &str) -> Result<(), Error<DeleteOrganizationOnboardingPortalLinkError>> {
449    // add a prefix to parameters to efficiently prevent name collisions
450    let p_path_project_id = project_id;
451    let p_path_organization_id = organization_id;
452    let p_path_onboarding_portal_link_id = onboarding_portal_link_id;
453
454    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));
455    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
456
457    if let Some(ref user_agent) = configuration.user_agent {
458        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
459    }
460    if let Some(ref token) = configuration.bearer_access_token {
461        req_builder = req_builder.bearer_auth(token.to_owned());
462    };
463
464    let req = req_builder.build()?;
465    let resp = configuration.client.execute(req).await?;
466
467    let status = resp.status();
468
469    if !status.is_client_error() && !status.is_server_error() {
470        Ok(())
471    } else {
472        let content = resp.text().await?;
473        let entity: Option<DeleteOrganizationOnboardingPortalLinkError> = serde_json::from_str(&content).ok();
474        Err(Error::ResponseError(ResponseContent { status, content, entity }))
475    }
476}
477
478/// Deletes an API key and immediately removes it.
479pub async fn delete_project_api_key(configuration: &configuration::Configuration, project: &str, token_id: &str) -> Result<(), Error<DeleteProjectApiKeyError>> {
480    // add a prefix to parameters to efficiently prevent name collisions
481    let p_path_project = project;
482    let p_path_token_id = token_id;
483
484    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));
485    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
486
487    if let Some(ref user_agent) = configuration.user_agent {
488        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
489    }
490    if let Some(ref token) = configuration.bearer_access_token {
491        req_builder = req_builder.bearer_auth(token.to_owned());
492    };
493
494    let req = req_builder.build()?;
495    let resp = configuration.client.execute(req).await?;
496
497    let status = resp.status();
498
499    if !status.is_client_error() && !status.is_server_error() {
500        Ok(())
501    } else {
502        let content = resp.text().await?;
503        let entity: Option<DeleteProjectApiKeyError> = serde_json::from_str(&content).ok();
504        Err(Error::ResponseError(ResponseContent { status, content, entity }))
505    }
506}
507
508/// Deprecated: use getProject instead  Retrieves an Enterprise SSO Organization for a project by its ID
509pub async fn get_organization(configuration: &configuration::Configuration, project_id: &str, organization_id: &str) -> Result<models::GetOrganizationResponse, Error<GetOrganizationError>> {
510    // add a prefix to parameters to efficiently prevent name collisions
511    let p_path_project_id = project_id;
512    let p_path_organization_id = organization_id;
513
514    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));
515    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
516
517    if let Some(ref user_agent) = configuration.user_agent {
518        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
519    }
520    if let Some(ref token) = configuration.bearer_access_token {
521        req_builder = req_builder.bearer_auth(token.to_owned());
522    };
523
524    let req = req_builder.build()?;
525    let resp = configuration.client.execute(req).await?;
526
527    let status = resp.status();
528    let content_type = resp
529        .headers()
530        .get("content-type")
531        .and_then(|v| v.to_str().ok())
532        .unwrap_or("application/octet-stream");
533    let content_type = super::ContentType::from(content_type);
534
535    if !status.is_client_error() && !status.is_server_error() {
536        let content = resp.text().await?;
537        match content_type {
538            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
539            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::GetOrganizationResponse`"))),
540            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`")))),
541        }
542    } else {
543        let content = resp.text().await?;
544        let entity: Option<GetOrganizationError> = serde_json::from_str(&content).ok();
545        Err(Error::ResponseError(ResponseContent { status, content, entity }))
546    }
547}
548
549/// Retrieves the organization onboarding portal links.
550pub async fn get_organization_onboarding_portal_links(configuration: &configuration::Configuration, project_id: &str, organization_id: &str) -> Result<models::OrganizationOnboardingPortalLinksResponse, Error<GetOrganizationOnboardingPortalLinksError>> {
551    // add a prefix to parameters to efficiently prevent name collisions
552    let p_path_project_id = project_id;
553    let p_path_organization_id = organization_id;
554
555    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));
556    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
557
558    if let Some(ref user_agent) = configuration.user_agent {
559        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
560    }
561    if let Some(ref token) = configuration.bearer_access_token {
562        req_builder = req_builder.bearer_auth(token.to_owned());
563    };
564
565    let req = req_builder.build()?;
566    let resp = configuration.client.execute(req).await?;
567
568    let status = resp.status();
569    let content_type = resp
570        .headers()
571        .get("content-type")
572        .and_then(|v| v.to_str().ok())
573        .unwrap_or("application/octet-stream");
574    let content_type = super::ContentType::from(content_type);
575
576    if !status.is_client_error() && !status.is_server_error() {
577        let content = resp.text().await?;
578        match content_type {
579            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
580            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OrganizationOnboardingPortalLinksResponse`"))),
581            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`")))),
582        }
583    } else {
584        let content = resp.text().await?;
585        let entity: Option<GetOrganizationOnboardingPortalLinksError> = serde_json::from_str(&content).ok();
586        Err(Error::ResponseError(ResponseContent { status, content, entity }))
587    }
588}
589
590/// Returns the project rendered into the configuration format the open source projects use (e.g. Ory Kratos for Identity, Ory Keto for Permissions), including the values Ory fills in for the project, such as the resolved base URLs.  The rendered configuration does not carry the operational configuration items (e.g. port, tracing, logging) available in the open source.
591pub async fn get_project(configuration: &configuration::Configuration, project_id: &str) -> Result<models::Project, Error<GetProjectError>> {
592    // add a prefix to parameters to efficiently prevent name collisions
593    let p_path_project_id = project_id;
594
595    let uri_str = format!("{}/projects/{project_id}", configuration.base_path, project_id=crate::apis::urlencode(p_path_project_id));
596    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
597
598    if let Some(ref user_agent) = configuration.user_agent {
599        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
600    }
601    if let Some(ref token) = configuration.bearer_access_token {
602        req_builder = req_builder.bearer_auth(token.to_owned());
603    };
604
605    let req = req_builder.build()?;
606    let resp = configuration.client.execute(req).await?;
607
608    let status = resp.status();
609    let content_type = resp
610        .headers()
611        .get("content-type")
612        .and_then(|v| v.to_str().ok())
613        .unwrap_or("application/octet-stream");
614    let content_type = super::ContentType::from(content_type);
615
616    if !status.is_client_error() && !status.is_server_error() {
617        let content = resp.text().await?;
618        match content_type {
619            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
620            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Project`"))),
621            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`")))),
622        }
623    } else {
624        let content = resp.text().await?;
625        let entity: Option<GetProjectError> = serde_json::from_str(&content).ok();
626        Err(Error::ResponseError(ResponseContent { status, content, entity }))
627    }
628}
629
630/// This endpoint requires the user to be a member of the project with the role `OWNER` or `DEVELOPER`.
631pub async fn get_project_members(configuration: &configuration::Configuration, project: &str) -> Result<Vec<models::ProjectMember>, Error<GetProjectMembersError>> {
632    // add a prefix to parameters to efficiently prevent name collisions
633    let p_path_project = project;
634
635    let uri_str = format!("{}/projects/{project}/members", configuration.base_path, project=crate::apis::urlencode(p_path_project));
636    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
637
638    if let Some(ref user_agent) = configuration.user_agent {
639        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
640    }
641    if let Some(ref token) = configuration.bearer_access_token {
642        req_builder = req_builder.bearer_auth(token.to_owned());
643    };
644
645    let req = req_builder.build()?;
646    let resp = configuration.client.execute(req).await?;
647
648    let status = resp.status();
649    let content_type = resp
650        .headers()
651        .get("content-type")
652        .and_then(|v| v.to_str().ok())
653        .unwrap_or("application/octet-stream");
654    let content_type = super::ContentType::from(content_type);
655
656    if !status.is_client_error() && !status.is_server_error() {
657        let content = resp.text().await?;
658        match content_type {
659            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
660            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;`"))),
661            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;`")))),
662        }
663    } else {
664        let content = resp.text().await?;
665        let entity: Option<GetProjectMembersError> = serde_json::from_str(&content).ok();
666        Err(Error::ResponseError(ResponseContent { status, content, entity }))
667    }
668}
669
670/// Deprecated: use getProject instead  Lists all Enterprise SSO organizations in a project.
671pub 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>> {
672    // add a prefix to parameters to efficiently prevent name collisions
673    let p_path_project_id = project_id;
674    let p_query_page_size = page_size;
675    let p_query_page_token = page_token;
676    let p_query_domain = domain;
677
678    let uri_str = format!("{}/projects/{project_id}/organizations", configuration.base_path, project_id=crate::apis::urlencode(p_path_project_id));
679    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
680
681    if let Some(ref param_value) = p_query_page_size {
682        req_builder = req_builder.query(&[("page_size", &param_value.to_string())]);
683    }
684    if let Some(ref param_value) = p_query_page_token {
685        req_builder = req_builder.query(&[("page_token", &param_value.to_string())]);
686    }
687    if let Some(ref param_value) = p_query_domain {
688        req_builder = req_builder.query(&[("domain", &param_value.to_string())]);
689    }
690    if let Some(ref user_agent) = configuration.user_agent {
691        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
692    }
693    if let Some(ref token) = configuration.bearer_access_token {
694        req_builder = req_builder.bearer_auth(token.to_owned());
695    };
696
697    let req = req_builder.build()?;
698    let resp = configuration.client.execute(req).await?;
699
700    let status = resp.status();
701    let content_type = resp
702        .headers()
703        .get("content-type")
704        .and_then(|v| v.to_str().ok())
705        .unwrap_or("application/octet-stream");
706    let content_type = super::ContentType::from(content_type);
707
708    if !status.is_client_error() && !status.is_server_error() {
709        let content = resp.text().await?;
710        match content_type {
711            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
712            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ListOrganizationsResponse`"))),
713            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`")))),
714        }
715    } else {
716        let content = resp.text().await?;
717        let entity: Option<ListOrganizationsError> = serde_json::from_str(&content).ok();
718        Err(Error::ResponseError(ResponseContent { status, content, entity }))
719    }
720}
721
722/// A list of all the project's API keys.
723pub async fn list_project_api_keys(configuration: &configuration::Configuration, project: &str) -> Result<Vec<models::ProjectApiKey>, Error<ListProjectApiKeysError>> {
724    // add a prefix to parameters to efficiently prevent name collisions
725    let p_path_project = project;
726
727    let uri_str = format!("{}/projects/{project}/tokens", configuration.base_path, project=crate::apis::urlencode(p_path_project));
728    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
729
730    if let Some(ref user_agent) = configuration.user_agent {
731        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
732    }
733    if let Some(ref token) = configuration.bearer_access_token {
734        req_builder = req_builder.bearer_auth(token.to_owned());
735    };
736
737    let req = req_builder.build()?;
738    let resp = configuration.client.execute(req).await?;
739
740    let status = resp.status();
741    let content_type = resp
742        .headers()
743        .get("content-type")
744        .and_then(|v| v.to_str().ok())
745        .unwrap_or("application/octet-stream");
746    let content_type = super::ContentType::from(content_type);
747
748    if !status.is_client_error() && !status.is_server_error() {
749        let content = resp.text().await?;
750        match content_type {
751            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
752            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;`"))),
753            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;`")))),
754        }
755    } else {
756        let content = resp.text().await?;
757        let entity: Option<ListProjectApiKeysError> = serde_json::from_str(&content).ok();
758        Err(Error::ResponseError(ResponseContent { status, content, entity }))
759    }
760}
761
762/// Lists all projects you have access to.
763pub async fn list_projects(configuration: &configuration::Configuration, ) -> Result<Vec<models::ProjectMetadata>, Error<ListProjectsError>> {
764
765    let uri_str = format!("{}/projects", configuration.base_path);
766    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
767
768    if let Some(ref user_agent) = configuration.user_agent {
769        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
770    }
771    if let Some(ref token) = configuration.bearer_access_token {
772        req_builder = req_builder.bearer_auth(token.to_owned());
773    };
774
775    let req = req_builder.build()?;
776    let resp = configuration.client.execute(req).await?;
777
778    let status = resp.status();
779    let content_type = resp
780        .headers()
781        .get("content-type")
782        .and_then(|v| v.to_str().ok())
783        .unwrap_or("application/octet-stream");
784    let content_type = super::ContentType::from(content_type);
785
786    if !status.is_client_error() && !status.is_server_error() {
787        let content = resp.text().await?;
788        match content_type {
789            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
790            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;`"))),
791            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;`")))),
792        }
793    } else {
794        let content = resp.text().await?;
795        let entity: Option<ListProjectsError> = serde_json::from_str(&content).ok();
796        Err(Error::ResponseError(ResponseContent { status, content, entity }))
797    }
798}
799
800/// 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.
801pub async fn patch_project(configuration: &configuration::Configuration, project_id: &str, json_patch: Option<Vec<models::JsonPatch>>) -> Result<models::SuccessfulProjectUpdate, Error<PatchProjectError>> {
802    // add a prefix to parameters to efficiently prevent name collisions
803    let p_path_project_id = project_id;
804    let p_body_json_patch = json_patch;
805
806    let uri_str = format!("{}/projects/{project_id}", configuration.base_path, project_id=crate::apis::urlencode(p_path_project_id));
807    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
808
809    if let Some(ref user_agent) = configuration.user_agent {
810        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
811    }
812    if let Some(ref token) = configuration.bearer_access_token {
813        req_builder = req_builder.bearer_auth(token.to_owned());
814    };
815    req_builder = req_builder.json(&p_body_json_patch);
816
817    let req = req_builder.build()?;
818    let resp = configuration.client.execute(req).await?;
819
820    let status = resp.status();
821    let content_type = resp
822        .headers()
823        .get("content-type")
824        .and_then(|v| v.to_str().ok())
825        .unwrap_or("application/octet-stream");
826    let content_type = super::ContentType::from(content_type);
827
828    if !status.is_client_error() && !status.is_server_error() {
829        let content = resp.text().await?;
830        match content_type {
831            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
832            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SuccessfulProjectUpdate`"))),
833            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`")))),
834        }
835    } else {
836        let content = resp.text().await?;
837        let entity: Option<PatchProjectError> = serde_json::from_str(&content).ok();
838        Err(Error::ResponseError(ResponseContent { status, content, entity }))
839    }
840}
841
842/// 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.
843pub 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>> {
844    // add a prefix to parameters to efficiently prevent name collisions
845    let p_path_project_id = project_id;
846    let p_path_revision_id = revision_id;
847    let p_body_json_patch = json_patch;
848
849    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));
850    let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
851
852    if let Some(ref user_agent) = configuration.user_agent {
853        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
854    }
855    if let Some(ref token) = configuration.bearer_access_token {
856        req_builder = req_builder.bearer_auth(token.to_owned());
857    };
858    req_builder = req_builder.json(&p_body_json_patch);
859
860    let req = req_builder.build()?;
861    let resp = configuration.client.execute(req).await?;
862
863    let status = resp.status();
864    let content_type = resp
865        .headers()
866        .get("content-type")
867        .and_then(|v| v.to_str().ok())
868        .unwrap_or("application/octet-stream");
869    let content_type = super::ContentType::from(content_type);
870
871    if !status.is_client_error() && !status.is_server_error() {
872        let content = resp.text().await?;
873        match content_type {
874            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
875            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SuccessfulProjectUpdate`"))),
876            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`")))),
877        }
878    } else {
879        let content = resp.text().await?;
880        let entity: Option<PatchProjectWithRevisionError> = serde_json::from_str(&content).ok();
881        Err(Error::ResponseError(ResponseContent { status, content, entity }))
882    }
883}
884
885/// !! 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.
886pub async fn purge_project(configuration: &configuration::Configuration, project_id: &str) -> Result<(), Error<PurgeProjectError>> {
887    // add a prefix to parameters to efficiently prevent name collisions
888    let p_path_project_id = project_id;
889
890    let uri_str = format!("{}/projects/{project_id}", configuration.base_path, project_id=crate::apis::urlencode(p_path_project_id));
891    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
892
893    if let Some(ref user_agent) = configuration.user_agent {
894        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
895    }
896    if let Some(ref token) = configuration.bearer_access_token {
897        req_builder = req_builder.bearer_auth(token.to_owned());
898    };
899
900    let req = req_builder.build()?;
901    let resp = configuration.client.execute(req).await?;
902
903    let status = resp.status();
904
905    if !status.is_client_error() && !status.is_server_error() {
906        Ok(())
907    } else {
908        let content = resp.text().await?;
909        let entity: Option<PurgeProjectError> = serde_json::from_str(&content).ok();
910        Err(Error::ResponseError(ResponseContent { status, content, entity }))
911    }
912}
913
914/// This also closes their open invites to this project: accepted invites become `removed` and pending invites become `cancelled`. This endpoint requires the user to be a member of the project with the role `OWNER`.
915pub async fn remove_project_member(configuration: &configuration::Configuration, project: &str, member: &str) -> Result<(), Error<RemoveProjectMemberError>> {
916    // add a prefix to parameters to efficiently prevent name collisions
917    let p_path_project = project;
918    let p_path_member = member;
919
920    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));
921    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
922
923    if let Some(ref user_agent) = configuration.user_agent {
924        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
925    }
926    if let Some(ref token) = configuration.bearer_access_token {
927        req_builder = req_builder.bearer_auth(token.to_owned());
928    };
929
930    let req = req_builder.build()?;
931    let resp = configuration.client.execute(req).await?;
932
933    let status = resp.status();
934
935    if !status.is_client_error() && !status.is_server_error() {
936        Ok(())
937    } else {
938        let content = resp.text().await?;
939        let entity: Option<RemoveProjectMemberError> = serde_json::from_str(&content).ok();
940        Err(Error::ResponseError(ResponseContent { status, content, entity }))
941    }
942}
943
944/// 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!
945pub async fn set_project(configuration: &configuration::Configuration, project_id: &str, set_project: Option<models::SetProject>) -> Result<models::SuccessfulProjectUpdate, Error<SetProjectError>> {
946    // add a prefix to parameters to efficiently prevent name collisions
947    let p_path_project_id = project_id;
948    let p_body_set_project = set_project;
949
950    let uri_str = format!("{}/projects/{project_id}", configuration.base_path, project_id=crate::apis::urlencode(p_path_project_id));
951    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
952
953    if let Some(ref user_agent) = configuration.user_agent {
954        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
955    }
956    if let Some(ref token) = configuration.bearer_access_token {
957        req_builder = req_builder.bearer_auth(token.to_owned());
958    };
959    req_builder = req_builder.json(&p_body_set_project);
960
961    let req = req_builder.build()?;
962    let resp = configuration.client.execute(req).await?;
963
964    let status = resp.status();
965    let content_type = resp
966        .headers()
967        .get("content-type")
968        .and_then(|v| v.to_str().ok())
969        .unwrap_or("application/octet-stream");
970    let content_type = super::ContentType::from(content_type);
971
972    if !status.is_client_error() && !status.is_server_error() {
973        let content = resp.text().await?;
974        match content_type {
975            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
976            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::SuccessfulProjectUpdate`"))),
977            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`")))),
978        }
979    } else {
980        let content = resp.text().await?;
981        let entity: Option<SetProjectError> = serde_json::from_str(&content).ok();
982        Err(Error::ResponseError(ResponseContent { status, content, entity }))
983    }
984}
985
986/// Deprecated: use setProject or patchProjectWithRevision instead  Updates an Enterprise SSO Organization in a project by its ID.
987pub async fn update_organization(configuration: &configuration::Configuration, project_id: &str, organization_id: &str, organization_body: Option<models::OrganizationBody>) -> Result<models::Organization, Error<UpdateOrganizationError>> {
988    // add a prefix to parameters to efficiently prevent name collisions
989    let p_path_project_id = project_id;
990    let p_path_organization_id = organization_id;
991    let p_body_organization_body = organization_body;
992
993    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));
994    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
995
996    if let Some(ref user_agent) = configuration.user_agent {
997        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
998    }
999    if let Some(ref token) = configuration.bearer_access_token {
1000        req_builder = req_builder.bearer_auth(token.to_owned());
1001    };
1002    req_builder = req_builder.json(&p_body_organization_body);
1003
1004    let req = req_builder.build()?;
1005    let resp = configuration.client.execute(req).await?;
1006
1007    let status = resp.status();
1008    let content_type = resp
1009        .headers()
1010        .get("content-type")
1011        .and_then(|v| v.to_str().ok())
1012        .unwrap_or("application/octet-stream");
1013    let content_type = super::ContentType::from(content_type);
1014
1015    if !status.is_client_error() && !status.is_server_error() {
1016        let content = resp.text().await?;
1017        match content_type {
1018            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1019            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Organization`"))),
1020            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`")))),
1021        }
1022    } else {
1023        let content = resp.text().await?;
1024        let entity: Option<UpdateOrganizationError> = serde_json::from_str(&content).ok();
1025        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1026    }
1027}
1028
1029/// Update a onboarding portal link for an organization.
1030pub 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>> {
1031    // add a prefix to parameters to efficiently prevent name collisions
1032    let p_path_project_id = project_id;
1033    let p_path_organization_id = organization_id;
1034    let p_path_onboarding_portal_link_id = onboarding_portal_link_id;
1035    let p_body_update_organization_onboarding_portal_link_body = update_organization_onboarding_portal_link_body;
1036
1037    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));
1038    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1039
1040    if let Some(ref user_agent) = configuration.user_agent {
1041        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1042    }
1043    if let Some(ref token) = configuration.bearer_access_token {
1044        req_builder = req_builder.bearer_auth(token.to_owned());
1045    };
1046    req_builder = req_builder.json(&p_body_update_organization_onboarding_portal_link_body);
1047
1048    let req = req_builder.build()?;
1049    let resp = configuration.client.execute(req).await?;
1050
1051    let status = resp.status();
1052    let content_type = resp
1053        .headers()
1054        .get("content-type")
1055        .and_then(|v| v.to_str().ok())
1056        .unwrap_or("application/octet-stream");
1057    let content_type = super::ContentType::from(content_type);
1058
1059    if !status.is_client_error() && !status.is_server_error() {
1060        let content = resp.text().await?;
1061        match content_type {
1062            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1063            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OnboardingPortalLink`"))),
1064            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`")))),
1065        }
1066    } else {
1067        let content = resp.text().await?;
1068        let entity: Option<UpdateOrganizationOnboardingPortalLinkError> = serde_json::from_str(&content).ok();
1069        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1070    }
1071}
1072
1073/// Parses an OPL document using the same product limits and subscription entitlements applied when the project's configuration is saved.
1074pub async fn validate_opl(configuration: &configuration::Configuration, project_id: &str, body: Option<&str>) -> Result<models::OplValidateResult, Error<ValidateOplError>> {
1075    // add a prefix to parameters to efficiently prevent name collisions
1076    let p_path_project_id = project_id;
1077    let p_body_body = body;
1078
1079    let uri_str = format!("{}/projects/{project_id}/opl/validate", configuration.base_path, project_id=crate::apis::urlencode(p_path_project_id));
1080    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1081
1082    if let Some(ref user_agent) = configuration.user_agent {
1083        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1084    }
1085    if let Some(ref token) = configuration.bearer_access_token {
1086        req_builder = req_builder.bearer_auth(token.to_owned());
1087    };
1088    req_builder = req_builder.json(&p_body_body);
1089
1090    let req = req_builder.build()?;
1091    let resp = configuration.client.execute(req).await?;
1092
1093    let status = resp.status();
1094    let content_type = resp
1095        .headers()
1096        .get("content-type")
1097        .and_then(|v| v.to_str().ok())
1098        .unwrap_or("application/octet-stream");
1099    let content_type = super::ContentType::from(content_type);
1100
1101    if !status.is_client_error() && !status.is_server_error() {
1102        let content = resp.text().await?;
1103        match content_type {
1104            ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1105            ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::OplValidateResult`"))),
1106            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::OplValidateResult`")))),
1107        }
1108    } else {
1109        let content = resp.text().await?;
1110        let entity: Option<ValidateOplError> = serde_json::from_str(&content).ok();
1111        Err(Error::ResponseError(ResponseContent { status, content, entity }))
1112    }
1113}
1114