import {z} from 'zod' export type Region = 'JP' | 'NA' | 'CN' | 'KR' | 'TW'; export type Language = 'jp' | 'en'; export type GetApiNiceRegionScriptScriptIdArgs = {region: Region, script_id: string, lang?: (Language | null) | undefined}; export type GetApiNiceRegionScriptScriptIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; export const niceQuestType = z.enum(["main", "free", "friendship", "event", "heroballad", "warBoard", "autoExecute"]); export const niceQuestFlag = z.enum(["none", "noBattle", "raid", "raidConnection", "noContinue", "noDisplayRemain", "raidLastDay", "closedHideCostItem", "closedHideCostNum", "closedHideProgress", "closedHideRecommendLv", "closedHideTrendClass", "closedHideReward", "noDisplayConsume", "superBoss", "noDisplayMissionNotify", "hideProgress", "dropFirstTimeOnly", "chapterSubIdJapaneseNumeralsCalligraphy", "supportOnlyForceBattle", "eventDeckNoSupport", "fatigueBattle", "supportSelectAfterScript", "branch", "userEventDeck", "noDisplayRaidRemain", "questMaxDamageRecord", "enableFollowQuest", "supportSvtMultipleSet", "supportOnlyBattle", "actConsumeBattleWin", "vote", "hideMaster", "disableMasterSkill", "disableCommandSpeel", "supportSvtEditablePosition", "branchScenario", "questKnockdownRecord", "notRetrievable", "displayLoopmark", "boostItemConsumeBattleWin", "playScenarioWithMapscreen", "battleRetreatQuestClear", "battleResultLoseQuestClear", "branchHaving", "noDisplayNextIcon", "windowOnly", "changeMasters", "notDisplayResultGetPoint", "forceToNoDrop", "displayConsumeIcon", "harvest", "reconstruction", "enemyImmediateAppear", "noSupportList", "live", "forceDisplayEnemyInfo", "alloutBattle", "recollection", "notSingleSupportOnly", "disableChapterSub"]); export const niceConsumeType = z.enum(["none", "ap", "rp", "item", "apAndItem"]); export const niceItemType = z.enum(["qp", "stone", "apRecover", "apAdd", "mana", "key", "gachaClass", "gachaRelic", "gachaTicket", "limit", "skillLvUp", "tdLvUp", "friendPoint", "eventPoint", "eventItem", "questRewardQp", "chargeStone", "rpAdd", "boostItem", "stoneFragments", "anonymous", "rarePri", "costumeRelease", "itemSelect", "commandCardPrmUp", "dice", "continueItem", "euqipSkillUseItem", "svtCoin", "friendshipUpItem", "purePri", "tradeAp", "revivalItem", "stormpod", "battleItem", "aniplexPlusChargeStone", "purePriShopReset", "exchangeSvtCoin", "reduceTradeTime", "eventPassiveSkillGiven", "classBoardResetItem", "netmarbleChargeStone"]); export const niceItemUse = z.enum(["skill", "appendSkill", "ascension", "costume"]); export const trait = z.enum(["unknown", "genderMale", "genderFemale", "genderUnknown", "classSaber", "classLancer", "classArcher", "classRider", "classCaster", "classAssassin", "classBerserker", "classShielder", "classRuler", "classAlterEgo", "classAvenger", "classDemonGodPillar", "classLoreGrandCaster", "classBeastI", "classBeastII", "classMoonCancer", "classBeastIIIR", "classForeigner", "classBeastIIIL", "classBeastUnknown", "classPretender", "classUOlgaMarie", "classUOlgaMarieGrand", "classGrandUnBeastUOlgaMarieAlienGod", "classAquaFragment", "classUOlgaMarieStellar", "classUnBeastOlgaMarie", "classGrandSaber", "classGrandLancer", "classGrandArcher", "classGrandRider", "classGrandCaster", "classGrandAssassin", "classGrandBerserker", "classGrandShielder", "classGrandRuler", "classGrandAlterego", "classGrandAvenger", "classGrandMoonCancer", "classGrandForeigner", "classGrandPretender", "classGrandUnBeast", "attributeSky", "attributeEarth", "attributeHuman", "attributeStar", "attributeBeast", "alignmentLawful", "alignmentChaotic", "alignmentNeutral", "alignmentGood", "alignmentEvil", "alignmentBalanced", "alignmentMadness", "alignmentSummer", "basedOnServant", "human", "undead", "artificialDemon", "demonBeast", "daemon", "demon", "soldier", "amazoness", "skeleton", "zombie", "ghost", "automata", "golem", "spellBook", "homunculus", "lamia", "centaur", "werebeast", "chimera", "wyvern", "dragonType", "gazer", "handOrDoor", "demonGodPillar", "oni", "hand", "door", "threatToHumanity", "divine", "humanoid", "dragon", "dragonSlayer", "roman", "wildbeast", "atalante", "saberface", "weakToEnumaElish", "riding", "arthur", "skyOrEarth", "skyOrEarthServant", "brynhildsBeloved", "undeadOrDaemon", "undeadOrDemon", "demonic", "skyOrEarthExceptPseudoAndDemi", "skyOrEarthExceptPseudoAndDemiServant", "divineOrDaemonOrUndead", "divineOrDemonOrUndead", "saberClassServant", "superGiant", "king", "greekMythologyMales", "illya", "feminineLookingServant", "argonaut", "associatedToTheArgo", "genderCaenisServant", "hominidaeServant", "blessedByKur", "demonicBeastServant", "canBeInBattle", "notBasedOnServant", "livingHuman", "cardArts", "cardBuster", "cardQuick", "cardExtra", "buffPositiveEffect", "buffNegativeEffect", "buffIncreaseDamage", "buffIncreaseDefence", "buffDecreaseDamage", "buffDecreaseDefence", "buffMentalEffect", "buffPoison", "buffCharm", "buffPetrify", "buffStun", "buffBurn", "buffSpecialResistUp", "buffSpecialResistDown", "buffEvadeAndInvincible", "buffSureHit", "buffNpSeal", "buffEvade", "buffInvincible", "buffTargetFocus", "buffGuts", "skillSeal", "buffCurse", "buffAtkUp", "buffPowerModStrUp", "buffDamagePlus", "buffNpDamageUp", "buffCritDamageUp", "buffCritRateUp", "buffAtkDown", "buffPowerModStrDown", "buffDamageMinus", "buffNpDamageDown", "buffCritDamageDown", "buffCritRateDown", "buffDeathResistDown", "buffDefenceUp", "buffMaxHpUpPercent", "buffMaxHpDownPercent", "buffMaxHpUp", "buffMaxHpDown", "buffImmobilize", "buffIncreasePoisonEffectiveness", "buffPigify", "buffCurseEffectUp", "buffTerrorStunChanceAfterTurn", "buffConfusion", "buffOffensiveMode", "buffDefensiveMode", "buffLockCardsDeck", "buffDisableColorCard", "buffChangeField", "buffIncreaseDefenceAgainstIndividuality", "buffDefUp", "buffInvinciblePierce", "buffHpRecoveryPerTurn", "buffNegativeEffectImmunity", "buffNegativeEffectAtTurnEnd", "attackPhysical", "attackProjectile", "attackMagical", "criticalHit", "faceCard", "cardNP", "kingproteaGrowth", "kingproteaInfiniteProliferation", "kingproteaProliferation", "kingproteaProliferationNPDefense", "fieldSunlight", "fieldShore", "fieldForest", "fieldBurning", "fieldCity", "shadowServant", "aoeNP", "stNP", "giant", "childServant", "buffSpecialInvincible", "buffSkillRankUp", "buffSleep", "nobunaga", "fieldImaginarySpace", "existenceOutsideTheDomain", "curse", "fieldShoreOrImaginarySpace", "shutenOnField", "shuten", "genji", "vengeance", "enemyGardenOfSinnersLivingCorpse", "enemyGardenOfSinnersApartmentGhostAndSkeleton", "enemyGardenOfSinnersBaseModel", "enemyGardenOfSinnersVengefulSpiritOfSevenPeople", "enemySaberEliWerebeastAndHomunculusAndKnight", "enemySaberEliSkeletonAndGhostAndLamia", "enemySaberEliBugAndGolem", "enemySeraphEater", "enemySeraphShapeshifter", "enemySeraphTypeI", "enemySeraphTypeSakura", "enemyHimejiCastleKnightAndGazerAndMassProduction", "enemyHimejiCastleDronesAndHomunculusAndAutomata", "enemyHimejiCastleSkeletonAndScarecrow", "enemyGuda3MiniNobu", "enemyDavinciTrueEnemy", "enemyDavinciFalseEnemy", "enemyCaseFilesRareEnemy", "enemyLasVegasBonusEnemy", "enemySummerCampRareEnemy", "enemyLittleBigTenguTsuwamonoEnemy", "eventSaberWars", "eventRashomon", "eventOnigashima", "eventOnigashimaRaid", "eventPrisma", "eventPrismaWorldEndMatch", "eventNeroFest2", "eventGuda2", "eventNeroFest3", "eventSetsubun", "eventApocrypha", "eventBattleInNewYork1", "eventOniland", "eventOoku", "eventGuda4", "eventLasVegas", "eventBattleInNewYork2", "eventSaberWarsII", "eventSummerCamp", "eventGuda5", "cursedBook", "buffCharmFemale", "mechanical", "fae", "hasCostume", "weakPointsRevealed", "chenGongNpBlock", "knightsOfTheRound", "divineSpirit", "buffNullifyBuff", "enemyGudaMiniNobu", "burningLove", "buffStrongAgainstWildBeast", "buffStrongAgainstDragon", "fairyTaleServant", "classBeastIV", "havingAnimalsCharacteristics", "like", "exaltation", "gubijin", "yuMeiren", "milleniumCastle", "protoMerlinNPChargeBlock", "valkyrie", "immuneToPigify", "summerModeServant", "shinsengumiServant", "ryozanpaku", "demonUnused", "levitating", "obstacleMaker", "defender", "hasGoddessMetamorphosis", "servantsWithSkyAttribute", "moon", "cardWeak", "cardStrong", "servant", "shadow", "chenGongNp", "cantBeSacrificed", "gutsBlock", "classBeastILost", "holdingHolyGrail", "standardClassServant", "classBeast", "classBeastVI", "classBeastVIBoss", "buffBound", "buffDamageCut", "marking", "manuscriptComplete", "myFairSoldier", "zeroStarServant", "oneStarServant", "twoStarServant", "threeStarServant", "fourStarServant", "fiveStarServant", "wrathOfTheEnshrinedDeity", "caitCuCerpriestessAscension0To2", "caitCuCerpriestessAscension3To4", "fieldAir", "caitCuCerpriestessOnTheField", "buffNpPerTurn", "buffStarPerTurn", "burnEffectivenessUp", "murasamaAscension0", "classUOlgaMarieFlare", "elementalsWrath", "buffBuffSuccessRateUp", "groupServant", "takeruDummyTrait", "artsBuff", "busterBuff", "quickBuff", "FSNServant", "fieldDarkness", "magicBullet", "protagonistCorrection", "normalAokoBuff", "magicBulletAtkBuff", "demeritFunction", "extraBuff", "robinCounter", "kuonjiAliceHasSkill3", "kuonjiAliceStage3", "instantDeathFunction", "forceInstantDeathFunction", "buffGutsOnInstantDeath", "robinAllGone", "classBeastEresh", "alignmentBeast", "bunnyServant", "buffSpecialDmgAgainstAlignmentGood", "buffSpecialDmgAgainstAlignmentEvil", "hasSupereffectiveNPAgainstAlignmentGood", "hasSupereffectiveNPAgainstAlignmentEvil", "happyHalloween", "happyHalloweenCounter", "protectedByBBDubai", "notProtectedByBBDubai", "canFlyInSpace", "buffSpecialInvinciblePierce", "sakuraSeries", "buffDefenceDown", "fieldHeaven", "fieldHell", "markOfSin", "quickChain", "artsChain", "busterChain", "mightyChain", "braveChain", "chainError", "classBeastDraco"]); export const niceTrait = z.object({id: z.number().int(), name: trait, negative: z.boolean().nullable().optional()}); export const niceItemBGType = z.enum(["zero", "bronze", "silver", "gold", "questClearQPReward", "aquaBlue", "six", "unknown"]); export const niceGiftType = z.enum(["servant", "item", "friendship", "userExp", "equip", "eventSvtJoin", "eventSvtGet", "questRewardIcon", "costumeRelease", "costumeGet", "commandCode", "eventPointBuff", "eventBoardGameToken", "eventCommandAssist", "eventHeelPortrait", "battleItem", "privilege", "classSkill"]); export const niceCondType = z.enum(["none", "questClear", "itemGet", "useItemEternity", "useItemTime", "useItemCount", "svtLevel", "svtLimit", "svtGet", "svtFriendship", "svtGroup", "event", "date", "weekday", "purchaseQpShop", "purchaseStoneShop", "warClear", "flag", "svtCountStop", "birthDay", "eventEnd", "svtEventJoin", "missionConditionDetail", "eventMissionClear", "eventMissionAchieve", "questClearNum", "notQuestGroupClear", "raidAlive", "raidDead", "raidDamage", "questChallengeNum", "masterMission", "questGroupClear", "superBossDamage", "superBossDamageAll", "purchaseShop", "questNotClear", "notShopPurchase", "notSvtGet", "notEventShopPurchase", "svtHaving", "notSvtHaving", "questChallengeNumEqual", "questChallengeNumBelow", "questClearNumEqual", "questClearNumBelow", "questClearPhase", "notQuestClearPhase", "eventPointGroupWin", "eventNormaPointClear", "questAvailable", "questGroupAvailableNum", "eventNormaPointNotClear", "notItemGet", "costumeGet", "questResetAvailable", "svtGetBeforeEventEnd", "questClearRaw", "questGroupClearRaw", "eventGroupPointRatioInTerm", "eventGroupRankInTerm", "notEventRaceQuestOrNotAllGroupGoal", "eventGroupTotalWinEachPlayer", "eventScriptPlay", "svtCostumeReleased", "questNotClearAnd", "svtRecoverd", "shopReleased", "eventPoint", "eventRewardDispCount", "equipWithTargetCostume", "raidGroupDead", "notSvtGroup", "notQuestResetAvailable", "notQuestClearRaw", "notQuestGroupClearRaw", "notEventMissionClear", "notEventMissionAchieve", "notCostumeGet", "notSvtCostumeReleased", "notEventRaceQuestOrNotTargetRankGoal", "playerGenderType", "shopGroupLimitNum", "eventGroupPoint", "eventGroupPointBelow", "eventTotalPoint", "eventTotalPointBelow", "eventValue", "eventValueBelow", "eventFlag", "eventStatus", "notEventStatus", "forceFalse", "svtHavingLimitMax", "eventPointBelow", "svtEquipFriendshipHaving", "movieNotDownload", "multipleDate", "svtFriendshipAbove", "svtFriendshipBelow", "movieDownloaded", "routeSelect", "notRouteSelect", "limitCount", "limitCountAbove", "limitCountBelow", "badEndPlay", "commandCodeGet", "notCommandCodeGet", "allUsersBoxGachaCount", "totalTdLevel", "totalTdLevelAbove", "totalTdLevelBelow", "commonRelease", "battleResultWin", "battleResultLose", "eventValueEqual", "boardGameTokenHaving", "boardGameTokenGroupHaving", "eventFlagOn", "eventFlagOff", "questStatusFlagOn", "questStatusFlagOff", "eventValueNotEqual", "limitCountMaxEqual", "limitCountMaxAbove", "limitCountMaxBelow", "boardGameTokenGetNum", "battleLineWinAbove", "battleLineLoseAbove", "battleLineContinueWin", "battleLineContinueLose", "battleLineContinueWinBelow", "battleLineContinueLoseBelow", "battleGroupWinAvove", "battleGroupLoseAvove", "svtLimitClassNum", "overTimeLimitRaidAlive", "onTimeLimitRaidDead", "onTimeLimitRaidDeadNum", "raidBattleProgressAbove", "svtEquipRarityLevelNum", "latestMainScenarioWarClear", "eventMapValueContains", "resetBirthDay", "shopFlagOn", "shopFlagOff", "purchaseValidShopGroup", "svtLevelClassNum", "svtLevelIdNum", "limitCountImageEqual", "limitCountImageAbove", "limitCountImageBelow", "eventTypeStartTimeToEndDate", "existBoxGachaScriptReplaceGiftId", "notExistBoxGachaScriptReplaceGiftId", "limitedPeriodVoiceChangeTypeOn", "startRandomMission", "randomMissionClearNum", "progressValueEqual", "progressValueAbove", "progressValueBelow", "randomMissionTotalClearNum", "weekdays", "eventFortificationRewardNum", "questClearBeforeEventStart", "notQuestClearBeforeEventStart", "eventTutorialFlagOn", "eventTutorialFlagOff", "eventSuperBossValueEqual", "notEventSuperBossValueEqual", "allSvtTargetSkillLvNum", "superBossDamageAbove", "superBossDamageBelow", "eventMissionGroupAchieve", "svtFriendshipClassNumAbove", "notWarClear", "svtSkillLvClassNumAbove", "svtClassLvUpCount", "svtClassSkillLvUpCount", "svtClassLimitUpCount", "svtClassFriendshipCount", "completeHeelPortrait", "notCompleteHeelPortrait", "classBoardSquareReleased", "svtLevelExchangeSvt", "svtLimitExchangeSvt", "skillLvExchangeSvt", "svtFriendshipExchangeSvt", "exchangeSvt", "raidDamageAbove", "raidDamageBelow", "raidGroupDamageAbove", "raidGroupDamageBelow", "raidDamageRateAbove", "raidDamageRateBelow", "raidDamageRateNotAbove", "raidDamageRateNotBelow", "raidGroupDamageRateAbove", "raidGroupDamageRateBelow", "raidGroupDamageRateNotAbove", "raidGroupDamageRateNotBelow", "notQuestGroupClearNum", "raidGroupOpenAbove", "raidGroupOpenBelow", "treasureDeviceAccelerate", "playQuestPhase", "notPlayQuestPhase", "eventStartToEnd", "commonValueAbove", "commonValueBelow", "commonValueEqual", "elapsedTimeAfterQuestClear", "withStartingMember", "latestQuestPhaseEqual", "notLatestQuestPhaseEqual", "purchaseShopNum", "eventTradeTotalNum", "limitedMissionAchieveNumBelow", "limitedMissionAchieveNumAbove", "notSvtVoicePlayed", "battlePointAbove", "battlePointBelow", "beforeSpecifiedDate", "notHaveChargeStone", "haveChargeStone", "battleFunctionTargetAllIndividuality", "battleFunctionTargetOneIndividuality", "beforeQuestClearTime", "afterQuestClearTime", "notBattleFunctionTargetAllIndividuality", "notBattleFunctionTargetOneIndividuality", "eventScriptNotPlay", "eventScriptFlag", "imagePartsGroup", "userLevelAbove", "userLevelBelow", "userLevelEqual", "highestWaveAbove", "highestWaveBelow", "privilegeValid", "privilegeInvalid", "battleActionOpponentIndividuality", "notBattleActionOpponentIndividuality", "treasureDeviceOfSelectedCard", "battleSvtFriendshipAbove", "battleSvtFriendshipBelow", "elapsedTimeAfterSvtGet", "notElapsedTimeAfterQuestClear", "notElapsedTimeAfterSvtGet", "grandSvtSet", "playedMovie", "notPlayedMovie", "notShopGroupLimitNum", "equipGet", "notEquipGet", "svtGetBeforeDate", "svtGetAfterDate", "notQuestAvailable", "notImagePartsGroup", "useEventPassiveSkillGivenItem", "notUseEventPassiveSkillGivenItem", "selfIndividuality", "notSelfIndividuality", "battleValueAbove", "battleValueBelow", "battleValueEqual", "battleValueNotEqual", "battlePointEqual", "battlePointNotEqual", "battleEntryPlayerTotalCountAbove", "battleEntryPlayerTotalCountBelow", "battleEntryPlayerTotalCountEqual", "battleEntryEnemyTotalCountAbove", "battleEntryEnemyTotalCountBelow", "battleEntryEnemyTotalCountEqual", "jobMaxLevelNumAbove", "jobMaxLevelNumBelow", "jobMaxLevelNumEqual", "svtHpReachNum", "svtAtkReachNum", "favoriteSvtIdEqual", "eventBallotSubmitted", "eventBallotNotSubmitted"]); export const niceBaseGift = z.object({id: z.number().int(), type: niceGiftType, objectId: z.number().int(), priority: z.number().int(), num: z.number().int()}); export const niceGiftAdd = z.object({priority: z.number().int(), replacementGiftIcon: z.string().min(1).max(2083), condType: niceCondType, targetId: z.number().int(), targetNum: z.number().int(), replacementGifts: z.array(niceBaseGift)}); export const niceGift = z.object({id: z.number().int(), type: niceGiftType, objectId: z.number().int(), priority: z.number().int(), num: z.number().int(), giftAdds: z.array(niceGiftAdd)}); export const niceItemSelect = z.object({idx: z.number().int(), gifts: z.array(niceGift), requireNum: z.number().int(), detail: z.string()}); export const niceItemScript = z.object({eventId: z.number().int().nullable().optional(), eventGroupId: z.number().int().nullable().optional(), maxNum: z.number().int().nullable().optional(), validClassIds: z.array(z.number().int()).nullable().optional()}); export const niceItem = z.object({id: z.number().int(), name: z.string(), originalName: z.string(), type: niceItemType, uses: z.array(niceItemUse), detail: z.string(), individuality: z.array(niceTrait), icon: z.string().min(1).max(2083), background: niceItemBGType, value: z.number().int(), eventId: z.number().int(), eventGroupId: z.number().int(), priority: z.number().int(), dropPriority: z.number().int(), startedAt: z.number().int(), endedAt: z.number().int(), itemSelects: z.array(niceItemSelect), script: niceItemScript}); export const niceItemAmount = z.object({item: niceItem, amount: z.number().int()}); export const niceQuestAfterClearType = z.enum(["close", "repeatFirst", "repeatLast", "resetInterval", "closeDisp"]); export const niceQuestGroupType = z.enum(["none", "eventQuest", "questRelease", "eventPointQuest", "eventPointGroupQuest", "eventRaceQuest", "eventRaceGroupQuest", "missionGroupQuest", "eventTower", "eventTowerFloor", "highlightQuest", "eventDailyPoint", "eventActivityPointGauge", "interlude", "eventBattleLine", "battleGroup", "shareQuestInfo", "alloutBattleQuest", "eventFortification", "unknown19"]); export const niceQuestGroup = z.object({type: niceQuestGroupType, groupId: z.number().int()}); export const niceQuestRelease = z.object({type: niceCondType, targetId: z.number().int(), value: z.number().int(), closedMessage: z.string()}); export const niceQuestReleaseOverwrite = z.object({questId: z.number().int(), priority: z.number().int(), condType: niceCondType, condId: z.number().int(), condNum: z.number().int(), closedMessage: z.string(), overlayClosedMessage: z.string(), eventId: z.number().int(), startedAt: z.number().int(), endedAt: z.number().int()}); export const niceQuestPhasePresent = z.object({phase: z.number().int(), gifts: z.array(niceGift), giftIcon: z.string().min(1).max(2083).nullable().optional(), condType: niceCondType, condId: z.number().int(), condNum: z.number().int(), originalScript: z.record(z.string(), z.unknown())}); export const scriptLink = z.object({scriptId: z.string(), script: z.string().min(1).max(2083)}); export const niceQuestPhaseScript = z.object({phase: z.number().int(), scripts: z.array(scriptLink)}); export const niceQuest = z.object({id: z.number().int(), name: z.string(), originalName: z.string(), type: niceQuestType, flags: z.array(niceQuestFlag), consumeType: niceConsumeType, consume: z.number().int(), consumeItem: z.array(niceItemAmount), afterClear: niceQuestAfterClearType, recommendLv: z.string(), spotId: z.number().int(), spotName: z.string(), warId: z.number().int(), warLongName: z.string(), chapterId: z.number().int(), chapterSubId: z.number().int(), chapterSubStr: z.string(), giftIcon: z.string().min(1).max(2083).nullable().optional(), gifts: z.array(niceGift), groups: z.array(niceQuestGroup), releaseConditions: z.array(niceQuestRelease), releaseOverwrites: z.array(niceQuestReleaseOverwrite), presents: z.array(niceQuestPhasePresent), phases: z.array(z.number().int()), phasesWithEnemies: z.array(z.number().int()).optional(), phasesNoBattle: z.array(z.number().int()).optional(), phaseScripts: z.array(niceQuestPhaseScript), priority: z.number().int(), noticeAt: z.number().int(), openedAt: z.number().int(), closedAt: z.number().int()}); export const niceScript = z.object({scriptId: z.string(), scriptSizeBytes: z.number().int(), script: z.string().min(1).max(2083), quests: z.array(niceQuest)}); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * Get Script data * * GET /nice/{region}/script/{script_id} */ export const getApiNiceRegionScriptScriptId = async (args: GetApiNiceRegionScriptScriptIdArgs, options?: GetApiNiceRegionScriptScriptIdOptions) => { const {baseUrl = "https://api.atlasacademy.io", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args.lang != null) query.append("lang", String(args.lang)) const url = `${baseUrl.replace(/\/+$/, '')}/nice/${encodeURIComponent(String(args.region))}/script/${encodeURIComponent(String(args.script_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return validateResponse(niceScript, await res.json()) };