1use reqwest;
13
14use crate::apis::ResponseContent;
15use super::{Error, configuration};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum CreateIdentityAdminError {
22 Status400(crate::models::JsonError),
23 Status401(crate::models::JsonError),
24 Status403(crate::models::JsonError),
25 Status409(crate::models::JsonError),
26 Status500(crate::models::JsonError),
27 UnknownValue(serde_json::Value),
28}
29
30#[derive(Debug, Clone, Serialize, Deserialize)]
32#[serde(untagged)]
33pub enum CreateRecoveryLinkAdminError {
34 Status400(crate::models::JsonError),
35 Status404(crate::models::JsonError),
36 Status500(crate::models::JsonError),
37 UnknownValue(serde_json::Value),
38}
39
40#[derive(Debug, Clone, Serialize, Deserialize)]
42#[serde(untagged)]
43pub enum DeleteIdentityAdminError {
44 Status401(crate::models::JsonError),
45 Status403(crate::models::JsonError),
46 Status404(crate::models::JsonError),
47 Status500(crate::models::JsonError),
48 UnknownValue(serde_json::Value),
49}
50
51#[derive(Debug, Clone, Serialize, Deserialize)]
53#[serde(untagged)]
54pub enum GetIdentityAdminError {
55 Status400(crate::models::JsonError),
56 Status401(crate::models::JsonError),
57 Status403(crate::models::JsonError),
58 Status404(crate::models::JsonError),
59 Status500(crate::models::JsonError),
60 UnknownValue(serde_json::Value),
61}
62
63#[derive(Debug, Clone, Serialize, Deserialize)]
65#[serde(untagged)]
66pub enum GetSchemaError {
67 Status404(crate::models::JsonError),
68 Status500(crate::models::JsonError),
69 UnknownValue(serde_json::Value),
70}
71
72#[derive(Debug, Clone, Serialize, Deserialize)]
74#[serde(untagged)]
75pub enum GetSchemaAdminError {
76 Status404(crate::models::JsonError),
77 Status500(crate::models::JsonError),
78 UnknownValue(serde_json::Value),
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum GetSelfServiceErrorError {
85 Status403(crate::models::JsonError),
86 Status404(crate::models::JsonError),
87 Status500(crate::models::JsonError),
88 UnknownValue(serde_json::Value),
89}
90
91#[derive(Debug, Clone, Serialize, Deserialize)]
93#[serde(untagged)]
94pub enum GetSelfServiceErrorAdminError {
95 Status403(crate::models::JsonError),
96 Status404(crate::models::JsonError),
97 Status500(crate::models::JsonError),
98 UnknownValue(serde_json::Value),
99}
100
101#[derive(Debug, Clone, Serialize, Deserialize)]
103#[serde(untagged)]
104pub enum GetSelfServiceLoginFlowError {
105 Status403(crate::models::JsonError),
106 Status404(crate::models::JsonError),
107 Status410(crate::models::JsonError),
108 Status500(crate::models::JsonError),
109 UnknownValue(serde_json::Value),
110}
111
112#[derive(Debug, Clone, Serialize, Deserialize)]
114#[serde(untagged)]
115pub enum GetSelfServiceLoginFlowAdminError {
116 Status403(crate::models::JsonError),
117 Status404(crate::models::JsonError),
118 Status410(crate::models::JsonError),
119 Status500(crate::models::JsonError),
120 UnknownValue(serde_json::Value),
121}
122
123#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum GetSelfServiceRecoveryFlowError {
127 Status404(crate::models::JsonError),
128 Status410(crate::models::JsonError),
129 Status500(crate::models::JsonError),
130 UnknownValue(serde_json::Value),
131}
132
133#[derive(Debug, Clone, Serialize, Deserialize)]
135#[serde(untagged)]
136pub enum GetSelfServiceRecoveryFlowAdminError {
137 Status404(crate::models::JsonError),
138 Status410(crate::models::JsonError),
139 Status500(crate::models::JsonError),
140 UnknownValue(serde_json::Value),
141}
142
143#[derive(Debug, Clone, Serialize, Deserialize)]
145#[serde(untagged)]
146pub enum GetSelfServiceRegistrationFlowError {
147 Status403(crate::models::JsonError),
148 Status404(crate::models::JsonError),
149 Status410(crate::models::JsonError),
150 Status500(crate::models::JsonError),
151 UnknownValue(serde_json::Value),
152}
153
154#[derive(Debug, Clone, Serialize, Deserialize)]
156#[serde(untagged)]
157pub enum GetSelfServiceRegistrationFlowAdminError {
158 Status403(crate::models::JsonError),
159 Status404(crate::models::JsonError),
160 Status410(crate::models::JsonError),
161 Status500(crate::models::JsonError),
162 UnknownValue(serde_json::Value),
163}
164
165#[derive(Debug, Clone, Serialize, Deserialize)]
167#[serde(untagged)]
168pub enum GetSelfServiceSettingsFlowError {
169 Status403(crate::models::JsonError),
170 Status404(crate::models::JsonError),
171 Status410(crate::models::JsonError),
172 Status500(crate::models::JsonError),
173 UnknownValue(serde_json::Value),
174}
175
176#[derive(Debug, Clone, Serialize, Deserialize)]
178#[serde(untagged)]
179pub enum GetSelfServiceSettingsFlowAdminError {
180 Status403(crate::models::JsonError),
181 Status404(crate::models::JsonError),
182 Status410(crate::models::JsonError),
183 Status500(crate::models::JsonError),
184 UnknownValue(serde_json::Value),
185}
186
187#[derive(Debug, Clone, Serialize, Deserialize)]
189#[serde(untagged)]
190pub enum GetSelfServiceVerificationFlowError {
191 Status403(crate::models::JsonError),
192 Status404(crate::models::JsonError),
193 Status500(crate::models::JsonError),
194 UnknownValue(serde_json::Value),
195}
196
197#[derive(Debug, Clone, Serialize, Deserialize)]
199#[serde(untagged)]
200pub enum GetSelfServiceVerificationFlowAdminError {
201 Status403(crate::models::JsonError),
202 Status404(crate::models::JsonError),
203 Status500(crate::models::JsonError),
204 UnknownValue(serde_json::Value),
205}
206
207#[derive(Debug, Clone, Serialize, Deserialize)]
209#[serde(untagged)]
210pub enum GetVersionAdminError {
211 UnknownValue(serde_json::Value),
212}
213
214#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum InitializeSelfServiceBrowserLogoutFlowError {
218 Status500(crate::models::JsonError),
219 UnknownValue(serde_json::Value),
220}
221
222#[derive(Debug, Clone, Serialize, Deserialize)]
224#[serde(untagged)]
225pub enum InitializeSelfServiceLoginViaApiFlowError {
226 Status400(crate::models::JsonError),
227 Status500(crate::models::JsonError),
228 UnknownValue(serde_json::Value),
229}
230
231#[derive(Debug, Clone, Serialize, Deserialize)]
233#[serde(untagged)]
234pub enum InitializeSelfServiceLoginViaBrowserFlowError {
235 Status500(crate::models::JsonError),
236 UnknownValue(serde_json::Value),
237}
238
239#[derive(Debug, Clone, Serialize, Deserialize)]
241#[serde(untagged)]
242pub enum InitializeSelfServiceRecoveryViaApiFlowError {
243 Status400(crate::models::JsonError),
244 Status500(crate::models::JsonError),
245 UnknownValue(serde_json::Value),
246}
247
248#[derive(Debug, Clone, Serialize, Deserialize)]
250#[serde(untagged)]
251pub enum InitializeSelfServiceRecoveryViaBrowserFlowError {
252 Status500(crate::models::JsonError),
253 UnknownValue(serde_json::Value),
254}
255
256#[derive(Debug, Clone, Serialize, Deserialize)]
258#[serde(untagged)]
259pub enum InitializeSelfServiceRegistrationError {
260 Status400(crate::models::JsonError),
261 Status500(crate::models::JsonError),
262 UnknownValue(serde_json::Value),
263}
264
265#[derive(Debug, Clone, Serialize, Deserialize)]
267#[serde(untagged)]
268pub enum InitializeSelfServiceRegistrationForBrowsersError {
269 Status500(crate::models::JsonError),
270 UnknownValue(serde_json::Value),
271}
272
273#[derive(Debug, Clone, Serialize, Deserialize)]
275#[serde(untagged)]
276pub enum InitializeSelfServiceSettingsViaApiFlowError {
277 Status400(crate::models::JsonError),
278 Status500(crate::models::JsonError),
279 UnknownValue(serde_json::Value),
280}
281
282#[derive(Debug, Clone, Serialize, Deserialize)]
284#[serde(untagged)]
285pub enum InitializeSelfServiceSettingsViaBrowserFlowError {
286 Status500(crate::models::JsonError),
287 UnknownValue(serde_json::Value),
288}
289
290#[derive(Debug, Clone, Serialize, Deserialize)]
292#[serde(untagged)]
293pub enum InitializeSelfServiceVerificationViaApiFlowError {
294 Status400(crate::models::JsonError),
295 Status500(crate::models::JsonError),
296 UnknownValue(serde_json::Value),
297}
298
299#[derive(Debug, Clone, Serialize, Deserialize)]
301#[serde(untagged)]
302pub enum InitializeSelfServiceVerificationViaBrowserFlowError {
303 Status500(crate::models::JsonError),
304 UnknownValue(serde_json::Value),
305}
306
307#[derive(Debug, Clone, Serialize, Deserialize)]
309#[serde(untagged)]
310pub enum IsAliveAdminError {
311 Status500(crate::models::GenericError),
312 UnknownValue(serde_json::Value),
313}
314
315#[derive(Debug, Clone, Serialize, Deserialize)]
317#[serde(untagged)]
318pub enum IsReadyAdminError {
319 Status503(crate::models::InlineResponse503),
320 UnknownValue(serde_json::Value),
321}
322
323#[derive(Debug, Clone, Serialize, Deserialize)]
325#[serde(untagged)]
326pub enum ListIdentitiesAdminError {
327 Status401(crate::models::JsonError),
328 Status403(crate::models::JsonError),
329 Status500(crate::models::JsonError),
330 UnknownValue(serde_json::Value),
331}
332
333#[derive(Debug, Clone, Serialize, Deserialize)]
335#[serde(untagged)]
336pub enum PrometheusAdminError {
337 UnknownValue(serde_json::Value),
338}
339
340#[derive(Debug, Clone, Serialize, Deserialize)]
342#[serde(untagged)]
343pub enum RevokeSessionError {
344 Status400(crate::models::JsonError),
345 Status500(crate::models::JsonError),
346 UnknownValue(serde_json::Value),
347}
348
349#[derive(Debug, Clone, Serialize, Deserialize)]
351#[serde(untagged)]
352pub enum SubmitSelfServiceLoginFlowError {
353 Status400(crate::models::LoginFlow),
354 Status500(crate::models::JsonError),
355 UnknownValue(serde_json::Value),
356}
357
358#[derive(Debug, Clone, Serialize, Deserialize)]
360#[serde(untagged)]
361pub enum SubmitSelfServiceRecoveryFlowError {
362 Status400(crate::models::RecoveryFlow),
363 Status500(crate::models::JsonError),
364 UnknownValue(serde_json::Value),
365}
366
367#[derive(Debug, Clone, Serialize, Deserialize)]
369#[serde(untagged)]
370pub enum SubmitSelfServiceRecoveryFlowWithLinkMethodError {
371 Status400(crate::models::RecoveryFlow),
372 Status500(crate::models::JsonError),
373 UnknownValue(serde_json::Value),
374}
375
376#[derive(Debug, Clone, Serialize, Deserialize)]
378#[serde(untagged)]
379pub enum SubmitSelfServiceRegistrationFlowError {
380 Status400(crate::models::RegistrationFlow),
381 Status500(crate::models::JsonError),
382 UnknownValue(serde_json::Value),
383}
384
385#[derive(Debug, Clone, Serialize, Deserialize)]
387#[serde(untagged)]
388pub enum SubmitSelfServiceSettingsFlowError {
389 Status400(crate::models::SettingsFlow),
390 Status401(crate::models::JsonError),
391 Status403(crate::models::JsonError),
392 Status500(crate::models::JsonError),
393 UnknownValue(serde_json::Value),
394}
395
396#[derive(Debug, Clone, Serialize, Deserialize)]
398#[serde(untagged)]
399pub enum SubmitSelfServiceVerificationFlowError {
400 Status400(crate::models::VerificationFlow),
401 Status500(crate::models::JsonError),
402 UnknownValue(serde_json::Value),
403}
404
405#[derive(Debug, Clone, Serialize, Deserialize)]
407#[serde(untagged)]
408pub enum ToSessionError {
409 Status401(crate::models::JsonError),
410 Status500(crate::models::JsonError),
411 UnknownValue(serde_json::Value),
412}
413
414#[derive(Debug, Clone, Serialize, Deserialize)]
416#[serde(untagged)]
417pub enum UpdateIdentityAdminError {
418 Status400(crate::models::JsonError),
419 Status401(crate::models::JsonError),
420 Status403(crate::models::JsonError),
421 Status404(crate::models::JsonError),
422 Status500(crate::models::JsonError),
423 UnknownValue(serde_json::Value),
424}
425
426
427pub async fn create_identity_admin(configuration: &configuration::Configuration, create_identity: Option<crate::models::CreateIdentity>) -> Result<crate::models::Identity, Error<CreateIdentityAdminError>> {
429
430 let local_var_client = &configuration.client;
431
432 let local_var_uri_str = format!("{}/api/kratos/admin/identities", configuration.base_path);
433 let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
434
435 if let Some(ref local_var_user_agent) = configuration.user_agent {
436 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
437 }
438 if let Some(ref local_var_token) = configuration.bearer_access_token {
439 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
440 };
441 local_var_req_builder = local_var_req_builder.json(&create_identity);
442
443 let local_var_req = local_var_req_builder.build()?;
444 let local_var_resp = local_var_client.execute(local_var_req).await?;
445
446 let local_var_status = local_var_resp.status();
447 let local_var_content = local_var_resp.text().await?;
448
449 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
450 serde_json::from_str(&local_var_content).map_err(Error::from)
451 } else {
452 let local_var_entity: Option<CreateIdentityAdminError> = serde_json::from_str(&local_var_content).ok();
453 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
454 Err(Error::ResponseError(local_var_error))
455 }
456}
457
458pub async fn create_recovery_link_admin(configuration: &configuration::Configuration, create_recovery_link: Option<crate::models::CreateRecoveryLink>) -> Result<crate::models::RecoveryLink, Error<CreateRecoveryLinkAdminError>> {
460
461 let local_var_client = &configuration.client;
462
463 let local_var_uri_str = format!("{}/api/kratos/admin/recovery/link", configuration.base_path);
464 let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
465
466 if let Some(ref local_var_user_agent) = configuration.user_agent {
467 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
468 }
469 if let Some(ref local_var_token) = configuration.bearer_access_token {
470 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
471 };
472 local_var_req_builder = local_var_req_builder.json(&create_recovery_link);
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<CreateRecoveryLinkAdminError> = 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
489pub async fn delete_identity_admin(configuration: &configuration::Configuration, id: &str) -> Result<(), Error<DeleteIdentityAdminError>> {
491
492 let local_var_client = &configuration.client;
493
494 let local_var_uri_str = format!("{}/api/kratos/admin/identities/{id}", configuration.base_path, id=crate::apis::urlencode(id));
495 let mut local_var_req_builder = local_var_client.delete(local_var_uri_str.as_str());
496
497 if let Some(ref local_var_user_agent) = configuration.user_agent {
498 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
499 }
500 if let Some(ref local_var_token) = configuration.bearer_access_token {
501 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
502 };
503
504 let local_var_req = local_var_req_builder.build()?;
505 let local_var_resp = local_var_client.execute(local_var_req).await?;
506
507 let local_var_status = local_var_resp.status();
508 let local_var_content = local_var_resp.text().await?;
509
510 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
511 Ok(())
512 } else {
513 let local_var_entity: Option<DeleteIdentityAdminError> = serde_json::from_str(&local_var_content).ok();
514 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
515 Err(Error::ResponseError(local_var_error))
516 }
517}
518
519pub async fn get_identity_admin(configuration: &configuration::Configuration, id: &str) -> Result<crate::models::Identity, Error<GetIdentityAdminError>> {
521
522 let local_var_client = &configuration.client;
523
524 let local_var_uri_str = format!("{}/api/kratos/admin/identities/{id}", configuration.base_path, id=crate::apis::urlencode(id));
525 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
526
527 if let Some(ref local_var_user_agent) = configuration.user_agent {
528 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
529 }
530 if let Some(ref local_var_token) = configuration.bearer_access_token {
531 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
532 };
533
534 let local_var_req = local_var_req_builder.build()?;
535 let local_var_resp = local_var_client.execute(local_var_req).await?;
536
537 let local_var_status = local_var_resp.status();
538 let local_var_content = local_var_resp.text().await?;
539
540 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
541 serde_json::from_str(&local_var_content).map_err(Error::from)
542 } else {
543 let local_var_entity: Option<GetIdentityAdminError> = serde_json::from_str(&local_var_content).ok();
544 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
545 Err(Error::ResponseError(local_var_error))
546 }
547}
548
549pub async fn get_schema(configuration: &configuration::Configuration, id: &str) -> Result<serde_json::Value, Error<GetSchemaError>> {
551
552 let local_var_client = &configuration.client;
553
554 let local_var_uri_str = format!("{}/api/kratos/public/schemas/{id}", configuration.base_path, id=crate::apis::urlencode(id));
555 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
556
557 if let Some(ref local_var_user_agent) = configuration.user_agent {
558 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
559 }
560
561 let local_var_req = local_var_req_builder.build()?;
562 let local_var_resp = local_var_client.execute(local_var_req).await?;
563
564 let local_var_status = local_var_resp.status();
565 let local_var_content = local_var_resp.text().await?;
566
567 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
568 serde_json::from_str(&local_var_content).map_err(Error::from)
569 } else {
570 let local_var_entity: Option<GetSchemaError> = serde_json::from_str(&local_var_content).ok();
571 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
572 Err(Error::ResponseError(local_var_error))
573 }
574}
575
576pub async fn get_schema_admin(configuration: &configuration::Configuration, id: &str) -> Result<serde_json::Value, Error<GetSchemaAdminError>> {
578
579 let local_var_client = &configuration.client;
580
581 let local_var_uri_str = format!("{}/api/kratos/admin/schemas/{id}", configuration.base_path, id=crate::apis::urlencode(id));
582 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
583
584 if let Some(ref local_var_user_agent) = configuration.user_agent {
585 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
586 }
587 if let Some(ref local_var_token) = configuration.bearer_access_token {
588 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
589 };
590
591 let local_var_req = local_var_req_builder.build()?;
592 let local_var_resp = local_var_client.execute(local_var_req).await?;
593
594 let local_var_status = local_var_resp.status();
595 let local_var_content = local_var_resp.text().await?;
596
597 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
598 serde_json::from_str(&local_var_content).map_err(Error::from)
599 } else {
600 let local_var_entity: Option<GetSchemaAdminError> = serde_json::from_str(&local_var_content).ok();
601 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
602 Err(Error::ResponseError(local_var_error))
603 }
604}
605
606pub async fn get_self_service_error(configuration: &configuration::Configuration, error: &str) -> Result<crate::models::ErrorContainer, Error<GetSelfServiceErrorError>> {
608
609 let local_var_client = &configuration.client;
610
611 let local_var_uri_str = format!("{}/api/kratos/public/self-service/errors", configuration.base_path);
612 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
613
614 local_var_req_builder = local_var_req_builder.query(&[("error", &error.to_string())]);
615 if let Some(ref local_var_user_agent) = configuration.user_agent {
616 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
617 }
618
619 let local_var_req = local_var_req_builder.build()?;
620 let local_var_resp = local_var_client.execute(local_var_req).await?;
621
622 let local_var_status = local_var_resp.status();
623 let local_var_content = local_var_resp.text().await?;
624
625 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
626 serde_json::from_str(&local_var_content).map_err(Error::from)
627 } else {
628 let local_var_entity: Option<GetSelfServiceErrorError> = serde_json::from_str(&local_var_content).ok();
629 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
630 Err(Error::ResponseError(local_var_error))
631 }
632}
633
634pub async fn get_self_service_error_admin(configuration: &configuration::Configuration, error: &str) -> Result<crate::models::ErrorContainer, Error<GetSelfServiceErrorAdminError>> {
636
637 let local_var_client = &configuration.client;
638
639 let local_var_uri_str = format!("{}/api/kratos/admin/self-service/errors", configuration.base_path);
640 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
641
642 local_var_req_builder = local_var_req_builder.query(&[("error", &error.to_string())]);
643 if let Some(ref local_var_user_agent) = configuration.user_agent {
644 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
645 }
646 if let Some(ref local_var_token) = configuration.bearer_access_token {
647 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
648 };
649
650 let local_var_req = local_var_req_builder.build()?;
651 let local_var_resp = local_var_client.execute(local_var_req).await?;
652
653 let local_var_status = local_var_resp.status();
654 let local_var_content = local_var_resp.text().await?;
655
656 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
657 serde_json::from_str(&local_var_content).map_err(Error::from)
658 } else {
659 let local_var_entity: Option<GetSelfServiceErrorAdminError> = serde_json::from_str(&local_var_content).ok();
660 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
661 Err(Error::ResponseError(local_var_error))
662 }
663}
664
665pub async fn get_self_service_login_flow(configuration: &configuration::Configuration, id: &str) -> Result<crate::models::LoginFlow, Error<GetSelfServiceLoginFlowError>> {
667
668 let local_var_client = &configuration.client;
669
670 let local_var_uri_str = format!("{}/api/kratos/public/self-service/login/flows", configuration.base_path);
671 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
672
673 local_var_req_builder = local_var_req_builder.query(&[("id", &id.to_string())]);
674 if let Some(ref local_var_user_agent) = configuration.user_agent {
675 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
676 }
677
678 let local_var_req = local_var_req_builder.build()?;
679 let local_var_resp = local_var_client.execute(local_var_req).await?;
680
681 let local_var_status = local_var_resp.status();
682 let local_var_content = local_var_resp.text().await?;
683
684 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
685 serde_json::from_str(&local_var_content).map_err(Error::from)
686 } else {
687 let local_var_entity: Option<GetSelfServiceLoginFlowError> = serde_json::from_str(&local_var_content).ok();
688 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
689 Err(Error::ResponseError(local_var_error))
690 }
691}
692
693pub async fn get_self_service_login_flow_admin(configuration: &configuration::Configuration, id: &str) -> Result<crate::models::LoginFlow, Error<GetSelfServiceLoginFlowAdminError>> {
695
696 let local_var_client = &configuration.client;
697
698 let local_var_uri_str = format!("{}/api/kratos/admin/self-service/login/flows", configuration.base_path);
699 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
700
701 local_var_req_builder = local_var_req_builder.query(&[("id", &id.to_string())]);
702 if let Some(ref local_var_user_agent) = configuration.user_agent {
703 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
704 }
705 if let Some(ref local_var_token) = configuration.bearer_access_token {
706 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
707 };
708
709 let local_var_req = local_var_req_builder.build()?;
710 let local_var_resp = local_var_client.execute(local_var_req).await?;
711
712 let local_var_status = local_var_resp.status();
713 let local_var_content = local_var_resp.text().await?;
714
715 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
716 serde_json::from_str(&local_var_content).map_err(Error::from)
717 } else {
718 let local_var_entity: Option<GetSelfServiceLoginFlowAdminError> = serde_json::from_str(&local_var_content).ok();
719 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
720 Err(Error::ResponseError(local_var_error))
721 }
722}
723
724pub async fn get_self_service_recovery_flow(configuration: &configuration::Configuration, id: &str) -> Result<crate::models::RecoveryFlow, Error<GetSelfServiceRecoveryFlowError>> {
726
727 let local_var_client = &configuration.client;
728
729 let local_var_uri_str = format!("{}/api/kratos/public/self-service/recovery/flows", configuration.base_path);
730 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
731
732 local_var_req_builder = local_var_req_builder.query(&[("id", &id.to_string())]);
733 if let Some(ref local_var_user_agent) = configuration.user_agent {
734 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
735 }
736
737 let local_var_req = local_var_req_builder.build()?;
738 let local_var_resp = local_var_client.execute(local_var_req).await?;
739
740 let local_var_status = local_var_resp.status();
741 let local_var_content = local_var_resp.text().await?;
742
743 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
744 serde_json::from_str(&local_var_content).map_err(Error::from)
745 } else {
746 let local_var_entity: Option<GetSelfServiceRecoveryFlowError> = serde_json::from_str(&local_var_content).ok();
747 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
748 Err(Error::ResponseError(local_var_error))
749 }
750}
751
752pub async fn get_self_service_recovery_flow_admin(configuration: &configuration::Configuration, id: &str) -> Result<crate::models::RecoveryFlow, Error<GetSelfServiceRecoveryFlowAdminError>> {
754
755 let local_var_client = &configuration.client;
756
757 let local_var_uri_str = format!("{}/api/kratos/admin/self-service/recovery/flows", configuration.base_path);
758 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
759
760 local_var_req_builder = local_var_req_builder.query(&[("id", &id.to_string())]);
761 if let Some(ref local_var_user_agent) = configuration.user_agent {
762 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
763 }
764 if let Some(ref local_var_token) = configuration.bearer_access_token {
765 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
766 };
767
768 let local_var_req = local_var_req_builder.build()?;
769 let local_var_resp = local_var_client.execute(local_var_req).await?;
770
771 let local_var_status = local_var_resp.status();
772 let local_var_content = local_var_resp.text().await?;
773
774 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
775 serde_json::from_str(&local_var_content).map_err(Error::from)
776 } else {
777 let local_var_entity: Option<GetSelfServiceRecoveryFlowAdminError> = serde_json::from_str(&local_var_content).ok();
778 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
779 Err(Error::ResponseError(local_var_error))
780 }
781}
782
783pub async fn get_self_service_registration_flow(configuration: &configuration::Configuration, id: &str) -> Result<crate::models::RegistrationFlow, Error<GetSelfServiceRegistrationFlowError>> {
785
786 let local_var_client = &configuration.client;
787
788 let local_var_uri_str = format!("{}/api/kratos/public/self-service/registration/flows", configuration.base_path);
789 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
790
791 local_var_req_builder = local_var_req_builder.query(&[("id", &id.to_string())]);
792 if let Some(ref local_var_user_agent) = configuration.user_agent {
793 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
794 }
795
796 let local_var_req = local_var_req_builder.build()?;
797 let local_var_resp = local_var_client.execute(local_var_req).await?;
798
799 let local_var_status = local_var_resp.status();
800 let local_var_content = local_var_resp.text().await?;
801
802 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
803 serde_json::from_str(&local_var_content).map_err(Error::from)
804 } else {
805 let local_var_entity: Option<GetSelfServiceRegistrationFlowError> = serde_json::from_str(&local_var_content).ok();
806 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
807 Err(Error::ResponseError(local_var_error))
808 }
809}
810
811pub async fn get_self_service_registration_flow_admin(configuration: &configuration::Configuration, id: &str) -> Result<crate::models::RegistrationFlow, Error<GetSelfServiceRegistrationFlowAdminError>> {
813
814 let local_var_client = &configuration.client;
815
816 let local_var_uri_str = format!("{}/api/kratos/admin/self-service/registration/flows", configuration.base_path);
817 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
818
819 local_var_req_builder = local_var_req_builder.query(&[("id", &id.to_string())]);
820 if let Some(ref local_var_user_agent) = configuration.user_agent {
821 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
822 }
823 if let Some(ref local_var_token) = configuration.bearer_access_token {
824 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
825 };
826
827 let local_var_req = local_var_req_builder.build()?;
828 let local_var_resp = local_var_client.execute(local_var_req).await?;
829
830 let local_var_status = local_var_resp.status();
831 let local_var_content = local_var_resp.text().await?;
832
833 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
834 serde_json::from_str(&local_var_content).map_err(Error::from)
835 } else {
836 let local_var_entity: Option<GetSelfServiceRegistrationFlowAdminError> = serde_json::from_str(&local_var_content).ok();
837 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
838 Err(Error::ResponseError(local_var_error))
839 }
840}
841
842pub async fn get_self_service_settings_flow(configuration: &configuration::Configuration, id: &str) -> Result<crate::models::SettingsFlow, Error<GetSelfServiceSettingsFlowError>> {
844
845 let local_var_client = &configuration.client;
846
847 let local_var_uri_str = format!("{}/api/kratos/public/self-service/settings/flows", configuration.base_path);
848 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
849
850 local_var_req_builder = local_var_req_builder.query(&[("id", &id.to_string())]);
851 if let Some(ref local_var_user_agent) = configuration.user_agent {
852 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
853 }
854 if let Some(ref local_var_token) = configuration.bearer_access_token {
855 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
856 };
857
858 let local_var_req = local_var_req_builder.build()?;
859 let local_var_resp = local_var_client.execute(local_var_req).await?;
860
861 let local_var_status = local_var_resp.status();
862 let local_var_content = local_var_resp.text().await?;
863
864 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
865 serde_json::from_str(&local_var_content).map_err(Error::from)
866 } else {
867 let local_var_entity: Option<GetSelfServiceSettingsFlowError> = serde_json::from_str(&local_var_content).ok();
868 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
869 Err(Error::ResponseError(local_var_error))
870 }
871}
872
873pub async fn get_self_service_settings_flow_admin(configuration: &configuration::Configuration, id: &str) -> Result<crate::models::SettingsFlow, Error<GetSelfServiceSettingsFlowAdminError>> {
875
876 let local_var_client = &configuration.client;
877
878 let local_var_uri_str = format!("{}/api/kratos/admin/self-service/settings/flows", configuration.base_path);
879 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
880
881 local_var_req_builder = local_var_req_builder.query(&[("id", &id.to_string())]);
882 if let Some(ref local_var_user_agent) = configuration.user_agent {
883 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
884 }
885 if let Some(ref local_var_token) = configuration.bearer_access_token {
886 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
887 };
888
889 let local_var_req = local_var_req_builder.build()?;
890 let local_var_resp = local_var_client.execute(local_var_req).await?;
891
892 let local_var_status = local_var_resp.status();
893 let local_var_content = local_var_resp.text().await?;
894
895 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
896 serde_json::from_str(&local_var_content).map_err(Error::from)
897 } else {
898 let local_var_entity: Option<GetSelfServiceSettingsFlowAdminError> = serde_json::from_str(&local_var_content).ok();
899 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
900 Err(Error::ResponseError(local_var_error))
901 }
902}
903
904pub async fn get_self_service_verification_flow(configuration: &configuration::Configuration, id: &str) -> Result<crate::models::VerificationFlow, Error<GetSelfServiceVerificationFlowError>> {
906
907 let local_var_client = &configuration.client;
908
909 let local_var_uri_str = format!("{}/api/kratos/public/self-service/verification/flows", configuration.base_path);
910 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
911
912 local_var_req_builder = local_var_req_builder.query(&[("id", &id.to_string())]);
913 if let Some(ref local_var_user_agent) = configuration.user_agent {
914 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
915 }
916
917 let local_var_req = local_var_req_builder.build()?;
918 let local_var_resp = local_var_client.execute(local_var_req).await?;
919
920 let local_var_status = local_var_resp.status();
921 let local_var_content = local_var_resp.text().await?;
922
923 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
924 serde_json::from_str(&local_var_content).map_err(Error::from)
925 } else {
926 let local_var_entity: Option<GetSelfServiceVerificationFlowError> = serde_json::from_str(&local_var_content).ok();
927 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
928 Err(Error::ResponseError(local_var_error))
929 }
930}
931
932pub async fn get_self_service_verification_flow_admin(configuration: &configuration::Configuration, id: &str) -> Result<crate::models::VerificationFlow, Error<GetSelfServiceVerificationFlowAdminError>> {
934
935 let local_var_client = &configuration.client;
936
937 let local_var_uri_str = format!("{}/api/kratos/admin/self-service/verification/flows", configuration.base_path);
938 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
939
940 local_var_req_builder = local_var_req_builder.query(&[("id", &id.to_string())]);
941 if let Some(ref local_var_user_agent) = configuration.user_agent {
942 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
943 }
944 if let Some(ref local_var_token) = configuration.bearer_access_token {
945 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
946 };
947
948 let local_var_req = local_var_req_builder.build()?;
949 let local_var_resp = local_var_client.execute(local_var_req).await?;
950
951 let local_var_status = local_var_resp.status();
952 let local_var_content = local_var_resp.text().await?;
953
954 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
955 serde_json::from_str(&local_var_content).map_err(Error::from)
956 } else {
957 let local_var_entity: Option<GetSelfServiceVerificationFlowAdminError> = serde_json::from_str(&local_var_content).ok();
958 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
959 Err(Error::ResponseError(local_var_error))
960 }
961}
962
963pub async fn get_version_admin(configuration: &configuration::Configuration, ) -> Result<crate::models::InlineResponse2001, Error<GetVersionAdminError>> {
965
966 let local_var_client = &configuration.client;
967
968 let local_var_uri_str = format!("{}/api/kratos/admin/version", configuration.base_path);
969 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
970
971 if let Some(ref local_var_user_agent) = configuration.user_agent {
972 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
973 }
974 if let Some(ref local_var_token) = configuration.bearer_access_token {
975 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
976 };
977
978 let local_var_req = local_var_req_builder.build()?;
979 let local_var_resp = local_var_client.execute(local_var_req).await?;
980
981 let local_var_status = local_var_resp.status();
982 let local_var_content = local_var_resp.text().await?;
983
984 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
985 serde_json::from_str(&local_var_content).map_err(Error::from)
986 } else {
987 let local_var_entity: Option<GetVersionAdminError> = serde_json::from_str(&local_var_content).ok();
988 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
989 Err(Error::ResponseError(local_var_error))
990 }
991}
992
993pub async fn initialize_self_service_browser_logout_flow(configuration: &configuration::Configuration, ) -> Result<(), Error<InitializeSelfServiceBrowserLogoutFlowError>> {
995
996 let local_var_client = &configuration.client;
997
998 let local_var_uri_str = format!("{}/api/kratos/public/self-service/browser/flows/logout", configuration.base_path);
999 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
1000
1001 if let Some(ref local_var_user_agent) = configuration.user_agent {
1002 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1003 }
1004
1005 let local_var_req = local_var_req_builder.build()?;
1006 let local_var_resp = local_var_client.execute(local_var_req).await?;
1007
1008 let local_var_status = local_var_resp.status();
1009 let local_var_content = local_var_resp.text().await?;
1010
1011 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1012 Ok(())
1013 } else {
1014 let local_var_entity: Option<InitializeSelfServiceBrowserLogoutFlowError> = serde_json::from_str(&local_var_content).ok();
1015 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1016 Err(Error::ResponseError(local_var_error))
1017 }
1018}
1019
1020pub async fn initialize_self_service_login_via_api_flow(configuration: &configuration::Configuration, refresh: Option<bool>) -> Result<crate::models::LoginFlow, Error<InitializeSelfServiceLoginViaApiFlowError>> {
1022
1023 let local_var_client = &configuration.client;
1024
1025 let local_var_uri_str = format!("{}/api/kratos/public/self-service/login/api", configuration.base_path);
1026 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
1027
1028 if let Some(ref local_var_str) = refresh {
1029 local_var_req_builder = local_var_req_builder.query(&[("refresh", &local_var_str.to_string())]);
1030 }
1031 if let Some(ref local_var_user_agent) = configuration.user_agent {
1032 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1033 }
1034
1035 let local_var_req = local_var_req_builder.build()?;
1036 let local_var_resp = local_var_client.execute(local_var_req).await?;
1037
1038 let local_var_status = local_var_resp.status();
1039 let local_var_content = local_var_resp.text().await?;
1040
1041 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1042 serde_json::from_str(&local_var_content).map_err(Error::from)
1043 } else {
1044 let local_var_entity: Option<InitializeSelfServiceLoginViaApiFlowError> = serde_json::from_str(&local_var_content).ok();
1045 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1046 Err(Error::ResponseError(local_var_error))
1047 }
1048}
1049
1050pub async fn initialize_self_service_login_via_browser_flow(configuration: &configuration::Configuration, ) -> Result<(), Error<InitializeSelfServiceLoginViaBrowserFlowError>> {
1052
1053 let local_var_client = &configuration.client;
1054
1055 let local_var_uri_str = format!("{}/api/kratos/public/self-service/login/browser", configuration.base_path);
1056 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
1057
1058 if let Some(ref local_var_user_agent) = configuration.user_agent {
1059 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1060 }
1061
1062 let local_var_req = local_var_req_builder.build()?;
1063 let local_var_resp = local_var_client.execute(local_var_req).await?;
1064
1065 let local_var_status = local_var_resp.status();
1066 let local_var_content = local_var_resp.text().await?;
1067
1068 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1069 Ok(())
1070 } else {
1071 let local_var_entity: Option<InitializeSelfServiceLoginViaBrowserFlowError> = serde_json::from_str(&local_var_content).ok();
1072 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1073 Err(Error::ResponseError(local_var_error))
1074 }
1075}
1076
1077pub async fn initialize_self_service_recovery_via_api_flow(configuration: &configuration::Configuration, ) -> Result<crate::models::RecoveryFlow, Error<InitializeSelfServiceRecoveryViaApiFlowError>> {
1079
1080 let local_var_client = &configuration.client;
1081
1082 let local_var_uri_str = format!("{}/api/kratos/public/self-service/recovery/api", configuration.base_path);
1083 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
1084
1085 if let Some(ref local_var_user_agent) = configuration.user_agent {
1086 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1087 }
1088
1089 let local_var_req = local_var_req_builder.build()?;
1090 let local_var_resp = local_var_client.execute(local_var_req).await?;
1091
1092 let local_var_status = local_var_resp.status();
1093 let local_var_content = local_var_resp.text().await?;
1094
1095 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1096 serde_json::from_str(&local_var_content).map_err(Error::from)
1097 } else {
1098 let local_var_entity: Option<InitializeSelfServiceRecoveryViaApiFlowError> = serde_json::from_str(&local_var_content).ok();
1099 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1100 Err(Error::ResponseError(local_var_error))
1101 }
1102}
1103
1104pub async fn initialize_self_service_recovery_via_browser_flow(configuration: &configuration::Configuration, ) -> Result<(), Error<InitializeSelfServiceRecoveryViaBrowserFlowError>> {
1106
1107 let local_var_client = &configuration.client;
1108
1109 let local_var_uri_str = format!("{}/api/kratos/public/self-service/recovery/browser", configuration.base_path);
1110 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
1111
1112 if let Some(ref local_var_user_agent) = configuration.user_agent {
1113 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1114 }
1115
1116 let local_var_req = local_var_req_builder.build()?;
1117 let local_var_resp = local_var_client.execute(local_var_req).await?;
1118
1119 let local_var_status = local_var_resp.status();
1120 let local_var_content = local_var_resp.text().await?;
1121
1122 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1123 Ok(())
1124 } else {
1125 let local_var_entity: Option<InitializeSelfServiceRecoveryViaBrowserFlowError> = serde_json::from_str(&local_var_content).ok();
1126 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1127 Err(Error::ResponseError(local_var_error))
1128 }
1129}
1130
1131pub async fn initialize_self_service_registration(configuration: &configuration::Configuration, ) -> Result<crate::models::RegistrationFlow, Error<InitializeSelfServiceRegistrationError>> {
1133
1134 let local_var_client = &configuration.client;
1135
1136 let local_var_uri_str = format!("{}/api/kratos/public/self-service/registration/api", configuration.base_path);
1137 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
1138
1139 if let Some(ref local_var_user_agent) = configuration.user_agent {
1140 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1141 }
1142
1143 let local_var_req = local_var_req_builder.build()?;
1144 let local_var_resp = local_var_client.execute(local_var_req).await?;
1145
1146 let local_var_status = local_var_resp.status();
1147 let local_var_content = local_var_resp.text().await?;
1148
1149 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1150 serde_json::from_str(&local_var_content).map_err(Error::from)
1151 } else {
1152 let local_var_entity: Option<InitializeSelfServiceRegistrationError> = serde_json::from_str(&local_var_content).ok();
1153 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1154 Err(Error::ResponseError(local_var_error))
1155 }
1156}
1157
1158pub async fn initialize_self_service_registration_for_browsers(configuration: &configuration::Configuration, ) -> Result<(), Error<InitializeSelfServiceRegistrationForBrowsersError>> {
1160
1161 let local_var_client = &configuration.client;
1162
1163 let local_var_uri_str = format!("{}/api/kratos/public/self-service/registration/browser", configuration.base_path);
1164 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
1165
1166 if let Some(ref local_var_user_agent) = configuration.user_agent {
1167 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1168 }
1169
1170 let local_var_req = local_var_req_builder.build()?;
1171 let local_var_resp = local_var_client.execute(local_var_req).await?;
1172
1173 let local_var_status = local_var_resp.status();
1174 let local_var_content = local_var_resp.text().await?;
1175
1176 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1177 Ok(())
1178 } else {
1179 let local_var_entity: Option<InitializeSelfServiceRegistrationForBrowsersError> = serde_json::from_str(&local_var_content).ok();
1180 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1181 Err(Error::ResponseError(local_var_error))
1182 }
1183}
1184
1185pub async fn initialize_self_service_settings_via_api_flow(configuration: &configuration::Configuration, ) -> Result<crate::models::SettingsFlow, Error<InitializeSelfServiceSettingsViaApiFlowError>> {
1187
1188 let local_var_client = &configuration.client;
1189
1190 let local_var_uri_str = format!("{}/api/kratos/public/self-service/settings/api", configuration.base_path);
1191 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
1192
1193 if let Some(ref local_var_user_agent) = configuration.user_agent {
1194 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1195 }
1196 if let Some(ref local_var_token) = configuration.bearer_access_token {
1197 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1198 };
1199
1200 let local_var_req = local_var_req_builder.build()?;
1201 let local_var_resp = local_var_client.execute(local_var_req).await?;
1202
1203 let local_var_status = local_var_resp.status();
1204 let local_var_content = local_var_resp.text().await?;
1205
1206 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1207 serde_json::from_str(&local_var_content).map_err(Error::from)
1208 } else {
1209 let local_var_entity: Option<InitializeSelfServiceSettingsViaApiFlowError> = serde_json::from_str(&local_var_content).ok();
1210 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1211 Err(Error::ResponseError(local_var_error))
1212 }
1213}
1214
1215pub async fn initialize_self_service_settings_via_browser_flow(configuration: &configuration::Configuration, ) -> Result<(), Error<InitializeSelfServiceSettingsViaBrowserFlowError>> {
1217
1218 let local_var_client = &configuration.client;
1219
1220 let local_var_uri_str = format!("{}/api/kratos/public/self-service/settings/browser", configuration.base_path);
1221 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
1222
1223 if let Some(ref local_var_user_agent) = configuration.user_agent {
1224 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1225 }
1226 if let Some(ref local_var_token) = configuration.bearer_access_token {
1227 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1228 };
1229
1230 let local_var_req = local_var_req_builder.build()?;
1231 let local_var_resp = local_var_client.execute(local_var_req).await?;
1232
1233 let local_var_status = local_var_resp.status();
1234 let local_var_content = local_var_resp.text().await?;
1235
1236 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1237 Ok(())
1238 } else {
1239 let local_var_entity: Option<InitializeSelfServiceSettingsViaBrowserFlowError> = serde_json::from_str(&local_var_content).ok();
1240 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1241 Err(Error::ResponseError(local_var_error))
1242 }
1243}
1244
1245pub async fn initialize_self_service_verification_via_api_flow(configuration: &configuration::Configuration, ) -> Result<crate::models::VerificationFlow, Error<InitializeSelfServiceVerificationViaApiFlowError>> {
1247
1248 let local_var_client = &configuration.client;
1249
1250 let local_var_uri_str = format!("{}/api/kratos/public/self-service/verification/api", configuration.base_path);
1251 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
1252
1253 if let Some(ref local_var_user_agent) = configuration.user_agent {
1254 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1255 }
1256
1257 let local_var_req = local_var_req_builder.build()?;
1258 let local_var_resp = local_var_client.execute(local_var_req).await?;
1259
1260 let local_var_status = local_var_resp.status();
1261 let local_var_content = local_var_resp.text().await?;
1262
1263 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1264 serde_json::from_str(&local_var_content).map_err(Error::from)
1265 } else {
1266 let local_var_entity: Option<InitializeSelfServiceVerificationViaApiFlowError> = serde_json::from_str(&local_var_content).ok();
1267 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1268 Err(Error::ResponseError(local_var_error))
1269 }
1270}
1271
1272pub async fn initialize_self_service_verification_via_browser_flow(configuration: &configuration::Configuration, ) -> Result<(), Error<InitializeSelfServiceVerificationViaBrowserFlowError>> {
1274
1275 let local_var_client = &configuration.client;
1276
1277 let local_var_uri_str = format!("{}/api/kratos/public/self-service/verification/browser", configuration.base_path);
1278 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
1279
1280 if let Some(ref local_var_user_agent) = configuration.user_agent {
1281 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1282 }
1283
1284 let local_var_req = local_var_req_builder.build()?;
1285 let local_var_resp = local_var_client.execute(local_var_req).await?;
1286
1287 let local_var_status = local_var_resp.status();
1288 let local_var_content = local_var_resp.text().await?;
1289
1290 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1291 Ok(())
1292 } else {
1293 let local_var_entity: Option<InitializeSelfServiceVerificationViaBrowserFlowError> = serde_json::from_str(&local_var_content).ok();
1294 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1295 Err(Error::ResponseError(local_var_error))
1296 }
1297}
1298
1299pub async fn is_alive_admin(configuration: &configuration::Configuration, ) -> Result<crate::models::InlineResponse200, Error<IsAliveAdminError>> {
1301
1302 let local_var_client = &configuration.client;
1303
1304 let local_var_uri_str = format!("{}/api/kratos/admin/health/alive", configuration.base_path);
1305 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
1306
1307 if let Some(ref local_var_user_agent) = configuration.user_agent {
1308 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1309 }
1310 if let Some(ref local_var_token) = configuration.bearer_access_token {
1311 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1312 };
1313
1314 let local_var_req = local_var_req_builder.build()?;
1315 let local_var_resp = local_var_client.execute(local_var_req).await?;
1316
1317 let local_var_status = local_var_resp.status();
1318 let local_var_content = local_var_resp.text().await?;
1319
1320 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1321 serde_json::from_str(&local_var_content).map_err(Error::from)
1322 } else {
1323 let local_var_entity: Option<IsAliveAdminError> = serde_json::from_str(&local_var_content).ok();
1324 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1325 Err(Error::ResponseError(local_var_error))
1326 }
1327}
1328
1329pub async fn is_ready_admin(configuration: &configuration::Configuration, ) -> Result<crate::models::InlineResponse200, Error<IsReadyAdminError>> {
1331
1332 let local_var_client = &configuration.client;
1333
1334 let local_var_uri_str = format!("{}/api/kratos/admin/health/ready", configuration.base_path);
1335 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
1336
1337 if let Some(ref local_var_user_agent) = configuration.user_agent {
1338 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1339 }
1340 if let Some(ref local_var_token) = configuration.bearer_access_token {
1341 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1342 };
1343
1344 let local_var_req = local_var_req_builder.build()?;
1345 let local_var_resp = local_var_client.execute(local_var_req).await?;
1346
1347 let local_var_status = local_var_resp.status();
1348 let local_var_content = local_var_resp.text().await?;
1349
1350 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1351 serde_json::from_str(&local_var_content).map_err(Error::from)
1352 } else {
1353 let local_var_entity: Option<IsReadyAdminError> = serde_json::from_str(&local_var_content).ok();
1354 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1355 Err(Error::ResponseError(local_var_error))
1356 }
1357}
1358
1359pub async fn list_identities_admin(configuration: &configuration::Configuration, per_page: Option<i64>, page: Option<i64>) -> Result<Vec<crate::models::Identity>, Error<ListIdentitiesAdminError>> {
1361
1362 let local_var_client = &configuration.client;
1363
1364 let local_var_uri_str = format!("{}/api/kratos/admin/identities", configuration.base_path);
1365 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
1366
1367 if let Some(ref local_var_str) = per_page {
1368 local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1369 }
1370 if let Some(ref local_var_str) = page {
1371 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1372 }
1373 if let Some(ref local_var_user_agent) = configuration.user_agent {
1374 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1375 }
1376 if let Some(ref local_var_token) = configuration.bearer_access_token {
1377 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1378 };
1379
1380 let local_var_req = local_var_req_builder.build()?;
1381 let local_var_resp = local_var_client.execute(local_var_req).await?;
1382
1383 let local_var_status = local_var_resp.status();
1384 let local_var_content = local_var_resp.text().await?;
1385
1386 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1387 serde_json::from_str(&local_var_content).map_err(Error::from)
1388 } else {
1389 let local_var_entity: Option<ListIdentitiesAdminError> = serde_json::from_str(&local_var_content).ok();
1390 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1391 Err(Error::ResponseError(local_var_error))
1392 }
1393}
1394
1395pub async fn prometheus_admin(configuration: &configuration::Configuration, ) -> Result<(), Error<PrometheusAdminError>> {
1397
1398 let local_var_client = &configuration.client;
1399
1400 let local_var_uri_str = format!("{}/api/kratos/admin/metrics/prometheus", configuration.base_path);
1401 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
1402
1403 if let Some(ref local_var_user_agent) = configuration.user_agent {
1404 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1405 }
1406 if let Some(ref local_var_token) = configuration.bearer_access_token {
1407 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1408 };
1409
1410 let local_var_req = local_var_req_builder.build()?;
1411 let local_var_resp = local_var_client.execute(local_var_req).await?;
1412
1413 let local_var_status = local_var_resp.status();
1414 let local_var_content = local_var_resp.text().await?;
1415
1416 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1417 Ok(())
1418 } else {
1419 let local_var_entity: Option<PrometheusAdminError> = serde_json::from_str(&local_var_content).ok();
1420 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1421 Err(Error::ResponseError(local_var_error))
1422 }
1423}
1424
1425pub async fn revoke_session(configuration: &configuration::Configuration, revoke_session: crate::models::RevokeSession) -> Result<(), Error<RevokeSessionError>> {
1427
1428 let local_var_client = &configuration.client;
1429
1430 let local_var_uri_str = format!("{}/api/kratos/public/sessions", configuration.base_path);
1431 let mut local_var_req_builder = local_var_client.delete(local_var_uri_str.as_str());
1432
1433 if let Some(ref local_var_user_agent) = configuration.user_agent {
1434 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1435 }
1436 local_var_req_builder = local_var_req_builder.json(&revoke_session);
1437
1438 let local_var_req = local_var_req_builder.build()?;
1439 let local_var_resp = local_var_client.execute(local_var_req).await?;
1440
1441 let local_var_status = local_var_resp.status();
1442 let local_var_content = local_var_resp.text().await?;
1443
1444 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1445 Ok(())
1446 } else {
1447 let local_var_entity: Option<RevokeSessionError> = serde_json::from_str(&local_var_content).ok();
1448 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1449 Err(Error::ResponseError(local_var_error))
1450 }
1451}
1452
1453pub async fn submit_self_service_login_flow(configuration: &configuration::Configuration, flow: &str, submit_self_service_login_flow: Option<crate::models::SubmitSelfServiceLoginFlow>) -> Result<crate::models::LoginViaApiResponse, Error<SubmitSelfServiceLoginFlowError>> {
1455
1456 let local_var_client = &configuration.client;
1457
1458 let local_var_uri_str = format!("{}/api/kratos/public/self-service/login", configuration.base_path);
1459 let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
1460
1461 local_var_req_builder = local_var_req_builder.query(&[("flow", &flow.to_string())]);
1462 if let Some(ref local_var_user_agent) = configuration.user_agent {
1463 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1464 }
1465 local_var_req_builder = local_var_req_builder.json(&submit_self_service_login_flow);
1466
1467 let local_var_req = local_var_req_builder.build()?;
1468 let local_var_resp = local_var_client.execute(local_var_req).await?;
1469
1470 let local_var_status = local_var_resp.status();
1471 let local_var_content = local_var_resp.text().await?;
1472
1473 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1474 serde_json::from_str(&local_var_content).map_err(Error::from)
1475 } else {
1476 let local_var_entity: Option<SubmitSelfServiceLoginFlowError> = serde_json::from_str(&local_var_content).ok();
1477 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1478 Err(Error::ResponseError(local_var_error))
1479 }
1480}
1481
1482pub async fn submit_self_service_recovery_flow(configuration: &configuration::Configuration, flow: &str, body: Option<serde_json::Value>) -> Result<(), Error<SubmitSelfServiceRecoveryFlowError>> {
1484
1485 let local_var_client = &configuration.client;
1486
1487 let local_var_uri_str = format!("{}/api/kratos/public/self-service/recovery", configuration.base_path);
1488 let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
1489
1490 local_var_req_builder = local_var_req_builder.query(&[("flow", &flow.to_string())]);
1491 if let Some(ref local_var_user_agent) = configuration.user_agent {
1492 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1493 }
1494 local_var_req_builder = local_var_req_builder.json(&body);
1495
1496 let local_var_req = local_var_req_builder.build()?;
1497 let local_var_resp = local_var_client.execute(local_var_req).await?;
1498
1499 let local_var_status = local_var_resp.status();
1500 let local_var_content = local_var_resp.text().await?;
1501
1502 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1503 Ok(())
1504 } else {
1505 let local_var_entity: Option<SubmitSelfServiceRecoveryFlowError> = serde_json::from_str(&local_var_content).ok();
1506 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1507 Err(Error::ResponseError(local_var_error))
1508 }
1509}
1510
1511pub async fn submit_self_service_recovery_flow_with_link_method(configuration: &configuration::Configuration, token: Option<&str>, flow: Option<&str>, submit_self_service_recovery_flow_with_link_method: Option<crate::models::SubmitSelfServiceRecoveryFlowWithLinkMethod>) -> Result<(), Error<SubmitSelfServiceRecoveryFlowWithLinkMethodError>> {
1513
1514 let local_var_client = &configuration.client;
1515
1516 let local_var_uri_str = format!("{}/api/kratos/public/self-service/recovery/methods/link", configuration.base_path);
1517 let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
1518
1519 if let Some(ref local_var_str) = token {
1520 local_var_req_builder = local_var_req_builder.query(&[("token", &local_var_str.to_string())]);
1521 }
1522 if let Some(ref local_var_str) = flow {
1523 local_var_req_builder = local_var_req_builder.query(&[("flow", &local_var_str.to_string())]);
1524 }
1525 if let Some(ref local_var_user_agent) = configuration.user_agent {
1526 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1527 }
1528 local_var_req_builder = local_var_req_builder.json(&submit_self_service_recovery_flow_with_link_method);
1529
1530 let local_var_req = local_var_req_builder.build()?;
1531 let local_var_resp = local_var_client.execute(local_var_req).await?;
1532
1533 let local_var_status = local_var_resp.status();
1534 let local_var_content = local_var_resp.text().await?;
1535
1536 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1537 Ok(())
1538 } else {
1539 let local_var_entity: Option<SubmitSelfServiceRecoveryFlowWithLinkMethodError> = serde_json::from_str(&local_var_content).ok();
1540 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1541 Err(Error::ResponseError(local_var_error))
1542 }
1543}
1544
1545pub async fn submit_self_service_registration_flow(configuration: &configuration::Configuration, flow: &str, submit_self_service_registration_flow: Option<crate::models::SubmitSelfServiceRegistrationFlow>) -> Result<crate::models::RegistrationViaApiResponse, Error<SubmitSelfServiceRegistrationFlowError>> {
1547
1548 let local_var_client = &configuration.client;
1549
1550 let local_var_uri_str = format!("{}/api/kratos/public/self-service/registration", configuration.base_path);
1551 let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
1552
1553 local_var_req_builder = local_var_req_builder.query(&[("flow", &flow.to_string())]);
1554 if let Some(ref local_var_user_agent) = configuration.user_agent {
1555 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1556 }
1557 local_var_req_builder = local_var_req_builder.json(&submit_self_service_registration_flow);
1558
1559 let local_var_req = local_var_req_builder.build()?;
1560 let local_var_resp = local_var_client.execute(local_var_req).await?;
1561
1562 let local_var_status = local_var_resp.status();
1563 let local_var_content = local_var_resp.text().await?;
1564
1565 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1566 serde_json::from_str(&local_var_content).map_err(Error::from)
1567 } else {
1568 let local_var_entity: Option<SubmitSelfServiceRegistrationFlowError> = serde_json::from_str(&local_var_content).ok();
1569 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1570 Err(Error::ResponseError(local_var_error))
1571 }
1572}
1573
1574pub async fn submit_self_service_settings_flow(configuration: &configuration::Configuration, flow: &str, submit_self_service_settings_flow: Option<crate::models::SubmitSelfServiceSettingsFlow>) -> Result<crate::models::SettingsViaApiResponse, Error<SubmitSelfServiceSettingsFlowError>> {
1576
1577 let local_var_client = &configuration.client;
1578
1579 let local_var_uri_str = format!("{}/api/kratos/public/self-service/settings", configuration.base_path);
1580 let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
1581
1582 local_var_req_builder = local_var_req_builder.query(&[("flow", &flow.to_string())]);
1583 if let Some(ref local_var_user_agent) = configuration.user_agent {
1584 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1585 }
1586 if let Some(ref local_var_token) = configuration.bearer_access_token {
1587 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1588 };
1589 local_var_req_builder = local_var_req_builder.json(&submit_self_service_settings_flow);
1590
1591 let local_var_req = local_var_req_builder.build()?;
1592 let local_var_resp = local_var_client.execute(local_var_req).await?;
1593
1594 let local_var_status = local_var_resp.status();
1595 let local_var_content = local_var_resp.text().await?;
1596
1597 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1598 serde_json::from_str(&local_var_content).map_err(Error::from)
1599 } else {
1600 let local_var_entity: Option<SubmitSelfServiceSettingsFlowError> = serde_json::from_str(&local_var_content).ok();
1601 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1602 Err(Error::ResponseError(local_var_error))
1603 }
1604}
1605
1606pub async fn submit_self_service_verification_flow(configuration: &configuration::Configuration, flow: &str, body: Option<serde_json::Value>) -> Result<(), Error<SubmitSelfServiceVerificationFlowError>> {
1608
1609 let local_var_client = &configuration.client;
1610
1611 let local_var_uri_str = format!("{}/api/kratos/public/self-service/verification/methods/link", configuration.base_path);
1612 let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
1613
1614 local_var_req_builder = local_var_req_builder.query(&[("flow", &flow.to_string())]);
1615 if let Some(ref local_var_user_agent) = configuration.user_agent {
1616 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1617 }
1618 local_var_req_builder = local_var_req_builder.json(&body);
1619
1620 let local_var_req = local_var_req_builder.build()?;
1621 let local_var_resp = local_var_client.execute(local_var_req).await?;
1622
1623 let local_var_status = local_var_resp.status();
1624 let local_var_content = local_var_resp.text().await?;
1625
1626 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1627 Ok(())
1628 } else {
1629 let local_var_entity: Option<SubmitSelfServiceVerificationFlowError> = serde_json::from_str(&local_var_content).ok();
1630 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1631 Err(Error::ResponseError(local_var_error))
1632 }
1633}
1634
1635pub async fn to_session(configuration: &configuration::Configuration, x_session_token: Option<&str>) -> Result<crate::models::Session, Error<ToSessionError>> {
1637
1638 let local_var_client = &configuration.client;
1639
1640 let local_var_uri_str = format!("{}/api/kratos/public/sessions/whoami", configuration.base_path);
1641 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
1642
1643 if let Some(ref local_var_user_agent) = configuration.user_agent {
1644 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1645 }
1646 if let Some(local_var_param_value) = x_session_token {
1647 local_var_req_builder = local_var_req_builder.header("X-Session-Token", local_var_param_value.to_string());
1648 }
1649
1650 let local_var_req = local_var_req_builder.build()?;
1651 let local_var_resp = local_var_client.execute(local_var_req).await?;
1652
1653 let local_var_status = local_var_resp.status();
1654 let local_var_content = local_var_resp.text().await?;
1655
1656 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1657 serde_json::from_str(&local_var_content).map_err(Error::from)
1658 } else {
1659 let local_var_entity: Option<ToSessionError> = serde_json::from_str(&local_var_content).ok();
1660 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1661 Err(Error::ResponseError(local_var_error))
1662 }
1663}
1664
1665pub async fn update_identity_admin(configuration: &configuration::Configuration, id: &str, update_identity: Option<crate::models::UpdateIdentity>) -> Result<crate::models::Identity, Error<UpdateIdentityAdminError>> {
1667
1668 let local_var_client = &configuration.client;
1669
1670 let local_var_uri_str = format!("{}/api/kratos/admin/identities/{id}", configuration.base_path, id=crate::apis::urlencode(id));
1671 let mut local_var_req_builder = local_var_client.put(local_var_uri_str.as_str());
1672
1673 if let Some(ref local_var_user_agent) = configuration.user_agent {
1674 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1675 }
1676 if let Some(ref local_var_token) = configuration.bearer_access_token {
1677 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1678 };
1679 local_var_req_builder = local_var_req_builder.json(&update_identity);
1680
1681 let local_var_req = local_var_req_builder.build()?;
1682 let local_var_resp = local_var_client.execute(local_var_req).await?;
1683
1684 let local_var_status = local_var_resp.status();
1685 let local_var_content = local_var_resp.text().await?;
1686
1687 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1688 serde_json::from_str(&local_var_content).map_err(Error::from)
1689 } else {
1690 let local_var_entity: Option<UpdateIdentityAdminError> = serde_json::from_str(&local_var_content).ok();
1691 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1692 Err(Error::ResponseError(local_var_error))
1693 }
1694}
1695