Skip to content

Commit

Permalink
added method to searchArtworkByGameID
Browse files Browse the repository at this point in the history
  • Loading branch information
DineshSolanki committed Aug 7, 2021
1 parent 2b940b7 commit 8991a0e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions FoliCon/Modules/IGDBClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public async Task<ResultResponse> SearchGameAsync(string query)
Contract.Assert(_serviceClient != null);
var r = await _serviceClient.QueryAsync<Game>(IGDBClient.Endpoints.Games,
$"search \"{query}\"; fields artworks.image_id, name,first_release_date,total_rating,summary,cover.*;");

var response = new ResultResponse
{
MediaType = MediaTypes.Game,
Expand All @@ -65,9 +66,9 @@ public async Task<ResultResponse> SearchGameByIdAsync(string id)

public async Task<Artwork[]> GetArtworksByGameIdAsync(string id)
{
var r = await _serviceClient.QueryAsync<Game>(IGDBClient.Endpoints.Games,
$"fields id, artworks.image_id; where id = {id};");
return r.First().Artworks.Values;
var r = await _serviceClient.QueryAsync<Artwork>(IGDBClient.Endpoints.Artworks,
$"fields image_id; where game = {id};");
return r;
}
public static ObservableCollection<ListItem> ExtractGameDetailsIntoListItem(Game[] result)
{
Expand Down

0 comments on commit 8991a0e

Please sign in to comment.