From 8a96cb321c8d65cfd549471b4f6d2c8c9458a017 Mon Sep 17 00:00:00 2001 From: spacemeowx2 Date: Mon, 5 Jun 2023 23:26:01 +0800 Subject: [PATCH] feat: add list-method opt and its query --- s3si.ts | 7 ++++++- src/app.ts | 4 ++++ src/constant.ts | 1 + src/types.ts | 6 ++++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/s3si.ts b/s3si.ts index f904804..cae0203 100644 --- a/s3si.ts +++ b/s3si.ts @@ -4,7 +4,7 @@ import { flags } from "./deps.ts"; const parseArgs = (args: string[]) => { const parsed = flags.parse(args, { - string: ["profilePath", "exporter", "skipMode"], + string: ["profilePath", "exporter", "skipMode", "listMethod"], boolean: ["help", "noProgress", "monitor", "withSummary"], alias: { "help": "h", @@ -14,6 +14,7 @@ const parseArgs = (args: string[]) => { "monitor": ["m"], "skipMode": ["s", "skip-mode"], "withSummary": "with-summary", + "listMethod": "list-method", }, }); return parsed; @@ -29,6 +30,10 @@ Options: --exporter , -e Exporter list to use (default: stat.ink) Multiple exporters can be separated by commas (e.g. "stat.ink,file") + --list-method When set to "latest", the latest 50 matches will be obtained. + When set to "all", matches of all modes will be obtained with a maximum of 250 matches (5 modes x 50 matches). + When set to "auto", the latest 50 matches will be obtained. If 50 matches have not been uploaded yet, matches will be obtained from the list of all modes. + "auto" is the default setting. --no-progress, -n Disable progress bar --monitor, -m Monitor mode --skip-mode , -s Skip mode (default: null) diff --git a/src/app.ts b/src/app.ts index be9e13f..dbd6e6c 100644 --- a/src/app.ts +++ b/src/app.ts @@ -10,6 +10,8 @@ import { delay, showError } from "./utils.ts"; import { GameFetcher } from "./GameFetcher.ts"; import { DEFAULT_ENV, Env } from "./env.ts"; +export type ListMethod = "latest" | "all" | "auto"; + export type Opts = { profilePath: string; exporter: string; @@ -17,6 +19,7 @@ export type Opts = { monitor: boolean; withSummary: boolean; skipMode?: string; + listMethod: string; cache?: Cache; stateBackend?: StateBackend; env: Env; @@ -28,6 +31,7 @@ export const DEFAULT_OPTS: Opts = { noProgress: false, monitor: false, withSummary: false, + listMethod: "auto", env: DEFAULT_ENV, }; diff --git a/src/constant.ts b/src/constant.ts index 45e0056..af265f4 100644 --- a/src/constant.ts +++ b/src/constant.ts @@ -10,6 +10,7 @@ export enum Queries { RegularBattleHistoriesQuery = "3baef04b095ad8975ea679d722bc17de", BankaraBattleHistoriesQuery = "0438ea6978ae8bd77c5d1250f4f84803", XBattleHistoriesQuery = "6796e3cd5dc3ebd51864dc709d899fc5", + EventBattleHistoriesQuery = "9744fcf676441873c7c8a51285b6aa4d", PrivateBattleHistoriesQuery = "8e5ae78b194264a6c230e262d069bd28", VsHistoryDetailQuery = "9ee0099fbe3d8db2a838a75cf42856dd", CoopHistoryQuery = "91b917becd2fa415890f5b47e15ffb15", diff --git a/src/types.ts b/src/types.ts index 1d3d0d0..1643ca8 100644 --- a/src/types.ts +++ b/src/types.ts @@ -8,6 +8,7 @@ export type VarsMap = { [Queries.RegularBattleHistoriesQuery]: []; [Queries.BankaraBattleHistoriesQuery]: []; [Queries.XBattleHistoriesQuery]: []; + [Queries.EventBattleHistoriesQuery]: []; [Queries.PrivateBattleHistoriesQuery]: []; [Queries.VsHistoryDetailQuery]: [{ vsResultId: string; @@ -415,6 +416,11 @@ export type RespMap = { }; [Queries.BankaraBattleHistoriesQuery]: BankaraBattleHistories; [Queries.XBattleHistoriesQuery]: XBattleHistories; + [Queries.EventBattleHistoriesQuery]: { + eventBattleHistories: { + historyGroups: HistoryGroups; + }; + }; [Queries.PrivateBattleHistoriesQuery]: { privateBattleHistories: { historyGroups: HistoryGroups;