Hi guys ,
I am on the Exercise 18, building game attributes on game detail page:
We need to modify the Game interface: adding 2 properties, genres as a Genre, and publishers as a Publisher :
export interface Game {
id: number;
name: string;
slug: string;
genres: Genre;
publishers: Publisher;
description_raw: string;
background_image: string;
parent_platforms: { platform: Platform } ;
metacritic: number;
rating_top: number;
}
I checked the RAWG game api here, found no such entries (genres or publishers, and also no description_raw as mention in a previous lecture) in the response as listed:
{
“count”: 0,
“next”: “…”,
“previous”: “…”,
“results”: [
{
“id”: 0,
“slug”: “string”,
“name”: “string”,
“released”: “2025-01-10”,
“tba”: true,
“background_image”: “…”,
“rating”: 0,
“rating_top”: 0,
“ratings”: {},
“ratings_count”: 0,
“reviews_text_count”: “string”,
“added”: 0,
“added_by_status”: {},
“metacritic”: 0,
“playtime”: 0,
“suggestions_count”: 0,
“updated”: “2025-01-10T13:02:26Z”,
“esrb_rating”: {
“id”: 0,
“slug”: “everyone”,
“name”: “Everyone”
},
“platforms”: [
{
“platform”: {
“id”: 0,
“slug”: “string”,
“name”: “string”
},
“released_at”: “string”,
“requirements”: {
“minimum”: “string”,
“recommended”: “string”
}
}
]
}
]
}
I am a bit confused, the api did not give access to genres and publishers or descriptions to a specific game, how axios still fetches the data by using the Game interface? Is it just RAWG hiding the full api plot, or am I misunderstanding the entire concept?
Thanks!
Yu