1use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum CreateBrowserLoginFlowError {
22 Status400(models::ErrorGeneric),
23 DefaultResponse(models::ErrorGeneric),
24 UnknownValue(serde_json::Value),
25}
26
27#[derive(Debug, Clone, Serialize, Deserialize)]
29#[serde(untagged)]
30pub enum CreateBrowserLogoutFlowError {
31 Status400(models::ErrorGeneric),
32 Status401(models::ErrorGeneric),
33 Status500(models::ErrorGeneric),
34 UnknownValue(serde_json::Value),
35}
36
37#[derive(Debug, Clone, Serialize, Deserialize)]
39#[serde(untagged)]
40pub enum CreateBrowserRecoveryFlowError {
41 Status400(models::ErrorGeneric),
42 DefaultResponse(models::ErrorGeneric),
43 UnknownValue(serde_json::Value),
44}
45
46#[derive(Debug, Clone, Serialize, Deserialize)]
48#[serde(untagged)]
49pub enum CreateBrowserRegistrationFlowError {
50 DefaultResponse(models::ErrorGeneric),
51 UnknownValue(serde_json::Value),
52}
53
54#[derive(Debug, Clone, Serialize, Deserialize)]
56#[serde(untagged)]
57pub enum CreateBrowserSettingsFlowError {
58 Status400(models::ErrorGeneric),
59 Status401(models::ErrorGeneric),
60 Status403(models::ErrorGeneric),
61 DefaultResponse(models::ErrorGeneric),
62 UnknownValue(serde_json::Value),
63}
64
65#[derive(Debug, Clone, Serialize, Deserialize)]
67#[serde(untagged)]
68pub enum CreateBrowserVerificationFlowError {
69 DefaultResponse(models::ErrorGeneric),
70 UnknownValue(serde_json::Value),
71}
72
73#[derive(Debug, Clone, Serialize, Deserialize)]
75#[serde(untagged)]
76pub enum CreateFedcmFlowError {
77 Status400(models::ErrorGeneric),
78 DefaultResponse(models::ErrorGeneric),
79 UnknownValue(serde_json::Value),
80}
81
82#[derive(Debug, Clone, Serialize, Deserialize)]
84#[serde(untagged)]
85pub enum CreateNativeLoginFlowError {
86 Status400(models::ErrorGeneric),
87 DefaultResponse(models::ErrorGeneric),
88 UnknownValue(serde_json::Value),
89}
90
91#[derive(Debug, Clone, Serialize, Deserialize)]
93#[serde(untagged)]
94pub enum CreateNativeRecoveryFlowError {
95 Status400(models::ErrorGeneric),
96 DefaultResponse(models::ErrorGeneric),
97 UnknownValue(serde_json::Value),
98}
99
100#[derive(Debug, Clone, Serialize, Deserialize)]
102#[serde(untagged)]
103pub enum CreateNativeRegistrationFlowError {
104 Status400(models::ErrorGeneric),
105 DefaultResponse(models::ErrorGeneric),
106 UnknownValue(serde_json::Value),
107}
108
109#[derive(Debug, Clone, Serialize, Deserialize)]
111#[serde(untagged)]
112pub enum CreateNativeSettingsFlowError {
113 Status400(models::ErrorGeneric),
114 DefaultResponse(models::ErrorGeneric),
115 UnknownValue(serde_json::Value),
116}
117
118#[derive(Debug, Clone, Serialize, Deserialize)]
120#[serde(untagged)]
121pub enum CreateNativeVerificationFlowError {
122 Status400(models::ErrorGeneric),
123 DefaultResponse(models::ErrorGeneric),
124 UnknownValue(serde_json::Value),
125}
126
127#[derive(Debug, Clone, Serialize, Deserialize)]
129#[serde(untagged)]
130pub enum DisableMyOtherSessionsError {
131 Status400(models::ErrorGeneric),
132 Status401(models::ErrorGeneric),
133 DefaultResponse(models::ErrorGeneric),
134 UnknownValue(serde_json::Value),
135}
136
137#[derive(Debug, Clone, Serialize, Deserialize)]
139#[serde(untagged)]
140pub enum DisableMySessionError {
141 Status400(models::ErrorGeneric),
142 Status401(models::ErrorGeneric),
143 DefaultResponse(models::ErrorGeneric),
144 UnknownValue(serde_json::Value),
145}
146
147#[derive(Debug, Clone, Serialize, Deserialize)]
149#[serde(untagged)]
150pub enum ExchangeSessionTokenError {
151 Status403(models::ErrorGeneric),
152 Status404(models::ErrorGeneric),
153 Status410(models::ErrorGeneric),
154 DefaultResponse(models::ErrorGeneric),
155 UnknownValue(serde_json::Value),
156}
157
158#[derive(Debug, Clone, Serialize, Deserialize)]
160#[serde(untagged)]
161pub enum GetFlowErrorError {
162 Status403(models::ErrorGeneric),
163 Status404(models::ErrorGeneric),
164 Status500(models::ErrorGeneric),
165 UnknownValue(serde_json::Value),
166}
167
168#[derive(Debug, Clone, Serialize, Deserialize)]
170#[serde(untagged)]
171pub enum GetLoginFlowError {
172 Status403(models::ErrorGeneric),
173 Status404(models::ErrorGeneric),
174 Status410(models::ErrorGeneric),
175 DefaultResponse(models::ErrorGeneric),
176 UnknownValue(serde_json::Value),
177}
178
179#[derive(Debug, Clone, Serialize, Deserialize)]
181#[serde(untagged)]
182pub enum GetRecoveryFlowError {
183 Status404(models::ErrorGeneric),
184 Status410(models::ErrorGeneric),
185 DefaultResponse(models::ErrorGeneric),
186 UnknownValue(serde_json::Value),
187}
188
189#[derive(Debug, Clone, Serialize, Deserialize)]
191#[serde(untagged)]
192pub enum GetRegistrationFlowError {
193 Status403(models::ErrorGeneric),
194 Status404(models::ErrorGeneric),
195 Status410(models::ErrorGeneric),
196 DefaultResponse(models::ErrorGeneric),
197 UnknownValue(serde_json::Value),
198}
199
200#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum GetSettingsFlowError {
204 Status401(models::ErrorGeneric),
205 Status403(models::ErrorGeneric),
206 Status404(models::ErrorGeneric),
207 Status410(models::ErrorGeneric),
208 DefaultResponse(models::ErrorGeneric),
209 UnknownValue(serde_json::Value),
210}
211
212#[derive(Debug, Clone, Serialize, Deserialize)]
214#[serde(untagged)]
215pub enum GetVerificationFlowError {
216 Status403(models::ErrorGeneric),
217 Status404(models::ErrorGeneric),
218 DefaultResponse(models::ErrorGeneric),
219 UnknownValue(serde_json::Value),
220}
221
222#[derive(Debug, Clone, Serialize, Deserialize)]
224#[serde(untagged)]
225pub enum GetWebAuthnJavaScriptError {
226 UnknownValue(serde_json::Value),
227}
228
229#[derive(Debug, Clone, Serialize, Deserialize)]
231#[serde(untagged)]
232pub enum ListMySessionsError {
233 Status400(models::ErrorGeneric),
234 Status401(models::ErrorGeneric),
235 DefaultResponse(models::ErrorGeneric),
236 UnknownValue(serde_json::Value),
237}
238
239#[derive(Debug, Clone, Serialize, Deserialize)]
241#[serde(untagged)]
242pub enum PerformNativeLogoutError {
243 Status400(models::ErrorGeneric),
244 DefaultResponse(models::ErrorGeneric),
245 UnknownValue(serde_json::Value),
246}
247
248#[derive(Debug, Clone, Serialize, Deserialize)]
250#[serde(untagged)]
251pub enum ToSessionError {
252 Status401(models::ErrorGeneric),
253 Status403(models::ErrorGeneric),
254 DefaultResponse(models::ErrorGeneric),
255 UnknownValue(serde_json::Value),
256}
257
258#[derive(Debug, Clone, Serialize, Deserialize)]
260#[serde(untagged)]
261pub enum UpdateFedcmFlowError {
262 Status400(models::LoginFlow),
263 Status410(models::ErrorGeneric),
264 Status422(models::ErrorBrowserLocationChangeRequired),
265 DefaultResponse(models::ErrorGeneric),
266 UnknownValue(serde_json::Value),
267}
268
269#[derive(Debug, Clone, Serialize, Deserialize)]
271#[serde(untagged)]
272pub enum UpdateLoginFlowError {
273 Status400(models::LoginFlow),
274 Status410(models::ErrorGeneric),
275 Status422(models::ErrorBrowserLocationChangeRequired),
276 DefaultResponse(models::ErrorGeneric),
277 UnknownValue(serde_json::Value),
278}
279
280#[derive(Debug, Clone, Serialize, Deserialize)]
282#[serde(untagged)]
283pub enum UpdateLogoutFlowError {
284 DefaultResponse(models::ErrorGeneric),
285 UnknownValue(serde_json::Value),
286}
287
288#[derive(Debug, Clone, Serialize, Deserialize)]
290#[serde(untagged)]
291pub enum UpdateRecoveryFlowError {
292 Status400(models::RecoveryFlow),
293 Status410(models::ErrorGeneric),
294 Status422(models::ErrorBrowserLocationChangeRequired),
295 DefaultResponse(models::ErrorGeneric),
296 UnknownValue(serde_json::Value),
297}
298
299#[derive(Debug, Clone, Serialize, Deserialize)]
301#[serde(untagged)]
302pub enum UpdateRegistrationFlowError {
303 Status400(models::RegistrationFlow),
304 Status410(models::ErrorGeneric),
305 Status422(models::ErrorBrowserLocationChangeRequired),
306 DefaultResponse(models::ErrorGeneric),
307 UnknownValue(serde_json::Value),
308}
309
310#[derive(Debug, Clone, Serialize, Deserialize)]
312#[serde(untagged)]
313pub enum UpdateSettingsFlowError {
314 Status400(models::SettingsFlow),
315 Status401(models::ErrorGeneric),
316 Status403(models::ErrorGeneric),
317 Status410(models::ErrorGeneric),
318 Status422(models::ErrorBrowserLocationChangeRequired),
319 DefaultResponse(models::ErrorGeneric),
320 UnknownValue(serde_json::Value),
321}
322
323#[derive(Debug, Clone, Serialize, Deserialize)]
325#[serde(untagged)]
326pub enum UpdateVerificationFlowError {
327 Status400(models::VerificationFlow),
328 Status410(models::ErrorGeneric),
329 DefaultResponse(models::ErrorGeneric),
330 UnknownValue(serde_json::Value),
331}
332
333
334pub async fn create_browser_login_flow(configuration: &configuration::Configuration, refresh: Option<bool>, aal: Option<&str>, return_to: Option<&str>, cookie: Option<&str>, login_challenge: Option<&str>, organization: Option<&str>, via: Option<&str>) -> Result<models::LoginFlow, Error<CreateBrowserLoginFlowError>> {
336 let local_var_configuration = configuration;
337
338 let local_var_client = &local_var_configuration.client;
339
340 let local_var_uri_str = format!("{}/self-service/login/browser", local_var_configuration.base_path);
341 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
342
343 if let Some(ref local_var_str) = refresh {
344 local_var_req_builder = local_var_req_builder.query(&[("refresh", &local_var_str.to_string())]);
345 }
346 if let Some(ref local_var_str) = aal {
347 local_var_req_builder = local_var_req_builder.query(&[("aal", &local_var_str.to_string())]);
348 }
349 if let Some(ref local_var_str) = return_to {
350 local_var_req_builder = local_var_req_builder.query(&[("return_to", &local_var_str.to_string())]);
351 }
352 if let Some(ref local_var_str) = login_challenge {
353 local_var_req_builder = local_var_req_builder.query(&[("login_challenge", &local_var_str.to_string())]);
354 }
355 if let Some(ref local_var_str) = organization {
356 local_var_req_builder = local_var_req_builder.query(&[("organization", &local_var_str.to_string())]);
357 }
358 if let Some(ref local_var_str) = via {
359 local_var_req_builder = local_var_req_builder.query(&[("via", &local_var_str.to_string())]);
360 }
361 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
362 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
363 }
364 if let Some(local_var_param_value) = cookie {
365 local_var_req_builder = local_var_req_builder.header("Cookie", local_var_param_value.to_string());
366 }
367
368 let local_var_req = local_var_req_builder.build()?;
369 let local_var_resp = local_var_client.execute(local_var_req).await?;
370
371 let local_var_status = local_var_resp.status();
372 let local_var_content = local_var_resp.text().await?;
373
374 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
375 serde_json::from_str(&local_var_content).map_err(Error::from)
376 } else {
377 let local_var_entity: Option<CreateBrowserLoginFlowError> = serde_json::from_str(&local_var_content).ok();
378 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
379 Err(Error::ResponseError(local_var_error))
380 }
381}
382
383pub async fn create_browser_logout_flow(configuration: &configuration::Configuration, cookie: Option<&str>, return_to: Option<&str>) -> Result<models::LogoutFlow, Error<CreateBrowserLogoutFlowError>> {
385 let local_var_configuration = configuration;
386
387 let local_var_client = &local_var_configuration.client;
388
389 let local_var_uri_str = format!("{}/self-service/logout/browser", local_var_configuration.base_path);
390 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
391
392 if let Some(ref local_var_str) = return_to {
393 local_var_req_builder = local_var_req_builder.query(&[("return_to", &local_var_str.to_string())]);
394 }
395 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
396 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
397 }
398 if let Some(local_var_param_value) = cookie {
399 local_var_req_builder = local_var_req_builder.header("cookie", local_var_param_value.to_string());
400 }
401
402 let local_var_req = local_var_req_builder.build()?;
403 let local_var_resp = local_var_client.execute(local_var_req).await?;
404
405 let local_var_status = local_var_resp.status();
406 let local_var_content = local_var_resp.text().await?;
407
408 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
409 serde_json::from_str(&local_var_content).map_err(Error::from)
410 } else {
411 let local_var_entity: Option<CreateBrowserLogoutFlowError> = serde_json::from_str(&local_var_content).ok();
412 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
413 Err(Error::ResponseError(local_var_error))
414 }
415}
416
417pub async fn create_browser_recovery_flow(configuration: &configuration::Configuration, return_to: Option<&str>) -> Result<models::RecoveryFlow, Error<CreateBrowserRecoveryFlowError>> {
419 let local_var_configuration = configuration;
420
421 let local_var_client = &local_var_configuration.client;
422
423 let local_var_uri_str = format!("{}/self-service/recovery/browser", local_var_configuration.base_path);
424 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
425
426 if let Some(ref local_var_str) = return_to {
427 local_var_req_builder = local_var_req_builder.query(&[("return_to", &local_var_str.to_string())]);
428 }
429 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
430 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
431 }
432
433 let local_var_req = local_var_req_builder.build()?;
434 let local_var_resp = local_var_client.execute(local_var_req).await?;
435
436 let local_var_status = local_var_resp.status();
437 let local_var_content = local_var_resp.text().await?;
438
439 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
440 serde_json::from_str(&local_var_content).map_err(Error::from)
441 } else {
442 let local_var_entity: Option<CreateBrowserRecoveryFlowError> = serde_json::from_str(&local_var_content).ok();
443 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
444 Err(Error::ResponseError(local_var_error))
445 }
446}
447
448pub async fn create_browser_registration_flow(configuration: &configuration::Configuration, return_to: Option<&str>, login_challenge: Option<&str>, after_verification_return_to: Option<&str>, organization: Option<&str>) -> Result<models::RegistrationFlow, Error<CreateBrowserRegistrationFlowError>> {
450 let local_var_configuration = configuration;
451
452 let local_var_client = &local_var_configuration.client;
453
454 let local_var_uri_str = format!("{}/self-service/registration/browser", local_var_configuration.base_path);
455 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
456
457 if let Some(ref local_var_str) = return_to {
458 local_var_req_builder = local_var_req_builder.query(&[("return_to", &local_var_str.to_string())]);
459 }
460 if let Some(ref local_var_str) = login_challenge {
461 local_var_req_builder = local_var_req_builder.query(&[("login_challenge", &local_var_str.to_string())]);
462 }
463 if let Some(ref local_var_str) = after_verification_return_to {
464 local_var_req_builder = local_var_req_builder.query(&[("after_verification_return_to", &local_var_str.to_string())]);
465 }
466 if let Some(ref local_var_str) = organization {
467 local_var_req_builder = local_var_req_builder.query(&[("organization", &local_var_str.to_string())]);
468 }
469 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
470 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
471 }
472
473 let local_var_req = local_var_req_builder.build()?;
474 let local_var_resp = local_var_client.execute(local_var_req).await?;
475
476 let local_var_status = local_var_resp.status();
477 let local_var_content = local_var_resp.text().await?;
478
479 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
480 serde_json::from_str(&local_var_content).map_err(Error::from)
481 } else {
482 let local_var_entity: Option<CreateBrowserRegistrationFlowError> = serde_json::from_str(&local_var_content).ok();
483 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
484 Err(Error::ResponseError(local_var_error))
485 }
486}
487
488pub async fn create_browser_settings_flow(configuration: &configuration::Configuration, return_to: Option<&str>, cookie: Option<&str>) -> Result<models::SettingsFlow, Error<CreateBrowserSettingsFlowError>> {
490 let local_var_configuration = configuration;
491
492 let local_var_client = &local_var_configuration.client;
493
494 let local_var_uri_str = format!("{}/self-service/settings/browser", local_var_configuration.base_path);
495 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
496
497 if let Some(ref local_var_str) = return_to {
498 local_var_req_builder = local_var_req_builder.query(&[("return_to", &local_var_str.to_string())]);
499 }
500 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
501 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
502 }
503 if let Some(local_var_param_value) = cookie {
504 local_var_req_builder = local_var_req_builder.header("Cookie", local_var_param_value.to_string());
505 }
506
507 let local_var_req = local_var_req_builder.build()?;
508 let local_var_resp = local_var_client.execute(local_var_req).await?;
509
510 let local_var_status = local_var_resp.status();
511 let local_var_content = local_var_resp.text().await?;
512
513 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
514 serde_json::from_str(&local_var_content).map_err(Error::from)
515 } else {
516 let local_var_entity: Option<CreateBrowserSettingsFlowError> = serde_json::from_str(&local_var_content).ok();
517 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
518 Err(Error::ResponseError(local_var_error))
519 }
520}
521
522pub async fn create_browser_verification_flow(configuration: &configuration::Configuration, return_to: Option<&str>) -> Result<models::VerificationFlow, Error<CreateBrowserVerificationFlowError>> {
524 let local_var_configuration = configuration;
525
526 let local_var_client = &local_var_configuration.client;
527
528 let local_var_uri_str = format!("{}/self-service/verification/browser", local_var_configuration.base_path);
529 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
530
531 if let Some(ref local_var_str) = return_to {
532 local_var_req_builder = local_var_req_builder.query(&[("return_to", &local_var_str.to_string())]);
533 }
534 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
535 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
536 }
537
538 let local_var_req = local_var_req_builder.build()?;
539 let local_var_resp = local_var_client.execute(local_var_req).await?;
540
541 let local_var_status = local_var_resp.status();
542 let local_var_content = local_var_resp.text().await?;
543
544 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
545 serde_json::from_str(&local_var_content).map_err(Error::from)
546 } else {
547 let local_var_entity: Option<CreateBrowserVerificationFlowError> = serde_json::from_str(&local_var_content).ok();
548 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
549 Err(Error::ResponseError(local_var_error))
550 }
551}
552
553pub async fn create_fedcm_flow(configuration: &configuration::Configuration, ) -> Result<models::CreateFedcmFlowResponse, Error<CreateFedcmFlowError>> {
555 let local_var_configuration = configuration;
556
557 let local_var_client = &local_var_configuration.client;
558
559 let local_var_uri_str = format!("{}/self-service/fed-cm/parameters", local_var_configuration.base_path);
560 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
561
562 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
563 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
564 }
565
566 let local_var_req = local_var_req_builder.build()?;
567 let local_var_resp = local_var_client.execute(local_var_req).await?;
568
569 let local_var_status = local_var_resp.status();
570 let local_var_content = local_var_resp.text().await?;
571
572 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
573 serde_json::from_str(&local_var_content).map_err(Error::from)
574 } else {
575 let local_var_entity: Option<CreateFedcmFlowError> = serde_json::from_str(&local_var_content).ok();
576 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
577 Err(Error::ResponseError(local_var_error))
578 }
579}
580
581pub async fn create_native_login_flow(configuration: &configuration::Configuration, refresh: Option<bool>, aal: Option<&str>, x_session_token: Option<&str>, return_session_token_exchange_code: Option<bool>, return_to: Option<&str>, organization: Option<&str>, via: Option<&str>) -> Result<models::LoginFlow, Error<CreateNativeLoginFlowError>> {
583 let local_var_configuration = configuration;
584
585 let local_var_client = &local_var_configuration.client;
586
587 let local_var_uri_str = format!("{}/self-service/login/api", local_var_configuration.base_path);
588 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
589
590 if let Some(ref local_var_str) = refresh {
591 local_var_req_builder = local_var_req_builder.query(&[("refresh", &local_var_str.to_string())]);
592 }
593 if let Some(ref local_var_str) = aal {
594 local_var_req_builder = local_var_req_builder.query(&[("aal", &local_var_str.to_string())]);
595 }
596 if let Some(ref local_var_str) = return_session_token_exchange_code {
597 local_var_req_builder = local_var_req_builder.query(&[("return_session_token_exchange_code", &local_var_str.to_string())]);
598 }
599 if let Some(ref local_var_str) = return_to {
600 local_var_req_builder = local_var_req_builder.query(&[("return_to", &local_var_str.to_string())]);
601 }
602 if let Some(ref local_var_str) = organization {
603 local_var_req_builder = local_var_req_builder.query(&[("organization", &local_var_str.to_string())]);
604 }
605 if let Some(ref local_var_str) = via {
606 local_var_req_builder = local_var_req_builder.query(&[("via", &local_var_str.to_string())]);
607 }
608 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
609 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
610 }
611 if let Some(local_var_param_value) = x_session_token {
612 local_var_req_builder = local_var_req_builder.header("X-Session-Token", local_var_param_value.to_string());
613 }
614
615 let local_var_req = local_var_req_builder.build()?;
616 let local_var_resp = local_var_client.execute(local_var_req).await?;
617
618 let local_var_status = local_var_resp.status();
619 let local_var_content = local_var_resp.text().await?;
620
621 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
622 serde_json::from_str(&local_var_content).map_err(Error::from)
623 } else {
624 let local_var_entity: Option<CreateNativeLoginFlowError> = serde_json::from_str(&local_var_content).ok();
625 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
626 Err(Error::ResponseError(local_var_error))
627 }
628}
629
630pub async fn create_native_recovery_flow(configuration: &configuration::Configuration, ) -> Result<models::RecoveryFlow, Error<CreateNativeRecoveryFlowError>> {
632 let local_var_configuration = configuration;
633
634 let local_var_client = &local_var_configuration.client;
635
636 let local_var_uri_str = format!("{}/self-service/recovery/api", local_var_configuration.base_path);
637 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
638
639 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
640 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
641 }
642
643 let local_var_req = local_var_req_builder.build()?;
644 let local_var_resp = local_var_client.execute(local_var_req).await?;
645
646 let local_var_status = local_var_resp.status();
647 let local_var_content = local_var_resp.text().await?;
648
649 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
650 serde_json::from_str(&local_var_content).map_err(Error::from)
651 } else {
652 let local_var_entity: Option<CreateNativeRecoveryFlowError> = serde_json::from_str(&local_var_content).ok();
653 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
654 Err(Error::ResponseError(local_var_error))
655 }
656}
657
658pub async fn create_native_registration_flow(configuration: &configuration::Configuration, return_session_token_exchange_code: Option<bool>, return_to: Option<&str>, organization: Option<&str>) -> Result<models::RegistrationFlow, Error<CreateNativeRegistrationFlowError>> {
660 let local_var_configuration = configuration;
661
662 let local_var_client = &local_var_configuration.client;
663
664 let local_var_uri_str = format!("{}/self-service/registration/api", local_var_configuration.base_path);
665 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
666
667 if let Some(ref local_var_str) = return_session_token_exchange_code {
668 local_var_req_builder = local_var_req_builder.query(&[("return_session_token_exchange_code", &local_var_str.to_string())]);
669 }
670 if let Some(ref local_var_str) = return_to {
671 local_var_req_builder = local_var_req_builder.query(&[("return_to", &local_var_str.to_string())]);
672 }
673 if let Some(ref local_var_str) = organization {
674 local_var_req_builder = local_var_req_builder.query(&[("organization", &local_var_str.to_string())]);
675 }
676 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
677 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
678 }
679
680 let local_var_req = local_var_req_builder.build()?;
681 let local_var_resp = local_var_client.execute(local_var_req).await?;
682
683 let local_var_status = local_var_resp.status();
684 let local_var_content = local_var_resp.text().await?;
685
686 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
687 serde_json::from_str(&local_var_content).map_err(Error::from)
688 } else {
689 let local_var_entity: Option<CreateNativeRegistrationFlowError> = serde_json::from_str(&local_var_content).ok();
690 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
691 Err(Error::ResponseError(local_var_error))
692 }
693}
694
695pub async fn create_native_settings_flow(configuration: &configuration::Configuration, x_session_token: Option<&str>) -> Result<models::SettingsFlow, Error<CreateNativeSettingsFlowError>> {
697 let local_var_configuration = configuration;
698
699 let local_var_client = &local_var_configuration.client;
700
701 let local_var_uri_str = format!("{}/self-service/settings/api", local_var_configuration.base_path);
702 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
703
704 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
705 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
706 }
707 if let Some(local_var_param_value) = x_session_token {
708 local_var_req_builder = local_var_req_builder.header("X-Session-Token", local_var_param_value.to_string());
709 }
710
711 let local_var_req = local_var_req_builder.build()?;
712 let local_var_resp = local_var_client.execute(local_var_req).await?;
713
714 let local_var_status = local_var_resp.status();
715 let local_var_content = local_var_resp.text().await?;
716
717 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
718 serde_json::from_str(&local_var_content).map_err(Error::from)
719 } else {
720 let local_var_entity: Option<CreateNativeSettingsFlowError> = serde_json::from_str(&local_var_content).ok();
721 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
722 Err(Error::ResponseError(local_var_error))
723 }
724}
725
726pub async fn create_native_verification_flow(configuration: &configuration::Configuration, return_to: Option<&str>) -> Result<models::VerificationFlow, Error<CreateNativeVerificationFlowError>> {
728 let local_var_configuration = configuration;
729
730 let local_var_client = &local_var_configuration.client;
731
732 let local_var_uri_str = format!("{}/self-service/verification/api", local_var_configuration.base_path);
733 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
734
735 if let Some(ref local_var_str) = return_to {
736 local_var_req_builder = local_var_req_builder.query(&[("return_to", &local_var_str.to_string())]);
737 }
738 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
739 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
740 }
741
742 let local_var_req = local_var_req_builder.build()?;
743 let local_var_resp = local_var_client.execute(local_var_req).await?;
744
745 let local_var_status = local_var_resp.status();
746 let local_var_content = local_var_resp.text().await?;
747
748 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
749 serde_json::from_str(&local_var_content).map_err(Error::from)
750 } else {
751 let local_var_entity: Option<CreateNativeVerificationFlowError> = serde_json::from_str(&local_var_content).ok();
752 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
753 Err(Error::ResponseError(local_var_error))
754 }
755}
756
757pub async fn disable_my_other_sessions(configuration: &configuration::Configuration, x_session_token: Option<&str>, cookie: Option<&str>) -> Result<models::DeleteMySessionsCount, Error<DisableMyOtherSessionsError>> {
759 let local_var_configuration = configuration;
760
761 let local_var_client = &local_var_configuration.client;
762
763 let local_var_uri_str = format!("{}/sessions", local_var_configuration.base_path);
764 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
765
766 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
767 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
768 }
769 if let Some(local_var_param_value) = x_session_token {
770 local_var_req_builder = local_var_req_builder.header("X-Session-Token", local_var_param_value.to_string());
771 }
772 if let Some(local_var_param_value) = cookie {
773 local_var_req_builder = local_var_req_builder.header("Cookie", local_var_param_value.to_string());
774 }
775
776 let local_var_req = local_var_req_builder.build()?;
777 let local_var_resp = local_var_client.execute(local_var_req).await?;
778
779 let local_var_status = local_var_resp.status();
780 let local_var_content = local_var_resp.text().await?;
781
782 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
783 serde_json::from_str(&local_var_content).map_err(Error::from)
784 } else {
785 let local_var_entity: Option<DisableMyOtherSessionsError> = serde_json::from_str(&local_var_content).ok();
786 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
787 Err(Error::ResponseError(local_var_error))
788 }
789}
790
791pub async fn disable_my_session(configuration: &configuration::Configuration, id: &str, x_session_token: Option<&str>, cookie: Option<&str>) -> Result<(), Error<DisableMySessionError>> {
793 let local_var_configuration = configuration;
794
795 let local_var_client = &local_var_configuration.client;
796
797 let local_var_uri_str = format!("{}/sessions/{id}", local_var_configuration.base_path, id=crate::apis::urlencode(id));
798 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
799
800 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
801 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
802 }
803 if let Some(local_var_param_value) = x_session_token {
804 local_var_req_builder = local_var_req_builder.header("X-Session-Token", local_var_param_value.to_string());
805 }
806 if let Some(local_var_param_value) = cookie {
807 local_var_req_builder = local_var_req_builder.header("Cookie", local_var_param_value.to_string());
808 }
809
810 let local_var_req = local_var_req_builder.build()?;
811 let local_var_resp = local_var_client.execute(local_var_req).await?;
812
813 let local_var_status = local_var_resp.status();
814 let local_var_content = local_var_resp.text().await?;
815
816 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
817 Ok(())
818 } else {
819 let local_var_entity: Option<DisableMySessionError> = serde_json::from_str(&local_var_content).ok();
820 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
821 Err(Error::ResponseError(local_var_error))
822 }
823}
824
825pub async fn exchange_session_token(configuration: &configuration::Configuration, init_code: &str, return_to_code: &str) -> Result<models::SuccessfulNativeLogin, Error<ExchangeSessionTokenError>> {
826 let local_var_configuration = configuration;
827
828 let local_var_client = &local_var_configuration.client;
829
830 let local_var_uri_str = format!("{}/sessions/token-exchange", local_var_configuration.base_path);
831 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
832
833 local_var_req_builder = local_var_req_builder.query(&[("init_code", &init_code.to_string())]);
834 local_var_req_builder = local_var_req_builder.query(&[("return_to_code", &return_to_code.to_string())]);
835 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
836 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
837 }
838
839 let local_var_req = local_var_req_builder.build()?;
840 let local_var_resp = local_var_client.execute(local_var_req).await?;
841
842 let local_var_status = local_var_resp.status();
843 let local_var_content = local_var_resp.text().await?;
844
845 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
846 serde_json::from_str(&local_var_content).map_err(Error::from)
847 } else {
848 let local_var_entity: Option<ExchangeSessionTokenError> = serde_json::from_str(&local_var_content).ok();
849 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
850 Err(Error::ResponseError(local_var_error))
851 }
852}
853
854pub async fn get_flow_error(configuration: &configuration::Configuration, id: &str) -> Result<models::FlowError, Error<GetFlowErrorError>> {
856 let local_var_configuration = configuration;
857
858 let local_var_client = &local_var_configuration.client;
859
860 let local_var_uri_str = format!("{}/self-service/errors", local_var_configuration.base_path);
861 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
862
863 local_var_req_builder = local_var_req_builder.query(&[("id", &id.to_string())]);
864 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
865 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
866 }
867
868 let local_var_req = local_var_req_builder.build()?;
869 let local_var_resp = local_var_client.execute(local_var_req).await?;
870
871 let local_var_status = local_var_resp.status();
872 let local_var_content = local_var_resp.text().await?;
873
874 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
875 serde_json::from_str(&local_var_content).map_err(Error::from)
876 } else {
877 let local_var_entity: Option<GetFlowErrorError> = serde_json::from_str(&local_var_content).ok();
878 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
879 Err(Error::ResponseError(local_var_error))
880 }
881}
882
883pub async fn get_login_flow(configuration: &configuration::Configuration, id: &str, cookie: Option<&str>) -> Result<models::LoginFlow, Error<GetLoginFlowError>> {
885 let local_var_configuration = configuration;
886
887 let local_var_client = &local_var_configuration.client;
888
889 let local_var_uri_str = format!("{}/self-service/login/flows", local_var_configuration.base_path);
890 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
891
892 local_var_req_builder = local_var_req_builder.query(&[("id", &id.to_string())]);
893 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
894 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
895 }
896 if let Some(local_var_param_value) = cookie {
897 local_var_req_builder = local_var_req_builder.header("Cookie", local_var_param_value.to_string());
898 }
899
900 let local_var_req = local_var_req_builder.build()?;
901 let local_var_resp = local_var_client.execute(local_var_req).await?;
902
903 let local_var_status = local_var_resp.status();
904 let local_var_content = local_var_resp.text().await?;
905
906 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
907 serde_json::from_str(&local_var_content).map_err(Error::from)
908 } else {
909 let local_var_entity: Option<GetLoginFlowError> = serde_json::from_str(&local_var_content).ok();
910 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
911 Err(Error::ResponseError(local_var_error))
912 }
913}
914
915pub async fn get_recovery_flow(configuration: &configuration::Configuration, id: &str, cookie: Option<&str>) -> Result<models::RecoveryFlow, Error<GetRecoveryFlowError>> {
917 let local_var_configuration = configuration;
918
919 let local_var_client = &local_var_configuration.client;
920
921 let local_var_uri_str = format!("{}/self-service/recovery/flows", local_var_configuration.base_path);
922 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
923
924 local_var_req_builder = local_var_req_builder.query(&[("id", &id.to_string())]);
925 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
926 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
927 }
928 if let Some(local_var_param_value) = cookie {
929 local_var_req_builder = local_var_req_builder.header("Cookie", local_var_param_value.to_string());
930 }
931
932 let local_var_req = local_var_req_builder.build()?;
933 let local_var_resp = local_var_client.execute(local_var_req).await?;
934
935 let local_var_status = local_var_resp.status();
936 let local_var_content = local_var_resp.text().await?;
937
938 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
939 serde_json::from_str(&local_var_content).map_err(Error::from)
940 } else {
941 let local_var_entity: Option<GetRecoveryFlowError> = serde_json::from_str(&local_var_content).ok();
942 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
943 Err(Error::ResponseError(local_var_error))
944 }
945}
946
947pub async fn get_registration_flow(configuration: &configuration::Configuration, id: &str, cookie: Option<&str>) -> Result<models::RegistrationFlow, Error<GetRegistrationFlowError>> {
949 let local_var_configuration = configuration;
950
951 let local_var_client = &local_var_configuration.client;
952
953 let local_var_uri_str = format!("{}/self-service/registration/flows", local_var_configuration.base_path);
954 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
955
956 local_var_req_builder = local_var_req_builder.query(&[("id", &id.to_string())]);
957 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
958 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
959 }
960 if let Some(local_var_param_value) = cookie {
961 local_var_req_builder = local_var_req_builder.header("Cookie", local_var_param_value.to_string());
962 }
963
964 let local_var_req = local_var_req_builder.build()?;
965 let local_var_resp = local_var_client.execute(local_var_req).await?;
966
967 let local_var_status = local_var_resp.status();
968 let local_var_content = local_var_resp.text().await?;
969
970 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
971 serde_json::from_str(&local_var_content).map_err(Error::from)
972 } else {
973 let local_var_entity: Option<GetRegistrationFlowError> = serde_json::from_str(&local_var_content).ok();
974 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
975 Err(Error::ResponseError(local_var_error))
976 }
977}
978
979pub async fn get_settings_flow(configuration: &configuration::Configuration, id: &str, x_session_token: Option<&str>, cookie: Option<&str>) -> Result<models::SettingsFlow, Error<GetSettingsFlowError>> {
981 let local_var_configuration = configuration;
982
983 let local_var_client = &local_var_configuration.client;
984
985 let local_var_uri_str = format!("{}/self-service/settings/flows", local_var_configuration.base_path);
986 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
987
988 local_var_req_builder = local_var_req_builder.query(&[("id", &id.to_string())]);
989 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
990 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
991 }
992 if let Some(local_var_param_value) = x_session_token {
993 local_var_req_builder = local_var_req_builder.header("X-Session-Token", local_var_param_value.to_string());
994 }
995 if let Some(local_var_param_value) = cookie {
996 local_var_req_builder = local_var_req_builder.header("Cookie", local_var_param_value.to_string());
997 }
998
999 let local_var_req = local_var_req_builder.build()?;
1000 let local_var_resp = local_var_client.execute(local_var_req).await?;
1001
1002 let local_var_status = local_var_resp.status();
1003 let local_var_content = local_var_resp.text().await?;
1004
1005 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1006 serde_json::from_str(&local_var_content).map_err(Error::from)
1007 } else {
1008 let local_var_entity: Option<GetSettingsFlowError> = serde_json::from_str(&local_var_content).ok();
1009 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1010 Err(Error::ResponseError(local_var_error))
1011 }
1012}
1013
1014pub async fn get_verification_flow(configuration: &configuration::Configuration, id: &str, cookie: Option<&str>) -> Result<models::VerificationFlow, Error<GetVerificationFlowError>> {
1016 let local_var_configuration = configuration;
1017
1018 let local_var_client = &local_var_configuration.client;
1019
1020 let local_var_uri_str = format!("{}/self-service/verification/flows", local_var_configuration.base_path);
1021 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1022
1023 local_var_req_builder = local_var_req_builder.query(&[("id", &id.to_string())]);
1024 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1025 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1026 }
1027 if let Some(local_var_param_value) = cookie {
1028 local_var_req_builder = local_var_req_builder.header("cookie", local_var_param_value.to_string());
1029 }
1030
1031 let local_var_req = local_var_req_builder.build()?;
1032 let local_var_resp = local_var_client.execute(local_var_req).await?;
1033
1034 let local_var_status = local_var_resp.status();
1035 let local_var_content = local_var_resp.text().await?;
1036
1037 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1038 serde_json::from_str(&local_var_content).map_err(Error::from)
1039 } else {
1040 let local_var_entity: Option<GetVerificationFlowError> = serde_json::from_str(&local_var_content).ok();
1041 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1042 Err(Error::ResponseError(local_var_error))
1043 }
1044}
1045
1046pub async fn get_web_authn_java_script(configuration: &configuration::Configuration, ) -> Result<String, Error<GetWebAuthnJavaScriptError>> {
1048 let local_var_configuration = configuration;
1049
1050 let local_var_client = &local_var_configuration.client;
1051
1052 let local_var_uri_str = format!("{}/.well-known/ory/webauthn.js", local_var_configuration.base_path);
1053 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1054
1055 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1056 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1057 }
1058
1059 let local_var_req = local_var_req_builder.build()?;
1060 let local_var_resp = local_var_client.execute(local_var_req).await?;
1061
1062 let local_var_status = local_var_resp.status();
1063 let local_var_content = local_var_resp.text().await?;
1064
1065 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1066 serde_json::from_str(&local_var_content).map_err(Error::from)
1067 } else {
1068 let local_var_entity: Option<GetWebAuthnJavaScriptError> = serde_json::from_str(&local_var_content).ok();
1069 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1070 Err(Error::ResponseError(local_var_error))
1071 }
1072}
1073
1074pub async fn list_my_sessions(configuration: &configuration::Configuration, per_page: Option<i64>, page: Option<i64>, page_size: Option<i64>, page_token: Option<&str>, x_session_token: Option<&str>, cookie: Option<&str>) -> Result<Vec<models::Session>, Error<ListMySessionsError>> {
1076 let local_var_configuration = configuration;
1077
1078 let local_var_client = &local_var_configuration.client;
1079
1080 let local_var_uri_str = format!("{}/sessions", local_var_configuration.base_path);
1081 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1082
1083 if let Some(ref local_var_str) = per_page {
1084 local_var_req_builder = local_var_req_builder.query(&[("per_page", &local_var_str.to_string())]);
1085 }
1086 if let Some(ref local_var_str) = page {
1087 local_var_req_builder = local_var_req_builder.query(&[("page", &local_var_str.to_string())]);
1088 }
1089 if let Some(ref local_var_str) = page_size {
1090 local_var_req_builder = local_var_req_builder.query(&[("page_size", &local_var_str.to_string())]);
1091 }
1092 if let Some(ref local_var_str) = page_token {
1093 local_var_req_builder = local_var_req_builder.query(&[("page_token", &local_var_str.to_string())]);
1094 }
1095 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1096 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1097 }
1098 if let Some(local_var_param_value) = x_session_token {
1099 local_var_req_builder = local_var_req_builder.header("X-Session-Token", local_var_param_value.to_string());
1100 }
1101 if let Some(local_var_param_value) = cookie {
1102 local_var_req_builder = local_var_req_builder.header("Cookie", local_var_param_value.to_string());
1103 }
1104
1105 let local_var_req = local_var_req_builder.build()?;
1106 let local_var_resp = local_var_client.execute(local_var_req).await?;
1107
1108 let local_var_status = local_var_resp.status();
1109 let local_var_content = local_var_resp.text().await?;
1110
1111 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1112 serde_json::from_str(&local_var_content).map_err(Error::from)
1113 } else {
1114 let local_var_entity: Option<ListMySessionsError> = serde_json::from_str(&local_var_content).ok();
1115 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1116 Err(Error::ResponseError(local_var_error))
1117 }
1118}
1119
1120pub async fn perform_native_logout(configuration: &configuration::Configuration, perform_native_logout_body: models::PerformNativeLogoutBody) -> Result<(), Error<PerformNativeLogoutError>> {
1122 let local_var_configuration = configuration;
1123
1124 let local_var_client = &local_var_configuration.client;
1125
1126 let local_var_uri_str = format!("{}/self-service/logout/api", local_var_configuration.base_path);
1127 let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
1128
1129 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1130 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1131 }
1132 local_var_req_builder = local_var_req_builder.json(&perform_native_logout_body);
1133
1134 let local_var_req = local_var_req_builder.build()?;
1135 let local_var_resp = local_var_client.execute(local_var_req).await?;
1136
1137 let local_var_status = local_var_resp.status();
1138 let local_var_content = local_var_resp.text().await?;
1139
1140 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1141 Ok(())
1142 } else {
1143 let local_var_entity: Option<PerformNativeLogoutError> = serde_json::from_str(&local_var_content).ok();
1144 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1145 Err(Error::ResponseError(local_var_error))
1146 }
1147}
1148
1149pub async fn to_session(configuration: &configuration::Configuration, x_session_token: Option<&str>, cookie: Option<&str>, tokenize_as: Option<&str>) -> Result<models::Session, Error<ToSessionError>> {
1151 let local_var_configuration = configuration;
1152
1153 let local_var_client = &local_var_configuration.client;
1154
1155 let local_var_uri_str = format!("{}/sessions/whoami", local_var_configuration.base_path);
1156 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1157
1158 if let Some(ref local_var_str) = tokenize_as {
1159 local_var_req_builder = local_var_req_builder.query(&[("tokenize_as", &local_var_str.to_string())]);
1160 }
1161 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1162 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1163 }
1164 if let Some(local_var_param_value) = x_session_token {
1165 local_var_req_builder = local_var_req_builder.header("X-Session-Token", local_var_param_value.to_string());
1166 }
1167 if let Some(local_var_param_value) = cookie {
1168 local_var_req_builder = local_var_req_builder.header("Cookie", local_var_param_value.to_string());
1169 }
1170
1171 let local_var_req = local_var_req_builder.build()?;
1172 let local_var_resp = local_var_client.execute(local_var_req).await?;
1173
1174 let local_var_status = local_var_resp.status();
1175 let local_var_content = local_var_resp.text().await?;
1176
1177 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1178 serde_json::from_str(&local_var_content).map_err(Error::from)
1179 } else {
1180 let local_var_entity: Option<ToSessionError> = serde_json::from_str(&local_var_content).ok();
1181 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1182 Err(Error::ResponseError(local_var_error))
1183 }
1184}
1185
1186pub async fn update_fedcm_flow(configuration: &configuration::Configuration, update_fedcm_flow_body: models::UpdateFedcmFlowBody) -> Result<models::SuccessfulNativeLogin, Error<UpdateFedcmFlowError>> {
1188 let local_var_configuration = configuration;
1189
1190 let local_var_client = &local_var_configuration.client;
1191
1192 let local_var_uri_str = format!("{}/self-service/fed-cm/token", local_var_configuration.base_path);
1193 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1194
1195 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1196 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1197 }
1198 local_var_req_builder = local_var_req_builder.json(&update_fedcm_flow_body);
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<UpdateFedcmFlowError> = 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 update_login_flow(configuration: &configuration::Configuration, flow: &str, update_login_flow_body: models::UpdateLoginFlowBody, x_session_token: Option<&str>, cookie: Option<&str>) -> Result<models::SuccessfulNativeLogin, Error<UpdateLoginFlowError>> {
1217 let local_var_configuration = configuration;
1218
1219 let local_var_client = &local_var_configuration.client;
1220
1221 let local_var_uri_str = format!("{}/self-service/login", local_var_configuration.base_path);
1222 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1223
1224 local_var_req_builder = local_var_req_builder.query(&[("flow", &flow.to_string())]);
1225 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1226 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1227 }
1228 if let Some(local_var_param_value) = x_session_token {
1229 local_var_req_builder = local_var_req_builder.header("X-Session-Token", local_var_param_value.to_string());
1230 }
1231 if let Some(local_var_param_value) = cookie {
1232 local_var_req_builder = local_var_req_builder.header("Cookie", local_var_param_value.to_string());
1233 }
1234 local_var_req_builder = local_var_req_builder.json(&update_login_flow_body);
1235
1236 let local_var_req = local_var_req_builder.build()?;
1237 let local_var_resp = local_var_client.execute(local_var_req).await?;
1238
1239 let local_var_status = local_var_resp.status();
1240 let local_var_content = local_var_resp.text().await?;
1241
1242 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1243 serde_json::from_str(&local_var_content).map_err(Error::from)
1244 } else {
1245 let local_var_entity: Option<UpdateLoginFlowError> = serde_json::from_str(&local_var_content).ok();
1246 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1247 Err(Error::ResponseError(local_var_error))
1248 }
1249}
1250
1251pub async fn update_logout_flow(configuration: &configuration::Configuration, token: Option<&str>, return_to: Option<&str>, cookie: Option<&str>) -> Result<(), Error<UpdateLogoutFlowError>> {
1253 let local_var_configuration = configuration;
1254
1255 let local_var_client = &local_var_configuration.client;
1256
1257 let local_var_uri_str = format!("{}/self-service/logout", local_var_configuration.base_path);
1258 let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
1259
1260 if let Some(ref local_var_str) = token {
1261 local_var_req_builder = local_var_req_builder.query(&[("token", &local_var_str.to_string())]);
1262 }
1263 if let Some(ref local_var_str) = return_to {
1264 local_var_req_builder = local_var_req_builder.query(&[("return_to", &local_var_str.to_string())]);
1265 }
1266 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1267 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1268 }
1269 if let Some(local_var_param_value) = cookie {
1270 local_var_req_builder = local_var_req_builder.header("Cookie", local_var_param_value.to_string());
1271 }
1272
1273 let local_var_req = local_var_req_builder.build()?;
1274 let local_var_resp = local_var_client.execute(local_var_req).await?;
1275
1276 let local_var_status = local_var_resp.status();
1277 let local_var_content = local_var_resp.text().await?;
1278
1279 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1280 Ok(())
1281 } else {
1282 let local_var_entity: Option<UpdateLogoutFlowError> = serde_json::from_str(&local_var_content).ok();
1283 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1284 Err(Error::ResponseError(local_var_error))
1285 }
1286}
1287
1288pub async fn update_recovery_flow(configuration: &configuration::Configuration, flow: &str, update_recovery_flow_body: models::UpdateRecoveryFlowBody, token: Option<&str>, cookie: Option<&str>) -> Result<models::RecoveryFlow, Error<UpdateRecoveryFlowError>> {
1290 let local_var_configuration = configuration;
1291
1292 let local_var_client = &local_var_configuration.client;
1293
1294 let local_var_uri_str = format!("{}/self-service/recovery", local_var_configuration.base_path);
1295 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1296
1297 local_var_req_builder = local_var_req_builder.query(&[("flow", &flow.to_string())]);
1298 if let Some(ref local_var_str) = token {
1299 local_var_req_builder = local_var_req_builder.query(&[("token", &local_var_str.to_string())]);
1300 }
1301 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1302 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1303 }
1304 if let Some(local_var_param_value) = cookie {
1305 local_var_req_builder = local_var_req_builder.header("Cookie", local_var_param_value.to_string());
1306 }
1307 local_var_req_builder = local_var_req_builder.json(&update_recovery_flow_body);
1308
1309 let local_var_req = local_var_req_builder.build()?;
1310 let local_var_resp = local_var_client.execute(local_var_req).await?;
1311
1312 let local_var_status = local_var_resp.status();
1313 let local_var_content = local_var_resp.text().await?;
1314
1315 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1316 serde_json::from_str(&local_var_content).map_err(Error::from)
1317 } else {
1318 let local_var_entity: Option<UpdateRecoveryFlowError> = serde_json::from_str(&local_var_content).ok();
1319 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1320 Err(Error::ResponseError(local_var_error))
1321 }
1322}
1323
1324pub async fn update_registration_flow(configuration: &configuration::Configuration, flow: &str, update_registration_flow_body: models::UpdateRegistrationFlowBody, cookie: Option<&str>) -> Result<models::SuccessfulNativeRegistration, Error<UpdateRegistrationFlowError>> {
1326 let local_var_configuration = configuration;
1327
1328 let local_var_client = &local_var_configuration.client;
1329
1330 let local_var_uri_str = format!("{}/self-service/registration", local_var_configuration.base_path);
1331 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1332
1333 local_var_req_builder = local_var_req_builder.query(&[("flow", &flow.to_string())]);
1334 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1335 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1336 }
1337 if let Some(local_var_param_value) = cookie {
1338 local_var_req_builder = local_var_req_builder.header("Cookie", local_var_param_value.to_string());
1339 }
1340 local_var_req_builder = local_var_req_builder.json(&update_registration_flow_body);
1341
1342 let local_var_req = local_var_req_builder.build()?;
1343 let local_var_resp = local_var_client.execute(local_var_req).await?;
1344
1345 let local_var_status = local_var_resp.status();
1346 let local_var_content = local_var_resp.text().await?;
1347
1348 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1349 serde_json::from_str(&local_var_content).map_err(Error::from)
1350 } else {
1351 let local_var_entity: Option<UpdateRegistrationFlowError> = serde_json::from_str(&local_var_content).ok();
1352 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1353 Err(Error::ResponseError(local_var_error))
1354 }
1355}
1356
1357pub async fn update_settings_flow(configuration: &configuration::Configuration, flow: &str, update_settings_flow_body: models::UpdateSettingsFlowBody, x_session_token: Option<&str>, cookie: Option<&str>) -> Result<models::SettingsFlow, Error<UpdateSettingsFlowError>> {
1359 let local_var_configuration = configuration;
1360
1361 let local_var_client = &local_var_configuration.client;
1362
1363 let local_var_uri_str = format!("{}/self-service/settings", local_var_configuration.base_path);
1364 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1365
1366 local_var_req_builder = local_var_req_builder.query(&[("flow", &flow.to_string())]);
1367 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1368 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1369 }
1370 if let Some(local_var_param_value) = x_session_token {
1371 local_var_req_builder = local_var_req_builder.header("X-Session-Token", local_var_param_value.to_string());
1372 }
1373 if let Some(local_var_param_value) = cookie {
1374 local_var_req_builder = local_var_req_builder.header("Cookie", local_var_param_value.to_string());
1375 }
1376 local_var_req_builder = local_var_req_builder.json(&update_settings_flow_body);
1377
1378 let local_var_req = local_var_req_builder.build()?;
1379 let local_var_resp = local_var_client.execute(local_var_req).await?;
1380
1381 let local_var_status = local_var_resp.status();
1382 let local_var_content = local_var_resp.text().await?;
1383
1384 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1385 serde_json::from_str(&local_var_content).map_err(Error::from)
1386 } else {
1387 let local_var_entity: Option<UpdateSettingsFlowError> = serde_json::from_str(&local_var_content).ok();
1388 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1389 Err(Error::ResponseError(local_var_error))
1390 }
1391}
1392
1393pub async fn update_verification_flow(configuration: &configuration::Configuration, flow: &str, update_verification_flow_body: models::UpdateVerificationFlowBody, token: Option<&str>, cookie: Option<&str>) -> Result<models::VerificationFlow, Error<UpdateVerificationFlowError>> {
1395 let local_var_configuration = configuration;
1396
1397 let local_var_client = &local_var_configuration.client;
1398
1399 let local_var_uri_str = format!("{}/self-service/verification", local_var_configuration.base_path);
1400 let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
1401
1402 local_var_req_builder = local_var_req_builder.query(&[("flow", &flow.to_string())]);
1403 if let Some(ref local_var_str) = token {
1404 local_var_req_builder = local_var_req_builder.query(&[("token", &local_var_str.to_string())]);
1405 }
1406 if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
1407 local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1408 }
1409 if let Some(local_var_param_value) = cookie {
1410 local_var_req_builder = local_var_req_builder.header("Cookie", local_var_param_value.to_string());
1411 }
1412 local_var_req_builder = local_var_req_builder.json(&update_verification_flow_body);
1413
1414 let local_var_req = local_var_req_builder.build()?;
1415 let local_var_resp = local_var_client.execute(local_var_req).await?;
1416
1417 let local_var_status = local_var_resp.status();
1418 let local_var_content = local_var_resp.text().await?;
1419
1420 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1421 serde_json::from_str(&local_var_content).map_err(Error::from)
1422 } else {
1423 let local_var_entity: Option<UpdateVerificationFlowError> = serde_json::from_str(&local_var_content).ok();
1424 let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
1425 Err(Error::ResponseError(local_var_error))
1426 }
1427}
1428