Fonctionne

This commit is contained in:
ExostFlash 2025-12-19 13:01:39 +01:00
parent 0008be71bd
commit e1af24097e

View file

@ -16,7 +16,7 @@ import java.util.List;
public class StreamifyApiClient {
private static final String BASE_URL = "http://api-stream.apps.lehub.tf/api"; // à adapter selon ton API
private static final String BASE_URL = "http://api-stream.apps.lehub.tf/api";
private final HttpClient httpClient;
private final Gson gson;
@ -40,10 +40,11 @@ public class StreamifyApiClient {
// parser l'objet JSON
JsonObject obj = gson.fromJson(response.body(), JsonObject.class);
// récupérer le tableau programs
// tableau programs
JsonElement programsElement = obj.get("programs");
Type listType = new TypeToken<List<Program>>() {}.getType();
// mappage GSON
List<Program> programs = gson.fromJson(programsElement, listType);
return programs;