package main import "net/http" // handleIGDBSearch handles GET /api/igdb/search — placeholder. // Once IGDB credentials are configured, this will query the Twitch API. func handleIGDBSearch(w http.ResponseWriter, r *http.Request) { query := r.URL.Query().Get("q") if query == "" { http.Error(w, "Query parameter 'q' required", http.StatusBadRequest) return } // TODO: Implement real IGDB search. // Requires TWITCH_CLIENT_ID and TWITCH_CLIENT_SECRET environment variables. // // Flow: // 1. POST https://id.twitch.tv/oauth2/token for access token // 2. POST https://api.igdb.com/v4/games with body: search "{query}"; fields name,cover.*,genres.*,screenshots.*; // 3. Resolve cover URLs → https://images.igdb.com/igdb/image/upload/t_cover_big/{image_id}.jpg // 4. Return matches writeJSON(w, http.StatusOK, []map[string]string{ { "message": "IGDB integration not yet configured. Set TWITCH_CLIENT_ID and TWITCH_CLIENT_SECRET env vars.", "query": query, }, }) }