1use super::{AddQuery, Error, configuration};
12use crate::models;
13use gloo_utils::format::JsValueSerdeExt;
14use serde::{Deserialize, Serialize};
15use wasm_bindgen::prelude::*;
16
17#[derive(Debug, Clone, Serialize, Deserialize)]
19#[serde(untagged)]
20pub enum CreateBrowserLoginFlowError {
21 Status400(models::ErrorGeneric),
22 DefaultResponse(models::ErrorGeneric),
23 UnknownValue(serde_json::Value),
24}
25
26#[derive(Debug, Clone, Serialize, Deserialize)]
28#[serde(untagged)]
29pub enum CreateBrowserLogoutFlowError {
30 Status400(models::ErrorGeneric),
31 Status401(models::ErrorGeneric),
32 Status500(models::ErrorGeneric),
33 UnknownValue(serde_json::Value),
34}
35
36#[derive(Debug, Clone, Serialize, Deserialize)]
38#[serde(untagged)]
39pub enum CreateBrowserRecoveryFlowError {
40 Status400(models::ErrorGeneric),
41 DefaultResponse(models::ErrorGeneric),
42 UnknownValue(serde_json::Value),
43}
44
45#[derive(Debug, Clone, Serialize, Deserialize)]
47#[serde(untagged)]
48pub enum CreateBrowserRegistrationFlowError {
49 DefaultResponse(models::ErrorGeneric),
50 UnknownValue(serde_json::Value),
51}
52
53#[derive(Debug, Clone, Serialize, Deserialize)]
55#[serde(untagged)]
56pub enum CreateBrowserSettingsFlowError {
57 Status400(models::ErrorGeneric),
58 Status401(models::ErrorGeneric),
59 Status403(models::ErrorGeneric),
60 DefaultResponse(models::ErrorGeneric),
61 UnknownValue(serde_json::Value),
62}
63
64#[derive(Debug, Clone, Serialize, Deserialize)]
66#[serde(untagged)]
67pub enum CreateBrowserVerificationFlowError {
68 DefaultResponse(models::ErrorGeneric),
69 UnknownValue(serde_json::Value),
70}
71
72#[derive(Debug, Clone, Serialize, Deserialize)]
74#[serde(untagged)]
75pub enum CreateFedcmFlowError {
76 Status400(models::ErrorGeneric),
77 DefaultResponse(models::ErrorGeneric),
78 UnknownValue(serde_json::Value),
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum CreateNativeLoginFlowError {
85 Status400(models::ErrorGeneric),
86 DefaultResponse(models::ErrorGeneric),
87 UnknownValue(serde_json::Value),
88}
89
90#[derive(Debug, Clone, Serialize, Deserialize)]
92#[serde(untagged)]
93pub enum CreateNativeRecoveryFlowError {
94 Status400(models::ErrorGeneric),
95 DefaultResponse(models::ErrorGeneric),
96 UnknownValue(serde_json::Value),
97}
98
99#[derive(Debug, Clone, Serialize, Deserialize)]
101#[serde(untagged)]
102pub enum CreateNativeRegistrationFlowError {
103 Status400(models::ErrorGeneric),
104 DefaultResponse(models::ErrorGeneric),
105 UnknownValue(serde_json::Value),
106}
107
108#[derive(Debug, Clone, Serialize, Deserialize)]
110#[serde(untagged)]
111pub enum CreateNativeSettingsFlowError {
112 Status400(models::ErrorGeneric),
113 DefaultResponse(models::ErrorGeneric),
114 UnknownValue(serde_json::Value),
115}
116
117#[derive(Debug, Clone, Serialize, Deserialize)]
119#[serde(untagged)]
120pub enum CreateNativeVerificationFlowError {
121 Status400(models::ErrorGeneric),
122 DefaultResponse(models::ErrorGeneric),
123 UnknownValue(serde_json::Value),
124}
125
126#[derive(Debug, Clone, Serialize, Deserialize)]
128#[serde(untagged)]
129pub enum DisableMyOtherSessionsError {
130 Status400(models::ErrorGeneric),
131 Status401(models::ErrorGeneric),
132 DefaultResponse(models::ErrorGeneric),
133 UnknownValue(serde_json::Value),
134}
135
136#[derive(Debug, Clone, Serialize, Deserialize)]
138#[serde(untagged)]
139pub enum DisableMySessionError {
140 Status400(models::ErrorGeneric),
141 Status401(models::ErrorGeneric),
142 DefaultResponse(models::ErrorGeneric),
143 UnknownValue(serde_json::Value),
144}
145
146#[derive(Debug, Clone, Serialize, Deserialize)]
148#[serde(untagged)]
149pub enum ExchangeSessionTokenError {
150 Status403(models::ErrorGeneric),
151 Status404(models::ErrorGeneric),
152 Status410(models::ErrorGeneric),
153 DefaultResponse(models::ErrorGeneric),
154 UnknownValue(serde_json::Value),
155}
156
157#[derive(Debug, Clone, Serialize, Deserialize)]
159#[serde(untagged)]
160pub enum GetFlowErrorError {
161 Status403(models::ErrorGeneric),
162 Status404(models::ErrorGeneric),
163 Status500(models::ErrorGeneric),
164 UnknownValue(serde_json::Value),
165}
166
167#[derive(Debug, Clone, Serialize, Deserialize)]
169#[serde(untagged)]
170pub enum GetLoginFlowError {
171 Status403(models::ErrorGeneric),
172 Status404(models::ErrorGeneric),
173 Status410(models::ErrorGeneric),
174 DefaultResponse(models::ErrorGeneric),
175 UnknownValue(serde_json::Value),
176}
177
178#[derive(Debug, Clone, Serialize, Deserialize)]
180#[serde(untagged)]
181pub enum GetRecoveryFlowError {
182 Status404(models::ErrorGeneric),
183 Status410(models::ErrorGeneric),
184 DefaultResponse(models::ErrorGeneric),
185 UnknownValue(serde_json::Value),
186}
187
188#[derive(Debug, Clone, Serialize, Deserialize)]
190#[serde(untagged)]
191pub enum GetRegistrationFlowError {
192 Status403(models::ErrorGeneric),
193 Status404(models::ErrorGeneric),
194 Status410(models::ErrorGeneric),
195 DefaultResponse(models::ErrorGeneric),
196 UnknownValue(serde_json::Value),
197}
198
199#[derive(Debug, Clone, Serialize, Deserialize)]
201#[serde(untagged)]
202pub enum GetSettingsFlowError {
203 Status401(models::ErrorGeneric),
204 Status403(models::ErrorGeneric),
205 Status404(models::ErrorGeneric),
206 Status410(models::ErrorGeneric),
207 DefaultResponse(models::ErrorGeneric),
208 UnknownValue(serde_json::Value),
209}
210
211#[derive(Debug, Clone, Serialize, Deserialize)]
213#[serde(untagged)]
214pub enum GetVerificationFlowError {
215 Status403(models::ErrorGeneric),
216 Status404(models::ErrorGeneric),
217 DefaultResponse(models::ErrorGeneric),
218 UnknownValue(serde_json::Value),
219}
220
221#[derive(Debug, Clone, Serialize, Deserialize)]
223#[serde(untagged)]
224pub enum GetWebAuthnJavaScriptError {
225 UnknownValue(serde_json::Value),
226}
227
228#[derive(Debug, Clone, Serialize, Deserialize)]
230#[serde(untagged)]
231pub enum ListMySessionsError {
232 Status400(models::ErrorGeneric),
233 Status401(models::ErrorGeneric),
234 DefaultResponse(models::ErrorGeneric),
235 UnknownValue(serde_json::Value),
236}
237
238#[derive(Debug, Clone, Serialize, Deserialize)]
240#[serde(untagged)]
241pub enum PerformNativeLogoutError {
242 Status400(models::ErrorGeneric),
243 DefaultResponse(models::ErrorGeneric),
244 UnknownValue(serde_json::Value),
245}
246
247#[derive(Debug, Clone, Serialize, Deserialize)]
249#[serde(untagged)]
250pub enum ToSessionError {
251 Status401(models::ErrorGeneric),
252 Status403(models::ErrorGeneric),
253 DefaultResponse(models::ErrorGeneric),
254 UnknownValue(serde_json::Value),
255}
256
257#[derive(Debug, Clone, Serialize, Deserialize)]
259#[serde(untagged)]
260pub enum UpdateFedcmFlowError {
261 Status400(models::LoginFlow),
262 Status410(models::ErrorGeneric),
263 Status422(models::ErrorBrowserLocationChangeRequired),
264 DefaultResponse(models::ErrorGeneric),
265 UnknownValue(serde_json::Value),
266}
267
268#[derive(Debug, Clone, Serialize, Deserialize)]
270#[serde(untagged)]
271pub enum UpdateLoginFlowError {
272 Status400(models::LoginFlow),
273 Status410(models::ErrorGeneric),
274 Status422(models::ErrorBrowserLocationChangeRequired),
275 DefaultResponse(models::ErrorGeneric),
276 UnknownValue(serde_json::Value),
277}
278
279#[derive(Debug, Clone, Serialize, Deserialize)]
281#[serde(untagged)]
282pub enum UpdateLogoutFlowError {
283 DefaultResponse(models::ErrorGeneric),
284 UnknownValue(serde_json::Value),
285}
286
287#[derive(Debug, Clone, Serialize, Deserialize)]
289#[serde(untagged)]
290pub enum UpdateRecoveryFlowError {
291 Status400(models::RecoveryFlow),
292 Status410(models::ErrorGeneric),
293 Status422(models::ErrorBrowserLocationChangeRequired),
294 DefaultResponse(models::ErrorGeneric),
295 UnknownValue(serde_json::Value),
296}
297
298#[derive(Debug, Clone, Serialize, Deserialize)]
300#[serde(untagged)]
301pub enum UpdateRegistrationFlowError {
302 Status400(models::RegistrationFlow),
303 Status410(models::ErrorGeneric),
304 Status422(models::ErrorBrowserLocationChangeRequired),
305 DefaultResponse(models::ErrorGeneric),
306 UnknownValue(serde_json::Value),
307}
308
309#[derive(Debug, Clone, Serialize, Deserialize)]
311#[serde(untagged)]
312pub enum UpdateSettingsFlowError {
313 Status400(models::SettingsFlow),
314 Status401(models::ErrorGeneric),
315 Status403(models::ErrorGeneric),
316 Status410(models::ErrorGeneric),
317 Status422(models::ErrorBrowserLocationChangeRequired),
318 DefaultResponse(models::ErrorGeneric),
319 UnknownValue(serde_json::Value),
320}
321
322#[derive(Debug, Clone, Serialize, Deserialize)]
324#[serde(untagged)]
325pub enum UpdateVerificationFlowError {
326 Status400(models::VerificationFlow),
327 Status410(models::ErrorGeneric),
328 DefaultResponse(models::ErrorGeneric),
329 UnknownValue(serde_json::Value),
330}
331
332pub async fn create_browser_login_flow(
334 configuration: &configuration::Configuration,
335 refresh: Option<bool>,
336 aal: Option<&str>,
337 return_to: Option<&str>,
338 cookie: Option<&str>,
339 login_challenge: Option<&str>,
340 organization: Option<&str>,
341 via: Option<&str>,
342 identity_schema: Option<&str>,
343) -> Result<models::LoginFlow, Error<CreateBrowserLoginFlowError>> {
344 let mut uri_str = String::new();
345 uri_str.push_str(&configuration.base_path);
346 uri_str.push_str("/self-service/login/browser");
347 let client = web_sys::RequestInit::new();
348 client.set_method("GET");
349 client.set_mode(web_sys::RequestMode::Cors);
350 client.set_credentials(web_sys::RequestCredentials::Include);
351 let mut is_first_query: bool = true;
352 if let Some(ref str) = refresh {
353 uri_str.add_query(&mut is_first_query, "refresh=", &str.to_string());
354 }
355 if let Some(ref str) = aal {
356 uri_str.add_query(&mut is_first_query, "aal=", &str.to_string());
357 }
358 if let Some(ref str) = return_to {
359 uri_str.add_query(&mut is_first_query, "return_to=", &str.to_string());
360 }
361 if let Some(ref str) = login_challenge {
362 uri_str.add_query(&mut is_first_query, "login_challenge=", &str.to_string());
363 }
364 if let Some(ref str) = organization {
365 uri_str.add_query(&mut is_first_query, "organization=", &str.to_string());
366 }
367 if let Some(ref str) = via {
368 uri_str.add_query(&mut is_first_query, "via=", &str.to_string());
369 }
370 if let Some(ref str) = identity_schema {
371 uri_str.add_query(&mut is_first_query, "identity_schema=", &str.to_string());
372 }
373 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
374 if let Some(ref user_agent) = configuration.user_agent {
375 req_builder.headers().set("USER_AGENT", user_agent)?;
376 }
377 if let Some(cookie) = cookie {
378 req_builder.headers().set("Cookie", cookie)?;
379 }
380 req_builder.headers().set("Accept", "application/json")?;
381 let req = wasm_bindgen_futures::JsFuture::from(
382 web_sys::window()
383 .expect("Failed to get Window object")
384 .fetch_with_request(&req_builder),
385 )
386 .await?;
387 assert!(req.is_instance_of::<web_sys::Response>());
388 let resp: web_sys::Response = req
389 .dyn_into()
390 .expect("Failed to dynamically cast JsFuture into Response");
391 super::handle_response(resp).await
392}
393
394pub async fn create_browser_logout_flow(
396 configuration: &configuration::Configuration,
397 cookie: Option<&str>,
398 return_to: Option<&str>,
399) -> Result<models::LogoutFlow, Error<CreateBrowserLogoutFlowError>> {
400 let mut uri_str = String::new();
401 uri_str.push_str(&configuration.base_path);
402 uri_str.push_str("/self-service/logout/browser");
403 let client = web_sys::RequestInit::new();
404 client.set_method("GET");
405 client.set_mode(web_sys::RequestMode::Cors);
406 client.set_credentials(web_sys::RequestCredentials::Include);
407 let mut is_first_query: bool = true;
408 if let Some(ref str) = return_to {
409 uri_str.add_query(&mut is_first_query, "return_to=", &str.to_string());
410 }
411 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
412 if let Some(ref user_agent) = configuration.user_agent {
413 req_builder.headers().set("USER_AGENT", user_agent)?;
414 }
415 if let Some(cookie) = cookie {
416 req_builder.headers().set("cookie", cookie)?;
417 }
418 req_builder.headers().set("Accept", "application/json")?;
419 let req = wasm_bindgen_futures::JsFuture::from(
420 web_sys::window()
421 .expect("Failed to get Window object")
422 .fetch_with_request(&req_builder),
423 )
424 .await?;
425 assert!(req.is_instance_of::<web_sys::Response>());
426 let resp: web_sys::Response = req
427 .dyn_into()
428 .expect("Failed to dynamically cast JsFuture into Response");
429 super::handle_response(resp).await
430}
431
432pub async fn create_browser_recovery_flow(
434 configuration: &configuration::Configuration,
435 return_to: Option<&str>,
436) -> Result<models::RecoveryFlow, Error<CreateBrowserRecoveryFlowError>> {
437 let mut uri_str = String::new();
438 uri_str.push_str(&configuration.base_path);
439 uri_str.push_str("/self-service/recovery/browser");
440 let client = web_sys::RequestInit::new();
441 client.set_method("GET");
442 client.set_mode(web_sys::RequestMode::Cors);
443 client.set_credentials(web_sys::RequestCredentials::Include);
444 let mut is_first_query: bool = true;
445 if let Some(ref str) = return_to {
446 uri_str.add_query(&mut is_first_query, "return_to=", &str.to_string());
447 }
448 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
449 if let Some(ref user_agent) = configuration.user_agent {
450 req_builder.headers().set("USER_AGENT", user_agent)?;
451 }
452 req_builder.headers().set("Accept", "application/json")?;
453 let req = wasm_bindgen_futures::JsFuture::from(
454 web_sys::window()
455 .expect("Failed to get Window object")
456 .fetch_with_request(&req_builder),
457 )
458 .await?;
459 assert!(req.is_instance_of::<web_sys::Response>());
460 let resp: web_sys::Response = req
461 .dyn_into()
462 .expect("Failed to dynamically cast JsFuture into Response");
463 super::handle_response(resp).await
464}
465
466pub async fn create_browser_registration_flow(
468 configuration: &configuration::Configuration,
469 return_to: Option<&str>,
470 login_challenge: Option<&str>,
471 after_verification_return_to: Option<&str>,
472 organization: Option<&str>,
473 identity_schema: Option<&str>,
474) -> Result<models::RegistrationFlow, Error<CreateBrowserRegistrationFlowError>> {
475 let mut uri_str = String::new();
476 uri_str.push_str(&configuration.base_path);
477 uri_str.push_str("/self-service/registration/browser");
478 let client = web_sys::RequestInit::new();
479 client.set_method("GET");
480 client.set_mode(web_sys::RequestMode::Cors);
481 client.set_credentials(web_sys::RequestCredentials::Include);
482 let mut is_first_query: bool = true;
483 if let Some(ref str) = return_to {
484 uri_str.add_query(&mut is_first_query, "return_to=", &str.to_string());
485 }
486 if let Some(ref str) = login_challenge {
487 uri_str.add_query(&mut is_first_query, "login_challenge=", &str.to_string());
488 }
489 if let Some(ref str) = after_verification_return_to {
490 uri_str.add_query(
491 &mut is_first_query,
492 "after_verification_return_to=",
493 &str.to_string(),
494 );
495 }
496 if let Some(ref str) = organization {
497 uri_str.add_query(&mut is_first_query, "organization=", &str.to_string());
498 }
499 if let Some(ref str) = identity_schema {
500 uri_str.add_query(&mut is_first_query, "identity_schema=", &str.to_string());
501 }
502 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
503 if let Some(ref user_agent) = configuration.user_agent {
504 req_builder.headers().set("USER_AGENT", user_agent)?;
505 }
506 req_builder.headers().set("Accept", "application/json")?;
507 let req = wasm_bindgen_futures::JsFuture::from(
508 web_sys::window()
509 .expect("Failed to get Window object")
510 .fetch_with_request(&req_builder),
511 )
512 .await?;
513 assert!(req.is_instance_of::<web_sys::Response>());
514 let resp: web_sys::Response = req
515 .dyn_into()
516 .expect("Failed to dynamically cast JsFuture into Response");
517 super::handle_response(resp).await
518}
519
520pub async fn create_browser_settings_flow(
522 configuration: &configuration::Configuration,
523 return_to: Option<&str>,
524 cookie: Option<&str>,
525) -> Result<models::SettingsFlow, Error<CreateBrowserSettingsFlowError>> {
526 let mut uri_str = String::new();
527 uri_str.push_str(&configuration.base_path);
528 uri_str.push_str("/self-service/settings/browser");
529 let client = web_sys::RequestInit::new();
530 client.set_method("GET");
531 client.set_mode(web_sys::RequestMode::Cors);
532 client.set_credentials(web_sys::RequestCredentials::Include);
533 let mut is_first_query: bool = true;
534 if let Some(ref str) = return_to {
535 uri_str.add_query(&mut is_first_query, "return_to=", &str.to_string());
536 }
537 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
538 if let Some(ref user_agent) = configuration.user_agent {
539 req_builder.headers().set("USER_AGENT", user_agent)?;
540 }
541 if let Some(cookie) = cookie {
542 req_builder.headers().set("Cookie", cookie)?;
543 }
544 req_builder.headers().set("Accept", "application/json")?;
545 let req = wasm_bindgen_futures::JsFuture::from(
546 web_sys::window()
547 .expect("Failed to get Window object")
548 .fetch_with_request(&req_builder),
549 )
550 .await?;
551 assert!(req.is_instance_of::<web_sys::Response>());
552 let resp: web_sys::Response = req
553 .dyn_into()
554 .expect("Failed to dynamically cast JsFuture into Response");
555 super::handle_response(resp).await
556}
557
558pub async fn create_browser_verification_flow(
560 configuration: &configuration::Configuration,
561 return_to: Option<&str>,
562) -> Result<models::VerificationFlow, Error<CreateBrowserVerificationFlowError>> {
563 let mut uri_str = String::new();
564 uri_str.push_str(&configuration.base_path);
565 uri_str.push_str("/self-service/verification/browser");
566 let client = web_sys::RequestInit::new();
567 client.set_method("GET");
568 client.set_mode(web_sys::RequestMode::Cors);
569 client.set_credentials(web_sys::RequestCredentials::Include);
570 let mut is_first_query: bool = true;
571 if let Some(ref str) = return_to {
572 uri_str.add_query(&mut is_first_query, "return_to=", &str.to_string());
573 }
574 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
575 if let Some(ref user_agent) = configuration.user_agent {
576 req_builder.headers().set("USER_AGENT", user_agent)?;
577 }
578 req_builder.headers().set("Accept", "application/json")?;
579 let req = wasm_bindgen_futures::JsFuture::from(
580 web_sys::window()
581 .expect("Failed to get Window object")
582 .fetch_with_request(&req_builder),
583 )
584 .await?;
585 assert!(req.is_instance_of::<web_sys::Response>());
586 let resp: web_sys::Response = req
587 .dyn_into()
588 .expect("Failed to dynamically cast JsFuture into Response");
589 super::handle_response(resp).await
590}
591
592pub async fn create_fedcm_flow(
594 configuration: &configuration::Configuration,
595) -> Result<models::CreateFedcmFlowResponse, Error<CreateFedcmFlowError>> {
596 let mut uri_str = String::new();
597 uri_str.push_str(&configuration.base_path);
598 uri_str.push_str("/self-service/fed-cm/parameters");
599 let client = web_sys::RequestInit::new();
600 client.set_method("GET");
601 client.set_mode(web_sys::RequestMode::Cors);
602 client.set_credentials(web_sys::RequestCredentials::Include);
603 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
604 if let Some(ref user_agent) = configuration.user_agent {
605 req_builder.headers().set("USER_AGENT", user_agent)?;
606 }
607 req_builder.headers().set("Accept", "application/json")?;
608 let req = wasm_bindgen_futures::JsFuture::from(
609 web_sys::window()
610 .expect("Failed to get Window object")
611 .fetch_with_request(&req_builder),
612 )
613 .await?;
614 assert!(req.is_instance_of::<web_sys::Response>());
615 let resp: web_sys::Response = req
616 .dyn_into()
617 .expect("Failed to dynamically cast JsFuture into Response");
618 super::handle_response(resp).await
619}
620
621pub async fn create_native_login_flow(
623 configuration: &configuration::Configuration,
624 refresh: Option<bool>,
625 aal: Option<&str>,
626 x_session_token: Option<&str>,
627 return_session_token_exchange_code: Option<bool>,
628 return_to: Option<&str>,
629 organization: Option<&str>,
630 via: Option<&str>,
631 identity_schema: Option<&str>,
632) -> Result<models::LoginFlow, Error<CreateNativeLoginFlowError>> {
633 let mut uri_str = String::new();
634 uri_str.push_str(&configuration.base_path);
635 uri_str.push_str("/self-service/login/api");
636 let client = web_sys::RequestInit::new();
637 client.set_method("GET");
638 client.set_mode(web_sys::RequestMode::Cors);
639 client.set_credentials(web_sys::RequestCredentials::Include);
640 let mut is_first_query: bool = true;
641 if let Some(ref str) = refresh {
642 uri_str.add_query(&mut is_first_query, "refresh=", &str.to_string());
643 }
644 if let Some(ref str) = aal {
645 uri_str.add_query(&mut is_first_query, "aal=", &str.to_string());
646 }
647 if let Some(ref str) = return_session_token_exchange_code {
648 uri_str.add_query(
649 &mut is_first_query,
650 "return_session_token_exchange_code=",
651 &str.to_string(),
652 );
653 }
654 if let Some(ref str) = return_to {
655 uri_str.add_query(&mut is_first_query, "return_to=", &str.to_string());
656 }
657 if let Some(ref str) = organization {
658 uri_str.add_query(&mut is_first_query, "organization=", &str.to_string());
659 }
660 if let Some(ref str) = via {
661 uri_str.add_query(&mut is_first_query, "via=", &str.to_string());
662 }
663 if let Some(ref str) = identity_schema {
664 uri_str.add_query(&mut is_first_query, "identity_schema=", &str.to_string());
665 }
666 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
667 if let Some(ref user_agent) = configuration.user_agent {
668 req_builder.headers().set("USER_AGENT", user_agent)?;
669 }
670 if let Some(x_session_token) = x_session_token {
671 req_builder
672 .headers()
673 .set("X-Session-Token", x_session_token)?;
674 }
675 req_builder.headers().set("Accept", "application/json")?;
676 let req = wasm_bindgen_futures::JsFuture::from(
677 web_sys::window()
678 .expect("Failed to get Window object")
679 .fetch_with_request(&req_builder),
680 )
681 .await?;
682 assert!(req.is_instance_of::<web_sys::Response>());
683 let resp: web_sys::Response = req
684 .dyn_into()
685 .expect("Failed to dynamically cast JsFuture into Response");
686 super::handle_response(resp).await
687}
688
689pub async fn create_native_recovery_flow(
691 configuration: &configuration::Configuration,
692) -> Result<models::RecoveryFlow, Error<CreateNativeRecoveryFlowError>> {
693 let mut uri_str = String::new();
694 uri_str.push_str(&configuration.base_path);
695 uri_str.push_str("/self-service/recovery/api");
696 let client = web_sys::RequestInit::new();
697 client.set_method("GET");
698 client.set_mode(web_sys::RequestMode::Cors);
699 client.set_credentials(web_sys::RequestCredentials::Include);
700 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
701 if let Some(ref user_agent) = configuration.user_agent {
702 req_builder.headers().set("USER_AGENT", user_agent)?;
703 }
704 req_builder.headers().set("Accept", "application/json")?;
705 let req = wasm_bindgen_futures::JsFuture::from(
706 web_sys::window()
707 .expect("Failed to get Window object")
708 .fetch_with_request(&req_builder),
709 )
710 .await?;
711 assert!(req.is_instance_of::<web_sys::Response>());
712 let resp: web_sys::Response = req
713 .dyn_into()
714 .expect("Failed to dynamically cast JsFuture into Response");
715 super::handle_response(resp).await
716}
717
718pub async fn create_native_registration_flow(
720 configuration: &configuration::Configuration,
721 return_session_token_exchange_code: Option<bool>,
722 return_to: Option<&str>,
723 organization: Option<&str>,
724 identity_schema: Option<&str>,
725) -> Result<models::RegistrationFlow, Error<CreateNativeRegistrationFlowError>> {
726 let mut uri_str = String::new();
727 uri_str.push_str(&configuration.base_path);
728 uri_str.push_str("/self-service/registration/api");
729 let client = web_sys::RequestInit::new();
730 client.set_method("GET");
731 client.set_mode(web_sys::RequestMode::Cors);
732 client.set_credentials(web_sys::RequestCredentials::Include);
733 let mut is_first_query: bool = true;
734 if let Some(ref str) = return_session_token_exchange_code {
735 uri_str.add_query(
736 &mut is_first_query,
737 "return_session_token_exchange_code=",
738 &str.to_string(),
739 );
740 }
741 if let Some(ref str) = return_to {
742 uri_str.add_query(&mut is_first_query, "return_to=", &str.to_string());
743 }
744 if let Some(ref str) = organization {
745 uri_str.add_query(&mut is_first_query, "organization=", &str.to_string());
746 }
747 if let Some(ref str) = identity_schema {
748 uri_str.add_query(&mut is_first_query, "identity_schema=", &str.to_string());
749 }
750 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
751 if let Some(ref user_agent) = configuration.user_agent {
752 req_builder.headers().set("USER_AGENT", user_agent)?;
753 }
754 req_builder.headers().set("Accept", "application/json")?;
755 let req = wasm_bindgen_futures::JsFuture::from(
756 web_sys::window()
757 .expect("Failed to get Window object")
758 .fetch_with_request(&req_builder),
759 )
760 .await?;
761 assert!(req.is_instance_of::<web_sys::Response>());
762 let resp: web_sys::Response = req
763 .dyn_into()
764 .expect("Failed to dynamically cast JsFuture into Response");
765 super::handle_response(resp).await
766}
767
768pub async fn create_native_settings_flow(
770 configuration: &configuration::Configuration,
771 x_session_token: Option<&str>,
772) -> Result<models::SettingsFlow, Error<CreateNativeSettingsFlowError>> {
773 let mut uri_str = String::new();
774 uri_str.push_str(&configuration.base_path);
775 uri_str.push_str("/self-service/settings/api");
776 let client = web_sys::RequestInit::new();
777 client.set_method("GET");
778 client.set_mode(web_sys::RequestMode::Cors);
779 client.set_credentials(web_sys::RequestCredentials::Include);
780 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
781 if let Some(ref user_agent) = configuration.user_agent {
782 req_builder.headers().set("USER_AGENT", user_agent)?;
783 }
784 if let Some(x_session_token) = x_session_token {
785 req_builder
786 .headers()
787 .set("X-Session-Token", x_session_token)?;
788 }
789 req_builder.headers().set("Accept", "application/json")?;
790 let req = wasm_bindgen_futures::JsFuture::from(
791 web_sys::window()
792 .expect("Failed to get Window object")
793 .fetch_with_request(&req_builder),
794 )
795 .await?;
796 assert!(req.is_instance_of::<web_sys::Response>());
797 let resp: web_sys::Response = req
798 .dyn_into()
799 .expect("Failed to dynamically cast JsFuture into Response");
800 super::handle_response(resp).await
801}
802
803pub async fn create_native_verification_flow(
805 configuration: &configuration::Configuration,
806 return_to: Option<&str>,
807) -> Result<models::VerificationFlow, Error<CreateNativeVerificationFlowError>> {
808 let mut uri_str = String::new();
809 uri_str.push_str(&configuration.base_path);
810 uri_str.push_str("/self-service/verification/api");
811 let client = web_sys::RequestInit::new();
812 client.set_method("GET");
813 client.set_mode(web_sys::RequestMode::Cors);
814 client.set_credentials(web_sys::RequestCredentials::Include);
815 let mut is_first_query: bool = true;
816 if let Some(ref str) = return_to {
817 uri_str.add_query(&mut is_first_query, "return_to=", &str.to_string());
818 }
819 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
820 if let Some(ref user_agent) = configuration.user_agent {
821 req_builder.headers().set("USER_AGENT", user_agent)?;
822 }
823 req_builder.headers().set("Accept", "application/json")?;
824 let req = wasm_bindgen_futures::JsFuture::from(
825 web_sys::window()
826 .expect("Failed to get Window object")
827 .fetch_with_request(&req_builder),
828 )
829 .await?;
830 assert!(req.is_instance_of::<web_sys::Response>());
831 let resp: web_sys::Response = req
832 .dyn_into()
833 .expect("Failed to dynamically cast JsFuture into Response");
834 super::handle_response(resp).await
835}
836
837pub async fn disable_my_other_sessions(
839 configuration: &configuration::Configuration,
840 x_session_token: Option<&str>,
841 cookie: Option<&str>,
842) -> Result<models::DeleteMySessionsCount, Error<DisableMyOtherSessionsError>> {
843 let mut uri_str = String::new();
844 uri_str.push_str(&configuration.base_path);
845 uri_str.push_str("/sessions");
846 let client = web_sys::RequestInit::new();
847 client.set_method("DELETE");
848 client.set_mode(web_sys::RequestMode::Cors);
849 client.set_credentials(web_sys::RequestCredentials::Include);
850 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
851 if let Some(ref user_agent) = configuration.user_agent {
852 req_builder.headers().set("USER_AGENT", user_agent)?;
853 }
854 if let Some(x_session_token) = x_session_token {
855 req_builder
856 .headers()
857 .set("X-Session-Token", x_session_token)?;
858 }
859 if let Some(cookie) = cookie {
860 req_builder.headers().set("Cookie", cookie)?;
861 }
862 req_builder.headers().set("Accept", "application/json")?;
863 let req = wasm_bindgen_futures::JsFuture::from(
864 web_sys::window()
865 .expect("Failed to get Window object")
866 .fetch_with_request(&req_builder),
867 )
868 .await?;
869 assert!(req.is_instance_of::<web_sys::Response>());
870 let resp: web_sys::Response = req
871 .dyn_into()
872 .expect("Failed to dynamically cast JsFuture into Response");
873 super::handle_response(resp).await
874}
875
876pub async fn disable_my_session(
878 configuration: &configuration::Configuration,
879 id: &str,
880 x_session_token: Option<&str>,
881 cookie: Option<&str>,
882) -> Result<(), Error<DisableMySessionError>> {
883 let id = crate::wasm_apis::urlencode(id);
884 let mut uri_str = String::new();
885 uri_str.push_str(&configuration.base_path);
886 uri_str.push_str("/sessions/");
887 uri_str.push_str(&id);
888 let client = web_sys::RequestInit::new();
889 client.set_method("DELETE");
890 client.set_mode(web_sys::RequestMode::Cors);
891 client.set_credentials(web_sys::RequestCredentials::Include);
892 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
893 if let Some(ref user_agent) = configuration.user_agent {
894 req_builder.headers().set("USER_AGENT", user_agent)?;
895 }
896 if let Some(x_session_token) = x_session_token {
897 req_builder
898 .headers()
899 .set("X-Session-Token", x_session_token)?;
900 }
901 if let Some(cookie) = cookie {
902 req_builder.headers().set("Cookie", cookie)?;
903 }
904 req_builder.headers().set("Accept", "application/json")?;
905 let req = wasm_bindgen_futures::JsFuture::from(
906 web_sys::window()
907 .expect("Failed to get Window object")
908 .fetch_with_request(&req_builder),
909 )
910 .await?;
911 assert!(req.is_instance_of::<web_sys::Response>());
912 let resp: web_sys::Response = req
913 .dyn_into()
914 .expect("Failed to dynamically cast JsFuture into Response");
915 super::handle_empty_response(resp).await
916}
917
918pub async fn exchange_session_token(
919 configuration: &configuration::Configuration,
920 init_code: &str,
921 return_to_code: &str,
922) -> Result<models::SuccessfulNativeLogin, Error<ExchangeSessionTokenError>> {
923 let mut uri_str = String::new();
924 uri_str.push_str(&configuration.base_path);
925 uri_str.push_str("/sessions/token-exchange");
926 let client = web_sys::RequestInit::new();
927 client.set_method("GET");
928 client.set_mode(web_sys::RequestMode::Cors);
929 client.set_credentials(web_sys::RequestCredentials::Include);
930 let mut is_first_query: bool = true;
931 uri_str.add_query(&mut is_first_query, "init_code=", &init_code.to_string());
932 uri_str.add_query(
933 &mut is_first_query,
934 "return_to_code=",
935 &return_to_code.to_string(),
936 );
937 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
938 if let Some(ref user_agent) = configuration.user_agent {
939 req_builder.headers().set("USER_AGENT", user_agent)?;
940 }
941 req_builder.headers().set("Accept", "application/json")?;
942 let req = wasm_bindgen_futures::JsFuture::from(
943 web_sys::window()
944 .expect("Failed to get Window object")
945 .fetch_with_request(&req_builder),
946 )
947 .await?;
948 assert!(req.is_instance_of::<web_sys::Response>());
949 let resp: web_sys::Response = req
950 .dyn_into()
951 .expect("Failed to dynamically cast JsFuture into Response");
952 super::handle_response(resp).await
953}
954
955pub async fn get_flow_error(
957 configuration: &configuration::Configuration,
958 id: &str,
959) -> Result<models::FlowError, Error<GetFlowErrorError>> {
960 let mut uri_str = String::new();
961 uri_str.push_str(&configuration.base_path);
962 uri_str.push_str("/self-service/errors");
963 let client = web_sys::RequestInit::new();
964 client.set_method("GET");
965 client.set_mode(web_sys::RequestMode::Cors);
966 client.set_credentials(web_sys::RequestCredentials::Include);
967 let mut is_first_query: bool = true;
968 uri_str.add_query(&mut is_first_query, "id=", &id.to_string());
969 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
970 if let Some(ref user_agent) = configuration.user_agent {
971 req_builder.headers().set("USER_AGENT", user_agent)?;
972 }
973 req_builder.headers().set("Accept", "application/json")?;
974 let req = wasm_bindgen_futures::JsFuture::from(
975 web_sys::window()
976 .expect("Failed to get Window object")
977 .fetch_with_request(&req_builder),
978 )
979 .await?;
980 assert!(req.is_instance_of::<web_sys::Response>());
981 let resp: web_sys::Response = req
982 .dyn_into()
983 .expect("Failed to dynamically cast JsFuture into Response");
984 super::handle_response(resp).await
985}
986
987pub async fn get_login_flow(
989 configuration: &configuration::Configuration,
990 id: &str,
991 cookie: Option<&str>,
992) -> Result<models::LoginFlow, Error<GetLoginFlowError>> {
993 let mut uri_str = String::new();
994 uri_str.push_str(&configuration.base_path);
995 uri_str.push_str("/self-service/login/flows");
996 let client = web_sys::RequestInit::new();
997 client.set_method("GET");
998 client.set_mode(web_sys::RequestMode::Cors);
999 client.set_credentials(web_sys::RequestCredentials::Include);
1000 let mut is_first_query: bool = true;
1001 uri_str.add_query(&mut is_first_query, "id=", &id.to_string());
1002 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
1003 if let Some(ref user_agent) = configuration.user_agent {
1004 req_builder.headers().set("USER_AGENT", user_agent)?;
1005 }
1006 if let Some(cookie) = cookie {
1007 req_builder.headers().set("Cookie", cookie)?;
1008 }
1009 req_builder.headers().set("Accept", "application/json")?;
1010 let req = wasm_bindgen_futures::JsFuture::from(
1011 web_sys::window()
1012 .expect("Failed to get Window object")
1013 .fetch_with_request(&req_builder),
1014 )
1015 .await?;
1016 assert!(req.is_instance_of::<web_sys::Response>());
1017 let resp: web_sys::Response = req
1018 .dyn_into()
1019 .expect("Failed to dynamically cast JsFuture into Response");
1020 super::handle_response(resp).await
1021}
1022
1023pub async fn get_recovery_flow(
1025 configuration: &configuration::Configuration,
1026 id: &str,
1027 cookie: Option<&str>,
1028) -> Result<models::RecoveryFlow, Error<GetRecoveryFlowError>> {
1029 let mut uri_str = String::new();
1030 uri_str.push_str(&configuration.base_path);
1031 uri_str.push_str("/self-service/recovery/flows");
1032 let client = web_sys::RequestInit::new();
1033 client.set_method("GET");
1034 client.set_mode(web_sys::RequestMode::Cors);
1035 client.set_credentials(web_sys::RequestCredentials::Include);
1036 let mut is_first_query: bool = true;
1037 uri_str.add_query(&mut is_first_query, "id=", &id.to_string());
1038 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
1039 if let Some(ref user_agent) = configuration.user_agent {
1040 req_builder.headers().set("USER_AGENT", user_agent)?;
1041 }
1042 if let Some(cookie) = cookie {
1043 req_builder.headers().set("Cookie", cookie)?;
1044 }
1045 req_builder.headers().set("Accept", "application/json")?;
1046 let req = wasm_bindgen_futures::JsFuture::from(
1047 web_sys::window()
1048 .expect("Failed to get Window object")
1049 .fetch_with_request(&req_builder),
1050 )
1051 .await?;
1052 assert!(req.is_instance_of::<web_sys::Response>());
1053 let resp: web_sys::Response = req
1054 .dyn_into()
1055 .expect("Failed to dynamically cast JsFuture into Response");
1056 super::handle_response(resp).await
1057}
1058
1059pub async fn get_registration_flow(
1061 configuration: &configuration::Configuration,
1062 id: &str,
1063 cookie: Option<&str>,
1064) -> Result<models::RegistrationFlow, Error<GetRegistrationFlowError>> {
1065 let mut uri_str = String::new();
1066 uri_str.push_str(&configuration.base_path);
1067 uri_str.push_str("/self-service/registration/flows");
1068 let client = web_sys::RequestInit::new();
1069 client.set_method("GET");
1070 client.set_mode(web_sys::RequestMode::Cors);
1071 client.set_credentials(web_sys::RequestCredentials::Include);
1072 let mut is_first_query: bool = true;
1073 uri_str.add_query(&mut is_first_query, "id=", &id.to_string());
1074 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
1075 if let Some(ref user_agent) = configuration.user_agent {
1076 req_builder.headers().set("USER_AGENT", user_agent)?;
1077 }
1078 if let Some(cookie) = cookie {
1079 req_builder.headers().set("Cookie", cookie)?;
1080 }
1081 req_builder.headers().set("Accept", "application/json")?;
1082 let req = wasm_bindgen_futures::JsFuture::from(
1083 web_sys::window()
1084 .expect("Failed to get Window object")
1085 .fetch_with_request(&req_builder),
1086 )
1087 .await?;
1088 assert!(req.is_instance_of::<web_sys::Response>());
1089 let resp: web_sys::Response = req
1090 .dyn_into()
1091 .expect("Failed to dynamically cast JsFuture into Response");
1092 super::handle_response(resp).await
1093}
1094
1095pub async fn get_settings_flow(
1097 configuration: &configuration::Configuration,
1098 id: &str,
1099 x_session_token: Option<&str>,
1100 cookie: Option<&str>,
1101) -> Result<models::SettingsFlow, Error<GetSettingsFlowError>> {
1102 let mut uri_str = String::new();
1103 uri_str.push_str(&configuration.base_path);
1104 uri_str.push_str("/self-service/settings/flows");
1105 let client = web_sys::RequestInit::new();
1106 client.set_method("GET");
1107 client.set_mode(web_sys::RequestMode::Cors);
1108 client.set_credentials(web_sys::RequestCredentials::Include);
1109 let mut is_first_query: bool = true;
1110 uri_str.add_query(&mut is_first_query, "id=", &id.to_string());
1111 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
1112 if let Some(ref user_agent) = configuration.user_agent {
1113 req_builder.headers().set("USER_AGENT", user_agent)?;
1114 }
1115 if let Some(x_session_token) = x_session_token {
1116 req_builder
1117 .headers()
1118 .set("X-Session-Token", x_session_token)?;
1119 }
1120 if let Some(cookie) = cookie {
1121 req_builder.headers().set("Cookie", cookie)?;
1122 }
1123 req_builder.headers().set("Accept", "application/json")?;
1124 let req = wasm_bindgen_futures::JsFuture::from(
1125 web_sys::window()
1126 .expect("Failed to get Window object")
1127 .fetch_with_request(&req_builder),
1128 )
1129 .await?;
1130 assert!(req.is_instance_of::<web_sys::Response>());
1131 let resp: web_sys::Response = req
1132 .dyn_into()
1133 .expect("Failed to dynamically cast JsFuture into Response");
1134 super::handle_response(resp).await
1135}
1136
1137pub async fn get_verification_flow(
1139 configuration: &configuration::Configuration,
1140 id: &str,
1141 cookie: Option<&str>,
1142) -> Result<models::VerificationFlow, Error<GetVerificationFlowError>> {
1143 let mut uri_str = String::new();
1144 uri_str.push_str(&configuration.base_path);
1145 uri_str.push_str("/self-service/verification/flows");
1146 let client = web_sys::RequestInit::new();
1147 client.set_method("GET");
1148 client.set_mode(web_sys::RequestMode::Cors);
1149 client.set_credentials(web_sys::RequestCredentials::Include);
1150 let mut is_first_query: bool = true;
1151 uri_str.add_query(&mut is_first_query, "id=", &id.to_string());
1152 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
1153 if let Some(ref user_agent) = configuration.user_agent {
1154 req_builder.headers().set("USER_AGENT", user_agent)?;
1155 }
1156 if let Some(cookie) = cookie {
1157 req_builder.headers().set("cookie", cookie)?;
1158 }
1159 req_builder.headers().set("Accept", "application/json")?;
1160 let req = wasm_bindgen_futures::JsFuture::from(
1161 web_sys::window()
1162 .expect("Failed to get Window object")
1163 .fetch_with_request(&req_builder),
1164 )
1165 .await?;
1166 assert!(req.is_instance_of::<web_sys::Response>());
1167 let resp: web_sys::Response = req
1168 .dyn_into()
1169 .expect("Failed to dynamically cast JsFuture into Response");
1170 super::handle_response(resp).await
1171}
1172
1173pub async fn get_web_authn_java_script(
1175 configuration: &configuration::Configuration,
1176) -> Result<String, Error<GetWebAuthnJavaScriptError>> {
1177 let mut uri_str = String::new();
1178 uri_str.push_str(&configuration.base_path);
1179 uri_str.push_str("/.well-known/ory/webauthn.js");
1180 let client = web_sys::RequestInit::new();
1181 client.set_method("GET");
1182 client.set_mode(web_sys::RequestMode::Cors);
1183 client.set_credentials(web_sys::RequestCredentials::Include);
1184 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
1185 if let Some(ref user_agent) = configuration.user_agent {
1186 req_builder.headers().set("USER_AGENT", user_agent)?;
1187 }
1188 req_builder.headers().set("Accept", "application/json")?;
1189 let req = wasm_bindgen_futures::JsFuture::from(
1190 web_sys::window()
1191 .expect("Failed to get Window object")
1192 .fetch_with_request(&req_builder),
1193 )
1194 .await?;
1195 assert!(req.is_instance_of::<web_sys::Response>());
1196 let resp: web_sys::Response = req
1197 .dyn_into()
1198 .expect("Failed to dynamically cast JsFuture into Response");
1199 super::handle_response(resp).await
1200}
1201
1202pub async fn list_my_sessions(
1204 configuration: &configuration::Configuration,
1205 per_page: Option<i64>,
1206 page: Option<i64>,
1207 page_size: Option<i64>,
1208 page_token: Option<&str>,
1209 x_session_token: Option<&str>,
1210 cookie: Option<&str>,
1211) -> Result<Vec<models::Session>, Error<ListMySessionsError>> {
1212 let mut uri_str = String::new();
1213 uri_str.push_str(&configuration.base_path);
1214 uri_str.push_str("/sessions");
1215 let client = web_sys::RequestInit::new();
1216 client.set_method("GET");
1217 client.set_mode(web_sys::RequestMode::Cors);
1218 client.set_credentials(web_sys::RequestCredentials::Include);
1219 let mut is_first_query: bool = true;
1220 if let Some(ref str) = per_page {
1221 uri_str.add_query(&mut is_first_query, "per_page=", &str.to_string());
1222 }
1223 if let Some(ref str) = page {
1224 uri_str.add_query(&mut is_first_query, "page=", &str.to_string());
1225 }
1226 if let Some(ref str) = page_size {
1227 uri_str.add_query(&mut is_first_query, "page_size=", &str.to_string());
1228 }
1229 if let Some(ref str) = page_token {
1230 uri_str.add_query(&mut is_first_query, "page_token=", &str.to_string());
1231 }
1232 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
1233 if let Some(ref user_agent) = configuration.user_agent {
1234 req_builder.headers().set("USER_AGENT", user_agent)?;
1235 }
1236 if let Some(x_session_token) = x_session_token {
1237 req_builder
1238 .headers()
1239 .set("X-Session-Token", x_session_token)?;
1240 }
1241 if let Some(cookie) = cookie {
1242 req_builder.headers().set("Cookie", cookie)?;
1243 }
1244 req_builder.headers().set("Accept", "application/json")?;
1245 let req = wasm_bindgen_futures::JsFuture::from(
1246 web_sys::window()
1247 .expect("Failed to get Window object")
1248 .fetch_with_request(&req_builder),
1249 )
1250 .await?;
1251 assert!(req.is_instance_of::<web_sys::Response>());
1252 let resp: web_sys::Response = req
1253 .dyn_into()
1254 .expect("Failed to dynamically cast JsFuture into Response");
1255 super::handle_response(resp).await
1256}
1257
1258pub async fn perform_native_logout(
1260 configuration: &configuration::Configuration,
1261 perform_native_logout_body: models::PerformNativeLogoutBody,
1262) -> Result<(), Error<PerformNativeLogoutError>> {
1263 let mut uri_str = String::new();
1264 uri_str.push_str(&configuration.base_path);
1265 uri_str.push_str("/self-service/logout/api");
1266 let client = web_sys::RequestInit::new();
1267 client.set_method("DELETE");
1268 client.set_mode(web_sys::RequestMode::Cors);
1269 client.set_credentials(web_sys::RequestCredentials::Include);
1270 client.set_body(&JsValue::from_serde(&perform_native_logout_body)?);
1271 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
1272 if let Some(ref user_agent) = configuration.user_agent {
1273 req_builder.headers().set("USER_AGENT", user_agent)?;
1274 }
1275 req_builder.headers().set("Accept", "application/json")?;
1276 req_builder
1277 .headers()
1278 .set("Content-Type", "application/json")?;
1279 let req = wasm_bindgen_futures::JsFuture::from(
1280 web_sys::window()
1281 .expect("Failed to get Window object")
1282 .fetch_with_request(&req_builder),
1283 )
1284 .await?;
1285 assert!(req.is_instance_of::<web_sys::Response>());
1286 let resp: web_sys::Response = req
1287 .dyn_into()
1288 .expect("Failed to dynamically cast JsFuture into Response");
1289 super::handle_empty_response(resp).await
1290}
1291
1292pub async fn to_session(
1294 configuration: &configuration::Configuration,
1295 x_session_token: Option<&str>,
1296 cookie: Option<&str>,
1297 tokenize_as: Option<&str>,
1298) -> Result<models::Session, Error<ToSessionError>> {
1299 let mut uri_str = String::new();
1300 uri_str.push_str(&configuration.base_path);
1301 uri_str.push_str("/sessions/whoami");
1302 let client = web_sys::RequestInit::new();
1303 client.set_method("GET");
1304 client.set_mode(web_sys::RequestMode::Cors);
1305 client.set_credentials(web_sys::RequestCredentials::Include);
1306 let mut is_first_query: bool = true;
1307 if let Some(ref str) = tokenize_as {
1308 uri_str.add_query(&mut is_first_query, "tokenize_as=", &str.to_string());
1309 }
1310 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
1311 if let Some(ref user_agent) = configuration.user_agent {
1312 req_builder.headers().set("USER_AGENT", user_agent)?;
1313 }
1314 if let Some(x_session_token) = x_session_token {
1315 req_builder
1316 .headers()
1317 .set("X-Session-Token", x_session_token)?;
1318 }
1319 if let Some(cookie) = cookie {
1320 req_builder.headers().set("Cookie", cookie)?;
1321 }
1322 req_builder.headers().set("Accept", "application/json")?;
1323 let req = wasm_bindgen_futures::JsFuture::from(
1324 web_sys::window()
1325 .expect("Failed to get Window object")
1326 .fetch_with_request(&req_builder),
1327 )
1328 .await?;
1329 assert!(req.is_instance_of::<web_sys::Response>());
1330 let resp: web_sys::Response = req
1331 .dyn_into()
1332 .expect("Failed to dynamically cast JsFuture into Response");
1333 super::handle_response(resp).await
1334}
1335
1336pub async fn update_fedcm_flow(
1338 configuration: &configuration::Configuration,
1339 update_fedcm_flow_body: models::UpdateFedcmFlowBody,
1340) -> Result<models::SuccessfulNativeLogin, Error<UpdateFedcmFlowError>> {
1341 let mut uri_str = String::new();
1342 uri_str.push_str(&configuration.base_path);
1343 uri_str.push_str("/self-service/fed-cm/token");
1344 let client = web_sys::RequestInit::new();
1345 client.set_method("POST");
1346 client.set_mode(web_sys::RequestMode::Cors);
1347 client.set_credentials(web_sys::RequestCredentials::Include);
1348 client.set_body(&JsValue::from_serde(&update_fedcm_flow_body)?);
1349 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
1350 if let Some(ref user_agent) = configuration.user_agent {
1351 req_builder.headers().set("USER_AGENT", user_agent)?;
1352 }
1353 req_builder.headers().set("Accept", "application/json")?;
1354 req_builder
1355 .headers()
1356 .set("Content-Type", "application/json")?;
1357 let req = wasm_bindgen_futures::JsFuture::from(
1358 web_sys::window()
1359 .expect("Failed to get Window object")
1360 .fetch_with_request(&req_builder),
1361 )
1362 .await?;
1363 assert!(req.is_instance_of::<web_sys::Response>());
1364 let resp: web_sys::Response = req
1365 .dyn_into()
1366 .expect("Failed to dynamically cast JsFuture into Response");
1367 super::handle_response(resp).await
1368}
1369
1370pub async fn update_login_flow(
1372 configuration: &configuration::Configuration,
1373 flow: &str,
1374 update_login_flow_body: models::UpdateLoginFlowBody,
1375 x_session_token: Option<&str>,
1376 cookie: Option<&str>,
1377) -> Result<models::SuccessfulNativeLogin, Error<UpdateLoginFlowError>> {
1378 let mut uri_str = String::new();
1379 uri_str.push_str(&configuration.base_path);
1380 uri_str.push_str("/self-service/login");
1381 let client = web_sys::RequestInit::new();
1382 client.set_method("POST");
1383 client.set_mode(web_sys::RequestMode::Cors);
1384 client.set_credentials(web_sys::RequestCredentials::Include);
1385 client.set_body(&JsValue::from_serde(&update_login_flow_body)?);
1386 let mut is_first_query: bool = true;
1387 uri_str.add_query(&mut is_first_query, "flow=", &flow.to_string());
1388 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
1389 if let Some(ref user_agent) = configuration.user_agent {
1390 req_builder.headers().set("USER_AGENT", user_agent)?;
1391 }
1392 if let Some(x_session_token) = x_session_token {
1393 req_builder
1394 .headers()
1395 .set("X-Session-Token", x_session_token)?;
1396 }
1397 if let Some(cookie) = cookie {
1398 req_builder.headers().set("Cookie", cookie)?;
1399 }
1400 req_builder.headers().set("Accept", "application/json")?;
1401 req_builder
1402 .headers()
1403 .set("Content-Type", "application/json")?;
1404 let req = wasm_bindgen_futures::JsFuture::from(
1405 web_sys::window()
1406 .expect("Failed to get Window object")
1407 .fetch_with_request(&req_builder),
1408 )
1409 .await?;
1410 assert!(req.is_instance_of::<web_sys::Response>());
1411 let resp: web_sys::Response = req
1412 .dyn_into()
1413 .expect("Failed to dynamically cast JsFuture into Response");
1414 super::handle_response(resp).await
1415}
1416
1417pub async fn update_logout_flow(
1419 configuration: &configuration::Configuration,
1420 token: Option<&str>,
1421 return_to: Option<&str>,
1422 cookie: Option<&str>,
1423) -> Result<(), Error<UpdateLogoutFlowError>> {
1424 let mut uri_str = String::new();
1425 uri_str.push_str(&configuration.base_path);
1426 uri_str.push_str("/self-service/logout");
1427 let client = web_sys::RequestInit::new();
1428 client.set_method("GET");
1429 client.set_mode(web_sys::RequestMode::Cors);
1430 client.set_credentials(web_sys::RequestCredentials::Include);
1431 let mut is_first_query: bool = true;
1432 if let Some(ref str) = token {
1433 uri_str.add_query(&mut is_first_query, "token=", &str.to_string());
1434 }
1435 if let Some(ref str) = return_to {
1436 uri_str.add_query(&mut is_first_query, "return_to=", &str.to_string());
1437 }
1438 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
1439 if let Some(ref user_agent) = configuration.user_agent {
1440 req_builder.headers().set("USER_AGENT", user_agent)?;
1441 }
1442 if let Some(cookie) = cookie {
1443 req_builder.headers().set("Cookie", cookie)?;
1444 }
1445 req_builder.headers().set("Accept", "application/json")?;
1446 let req = wasm_bindgen_futures::JsFuture::from(
1447 web_sys::window()
1448 .expect("Failed to get Window object")
1449 .fetch_with_request(&req_builder),
1450 )
1451 .await?;
1452 assert!(req.is_instance_of::<web_sys::Response>());
1453 let resp: web_sys::Response = req
1454 .dyn_into()
1455 .expect("Failed to dynamically cast JsFuture into Response");
1456 super::handle_empty_response(resp).await
1457}
1458
1459pub async fn update_recovery_flow(
1461 configuration: &configuration::Configuration,
1462 flow: &str,
1463 update_recovery_flow_body: models::UpdateRecoveryFlowBody,
1464 token: Option<&str>,
1465 cookie: Option<&str>,
1466) -> Result<models::RecoveryFlow, Error<UpdateRecoveryFlowError>> {
1467 let mut uri_str = String::new();
1468 uri_str.push_str(&configuration.base_path);
1469 uri_str.push_str("/self-service/recovery");
1470 let client = web_sys::RequestInit::new();
1471 client.set_method("POST");
1472 client.set_mode(web_sys::RequestMode::Cors);
1473 client.set_credentials(web_sys::RequestCredentials::Include);
1474 client.set_body(&JsValue::from_serde(&update_recovery_flow_body)?);
1475 let mut is_first_query: bool = true;
1476 uri_str.add_query(&mut is_first_query, "flow=", &flow.to_string());
1477 if let Some(ref str) = token {
1478 uri_str.add_query(&mut is_first_query, "token=", &str.to_string());
1479 }
1480 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
1481 if let Some(ref user_agent) = configuration.user_agent {
1482 req_builder.headers().set("USER_AGENT", user_agent)?;
1483 }
1484 if let Some(cookie) = cookie {
1485 req_builder.headers().set("Cookie", cookie)?;
1486 }
1487 req_builder.headers().set("Accept", "application/json")?;
1488 req_builder
1489 .headers()
1490 .set("Content-Type", "application/json")?;
1491 let req = wasm_bindgen_futures::JsFuture::from(
1492 web_sys::window()
1493 .expect("Failed to get Window object")
1494 .fetch_with_request(&req_builder),
1495 )
1496 .await?;
1497 assert!(req.is_instance_of::<web_sys::Response>());
1498 let resp: web_sys::Response = req
1499 .dyn_into()
1500 .expect("Failed to dynamically cast JsFuture into Response");
1501 super::handle_response(resp).await
1502}
1503
1504pub async fn update_registration_flow(
1506 configuration: &configuration::Configuration,
1507 flow: &str,
1508 update_registration_flow_body: models::UpdateRegistrationFlowBody,
1509 cookie: Option<&str>,
1510) -> Result<models::SuccessfulNativeRegistration, Error<UpdateRegistrationFlowError>> {
1511 let mut uri_str = String::new();
1512 uri_str.push_str(&configuration.base_path);
1513 uri_str.push_str("/self-service/registration");
1514 let client = web_sys::RequestInit::new();
1515 client.set_method("POST");
1516 client.set_mode(web_sys::RequestMode::Cors);
1517 client.set_credentials(web_sys::RequestCredentials::Include);
1518 client.set_body(&JsValue::from_serde(&update_registration_flow_body)?);
1519 let mut is_first_query: bool = true;
1520 uri_str.add_query(&mut is_first_query, "flow=", &flow.to_string());
1521 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
1522 if let Some(ref user_agent) = configuration.user_agent {
1523 req_builder.headers().set("USER_AGENT", user_agent)?;
1524 }
1525 if let Some(cookie) = cookie {
1526 req_builder.headers().set("Cookie", cookie)?;
1527 }
1528 req_builder.headers().set("Accept", "application/json")?;
1529 req_builder
1530 .headers()
1531 .set("Content-Type", "application/json")?;
1532 let req = wasm_bindgen_futures::JsFuture::from(
1533 web_sys::window()
1534 .expect("Failed to get Window object")
1535 .fetch_with_request(&req_builder),
1536 )
1537 .await?;
1538 assert!(req.is_instance_of::<web_sys::Response>());
1539 let resp: web_sys::Response = req
1540 .dyn_into()
1541 .expect("Failed to dynamically cast JsFuture into Response");
1542 super::handle_response(resp).await
1543}
1544
1545pub async fn update_settings_flow(
1547 configuration: &configuration::Configuration,
1548 flow: &str,
1549 update_settings_flow_body: models::UpdateSettingsFlowBody,
1550 x_session_token: Option<&str>,
1551 cookie: Option<&str>,
1552) -> Result<models::SettingsFlow, Error<UpdateSettingsFlowError>> {
1553 let mut uri_str = String::new();
1554 uri_str.push_str(&configuration.base_path);
1555 uri_str.push_str("/self-service/settings");
1556 let client = web_sys::RequestInit::new();
1557 client.set_method("POST");
1558 client.set_mode(web_sys::RequestMode::Cors);
1559 client.set_credentials(web_sys::RequestCredentials::Include);
1560 client.set_body(&JsValue::from_serde(&update_settings_flow_body)?);
1561 let mut is_first_query: bool = true;
1562 uri_str.add_query(&mut is_first_query, "flow=", &flow.to_string());
1563 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
1564 if let Some(ref user_agent) = configuration.user_agent {
1565 req_builder.headers().set("USER_AGENT", user_agent)?;
1566 }
1567 if let Some(x_session_token) = x_session_token {
1568 req_builder
1569 .headers()
1570 .set("X-Session-Token", x_session_token)?;
1571 }
1572 if let Some(cookie) = cookie {
1573 req_builder.headers().set("Cookie", cookie)?;
1574 }
1575 req_builder.headers().set("Accept", "application/json")?;
1576 req_builder
1577 .headers()
1578 .set("Content-Type", "application/json")?;
1579 let req = wasm_bindgen_futures::JsFuture::from(
1580 web_sys::window()
1581 .expect("Failed to get Window object")
1582 .fetch_with_request(&req_builder),
1583 )
1584 .await?;
1585 assert!(req.is_instance_of::<web_sys::Response>());
1586 let resp: web_sys::Response = req
1587 .dyn_into()
1588 .expect("Failed to dynamically cast JsFuture into Response");
1589 super::handle_response(resp).await
1590}
1591
1592pub async fn update_verification_flow(
1594 configuration: &configuration::Configuration,
1595 flow: &str,
1596 update_verification_flow_body: models::UpdateVerificationFlowBody,
1597 token: Option<&str>,
1598 cookie: Option<&str>,
1599) -> Result<models::VerificationFlow, Error<UpdateVerificationFlowError>> {
1600 let mut uri_str = String::new();
1601 uri_str.push_str(&configuration.base_path);
1602 uri_str.push_str("/self-service/verification");
1603 let client = web_sys::RequestInit::new();
1604 client.set_method("POST");
1605 client.set_mode(web_sys::RequestMode::Cors);
1606 client.set_credentials(web_sys::RequestCredentials::Include);
1607 client.set_body(&JsValue::from_serde(&update_verification_flow_body)?);
1608 let mut is_first_query: bool = true;
1609 uri_str.add_query(&mut is_first_query, "flow=", &flow.to_string());
1610 if let Some(ref str) = token {
1611 uri_str.add_query(&mut is_first_query, "token=", &str.to_string());
1612 }
1613 let req_builder = web_sys::Request::new_with_str_and_init(&uri_str, &client)?;
1614 if let Some(ref user_agent) = configuration.user_agent {
1615 req_builder.headers().set("USER_AGENT", user_agent)?;
1616 }
1617 if let Some(cookie) = cookie {
1618 req_builder.headers().set("Cookie", cookie)?;
1619 }
1620 req_builder.headers().set("Accept", "application/json")?;
1621 req_builder
1622 .headers()
1623 .set("Content-Type", "application/json")?;
1624 let req = wasm_bindgen_futures::JsFuture::from(
1625 web_sys::window()
1626 .expect("Failed to get Window object")
1627 .fetch_with_request(&req_builder),
1628 )
1629 .await?;
1630 assert!(req.is_instance_of::<web_sys::Response>());
1631 let resp: web_sys::Response = req
1632 .dyn_into()
1633 .expect("Failed to dynamically cast JsFuture into Response");
1634 super::handle_response(resp).await
1635}