delete games
This commit is contained in:
@@ -279,6 +279,10 @@ class BackendApi {
|
||||
await _post({'action': 'delete_show', 'show_id': showId});
|
||||
}
|
||||
|
||||
Future<void> deleteGame(int igdbId) async {
|
||||
await _post({'action': 'delete_game', 'igdb_id': igdbId});
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> setGameStatus({
|
||||
required int igdbId,
|
||||
required String name,
|
||||
@@ -290,6 +294,7 @@ class BackendApi {
|
||||
String? summary,
|
||||
String? storyline,
|
||||
String? coverUrl,
|
||||
int? releaseYear,
|
||||
}) async {
|
||||
final map = await _post({
|
||||
'action': 'set_game_status',
|
||||
@@ -303,6 +308,7 @@ class BackendApi {
|
||||
if (summary != null) 'summary': summary,
|
||||
if (storyline != null) 'storyline': storyline,
|
||||
if (coverUrl != null) 'cover_url': coverUrl,
|
||||
if (releaseYear != null) 'release_year': releaseYear,
|
||||
});
|
||||
return (map['game'] as Map).cast<String, dynamic>();
|
||||
}
|
||||
|
||||
@@ -34,4 +34,24 @@ class IgdbApi {
|
||||
}
|
||||
throw Exception('IGDB search: unerwartetes Antwortformat');
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> getGameDetails(int igdbId, {String lang = 'de'}) async {
|
||||
final res = await _dio.get(
|
||||
'',
|
||||
queryParameters: {
|
||||
'action': 'details',
|
||||
'id': igdbId,
|
||||
'lang': lang,
|
||||
'check_external': 1,
|
||||
},
|
||||
);
|
||||
if (res.statusCode != 200) {
|
||||
throw Exception('IGDB details HTTP ${res.statusCode}');
|
||||
}
|
||||
final data = res.data;
|
||||
if (data is Map && data['game'] is Map) {
|
||||
return (data['game'] as Map).cast<String, dynamic>();
|
||||
}
|
||||
throw Exception('IGDB details: unerwartetes Antwortformat');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user