Fonctionne
This commit is contained in:
parent
0008be71bd
commit
e1af24097e
1 changed files with 4 additions and 3 deletions
|
|
@ -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,11 +40,12 @@ 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();
|
||||
List<Program> programs = gson.fromJson(programsElement, listType);
|
||||
// mappage GSON
|
||||
List<Program> programs = gson.fromJson(programsElement, listType);
|
||||
|
||||
return programs;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue