-
Notifications
You must be signed in to change notification settings - Fork 1
/
password.ts
82 lines (66 loc) · 1.84 KB
/
password.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import {get, post} from "./index";
// 密码创建
export interface PasswordCreateRequest {
uin: number;
password: string;
device_seed: number;
protocol: number;
}
// 提交滑块ticket
export interface SubmitTicketRequest {
uin: number;
protocol: number;
ticket: string;
}
// 请求短信验证码
export interface RequestSmsRequest {
uin: number;
protocol: number;
}
// 提交短信验证码
export interface SubmitSmsRequest {
uin: number;
protocol: number;
sms: string;
}
// 删除客户端
export interface PasswordDeleteClientRequest {
uin: number;
protocol: number;
}
// 密码登录响应
export interface LoginResponse {
state: string;
captcha_url?: string;
verify_url?: string;
sms_phone?: string;
message?: string;
}
export interface PasswordListClientResponse {
clients: PasswordClient[];
}
export interface PasswordClient {
uin: number;
protocol: number;
resp: LoginResponse;
}
export interface BaseResponse {
}
export const passwordCreate = async (req: PasswordCreateRequest): Promise<LoginResponse> => {
return await post("/login/password/create", req)
}
export const passwordSubmitTicket = async (req: SubmitTicketRequest): Promise<LoginResponse> => {
return await post("/login/password/submit_ticket", req)
}
export const passwordRequestSms = async (req: RequestSmsRequest): Promise<LoginResponse> => {
return await post("/login/password/request_sms", req)
}
export const passwordSubmitSms = async (req: SubmitSmsRequest): Promise<LoginResponse> => {
return await post("/login/password/submit_sms", req)
}
export const passwordDeleteClient = async (req: PasswordDeleteClientRequest): Promise<BaseResponse> => {
return await post("/login/password/delete", req)
}
export const passwordListClient = async (): Promise<PasswordListClientResponse> => {
return await get("/login/password/list")
}