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.17.2
7 * Contact: support@ory.sh
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
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_project`]
30#[derive(Debug, Clone, Serialize, Deserialize)]
31#[serde(untagged)]
32pub enum CreateProjectError {
33    Status401(models::ErrorGeneric),
34    Status403(models::ErrorGeneric),
35    Status404(models::ErrorGeneric),
36    DefaultResponse(models::ErrorGeneric),
37    UnknownValue(serde_json::Value),
38}
39
40/// struct for typed errors of method [`create_project_api_key`]
41#[derive(Debug, Clone, Serialize, Deserialize)]
42#[serde(untagged)]
43pub enum CreateProjectApiKeyError {
44    DefaultResponse(models::ErrorGeneric),
45    UnknownValue(serde_json::Value),
46}
47
48/// struct for typed errors of method [`delete_organization`]
49#[derive(Debug, Clone, Serialize, Deserialize)]
50#[serde(untagged)]
51pub enum DeleteOrganizationError {
52    Status400(models::ErrorGeneric),
53    Status403(models::ErrorGeneric),
54    Status404(models::ErrorGeneric),
55    Status409(models::ErrorGeneric),
56    DefaultResponse(models::ErrorGeneric),
57    UnknownValue(serde_json::Value),
58}
59
60/// struct for typed errors of method [`delete_project_api_key`]
61#[derive(Debug, Clone, Serialize, Deserialize)]
62#[serde(untagged)]
63pub enum DeleteProjectApiKeyError {
64    DefaultResponse(models::ErrorGeneric),
65    UnknownValue(serde_json::Value),
66}
67
68/// struct for typed errors of method [`get_organization`]
69#[derive(Debug, Clone, Serialize, Deserialize)]
70#[serde(untagged)]
71pub enum GetOrganizationError {
72    Status400(models::ErrorGeneric),
73    Status403(models::ErrorGeneric),
74    DefaultResponse(models::ErrorGeneric),
75    UnknownValue(serde_json::Value),
76}
77
78/// struct for typed errors of method [`get_project`]
79#[derive(Debug, Clone, Serialize, Deserialize)]
80#[serde(untagged)]
81pub enum GetProjectError {
82    Status401(models::ErrorGeneric),
83    Status403(models::ErrorGeneric),
84    Status404(models::ErrorGeneric),
85    DefaultResponse(models::ErrorGeneric),
86    UnknownValue(serde_json::Value),
87}
88
89/// struct for typed errors of method [`get_project_members`]
90#[derive(Debug, Clone, Serialize, Deserialize)]
91#[serde(untagged)]
92pub enum GetProjectMembersError {
93    Status401(models::GenericError),
94    Status406(models::GenericError),
95    DefaultResponse(models::GenericError),
96    UnknownValue(serde_json::Value),
97}
98
99/// struct for typed errors of method [`list_organizations`]
100#[derive(Debug, Clone, Serialize, Deserialize)]
101#[serde(untagged)]
102pub enum ListOrganizationsError {
103    Status400(models::ErrorGeneric),
104    Status403(models::ErrorGeneric),
105    DefaultResponse(models::ErrorGeneric),
106    UnknownValue(serde_json::Value),
107}
108
109/// struct for typed errors of method [`list_project_api_keys`]
110#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum ListProjectApiKeysError {
113    DefaultResponse(models::ErrorGeneric),
114    UnknownValue(serde_json::Value),
115}
116
117/// struct for typed errors of method [`list_projects`]
118#[derive(Debug, Clone, Serialize, Deserialize)]
119#[serde(untagged)]
120pub enum ListProjectsError {
121    Status401(models::ErrorGeneric),
122    Status403(models::ErrorGeneric),
123    Status404(models::ErrorGeneric),
124    DefaultResponse(models::ErrorGeneric),
125    UnknownValue(serde_json::Value),
126}
127
128/// struct for typed errors of method [`patch_project`]
129#[derive(Debug, Clone, Serialize, Deserialize)]
130#[serde(untagged)]
131pub enum PatchProjectError {
132    Status400(models::ErrorGeneric),
133    Status401(models::ErrorGeneric),
134    Status403(models::ErrorGeneric),
135    Status404(models::ErrorGeneric),
136    DefaultResponse(models::ErrorGeneric),
137    UnknownValue(serde_json::Value),
138}
139
140/// struct for typed errors of method [`patch_project_with_revision`]
141#[derive(Debug, Clone, Serialize, Deserialize)]
142#[serde(untagged)]
143pub enum PatchProjectWithRevisionError {
144    Status400(models::ErrorGeneric),
145    Status401(models::ErrorGeneric),
146    Status403(models::ErrorGeneric),
147    Status404(models::ErrorGeneric),
148    DefaultResponse(models::ErrorGeneric),
149    UnknownValue(serde_json::Value),
150}
151
152/// struct for typed errors of method [`purge_project`]
153#[derive(Debug, Clone, Serialize, Deserialize)]
154#[serde(untagged)]
155pub enum PurgeProjectError {
156    Status401(models::GenericError),
157    Status403(models::GenericError),
158    Status404(models::GenericError),
159    DefaultResponse(models::GenericError),
160    UnknownValue(serde_json::Value),
161}
162
163/// struct for typed errors of method [`remove_project_member`]
164#[derive(Debug, Clone, Serialize, Deserialize)]
165#[serde(untagged)]
166pub enum RemoveProjectMemberError {
167    Status401(models::GenericError),
168    Status406(models::GenericError),
169    DefaultResponse(models::GenericError),
170    UnknownValue(serde_json::Value),
171}
172
173/// struct for typed errors of method [`set_project`]
174#[derive(Debug, Clone, Serialize, Deserialize)]
175#[serde(untagged)]
176pub enum SetProjectError {
177    Status400(models::ErrorGeneric),
178    Status401(models::ErrorGeneric),
179    Status403(models::ErrorGeneric),
180    Status404(models::ErrorGeneric),
181    DefaultResponse(models::ErrorGeneric),
182    UnknownValue(serde_json::Value),
183}
184
185/// struct for typed errors of method [`update_organization`]
186#[derive(Debug, Clone, Serialize, Deserialize)]
187#[serde(untagged)]
188pub enum UpdateOrganizationError {
189    Status400(models::ErrorGeneric),
190    Status403(models::ErrorGeneric),
191    Status404(models::ErrorGeneric),
192    Status409(models::ErrorGeneric),
193    DefaultResponse(models::ErrorGeneric),
194    UnknownValue(serde_json::Value),
195}
196
197
198/// Creates an Enterprise SSO Organization in a project.
199pub async fn create_organization(configuration: &configuration::Configuration, project_id: &str, organization_body: Option<models::OrganizationBody>) -> Result<models::Organization, Error<CreateOrganizationError>> {
200    let local_var_configuration = configuration;
201
202    let local_var_client = &local_var_configuration.client;
203
204    let local_var_uri_str = format!("{}/projects/{project_id}/organizations", local_var_configuration.base_path, project_id=crate::apis::urlencode(project_id));
205    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
206
207    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
208        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
209    }
210    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
211        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
212    };
213    local_var_req_builder = local_var_req_builder.json(&organization_body);
214
215    let local_var_req = local_var_req_builder.build()?;
216    let local_var_resp = local_var_client.execute(local_var_req).await?;
217
218    let local_var_status = local_var_resp.status();
219    let local_var_content = local_var_resp.text().await?;
220
221    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
222        serde_json::from_str(&local_var_content).map_err(Error::from)
223    } else {
224        let local_var_entity: Option<CreateOrganizationError> = serde_json::from_str(&local_var_content).ok();
225        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
226        Err(Error::ResponseError(local_var_error))
227    }
228}
229
230/// Creates a new project.
231pub async fn create_project(configuration: &configuration::Configuration, create_project_body: Option<models::CreateProjectBody>) -> Result<models::Project, Error<CreateProjectError>> {
232    let local_var_configuration = configuration;
233
234    let local_var_client = &local_var_configuration.client;
235
236    let local_var_uri_str = format!("{}/projects", local_var_configuration.base_path);
237    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
238
239    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
240        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
241    }
242    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
243        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
244    };
245    local_var_req_builder = local_var_req_builder.json(&create_project_body);
246
247    let local_var_req = local_var_req_builder.build()?;
248    let local_var_resp = local_var_client.execute(local_var_req).await?;
249
250    let local_var_status = local_var_resp.status();
251    let local_var_content = local_var_resp.text().await?;
252
253    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
254        serde_json::from_str(&local_var_content).map_err(Error::from)
255    } else {
256        let local_var_entity: Option<CreateProjectError> = serde_json::from_str(&local_var_content).ok();
257        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
258        Err(Error::ResponseError(local_var_error))
259    }
260}
261
262/// Create an API key for a project.
263pub async fn create_project_api_key(configuration: &configuration::Configuration, project: &str, create_project_api_key_request: Option<models::CreateProjectApiKeyRequest>) -> Result<models::ProjectApiKey, Error<CreateProjectApiKeyError>> {
264    let local_var_configuration = configuration;
265
266    let local_var_client = &local_var_configuration.client;
267
268    let local_var_uri_str = format!("{}/projects/{project}/tokens", local_var_configuration.base_path, project=crate::apis::urlencode(project));
269    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
270
271    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
272        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
273    }
274    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
275        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
276    };
277    local_var_req_builder = local_var_req_builder.json(&create_project_api_key_request);
278
279    let local_var_req = local_var_req_builder.build()?;
280    let local_var_resp = local_var_client.execute(local_var_req).await?;
281
282    let local_var_status = local_var_resp.status();
283    let local_var_content = local_var_resp.text().await?;
284
285    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
286        serde_json::from_str(&local_var_content).map_err(Error::from)
287    } else {
288        let local_var_entity: Option<CreateProjectApiKeyError> = serde_json::from_str(&local_var_content).ok();
289        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
290        Err(Error::ResponseError(local_var_error))
291    }
292}
293
294/// Irrecoverably deletes an Enterprise SSO Organization in a project by its ID.
295pub async fn delete_organization(configuration: &configuration::Configuration, project_id: &str, organization_id: &str) -> Result<(), Error<DeleteOrganizationError>> {
296    let local_var_configuration = configuration;
297
298    let local_var_client = &local_var_configuration.client;
299
300    let local_var_uri_str = format!("{}/projects/{project_id}/organizations/{organization_id}", local_var_configuration.base_path, project_id=crate::apis::urlencode(project_id), organization_id=crate::apis::urlencode(organization_id));
301    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
302
303    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
304        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
305    }
306    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
307        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
308    };
309
310    let local_var_req = local_var_req_builder.build()?;
311    let local_var_resp = local_var_client.execute(local_var_req).await?;
312
313    let local_var_status = local_var_resp.status();
314    let local_var_content = local_var_resp.text().await?;
315
316    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
317        Ok(())
318    } else {
319        let local_var_entity: Option<DeleteOrganizationError> = serde_json::from_str(&local_var_content).ok();
320        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
321        Err(Error::ResponseError(local_var_error))
322    }
323}
324
325/// Deletes an API key and immediately removes it.
326pub async fn delete_project_api_key(configuration: &configuration::Configuration, project: &str, token_id: &str) -> Result<(), Error<DeleteProjectApiKeyError>> {
327    let local_var_configuration = configuration;
328
329    let local_var_client = &local_var_configuration.client;
330
331    let local_var_uri_str = format!("{}/projects/{project}/tokens/{token_id}", local_var_configuration.base_path, project=crate::apis::urlencode(project), token_id=crate::apis::urlencode(token_id));
332    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
333
334    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
335        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
336    }
337    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
338        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
339    };
340
341    let local_var_req = local_var_req_builder.build()?;
342    let local_var_resp = local_var_client.execute(local_var_req).await?;
343
344    let local_var_status = local_var_resp.status();
345    let local_var_content = local_var_resp.text().await?;
346
347    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
348        Ok(())
349    } else {
350        let local_var_entity: Option<DeleteProjectApiKeyError> = serde_json::from_str(&local_var_content).ok();
351        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
352        Err(Error::ResponseError(local_var_error))
353    }
354}
355
356/// Retrieves an Enterprise SSO Organization for a project by its ID
357pub async fn get_organization(configuration: &configuration::Configuration, project_id: &str, organization_id: &str) -> Result<models::GetOrganizationResponse, Error<GetOrganizationError>> {
358    let local_var_configuration = configuration;
359
360    let local_var_client = &local_var_configuration.client;
361
362    let local_var_uri_str = format!("{}/projects/{project_id}/organizations/{organization_id}", local_var_configuration.base_path, project_id=crate::apis::urlencode(project_id), organization_id=crate::apis::urlencode(organization_id));
363    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
364
365    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
366        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
367    }
368    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
369        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
370    };
371
372    let local_var_req = local_var_req_builder.build()?;
373    let local_var_resp = local_var_client.execute(local_var_req).await?;
374
375    let local_var_status = local_var_resp.status();
376    let local_var_content = local_var_resp.text().await?;
377
378    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
379        serde_json::from_str(&local_var_content).map_err(Error::from)
380    } else {
381        let local_var_entity: Option<GetOrganizationError> = serde_json::from_str(&local_var_content).ok();
382        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
383        Err(Error::ResponseError(local_var_error))
384    }
385}
386
387/// Get a projects you have access to by its ID.
388pub async fn get_project(configuration: &configuration::Configuration, project_id: &str) -> Result<models::Project, Error<GetProjectError>> {
389    let local_var_configuration = configuration;
390
391    let local_var_client = &local_var_configuration.client;
392
393    let local_var_uri_str = format!("{}/projects/{project_id}", local_var_configuration.base_path, project_id=crate::apis::urlencode(project_id));
394    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
395
396    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
397        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
398    }
399    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
400        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
401    };
402
403    let local_var_req = local_var_req_builder.build()?;
404    let local_var_resp = local_var_client.execute(local_var_req).await?;
405
406    let local_var_status = local_var_resp.status();
407    let local_var_content = local_var_resp.text().await?;
408
409    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
410        serde_json::from_str(&local_var_content).map_err(Error::from)
411    } else {
412        let local_var_entity: Option<GetProjectError> = serde_json::from_str(&local_var_content).ok();
413        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
414        Err(Error::ResponseError(local_var_error))
415    }
416}
417
418/// This endpoint requires the user to be a member of the project with the role `OWNER` or `DEVELOPER`.
419pub async fn get_project_members(configuration: &configuration::Configuration, project: &str) -> Result<Vec<models::ProjectMember>, Error<GetProjectMembersError>> {
420    let local_var_configuration = configuration;
421
422    let local_var_client = &local_var_configuration.client;
423
424    let local_var_uri_str = format!("{}/projects/{project}/members", local_var_configuration.base_path, project=crate::apis::urlencode(project));
425    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
426
427    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
428        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
429    }
430    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
431        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
432    };
433
434    let local_var_req = local_var_req_builder.build()?;
435    let local_var_resp = local_var_client.execute(local_var_req).await?;
436
437    let local_var_status = local_var_resp.status();
438    let local_var_content = local_var_resp.text().await?;
439
440    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
441        serde_json::from_str(&local_var_content).map_err(Error::from)
442    } else {
443        let local_var_entity: Option<GetProjectMembersError> = serde_json::from_str(&local_var_content).ok();
444        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
445        Err(Error::ResponseError(local_var_error))
446    }
447}
448
449/// Lists all Enterprise SSO organizations in a project.
450pub 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>> {
451    let local_var_configuration = configuration;
452
453    let local_var_client = &local_var_configuration.client;
454
455    let local_var_uri_str = format!("{}/projects/{project_id}/organizations", local_var_configuration.base_path, project_id=crate::apis::urlencode(project_id));
456    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
457
458    if let Some(ref local_var_str) = page_size {
459        local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
460    }
461    if let Some(ref local_var_str) = page_token {
462        local_var_req_builder = local_var_req_builder.query(&[("page_token", &local_var_str.to_string())]);
463    }
464    if let Some(ref local_var_str) = domain {
465        local_var_req_builder = local_var_req_builder.query(&[("domain", &local_var_str.to_string())]);
466    }
467    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
468        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
469    }
470    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
471        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
472    };
473
474    let local_var_req = local_var_req_builder.build()?;
475    let local_var_resp = local_var_client.execute(local_var_req).await?;
476
477    let local_var_status = local_var_resp.status();
478    let local_var_content = local_var_resp.text().await?;
479
480    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
481        serde_json::from_str(&local_var_content).map_err(Error::from)
482    } else {
483        let local_var_entity: Option<ListOrganizationsError> = serde_json::from_str(&local_var_content).ok();
484        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
485        Err(Error::ResponseError(local_var_error))
486    }
487}
488
489/// A list of all the project's API keys.
490pub async fn list_project_api_keys(configuration: &configuration::Configuration, project: &str) -> Result<Vec<models::ProjectApiKey>, Error<ListProjectApiKeysError>> {
491    let local_var_configuration = configuration;
492
493    let local_var_client = &local_var_configuration.client;
494
495    let local_var_uri_str = format!("{}/projects/{project}/tokens", local_var_configuration.base_path, project=crate::apis::urlencode(project));
496    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
497
498    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
499        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
500    }
501    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
502        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
503    };
504
505    let local_var_req = local_var_req_builder.build()?;
506    let local_var_resp = local_var_client.execute(local_var_req).await?;
507
508    let local_var_status = local_var_resp.status();
509    let local_var_content = local_var_resp.text().await?;
510
511    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
512        serde_json::from_str(&local_var_content).map_err(Error::from)
513    } else {
514        let local_var_entity: Option<ListProjectApiKeysError> = serde_json::from_str(&local_var_content).ok();
515        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
516        Err(Error::ResponseError(local_var_error))
517    }
518}
519
520/// Lists all projects you have access to.
521pub async fn list_projects(configuration: &configuration::Configuration, ) -> Result<Vec<models::ProjectMetadata>, Error<ListProjectsError>> {
522    let local_var_configuration = configuration;
523
524    let local_var_client = &local_var_configuration.client;
525
526    let local_var_uri_str = format!("{}/projects", local_var_configuration.base_path);
527    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
528
529    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
530        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
531    }
532    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
533        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
534    };
535
536    let local_var_req = local_var_req_builder.build()?;
537    let local_var_resp = local_var_client.execute(local_var_req).await?;
538
539    let local_var_status = local_var_resp.status();
540    let local_var_content = local_var_resp.text().await?;
541
542    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
543        serde_json::from_str(&local_var_content).map_err(Error::from)
544    } else {
545        let local_var_entity: Option<ListProjectsError> = serde_json::from_str(&local_var_content).ok();
546        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
547        Err(Error::ResponseError(local_var_error))
548    }
549}
550
551/// 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.
552pub async fn patch_project(configuration: &configuration::Configuration, project_id: &str, json_patch: Option<Vec<models::JsonPatch>>) -> Result<models::SuccessfulProjectUpdate, Error<PatchProjectError>> {
553    let local_var_configuration = configuration;
554
555    let local_var_client = &local_var_configuration.client;
556
557    let local_var_uri_str = format!("{}/projects/{project_id}", local_var_configuration.base_path, project_id=crate::apis::urlencode(project_id));
558    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
559
560    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
561        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
562    }
563    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
564        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
565    };
566    local_var_req_builder = local_var_req_builder.json(&json_patch);
567
568    let local_var_req = local_var_req_builder.build()?;
569    let local_var_resp = local_var_client.execute(local_var_req).await?;
570
571    let local_var_status = local_var_resp.status();
572    let local_var_content = local_var_resp.text().await?;
573
574    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
575        serde_json::from_str(&local_var_content).map_err(Error::from)
576    } else {
577        let local_var_entity: Option<PatchProjectError> = serde_json::from_str(&local_var_content).ok();
578        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
579        Err(Error::ResponseError(local_var_error))
580    }
581}
582
583/// 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.
584pub 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>> {
585    let local_var_configuration = configuration;
586
587    let local_var_client = &local_var_configuration.client;
588
589    let local_var_uri_str = format!("{}/projects/{project_id}/revision/{revision_id}", local_var_configuration.base_path, project_id=crate::apis::urlencode(project_id), revision_id=crate::apis::urlencode(revision_id));
590    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PATCH, local_var_uri_str.as_str());
591
592    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
593        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
594    }
595    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
596        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
597    };
598    local_var_req_builder = local_var_req_builder.json(&json_patch);
599
600    let local_var_req = local_var_req_builder.build()?;
601    let local_var_resp = local_var_client.execute(local_var_req).await?;
602
603    let local_var_status = local_var_resp.status();
604    let local_var_content = local_var_resp.text().await?;
605
606    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
607        serde_json::from_str(&local_var_content).map_err(Error::from)
608    } else {
609        let local_var_entity: Option<PatchProjectWithRevisionError> = serde_json::from_str(&local_var_content).ok();
610        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
611        Err(Error::ResponseError(local_var_error))
612    }
613}
614
615/// !! 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.
616pub async fn purge_project(configuration: &configuration::Configuration, project_id: &str) -> Result<(), Error<PurgeProjectError>> {
617    let local_var_configuration = configuration;
618
619    let local_var_client = &local_var_configuration.client;
620
621    let local_var_uri_str = format!("{}/projects/{project_id}", local_var_configuration.base_path, project_id=crate::apis::urlencode(project_id));
622    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
623
624    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
625        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
626    }
627    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
628        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
629    };
630
631    let local_var_req = local_var_req_builder.build()?;
632    let local_var_resp = local_var_client.execute(local_var_req).await?;
633
634    let local_var_status = local_var_resp.status();
635    let local_var_content = local_var_resp.text().await?;
636
637    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
638        Ok(())
639    } else {
640        let local_var_entity: Option<PurgeProjectError> = serde_json::from_str(&local_var_content).ok();
641        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
642        Err(Error::ResponseError(local_var_error))
643    }
644}
645
646/// This also sets their invite status to `REMOVED`. This endpoint requires the user to be a member of the project with the role `OWNER`.
647pub async fn remove_project_member(configuration: &configuration::Configuration, project: &str, member: &str) -> Result<(), Error<RemoveProjectMemberError>> {
648    let local_var_configuration = configuration;
649
650    let local_var_client = &local_var_configuration.client;
651
652    let local_var_uri_str = format!("{}/projects/{project}/members/{member}", local_var_configuration.base_path, project=crate::apis::urlencode(project), member=crate::apis::urlencode(member));
653    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
654
655    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
656        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
657    }
658    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
659        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
660    };
661
662    let local_var_req = local_var_req_builder.build()?;
663    let local_var_resp = local_var_client.execute(local_var_req).await?;
664
665    let local_var_status = local_var_resp.status();
666    let local_var_content = local_var_resp.text().await?;
667
668    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
669        Ok(())
670    } else {
671        let local_var_entity: Option<RemoveProjectMemberError> = serde_json::from_str(&local_var_content).ok();
672        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
673        Err(Error::ResponseError(local_var_error))
674    }
675}
676
677/// 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!
678pub async fn set_project(configuration: &configuration::Configuration, project_id: &str, set_project: Option<models::SetProject>) -> Result<models::SuccessfulProjectUpdate, Error<SetProjectError>> {
679    let local_var_configuration = configuration;
680
681    let local_var_client = &local_var_configuration.client;
682
683    let local_var_uri_str = format!("{}/projects/{project_id}", local_var_configuration.base_path, project_id=crate::apis::urlencode(project_id));
684    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
685
686    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
687        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
688    }
689    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
690        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
691    };
692    local_var_req_builder = local_var_req_builder.json(&set_project);
693
694    let local_var_req = local_var_req_builder.build()?;
695    let local_var_resp = local_var_client.execute(local_var_req).await?;
696
697    let local_var_status = local_var_resp.status();
698    let local_var_content = local_var_resp.text().await?;
699
700    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
701        serde_json::from_str(&local_var_content).map_err(Error::from)
702    } else {
703        let local_var_entity: Option<SetProjectError> = serde_json::from_str(&local_var_content).ok();
704        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
705        Err(Error::ResponseError(local_var_error))
706    }
707}
708
709/// Updates an Enterprise SSO Organization in a project by its ID.
710pub async fn update_organization(configuration: &configuration::Configuration, project_id: &str, organization_id: &str, organization_body: Option<models::OrganizationBody>) -> Result<models::Organization, Error<UpdateOrganizationError>> {
711    let local_var_configuration = configuration;
712
713    let local_var_client = &local_var_configuration.client;
714
715    let local_var_uri_str = format!("{}/projects/{project_id}/organizations/{organization_id}", local_var_configuration.base_path, project_id=crate::apis::urlencode(project_id), organization_id=crate::apis::urlencode(organization_id));
716    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
717
718    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
719        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
720    }
721    if let Some(ref local_var_token) = local_var_configuration.bearer_access_token {
722        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
723    };
724    local_var_req_builder = local_var_req_builder.json(&organization_body);
725
726    let local_var_req = local_var_req_builder.build()?;
727    let local_var_resp = local_var_client.execute(local_var_req).await?;
728
729    let local_var_status = local_var_resp.status();
730    let local_var_content = local_var_resp.text().await?;
731
732    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
733        serde_json::from_str(&local_var_content).map_err(Error::from)
734    } else {
735        let local_var_entity: Option<UpdateOrganizationError> = serde_json::from_str(&local_var_content).ok();
736        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
737        Err(Error::ResponseError(local_var_error))
738    }
739}
740