71 lines
1.4 KiB
TypeScript
71 lines
1.4 KiB
TypeScript
import { GET, POST, type DefAPINamespace } from "@strpc/def";
|
|
|
|
//굳이 할 필요는 없지만, d.ts가 깔끔해짐
|
|
import type {
|
|
InvalidResponse, ValidResponse
|
|
} from "@strpc/def";
|
|
import type {
|
|
ArgDeleteAPI,
|
|
ArgGetAPI,
|
|
ArgHeadAPI,
|
|
ArgPatchAPI,
|
|
ArgPostAPI,
|
|
ArgPutAPI,
|
|
EmptyDeleteAPI,
|
|
EmptyGetAPI,
|
|
EmptyHeadAPI,
|
|
EmptyPatchAPI,
|
|
EmptyPostAPI,
|
|
EmptyPutAPI,
|
|
} from "@strpc/def/types";
|
|
|
|
|
|
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>(),
|
|
},
|
|
GetGameLoginToken: GET<{
|
|
result: true,
|
|
gameLoginToken: string,
|
|
userID: number,
|
|
}>(),
|
|
|
|
} satisfies DefAPINamespace; |