Skip to content

Add OverFast API client utility#45

Draft
Copilot wants to merge 3 commits into
devfrom
copilot/add-data-fetching-overfast-api-again
Draft

Add OverFast API client utility#45
Copilot wants to merge 3 commits into
devfrom
copilot/add-data-fetching-overfast-api-again

Conversation

Copilot AI commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

Interface to the OverFast API for fetching Overwatch hero, map, and player data at runtime, with localStorage persistence and portrait hashing for image matching.

Types (src/types.d.ts)

  • API response types: OverFastHero, OverFastMap, OverFastPlayerResult, OverFastPlayerSearchResponse
  • Storage types: StoredHero (includes portraitHash), StoredMap, OverFastStore (schema-versioned)

API Client (src/utils/overfastApi.ts)

  • fetchHeroes(), fetchMaps(), searchPlayers(name) — typed fetch wrappers for /heroes, /maps, /players
  • hashPortraitFromUrl(url) — loads portrait image cross-origin and computes dhash (same algorithm as imageRecognition.ts)
  • updateOverFastData() — fetches heroes + maps, hashes all portraits via Promise.all, persists to vowt_overfast_data
  • loadOverFastData() / clearOverFastData() — localStorage read/clear with Date reviver
// Fetch and cache all data
const store = await updateOverFastData();
// store.heroes[0].portraitHash → "6b2b17451147b400" (ready for hamDist comparison)

// Load from cache
const cached = loadOverFastData();

Tests

26 tests covering all exported functions — fetch mocking, image loading, canvas mocking, error handling, URL encoding, Date revival, corrupted data.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add data fetching from OverFast API</issue_title>
<issue_description>We should fetch hero list, in-game character portraits, and maps list, at runtime via OverFast API.

Store to persistent memory and only update when prompted by user via a new button on the UI.
Hero portraits should be hashed before storing, ready for image matching.</issue_description>

<agent_instructions>No need to fully integrate in this branch/PR, just make an implementation that provides an interface to the API. This should include a new util file, typings, handling received data, etc.

Allowlist configured to:

Comments on the Issue (you are @copilot in this section)

Custom agent used: solid-developer
Agent specialising in SolidJS web development


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

Copilot AI and others added 2 commits March 18, 2026 10:36
…r data

- Add type definitions for OverFast API responses (OverFastHero, OverFastMap,
  OverFastPlayerResult, OverFastPlayerSearchResponse) and storage types
  (StoredHero, StoredMap, OverFastStore) to src/types.d.ts
- Create src/utils/overfastApi.ts with API fetch functions (fetchHeroes,
  fetchMaps, searchPlayers), image hashing (hashPortraitFromUrl), and
  localStorage persistence (updateOverFastData, loadOverFastData, clearOverFastData)
- Add comprehensive test suite with 26 tests covering all exported functions
Co-authored-by: qaeu <43359569+qaeu@users.noreply.github.com>
Copilot AI changed the title [WIP] Add data fetching from OverFast API Add OverFast API client utility Mar 18, 2026
Copilot AI requested a review from qaeu March 18, 2026 10:41
Copilot finished work on behalf of qaeu March 18, 2026 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add data fetching from OverFast API

2 participants