igdb-api-node icon indicating copy to clipboard operation
igdb-api-node copied to clipboard

Is Expand still a thing in this latest API?

Open adjstreams opened this issue 2 years ago • 1 comments

Looks like I can write requests directly to the API and expand will work, but this library doesn't support expand, is that right?

adjstreams avatar Aug 01 '22 09:08 adjstreams

@adjstreams I don't know if you were able to get an answer, but just in case -- it seems like you can still use expand with this wrapper the same way as it's described in the api docs by adding a sub-property to that field. So for genre, you could do genres.* or genres.name as part of the fields parameter. I was able to expand release_dates and directly grab the associated years when searching for a game with the following example:

const { data } = await igdb(clientId, token)
    .search('Halo')
    .fields(['name', 'release_dates.y'])
    .request('/games')

4upz avatar Nov 23 '22 20:11 4upz