igdb_client 0.0.7 copy "igdb_client: ^0.0.7" to clipboard
igdb_client: ^0.0.7 copied to clipboard

A dart library for IGDB API

igdb_client #

A Dart library for using the IGDB.com API v4 https://api-docs.igdb.com/

It is highly recommended to read through the IGDB documentation to understand what exactly you can do with the API.

Usage in Web and Mobile Applications #

From the IGDB documentation on Web and Mobile applications

What?

The IGDB V4 API uses Oauth App Tokens, which aren’t suitable for mobile or frontend-only applications:

  • There is a limit of roughly 25 app tokens active at any time
  • Tokens expire after roughly 60 days. To help transition to V4, we are providing a quick way to setup a proxy for mobile applications.

How?

Please follow our proxy guide!!

Usage #

To start using this, just add it to your pubspec:

pub package

See example/igdb_client_example.dart for a more in depth example of some of the things you can do with this client. Otherwise a simple example can be found below.

import 'package:igdb_client/igdb_client.dart';

// You should only run this once, then save it somewhere. It will eventually
// expire after ~60 days, at which point you will need to getOauthToken again
// 
// The reason for this is that there is a limit of roughly 25 app tokens
// active at any time. See https://api-docs.igdb.com/#web-and-mobile-applications
var token = await IGDBClient.getOauthToken(MY_CLIENT_ID, MY_CLIENT_SECRET);

var client = new IGDBClient(MY_USER_AGENT, MY_CLIENT_ID, token.accessToken, logger: IGDBConsoleLogger());

var gamesResponse = await client.games(new IGDBRequestParameters(
  limit: 3
));

print(IGDBClient.getPrettyStringFromMap(gamesResponse.toMap()));

if (gamesResponse.isSuccess()) {
  // do something with gamesResponse.data
}
else {
  // do something depending on gamesResponse.error
}
3
likes
30
pub points
0%
popularity

Publisher

unverified uploader

A dart library for IGDB API

Repository (GitHub)
View/report issues

License

BSD-2-Clause (license)

Dependencies

http

More

Packages that depend on igdb_client