roblox_api/api/auth_token_service/
v1.rs1use serde::{Deserialize, Serialize};
2
3use crate::{DateTime, endpoint};
4
5pub const URL: &str = "https://apis.roblox.com/auth-token-service/v1";
6
7#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
10pub enum LoginStatus {
11 Created,
12 Validated,
13}
14
15#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
16#[serde(rename_all = "camelCase")]
17pub struct LoginToken {
18 pub code: String,
19 pub status: String,
20 pub private_key: String,
21 pub expiration_time: DateTime,
22 pub image_path: String,
23}
24
25#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
26#[serde(rename_all = "camelCase")]
27pub struct LoginTokenStatus {
28 pub status: LoginStatus,
29 pub account_name: Option<String>,
30 pub account_picture_url: Option<String>,
31 pub expiration_time: String,
32}
33
34#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)]
35#[serde(rename_all = "camelCase")]
36pub struct InspectionInfo {
37 pub location: String,
38 pub device_info: String,
39}
40
41endpoint! {
42 login_create() -> LoginToken {
43 POST "{URL}/login/create";
44 }
45
46 login_cancel(code: &str) -> () {
47 POST "{URL}/login/cancel";
48 types {
49 Request<'a> {
50 code: &'a str,
51 }
52 }
53 body_serialize {
54 &Request { code }
55 }
56
57 void
58 }
59
60 login_status(code: &str, key: &str) -> LoginTokenStatus {
61 POST "{URL}/login/status";
62 types {
63 Request<'a> {
64 code: &'a str,
65 key("privateKey"): &'a str,
66 }
67 }
68 body_serialize {
69 &Request { code, key }
70 }
71 }
72
73 inspect_code(code: &str) -> InspectionInfo {
74 POST "{URL}/login/enterCode";
75 types {
76 Request<'a> {
77 code: &'a str,
78 }
79 }
80 body_serialize {
81 &Request { code }
82 }
83 }
84
85 validate_code(code: &str) -> () {
86 POST "{URL}/login/validateCode";
87 types {
88 Request<'a> {
89 code: &'a str,
90 }
91 }
92 body_serialize {
93 &Request { code }
94 }
95
96 void
97 }
98
99 qr_code_image(key: &str, code: &str) -> Vec<u8> {
100 GET "{URL}/login/qr-code-image";
101 query {
102 "key" => key,
103 "code" => code,
104 }
105 raw_bytes
106 }
107}