Skip to content

Comments

feat(api): add V2 JSON:API relationship endpoint for GameHash resources#4593

Open
wescopeland wants to merge 1 commit intoRetroAchievements:masterfrom
wescopeland:v2-game-hashes
Open

feat(api): add V2 JSON:API relationship endpoint for GameHash resources#4593
wescopeland wants to merge 1 commit intoRetroAchievements:masterfrom
wescopeland:v2-game-hashes

Conversation

@wescopeland
Copy link
Member

This PR adds a V2 API relationship endpoint for GameHash resources, accessible via GET /games/{game}/hashes. This provides the functionality of V1's API_GetGameHashes endpoint. Things worth noting:

  • Hashes are accessed exclusively via the relationship route. There is (currently) no standalone index, but one may be desirable later.
  • The labels attribute is parsed from its stored comma-separated string into a JSON array.
  • All compatibility states are returned by default. The filter[compatibility] param supports comma-separated values to filter by one or more states (eg: compatible, incompatible, untested, patch-required).
  • Soft-deleted hashes are automatically excluded.
  • The game relationship can be included via ?include=game.

How to test this PR

# Get paginated hashes for a game (50 per page)
curl --request GET \
  --url http://localhost:64000/api/v2/games/1/hashes \
  --header 'X-API-Key: {redacted}'

# Get only compatible hashes (matches V1 API behavior)
curl --request GET \
  --url 'http://localhost:64000/api/v2/games/1/hashes?filter[compatibility]=compatible' \
  --header 'X-API-Key: {redacted}'

# Get compatible and incompatible hashes
curl --request GET \
  --url 'http://localhost:64000/api/v2/games/1/hashes?filter[compatibility]=compatible,incompatible' \
  --header 'X-API-Key: {redacted}'

# Get hashes with game data included
curl --request GET \
  --url 'http://localhost:64000/api/v2/games/1/hashes?include=game' \
  --header 'X-API-Key: {redacted}'

# Custom pagination (page 2, 25 per page)
curl --request GET \
  --url 'http://localhost:64000/api/v2/games/1/hashes?page[number]=2&page[size]=25' \
  --header 'X-API-Key: {redacted}'

@wescopeland wescopeland requested a review from a team February 24, 2026 23:44
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.

1 participant