mitchhymel / dart-igdb_client

A Dart client for accessing IGDB.com API
BSD 2-Clause "Simplified" License
6 stars 5 forks source link

Where can i find "User Agent" parameter? #5

Closed d-apps closed 4 years ago

d-apps commented 4 years ago

Could you please tell me where can I find my User Agent?

I couldn't find it anywhere, in your example you don't show the variable value...

var client = new IGDBClient("?", API_KEY);

mitchhymel commented 4 years ago

The User Agent string is a way for your app to identify itself to the IGDB servers. This can be whatever you want it to be - any string value should work here.

d-apps commented 4 years ago

Thank you.

d-apps commented 4 years ago

Could you please explain me how to pass each game found in gamesResponse.data to a Game class to show to the user?

class Game {

String id; String name; String cover; String storyline; List screenshots;

}

And how do I access and show fields with numbers, like:

"screenshots": [ 25285, 25286 ]

"id": 19678,

class Game {

String id; String name; String cover; String storyline; List screenshots;

}

mitchhymel commented 4 years ago

I have a "work in progress but I kinda stopped working on it for now" app that was the motivation for creating this library which you can check out here:

As for some code relevant to your question... Check out here showing how I use igdb_client to fetch the data and what params I use. Then check here for how I convert the response's map object to my own data class. JSON serialization/deserialization in flutter is not as nice as other languages so I just did this manually as can be seen in the fromMap method.

d-apps commented 4 years ago

I just made a question about IGDB on stackoverflow about this hehe, thank you for the links, it will help me a lot. I am new to APIs, this is my first project using one.

d-apps commented 4 years ago

@mitchhymel Is the quality so low for cover and screenshots? all them have 90x90 px, looks ugly in the app :/ and I didn't find some games or they don't have cover or screen.

mitchhymel commented 4 years ago

I'd suggest reading IGDB's API docs to understand how they handle images and to ultimately understand why igdb_client handles images the way it does.

The reason you're seeing the 90x90px images is because that is the default unless you specify a size.

The igdb_client provides helpers to get image urls of specific quality provided the image id and quality enum.

You can also view my app's code as an example of this being used in practice.