roblox_api/api/two_step_verification/
v1.rs1use serde::{Deserialize, Serialize};
2use strum_macros::{Display, EnumString};
3
4use crate::endpoint;
5
6pub const URL: &str = "https://twostepverification.roblox.com/v1";
7
8#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq, Display, EnumString)]
9#[serde(rename_all = "lowercase")]
10pub enum TwoStepMethodType {
11 Authenticator,
12 Email,
13 #[serde(rename = "cross-device")]
14 CrossDevice,
15}
16
17#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
18#[serde(rename_all = "camelCase")]
19pub struct TwoStepMethods {
20 pub is_user_verified: bool,
21 pub primary: Option<TwoStepMethodType>,
22 pub methods: Vec<TwoStepMethodType>,
23}
24
25#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
26#[serde(rename_all = "camelCase")]
27pub struct TwoStepVerify {
28 pub is_two_step_verification_enabled: bool,
29 pub ticket: Option<String>,
30}
31
32endpoint! {
33 authenticator_verify(id: u64, code: &str, challenge_id: &str, method: &str) -> TwoStepVerify {
34 POST "{URL}/users/{id}/channels/authenticator/verify";
35
36 types {
37 Request<'a> {
38 code("code"): &'a str,
39 challenge_id("challengeId"): &'a str,
40 method("verificationMethod"): &'a str,
41 }
42 }
43
44 body_serialize {
45 Request { code, challenge_id, method }
46 }
47 }
48}