52 lines
1.1 KiB
TypeScript
52 lines
1.1 KiB
TypeScript
import { type DefAPINamespace, GET, POST } from "./defs.js";
|
|
|
|
export type LoginResponse = {
|
|
result: true,
|
|
nextToken: [number, string] | undefined,
|
|
}
|
|
|
|
export type LoginFailed = {
|
|
result: false,
|
|
reqOTP: boolean,
|
|
reason: string,
|
|
}
|
|
|
|
|
|
export type AutoLoginNonceResponse = {
|
|
result: true,
|
|
loginNonce: string,
|
|
};
|
|
|
|
export type AutoLoginResponse = {
|
|
result: true,
|
|
nextToken: [number, string] | undefined,
|
|
}
|
|
|
|
|
|
export type AutoLoginFailed = {
|
|
result: false,
|
|
silent: boolean,
|
|
reason: string,
|
|
}
|
|
|
|
/** @internal */
|
|
export const structure = {
|
|
Login: {
|
|
LoginByID: POST<{
|
|
id: string,
|
|
password: string,
|
|
}, LoginResponse, LoginFailed>(),
|
|
LoginByToken: POST<{
|
|
hashedToken: string,
|
|
token_id: number,
|
|
}, AutoLoginResponse, AutoLoginFailed>(),
|
|
ReqNonce: GET<AutoLoginNonceResponse, AutoLoginFailed>(),
|
|
test: GET<{result: true, hello:'world'}>(),
|
|
},
|
|
GetGameLoginToken: GET<{
|
|
result: true,
|
|
gameLoginToken: string,
|
|
userID: number,
|
|
}>(),
|
|
|
|
} satisfies DefAPINamespace; |