import {z} from 'zod' export type CharacterID = number; export type GetApiCharactersCharacterIdAssetsArgs = {character_id: CharacterID, page?: number | undefined, 'Accept-Language'?: ('en' | 'de' | 'fr' | 'ja' | 'ru' | 'zh' | 'ko' | 'es') | undefined, 'If-None-Match'?: string | undefined, 'X-Compatibility-Date': '2025-12-16', 'X-Tenant'?: string | undefined, 'If-Modified-Since'?: string | undefined}; export type GetApiCharactersCharacterIdAssetsOptions = {baseUrl?: string | undefined, OAuth2?: string | undefined, fetch?: typeof fetch | undefined}; export const charactersCharacterIdAssetsGet = z.array(z.object({is_blueprint_copy: z.boolean().optional(), is_singleton: z.boolean(), item_id: z.number().int(), location_flag: z.enum(["AssetSafety", "AutoFit", "BoosterBay", "CapsuleerDeliveries", "Cargo", "CorporationGoalDeliveries", "CorpseBay", "Deliveries", "DroneBay", "ExpeditionHold", "FighterBay", "FighterTube0", "FighterTube1", "FighterTube2", "FighterTube3", "FighterTube4", "FleetHangar", "FrigateEscapeBay", "Hangar", "HangarAll", "HiSlot0", "HiSlot1", "HiSlot2", "HiSlot3", "HiSlot4", "HiSlot5", "HiSlot6", "HiSlot7", "HiddenModifiers", "Implant", "InfrastructureHangar", "LoSlot0", "LoSlot1", "LoSlot2", "LoSlot3", "LoSlot4", "LoSlot5", "LoSlot6", "LoSlot7", "Locked", "MedSlot0", "MedSlot1", "MedSlot2", "MedSlot3", "MedSlot4", "MedSlot5", "MedSlot6", "MedSlot7", "MobileDepotHold", "MoonMaterialBay", "QuafeBay", "RigSlot0", "RigSlot1", "RigSlot2", "RigSlot3", "RigSlot4", "RigSlot5", "RigSlot6", "RigSlot7", "ShipHangar", "Skill", "SpecializedAmmoHold", "SpecializedAsteroidHold", "SpecializedCommandCenterHold", "SpecializedFuelBay", "SpecializedGasHold", "SpecializedIceHold", "SpecializedIndustrialShipHold", "SpecializedLargeShipHold", "SpecializedMaterialBay", "SpecializedMediumShipHold", "SpecializedMineralHold", "SpecializedOreHold", "SpecializedPlanetaryCommoditiesHold", "SpecializedSalvageHold", "SpecializedShipHold", "SpecializedSmallShipHold", "StructureDeedBay", "SubSystemBay", "SubSystemSlot0", "SubSystemSlot1", "SubSystemSlot2", "SubSystemSlot3", "SubSystemSlot4", "SubSystemSlot5", "SubSystemSlot6", "SubSystemSlot7", "Unlocked", "Wardrobe"]), location_id: z.number().int(), location_type: z.enum(["station", "solar_system", "item", "other"]), quantity: z.number().int(), type_id: z.number().int()})); 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 character assets * * GET /characters/{character_id}/assets */ export const getApiCharactersCharacterIdAssets = async (args: GetApiCharactersCharacterIdAssetsArgs, options?: GetApiCharactersCharacterIdAssetsOptions) => { const {baseUrl = "https://esi.evetech.net", fetch: fetchFn = fetch, OAuth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args.page != null) query.append("page", String(args.page)) if (args['Accept-Language'] != null) headers.set("Accept-Language", String(args['Accept-Language'])) if (args['If-None-Match'] != null) headers.set("If-None-Match", String(args['If-None-Match'])) if (args['X-Compatibility-Date'] != null) headers.set("X-Compatibility-Date", String(args['X-Compatibility-Date'])) if (args['X-Tenant'] != null) headers.set("X-Tenant", String(args['X-Tenant'])) if (args['If-Modified-Since'] != null) headers.set("If-Modified-Since", String(args['If-Modified-Since'])) if (OAuth2 !== undefined) headers.set('authorization', `Bearer ${OAuth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/characters/${encodeURIComponent(String(args.character_id))}/assets${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(charactersCharacterIdAssetsGet, await res.json()) };