feat: 여러턴 예약을 ReserveBulkdCommand로 대체
This commit is contained in:
+7
-6
@@ -3,17 +3,17 @@ import { APIPathGen } from "./util/APIPathGen";
|
||||
import { callSammoAPI, type ValidResponse } from "./util/callSammoAPI";
|
||||
export type { ValidResponse, InvalidResponse };
|
||||
|
||||
async function done<ResultType extends ValidResponse>(args?: Record<string, unknown>): Promise<ResultType>;
|
||||
async function done<ResultType extends ValidResponse>(args: Record<string, unknown> | undefined, returnError: false): Promise<ResultType>;
|
||||
async function done<ResultType extends ValidResponse, ErrorType extends InvalidResponse>(args: Record<string, unknown> | undefined, returnError: true): Promise<ResultType | ErrorType>;
|
||||
async function done<ResultType extends ValidResponse>(args?: Record<string, unknown> | Record<string, unknown>[]): Promise<ResultType>;
|
||||
async function done<ResultType extends ValidResponse>(args: Record<string, unknown> | Record<string, unknown>[] | undefined, returnError: false): Promise<ResultType>;
|
||||
async function done<ResultType extends ValidResponse, ErrorType extends InvalidResponse>(args: Record<string, unknown> | Record<string, unknown>[] | undefined, returnError: true): Promise<ResultType | ErrorType>;
|
||||
|
||||
async function done<ResultType extends ValidResponse, ErrorType extends InvalidResponse>(args?: Record<string, unknown>, returnError = false): Promise<ResultType | ErrorType> {
|
||||
async function done<ResultType extends ValidResponse, ErrorType extends InvalidResponse>(args?: Record<string, unknown> | Record<string, unknown>[], returnError = false): Promise<ResultType | ErrorType> {
|
||||
console.error(`Can't directly call. ${args}, ${returnError}. Use auto-generated path API.`);
|
||||
return callSammoAPI<ResultType, ErrorType>([], args, true);
|
||||
}
|
||||
|
||||
const apiRealPath = {
|
||||
Betting:{
|
||||
Betting: {
|
||||
Bet: done,
|
||||
GetBettingDetail: done,
|
||||
GetBettingList: done,
|
||||
@@ -23,6 +23,7 @@ const apiRealPath = {
|
||||
PushCommand: done,
|
||||
RepeatCommand: done,
|
||||
ReserveCommand: done,
|
||||
ReserveBulkCommand: done,
|
||||
},
|
||||
General: {
|
||||
Join: done,
|
||||
@@ -54,7 +55,7 @@ const apiRealPath = {
|
||||
} as const;
|
||||
|
||||
export const SammoAPI = APIPathGen<typeof done, typeof apiRealPath>(apiRealPath, (path: string[]) => {
|
||||
return (args?: Record<string, unknown>, returnError?: boolean) => {
|
||||
return (args?: Record<string, unknown> | Record<string, unknown>[], returnError?: boolean) => {
|
||||
if (returnError) {
|
||||
return callSammoAPI(path.join('/'), args, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user