1use reqwest;
13use serde::{Deserialize, Serialize, de::Error as _};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration, ContentType};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum BatchPatchIdentitiesError {
22 Status400(models::ErrorGeneric),
23 Status409(models::ErrorGeneric),
24 DefaultResponse(models::ErrorGeneric),
25 UnknownValue(serde_json::Value),
26}
27
28#[derive(Debug, Clone, Serialize, Deserialize)]
30#[serde(untagged)]
31pub enum CreateIdentityError {
32 Status400(models::ErrorGeneric),
33 Status409(models::ErrorGeneric),
34 DefaultResponse(models::ErrorGeneric),
35 UnknownValue(serde_json::Value),
36}
37
38#[derive(Debug, Clone, Serialize, Deserialize)]
40#[serde(untagged)]
41pub enum CreateRecoveryCodeForIdentityError {
42 Status400(models::ErrorGeneric),
43 Status404(models::ErrorGeneric),
44 DefaultResponse(models::ErrorGeneric),
45 UnknownValue(serde_json::Value),
46}
47
48#[derive(Debug, Clone, Serialize, Deserialize)]
50#[serde(untagged)]
51pub enum CreateRecoveryLinkForIdentityError {
52 Status400(models::ErrorGeneric),
53 Status404(models::ErrorGeneric),
54 DefaultResponse(models::ErrorGeneric),
55 UnknownValue(serde_json::Value),
56}
57
58#[derive(Debug, Clone, Serialize, Deserialize)]
60#[serde(untagged)]
61pub enum CreateTestLoginFlowError {
62 Status400(models::ErrorGeneric),
63 Status404(models::ErrorGeneric),
64 DefaultResponse(models::ErrorGeneric),
65 UnknownValue(serde_json::Value),
66}
67
68#[derive(Debug, Clone, Serialize, Deserialize)]
70#[serde(untagged)]
71pub enum DeleteIdentityError {
72 Status404(models::ErrorGeneric),
73 DefaultResponse(models::ErrorGeneric),
74 UnknownValue(serde_json::Value),
75}
76
77#[derive(Debug, Clone, Serialize, Deserialize)]
79#[serde(untagged)]
80pub enum DeleteIdentityCredentialsError {
81 Status404(models::ErrorGeneric),
82 DefaultResponse(models::ErrorGeneric),
83 UnknownValue(serde_json::Value),
84}
85
86#[derive(Debug, Clone, Serialize, Deserialize)]
88#[serde(untagged)]
89pub enum DeleteIdentitySessionsError {
90 Status400(models::ErrorGeneric),
91 Status401(models::ErrorGeneric),
92 Status404(models::ErrorGeneric),
93 DefaultResponse(models::ErrorGeneric),
94 UnknownValue(serde_json::Value),
95}
96
97#[derive(Debug, Clone, Serialize, Deserialize)]
99#[serde(untagged)]
100pub enum DisableSessionError {
101 Status400(models::ErrorGeneric),
102 Status401(models::ErrorGeneric),
103 DefaultResponse(models::ErrorGeneric),
104 UnknownValue(serde_json::Value),
105}
106
107#[derive(Debug, Clone, Serialize, Deserialize)]
109#[serde(untagged)]
110pub enum ExtendSessionError {
111 Status400(models::ErrorGeneric),
112 Status404(models::ErrorGeneric),
113 DefaultResponse(models::ErrorGeneric),
114 UnknownValue(serde_json::Value),
115}
116
117#[derive(Debug, Clone, Serialize, Deserialize)]
119#[serde(untagged)]
120pub enum GetIdentityError {
121 Status404(models::ErrorGeneric),
122 DefaultResponse(models::ErrorGeneric),
123 UnknownValue(serde_json::Value),
124}
125
126#[derive(Debug, Clone, Serialize, Deserialize)]
128#[serde(untagged)]
129pub enum GetIdentityByExternalIdError {
130 Status404(models::ErrorGeneric),
131 DefaultResponse(models::ErrorGeneric),
132 UnknownValue(serde_json::Value),
133}
134
135#[derive(Debug, Clone, Serialize, Deserialize)]
137#[serde(untagged)]
138pub enum GetIdentitySchemaError {
139 Status404(models::ErrorGeneric),
140 DefaultResponse(models::ErrorGeneric),
141 UnknownValue(serde_json::Value),
142}
143
144#[derive(Debug, Clone, Serialize, Deserialize)]
146#[serde(untagged)]
147pub enum GetSessionError {
148 Status400(models::ErrorGeneric),
149 DefaultResponse(models::ErrorGeneric),
150 UnknownValue(serde_json::Value),
151}
152
153#[derive(Debug, Clone, Serialize, Deserialize)]
155#[serde(untagged)]
156pub enum ListIdentitiesError {
157 DefaultResponse(models::ErrorGeneric),
158 UnknownValue(serde_json::Value),
159}
160
161#[derive(Debug, Clone, Serialize, Deserialize)]
163#[serde(untagged)]
164pub enum ListIdentitySchemasError {
165 DefaultResponse(models::ErrorGeneric),
166 UnknownValue(serde_json::Value),
167}
168
169#[derive(Debug, Clone, Serialize, Deserialize)]
171#[serde(untagged)]
172pub enum ListIdentitySessionsError {
173 Status400(models::ErrorGeneric),
174 Status404(models::ErrorGeneric),
175 DefaultResponse(models::ErrorGeneric),
176 UnknownValue(serde_json::Value),
177}
178
179#[derive(Debug, Clone, Serialize, Deserialize)]
181#[serde(untagged)]
182pub enum ListSessionsError {
183 Status400(models::ErrorGeneric),
184 DefaultResponse(models::ErrorGeneric),
185 UnknownValue(serde_json::Value),
186}
187
188#[derive(Debug, Clone, Serialize, Deserialize)]
190#[serde(untagged)]
191pub enum ManageSessionsError {
192 Status400(models::ErrorGeneric),
193 Status401(models::ErrorGeneric),
194 DefaultResponse(models::ErrorGeneric),
195 UnknownValue(serde_json::Value),
196}
197
198#[derive(Debug, Clone, Serialize, Deserialize)]
200#[serde(untagged)]
201pub enum PatchIdentityError {
202 Status400(models::ErrorGeneric),
203 Status404(models::ErrorGeneric),
204 Status409(models::ErrorGeneric),
205 DefaultResponse(models::ErrorGeneric),
206 UnknownValue(serde_json::Value),
207}
208
209#[derive(Debug, Clone, Serialize, Deserialize)]
211#[serde(untagged)]
212pub enum UpdateIdentityError {
213 Status400(models::ErrorGeneric),
214 Status404(models::ErrorGeneric),
215 Status409(models::ErrorGeneric),
216 DefaultResponse(models::ErrorGeneric),
217 UnknownValue(serde_json::Value),
218}
219
220
221pub async fn batch_patch_identities(configuration: &configuration::Configuration, patch_identities_body: Option<models::PatchIdentitiesBody>) -> Result<models::BatchPatchIdentitiesResponse, Error<BatchPatchIdentitiesError>> {
223 let p_body_patch_identities_body = patch_identities_body;
225
226 let uri_str = format!("{}/admin/identities", configuration.base_path);
227 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
228
229 if let Some(ref user_agent) = configuration.user_agent {
230 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
231 }
232 if let Some(ref token) = configuration.bearer_access_token {
233 req_builder = req_builder.bearer_auth(token.to_owned());
234 };
235 req_builder = req_builder.json(&p_body_patch_identities_body);
236
237 let req = req_builder.build()?;
238 let resp = configuration.client.execute(req).await?;
239
240 let status = resp.status();
241 let content_type = resp
242 .headers()
243 .get("content-type")
244 .and_then(|v| v.to_str().ok())
245 .unwrap_or("application/octet-stream");
246 let content_type = super::ContentType::from(content_type);
247
248 if !status.is_client_error() && !status.is_server_error() {
249 let content = resp.text().await?;
250 match content_type {
251 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
252 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::BatchPatchIdentitiesResponse`"))),
253 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::BatchPatchIdentitiesResponse`")))),
254 }
255 } else {
256 let content = resp.text().await?;
257 let entity: Option<BatchPatchIdentitiesError> = serde_json::from_str(&content).ok();
258 Err(Error::ResponseError(ResponseContent { status, content, entity }))
259 }
260}
261
262pub async fn create_identity(configuration: &configuration::Configuration, create_identity_body: Option<models::CreateIdentityBody>) -> Result<models::Identity, Error<CreateIdentityError>> {
264 let p_body_create_identity_body = create_identity_body;
266
267 let uri_str = format!("{}/admin/identities", configuration.base_path);
268 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
269
270 if let Some(ref user_agent) = configuration.user_agent {
271 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
272 }
273 if let Some(ref token) = configuration.bearer_access_token {
274 req_builder = req_builder.bearer_auth(token.to_owned());
275 };
276 req_builder = req_builder.json(&p_body_create_identity_body);
277
278 let req = req_builder.build()?;
279 let resp = configuration.client.execute(req).await?;
280
281 let status = resp.status();
282 let content_type = resp
283 .headers()
284 .get("content-type")
285 .and_then(|v| v.to_str().ok())
286 .unwrap_or("application/octet-stream");
287 let content_type = super::ContentType::from(content_type);
288
289 if !status.is_client_error() && !status.is_server_error() {
290 let content = resp.text().await?;
291 match content_type {
292 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
293 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Identity`"))),
294 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::Identity`")))),
295 }
296 } else {
297 let content = resp.text().await?;
298 let entity: Option<CreateIdentityError> = serde_json::from_str(&content).ok();
299 Err(Error::ResponseError(ResponseContent { status, content, entity }))
300 }
301}
302
303pub async fn create_recovery_code_for_identity(configuration: &configuration::Configuration, create_recovery_code_for_identity_body: Option<models::CreateRecoveryCodeForIdentityBody>) -> Result<models::RecoveryCodeForIdentity, Error<CreateRecoveryCodeForIdentityError>> {
305 let p_body_create_recovery_code_for_identity_body = create_recovery_code_for_identity_body;
307
308 let uri_str = format!("{}/admin/recovery/code", configuration.base_path);
309 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
310
311 if let Some(ref user_agent) = configuration.user_agent {
312 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
313 }
314 if let Some(ref token) = configuration.bearer_access_token {
315 req_builder = req_builder.bearer_auth(token.to_owned());
316 };
317 req_builder = req_builder.json(&p_body_create_recovery_code_for_identity_body);
318
319 let req = req_builder.build()?;
320 let resp = configuration.client.execute(req).await?;
321
322 let status = resp.status();
323 let content_type = resp
324 .headers()
325 .get("content-type")
326 .and_then(|v| v.to_str().ok())
327 .unwrap_or("application/octet-stream");
328 let content_type = super::ContentType::from(content_type);
329
330 if !status.is_client_error() && !status.is_server_error() {
331 let content = resp.text().await?;
332 match content_type {
333 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
334 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RecoveryCodeForIdentity`"))),
335 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::RecoveryCodeForIdentity`")))),
336 }
337 } else {
338 let content = resp.text().await?;
339 let entity: Option<CreateRecoveryCodeForIdentityError> = serde_json::from_str(&content).ok();
340 Err(Error::ResponseError(ResponseContent { status, content, entity }))
341 }
342}
343
344pub async fn create_recovery_link_for_identity(configuration: &configuration::Configuration, return_to: Option<&str>, create_recovery_link_for_identity_body: Option<models::CreateRecoveryLinkForIdentityBody>) -> Result<models::RecoveryLinkForIdentity, Error<CreateRecoveryLinkForIdentityError>> {
346 let p_query_return_to = return_to;
348 let p_body_create_recovery_link_for_identity_body = create_recovery_link_for_identity_body;
349
350 let uri_str = format!("{}/admin/recovery/link", configuration.base_path);
351 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
352
353 if let Some(ref param_value) = p_query_return_to {
354 req_builder = req_builder.query(&[("return_to", ¶m_value.to_string())]);
355 }
356 if let Some(ref user_agent) = configuration.user_agent {
357 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
358 }
359 if let Some(ref token) = configuration.bearer_access_token {
360 req_builder = req_builder.bearer_auth(token.to_owned());
361 };
362 req_builder = req_builder.json(&p_body_create_recovery_link_for_identity_body);
363
364 let req = req_builder.build()?;
365 let resp = configuration.client.execute(req).await?;
366
367 let status = resp.status();
368 let content_type = resp
369 .headers()
370 .get("content-type")
371 .and_then(|v| v.to_str().ok())
372 .unwrap_or("application/octet-stream");
373 let content_type = super::ContentType::from(content_type);
374
375 if !status.is_client_error() && !status.is_server_error() {
376 let content = resp.text().await?;
377 match content_type {
378 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
379 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::RecoveryLinkForIdentity`"))),
380 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::RecoveryLinkForIdentity`")))),
381 }
382 } else {
383 let content = resp.text().await?;
384 let entity: Option<CreateRecoveryLinkForIdentityError> = serde_json::from_str(&content).ok();
385 Err(Error::ResponseError(ResponseContent { status, content, entity }))
386 }
387}
388
389pub async fn create_test_login_flow(configuration: &configuration::Configuration, create_test_login_flow_body: models::CreateTestLoginFlowBody) -> Result<models::LoginFlow, Error<CreateTestLoginFlowError>> {
391 let p_body_create_test_login_flow_body = create_test_login_flow_body;
393
394 let uri_str = format!("{}/admin/test-login-flows", configuration.base_path);
395 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
396
397 if let Some(ref user_agent) = configuration.user_agent {
398 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
399 }
400 if let Some(ref token) = configuration.bearer_access_token {
401 req_builder = req_builder.bearer_auth(token.to_owned());
402 };
403 req_builder = req_builder.json(&p_body_create_test_login_flow_body);
404
405 let req = req_builder.build()?;
406 let resp = configuration.client.execute(req).await?;
407
408 let status = resp.status();
409 let content_type = resp
410 .headers()
411 .get("content-type")
412 .and_then(|v| v.to_str().ok())
413 .unwrap_or("application/octet-stream");
414 let content_type = super::ContentType::from(content_type);
415
416 if !status.is_client_error() && !status.is_server_error() {
417 let content = resp.text().await?;
418 match content_type {
419 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
420 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::LoginFlow`"))),
421 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::LoginFlow`")))),
422 }
423 } else {
424 let content = resp.text().await?;
425 let entity: Option<CreateTestLoginFlowError> = serde_json::from_str(&content).ok();
426 Err(Error::ResponseError(ResponseContent { status, content, entity }))
427 }
428}
429
430pub async fn delete_identity(configuration: &configuration::Configuration, id: &str) -> Result<(), Error<DeleteIdentityError>> {
432 let p_path_id = id;
434
435 let uri_str = format!("{}/admin/identities/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
436 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
437
438 if let Some(ref user_agent) = configuration.user_agent {
439 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
440 }
441 if let Some(ref token) = configuration.bearer_access_token {
442 req_builder = req_builder.bearer_auth(token.to_owned());
443 };
444
445 let req = req_builder.build()?;
446 let resp = configuration.client.execute(req).await?;
447
448 let status = resp.status();
449
450 if !status.is_client_error() && !status.is_server_error() {
451 Ok(())
452 } else {
453 let content = resp.text().await?;
454 let entity: Option<DeleteIdentityError> = serde_json::from_str(&content).ok();
455 Err(Error::ResponseError(ResponseContent { status, content, entity }))
456 }
457}
458
459pub async fn delete_identity_credentials(configuration: &configuration::Configuration, id: &str, r#type: &str, identifier: Option<&str>) -> Result<(), Error<DeleteIdentityCredentialsError>> {
461 let p_path_id = id;
463 let p_path_type = r#type;
464 let p_query_identifier = identifier;
465
466 let uri_str = format!("{}/admin/identities/{id}/credentials/{type}", configuration.base_path, id=crate::apis::urlencode(p_path_id), type=crate::apis::urlencode(p_path_type));
467 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
468
469 if let Some(ref param_value) = p_query_identifier {
470 req_builder = req_builder.query(&[("identifier", ¶m_value.to_string())]);
471 }
472 if let Some(ref user_agent) = configuration.user_agent {
473 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
474 }
475 if let Some(ref token) = configuration.bearer_access_token {
476 req_builder = req_builder.bearer_auth(token.to_owned());
477 };
478
479 let req = req_builder.build()?;
480 let resp = configuration.client.execute(req).await?;
481
482 let status = resp.status();
483
484 if !status.is_client_error() && !status.is_server_error() {
485 Ok(())
486 } else {
487 let content = resp.text().await?;
488 let entity: Option<DeleteIdentityCredentialsError> = serde_json::from_str(&content).ok();
489 Err(Error::ResponseError(ResponseContent { status, content, entity }))
490 }
491}
492
493pub async fn delete_identity_sessions(configuration: &configuration::Configuration, id: &str) -> Result<(), Error<DeleteIdentitySessionsError>> {
495 let p_path_id = id;
497
498 let uri_str = format!("{}/admin/identities/{id}/sessions", configuration.base_path, id=crate::apis::urlencode(p_path_id));
499 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
500
501 if let Some(ref user_agent) = configuration.user_agent {
502 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
503 }
504 if let Some(ref token) = configuration.bearer_access_token {
505 req_builder = req_builder.bearer_auth(token.to_owned());
506 };
507
508 let req = req_builder.build()?;
509 let resp = configuration.client.execute(req).await?;
510
511 let status = resp.status();
512
513 if !status.is_client_error() && !status.is_server_error() {
514 Ok(())
515 } else {
516 let content = resp.text().await?;
517 let entity: Option<DeleteIdentitySessionsError> = serde_json::from_str(&content).ok();
518 Err(Error::ResponseError(ResponseContent { status, content, entity }))
519 }
520}
521
522pub async fn disable_session(configuration: &configuration::Configuration, id: &str) -> Result<(), Error<DisableSessionError>> {
524 let p_path_id = id;
526
527 let uri_str = format!("{}/admin/sessions/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
528 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
529
530 if let Some(ref user_agent) = configuration.user_agent {
531 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
532 }
533 if let Some(ref token) = configuration.bearer_access_token {
534 req_builder = req_builder.bearer_auth(token.to_owned());
535 };
536
537 let req = req_builder.build()?;
538 let resp = configuration.client.execute(req).await?;
539
540 let status = resp.status();
541
542 if !status.is_client_error() && !status.is_server_error() {
543 Ok(())
544 } else {
545 let content = resp.text().await?;
546 let entity: Option<DisableSessionError> = serde_json::from_str(&content).ok();
547 Err(Error::ResponseError(ResponseContent { status, content, entity }))
548 }
549}
550
551pub async fn extend_session(configuration: &configuration::Configuration, id: &str) -> Result<models::Session, Error<ExtendSessionError>> {
553 let p_path_id = id;
555
556 let uri_str = format!("{}/admin/sessions/{id}/extend", configuration.base_path, id=crate::apis::urlencode(p_path_id));
557 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
558
559 if let Some(ref user_agent) = configuration.user_agent {
560 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
561 }
562 if let Some(ref token) = configuration.bearer_access_token {
563 req_builder = req_builder.bearer_auth(token.to_owned());
564 };
565
566 let req = req_builder.build()?;
567 let resp = configuration.client.execute(req).await?;
568
569 let status = resp.status();
570 let content_type = resp
571 .headers()
572 .get("content-type")
573 .and_then(|v| v.to_str().ok())
574 .unwrap_or("application/octet-stream");
575 let content_type = super::ContentType::from(content_type);
576
577 if !status.is_client_error() && !status.is_server_error() {
578 let content = resp.text().await?;
579 match content_type {
580 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
581 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Session`"))),
582 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::Session`")))),
583 }
584 } else {
585 let content = resp.text().await?;
586 let entity: Option<ExtendSessionError> = serde_json::from_str(&content).ok();
587 Err(Error::ResponseError(ResponseContent { status, content, entity }))
588 }
589}
590
591pub async fn get_identity(configuration: &configuration::Configuration, id: &str, include_credential: Option<Vec<String>>) -> Result<models::Identity, Error<GetIdentityError>> {
593 let p_path_id = id;
595 let p_query_include_credential = include_credential;
596
597 let uri_str = format!("{}/admin/identities/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
598 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
599
600 if let Some(ref param_value) = p_query_include_credential {
601 req_builder = match "multi" {
602 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("include_credential".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
603 _ => req_builder.query(&[("include_credential", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
604 };
605 }
606 if let Some(ref user_agent) = configuration.user_agent {
607 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
608 }
609 if let Some(ref token) = configuration.bearer_access_token {
610 req_builder = req_builder.bearer_auth(token.to_owned());
611 };
612
613 let req = req_builder.build()?;
614 let resp = configuration.client.execute(req).await?;
615
616 let status = resp.status();
617 let content_type = resp
618 .headers()
619 .get("content-type")
620 .and_then(|v| v.to_str().ok())
621 .unwrap_or("application/octet-stream");
622 let content_type = super::ContentType::from(content_type);
623
624 if !status.is_client_error() && !status.is_server_error() {
625 let content = resp.text().await?;
626 match content_type {
627 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
628 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Identity`"))),
629 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::Identity`")))),
630 }
631 } else {
632 let content = resp.text().await?;
633 let entity: Option<GetIdentityError> = serde_json::from_str(&content).ok();
634 Err(Error::ResponseError(ResponseContent { status, content, entity }))
635 }
636}
637
638pub async fn get_identity_by_external_id(configuration: &configuration::Configuration, external_id: &str, include_credential: Option<Vec<String>>) -> Result<models::Identity, Error<GetIdentityByExternalIdError>> {
640 let p_path_external_id = external_id;
642 let p_query_include_credential = include_credential;
643
644 let uri_str = format!("{}/admin/identities/by/external/{externalID}", configuration.base_path, externalID=crate::apis::urlencode(p_path_external_id));
645 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
646
647 if let Some(ref param_value) = p_query_include_credential {
648 req_builder = match "multi" {
649 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("include_credential".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
650 _ => req_builder.query(&[("include_credential", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
651 };
652 }
653 if let Some(ref user_agent) = configuration.user_agent {
654 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
655 }
656 if let Some(ref token) = configuration.bearer_access_token {
657 req_builder = req_builder.bearer_auth(token.to_owned());
658 };
659
660 let req = req_builder.build()?;
661 let resp = configuration.client.execute(req).await?;
662
663 let status = resp.status();
664 let content_type = resp
665 .headers()
666 .get("content-type")
667 .and_then(|v| v.to_str().ok())
668 .unwrap_or("application/octet-stream");
669 let content_type = super::ContentType::from(content_type);
670
671 if !status.is_client_error() && !status.is_server_error() {
672 let content = resp.text().await?;
673 match content_type {
674 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
675 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Identity`"))),
676 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::Identity`")))),
677 }
678 } else {
679 let content = resp.text().await?;
680 let entity: Option<GetIdentityByExternalIdError> = serde_json::from_str(&content).ok();
681 Err(Error::ResponseError(ResponseContent { status, content, entity }))
682 }
683}
684
685pub async fn get_identity_schema(configuration: &configuration::Configuration, id: &str) -> Result<serde_json::Value, Error<GetIdentitySchemaError>> {
687 let p_path_id = id;
689
690 let uri_str = format!("{}/schemas/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
691 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
692
693 if let Some(ref user_agent) = configuration.user_agent {
694 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
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 `serde_json::Value`"))),
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 `serde_json::Value`")))),
714 }
715 } else {
716 let content = resp.text().await?;
717 let entity: Option<GetIdentitySchemaError> = serde_json::from_str(&content).ok();
718 Err(Error::ResponseError(ResponseContent { status, content, entity }))
719 }
720}
721
722pub async fn get_session(configuration: &configuration::Configuration, id: &str, expand: Option<Vec<String>>) -> Result<models::Session, Error<GetSessionError>> {
724 let p_path_id = id;
726 let p_query_expand = expand;
727
728 let uri_str = format!("{}/admin/sessions/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
729 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
730
731 if let Some(ref param_value) = p_query_expand {
732 req_builder = match "multi" {
733 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("expand".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
734 _ => req_builder.query(&[("expand", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
735 };
736 }
737 if let Some(ref user_agent) = configuration.user_agent {
738 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
739 }
740 if let Some(ref token) = configuration.bearer_access_token {
741 req_builder = req_builder.bearer_auth(token.to_owned());
742 };
743
744 let req = req_builder.build()?;
745 let resp = configuration.client.execute(req).await?;
746
747 let status = resp.status();
748 let content_type = resp
749 .headers()
750 .get("content-type")
751 .and_then(|v| v.to_str().ok())
752 .unwrap_or("application/octet-stream");
753 let content_type = super::ContentType::from(content_type);
754
755 if !status.is_client_error() && !status.is_server_error() {
756 let content = resp.text().await?;
757 match content_type {
758 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
759 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Session`"))),
760 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::Session`")))),
761 }
762 } else {
763 let content = resp.text().await?;
764 let entity: Option<GetSessionError> = serde_json::from_str(&content).ok();
765 Err(Error::ResponseError(ResponseContent { status, content, entity }))
766 }
767}
768
769pub async fn list_identities(configuration: &configuration::Configuration, per_page: Option<i64>, page: Option<i64>, page_size: Option<i64>, page_token: Option<&str>, consistency: Option<&str>, ids: Option<Vec<String>>, credentials_identifier: Option<&str>, preview_credentials_identifier_similar: Option<&str>, include_credential: Option<Vec<String>>, organization_id: Option<&str>) -> Result<Vec<models::Identity>, Error<ListIdentitiesError>> {
771 let p_query_per_page = per_page;
773 let p_query_page = page;
774 let p_query_page_size = page_size;
775 let p_query_page_token = page_token;
776 let p_query_consistency = consistency;
777 let p_query_ids = ids;
778 let p_query_credentials_identifier = credentials_identifier;
779 let p_query_preview_credentials_identifier_similar = preview_credentials_identifier_similar;
780 let p_query_include_credential = include_credential;
781 let p_query_organization_id = organization_id;
782
783 let uri_str = format!("{}/admin/identities", configuration.base_path);
784 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
785
786 if let Some(ref param_value) = p_query_per_page {
787 req_builder = req_builder.query(&[("per_page", ¶m_value.to_string())]);
788 }
789 if let Some(ref param_value) = p_query_page {
790 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
791 }
792 if let Some(ref param_value) = p_query_page_size {
793 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
794 }
795 if let Some(ref param_value) = p_query_page_token {
796 req_builder = req_builder.query(&[("page_token", ¶m_value.to_string())]);
797 }
798 if let Some(ref param_value) = p_query_consistency {
799 req_builder = req_builder.query(&[("consistency", ¶m_value.to_string())]);
800 }
801 if let Some(ref param_value) = p_query_ids {
802 req_builder = match "multi" {
803 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("ids".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
804 _ => req_builder.query(&[("ids", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
805 };
806 }
807 if let Some(ref param_value) = p_query_credentials_identifier {
808 req_builder = req_builder.query(&[("credentials_identifier", ¶m_value.to_string())]);
809 }
810 if let Some(ref param_value) = p_query_preview_credentials_identifier_similar {
811 req_builder = req_builder.query(&[("preview_credentials_identifier_similar", ¶m_value.to_string())]);
812 }
813 if let Some(ref param_value) = p_query_include_credential {
814 req_builder = match "multi" {
815 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("include_credential".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
816 _ => req_builder.query(&[("include_credential", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
817 };
818 }
819 if let Some(ref param_value) = p_query_organization_id {
820 req_builder = req_builder.query(&[("organization_id", ¶m_value.to_string())]);
821 }
822 if let Some(ref user_agent) = configuration.user_agent {
823 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
824 }
825 if let Some(ref token) = configuration.bearer_access_token {
826 req_builder = req_builder.bearer_auth(token.to_owned());
827 };
828
829 let req = req_builder.build()?;
830 let resp = configuration.client.execute(req).await?;
831
832 let status = resp.status();
833 let content_type = resp
834 .headers()
835 .get("content-type")
836 .and_then(|v| v.to_str().ok())
837 .unwrap_or("application/octet-stream");
838 let content_type = super::ContentType::from(content_type);
839
840 if !status.is_client_error() && !status.is_server_error() {
841 let content = resp.text().await?;
842 match content_type {
843 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
844 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Identity>`"))),
845 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Identity>`")))),
846 }
847 } else {
848 let content = resp.text().await?;
849 let entity: Option<ListIdentitiesError> = serde_json::from_str(&content).ok();
850 Err(Error::ResponseError(ResponseContent { status, content, entity }))
851 }
852}
853
854pub async fn list_identity_schemas(configuration: &configuration::Configuration, per_page: Option<i64>, page: Option<i64>, page_size: Option<i64>, page_token: Option<&str>) -> Result<Vec<models::IdentitySchemaContainer>, Error<ListIdentitySchemasError>> {
856 let p_query_per_page = per_page;
858 let p_query_page = page;
859 let p_query_page_size = page_size;
860 let p_query_page_token = page_token;
861
862 let uri_str = format!("{}/schemas", configuration.base_path);
863 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
864
865 if let Some(ref param_value) = p_query_per_page {
866 req_builder = req_builder.query(&[("per_page", ¶m_value.to_string())]);
867 }
868 if let Some(ref param_value) = p_query_page {
869 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
870 }
871 if let Some(ref param_value) = p_query_page_size {
872 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
873 }
874 if let Some(ref param_value) = p_query_page_token {
875 req_builder = req_builder.query(&[("page_token", ¶m_value.to_string())]);
876 }
877 if let Some(ref user_agent) = configuration.user_agent {
878 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
879 }
880
881 let req = req_builder.build()?;
882 let resp = configuration.client.execute(req).await?;
883
884 let status = resp.status();
885 let content_type = resp
886 .headers()
887 .get("content-type")
888 .and_then(|v| v.to_str().ok())
889 .unwrap_or("application/octet-stream");
890 let content_type = super::ContentType::from(content_type);
891
892 if !status.is_client_error() && !status.is_server_error() {
893 let content = resp.text().await?;
894 match content_type {
895 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
896 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::IdentitySchemaContainer>`"))),
897 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::IdentitySchemaContainer>`")))),
898 }
899 } else {
900 let content = resp.text().await?;
901 let entity: Option<ListIdentitySchemasError> = serde_json::from_str(&content).ok();
902 Err(Error::ResponseError(ResponseContent { status, content, entity }))
903 }
904}
905
906pub async fn list_identity_sessions(configuration: &configuration::Configuration, id: &str, per_page: Option<i64>, page: Option<i64>, page_size: Option<i64>, page_token: Option<&str>, active: Option<bool>) -> Result<Vec<models::Session>, Error<ListIdentitySessionsError>> {
908 let p_path_id = id;
910 let p_query_per_page = per_page;
911 let p_query_page = page;
912 let p_query_page_size = page_size;
913 let p_query_page_token = page_token;
914 let p_query_active = active;
915
916 let uri_str = format!("{}/admin/identities/{id}/sessions", configuration.base_path, id=crate::apis::urlencode(p_path_id));
917 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
918
919 if let Some(ref param_value) = p_query_per_page {
920 req_builder = req_builder.query(&[("per_page", ¶m_value.to_string())]);
921 }
922 if let Some(ref param_value) = p_query_page {
923 req_builder = req_builder.query(&[("page", ¶m_value.to_string())]);
924 }
925 if let Some(ref param_value) = p_query_page_size {
926 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
927 }
928 if let Some(ref param_value) = p_query_page_token {
929 req_builder = req_builder.query(&[("page_token", ¶m_value.to_string())]);
930 }
931 if let Some(ref param_value) = p_query_active {
932 req_builder = req_builder.query(&[("active", ¶m_value.to_string())]);
933 }
934 if let Some(ref user_agent) = configuration.user_agent {
935 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
936 }
937 if let Some(ref token) = configuration.bearer_access_token {
938 req_builder = req_builder.bearer_auth(token.to_owned());
939 };
940
941 let req = req_builder.build()?;
942 let resp = configuration.client.execute(req).await?;
943
944 let status = resp.status();
945 let content_type = resp
946 .headers()
947 .get("content-type")
948 .and_then(|v| v.to_str().ok())
949 .unwrap_or("application/octet-stream");
950 let content_type = super::ContentType::from(content_type);
951
952 if !status.is_client_error() && !status.is_server_error() {
953 let content = resp.text().await?;
954 match content_type {
955 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
956 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Session>`"))),
957 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Session>`")))),
958 }
959 } else {
960 let content = resp.text().await?;
961 let entity: Option<ListIdentitySessionsError> = serde_json::from_str(&content).ok();
962 Err(Error::ResponseError(ResponseContent { status, content, entity }))
963 }
964}
965
966pub async fn list_sessions(configuration: &configuration::Configuration, page_size: Option<i64>, page_token: Option<&str>, active: Option<bool>, expand: Option<Vec<String>>) -> Result<Vec<models::Session>, Error<ListSessionsError>> {
968 let p_query_page_size = page_size;
970 let p_query_page_token = page_token;
971 let p_query_active = active;
972 let p_query_expand = expand;
973
974 let uri_str = format!("{}/admin/sessions", configuration.base_path);
975 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
976
977 if let Some(ref param_value) = p_query_page_size {
978 req_builder = req_builder.query(&[("page_size", ¶m_value.to_string())]);
979 }
980 if let Some(ref param_value) = p_query_page_token {
981 req_builder = req_builder.query(&[("page_token", ¶m_value.to_string())]);
982 }
983 if let Some(ref param_value) = p_query_active {
984 req_builder = req_builder.query(&[("active", ¶m_value.to_string())]);
985 }
986 if let Some(ref param_value) = p_query_expand {
987 req_builder = match "multi" {
988 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("expand".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
989 _ => req_builder.query(&[("expand", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
990 };
991 }
992 if let Some(ref user_agent) = configuration.user_agent {
993 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
994 }
995 if let Some(ref token) = configuration.bearer_access_token {
996 req_builder = req_builder.bearer_auth(token.to_owned());
997 };
998
999 let req = req_builder.build()?;
1000 let resp = configuration.client.execute(req).await?;
1001
1002 let status = resp.status();
1003 let content_type = resp
1004 .headers()
1005 .get("content-type")
1006 .and_then(|v| v.to_str().ok())
1007 .unwrap_or("application/octet-stream");
1008 let content_type = super::ContentType::from(content_type);
1009
1010 if !status.is_client_error() && !status.is_server_error() {
1011 let content = resp.text().await?;
1012 match content_type {
1013 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1014 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec<models::Session>`"))),
1015 ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec<models::Session>`")))),
1016 }
1017 } else {
1018 let content = resp.text().await?;
1019 let entity: Option<ListSessionsError> = serde_json::from_str(&content).ok();
1020 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1021 }
1022}
1023
1024pub async fn manage_sessions(configuration: &configuration::Configuration, manage_sessions_body: models::ManageSessionsBody) -> Result<models::ManageSessionsResponse, Error<ManageSessionsError>> {
1026 let p_body_manage_sessions_body = manage_sessions_body;
1028
1029 let uri_str = format!("{}/admin/sessions", configuration.base_path);
1030 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
1031
1032 if let Some(ref user_agent) = configuration.user_agent {
1033 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1034 }
1035 if let Some(ref token) = configuration.bearer_access_token {
1036 req_builder = req_builder.bearer_auth(token.to_owned());
1037 };
1038 req_builder = req_builder.json(&p_body_manage_sessions_body);
1039
1040 let req = req_builder.build()?;
1041 let resp = configuration.client.execute(req).await?;
1042
1043 let status = resp.status();
1044 let content_type = resp
1045 .headers()
1046 .get("content-type")
1047 .and_then(|v| v.to_str().ok())
1048 .unwrap_or("application/octet-stream");
1049 let content_type = super::ContentType::from(content_type);
1050
1051 if !status.is_client_error() && !status.is_server_error() {
1052 let content = resp.text().await?;
1053 match content_type {
1054 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1055 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::ManageSessionsResponse`"))),
1056 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::ManageSessionsResponse`")))),
1057 }
1058 } else {
1059 let content = resp.text().await?;
1060 let entity: Option<ManageSessionsError> = serde_json::from_str(&content).ok();
1061 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1062 }
1063}
1064
1065pub async fn patch_identity(configuration: &configuration::Configuration, id: &str, json_patch: Option<Vec<models::JsonPatch>>) -> Result<models::Identity, Error<PatchIdentityError>> {
1067 let p_path_id = id;
1069 let p_body_json_patch = json_patch;
1070
1071 let uri_str = format!("{}/admin/identities/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
1072 let mut req_builder = configuration.client.request(reqwest::Method::PATCH, &uri_str);
1073
1074 if let Some(ref user_agent) = configuration.user_agent {
1075 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1076 }
1077 if let Some(ref token) = configuration.bearer_access_token {
1078 req_builder = req_builder.bearer_auth(token.to_owned());
1079 };
1080 req_builder = req_builder.json(&p_body_json_patch);
1081
1082 let req = req_builder.build()?;
1083 let resp = configuration.client.execute(req).await?;
1084
1085 let status = resp.status();
1086 let content_type = resp
1087 .headers()
1088 .get("content-type")
1089 .and_then(|v| v.to_str().ok())
1090 .unwrap_or("application/octet-stream");
1091 let content_type = super::ContentType::from(content_type);
1092
1093 if !status.is_client_error() && !status.is_server_error() {
1094 let content = resp.text().await?;
1095 match content_type {
1096 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1097 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Identity`"))),
1098 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::Identity`")))),
1099 }
1100 } else {
1101 let content = resp.text().await?;
1102 let entity: Option<PatchIdentityError> = serde_json::from_str(&content).ok();
1103 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1104 }
1105}
1106
1107pub async fn update_identity(configuration: &configuration::Configuration, id: &str, update_identity_body: Option<models::UpdateIdentityBody>) -> Result<models::Identity, Error<UpdateIdentityError>> {
1109 let p_path_id = id;
1111 let p_body_update_identity_body = update_identity_body;
1112
1113 let uri_str = format!("{}/admin/identities/{id}", configuration.base_path, id=crate::apis::urlencode(p_path_id));
1114 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
1115
1116 if let Some(ref user_agent) = configuration.user_agent {
1117 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
1118 }
1119 if let Some(ref token) = configuration.bearer_access_token {
1120 req_builder = req_builder.bearer_auth(token.to_owned());
1121 };
1122 req_builder = req_builder.json(&p_body_update_identity_body);
1123
1124 let req = req_builder.build()?;
1125 let resp = configuration.client.execute(req).await?;
1126
1127 let status = resp.status();
1128 let content_type = resp
1129 .headers()
1130 .get("content-type")
1131 .and_then(|v| v.to_str().ok())
1132 .unwrap_or("application/octet-stream");
1133 let content_type = super::ContentType::from(content_type);
1134
1135 if !status.is_client_error() && !status.is_server_error() {
1136 let content = resp.text().await?;
1137 match content_type {
1138 ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
1139 ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::Identity`"))),
1140 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::Identity`")))),
1141 }
1142 } else {
1143 let content = resp.text().await?;
1144 let entity: Option<UpdateIdentityError> = serde_json::from_str(&content).ok();
1145 Err(Error::ResponseError(ResponseContent { status, content, entity }))
1146 }
1147}
1148