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

outdated

A dart library for IGDB API

example/igdb_client_example.dart

import 'api_key.dart';

import 'package:igdb_client/igdb_client.dart';

var client = new IGDBClient(
    MY_USER_AGENT,
    MY_API_KEY,
);

main() async {


  // Find games with 'infamous' in their name and return
  // the results' name and expand their release_dates and platforms.
  var gamesResponse = await client.games(new IGDBRequestParameters(
    search: 'infamous',
    fields: ['name', 'release_dates.*', 'platforms.*']
  ));
  printResponse(gamesResponse);

  // Find games that are not yet released but are releasing soon in the
  // North American, Worlwide, or Unspecified regions, then sort by 
  // release date.
  int msecSinceEpoch = DateTime.now().millisecondsSinceEpoch;
  int secsSinceEpoch = msecSinceEpoch~/1000;
  String timeNow = secsSinceEpoch.toString();
  var releaseResponse = await client.releaseDates(new IGDBRequestParameters(
    filters: 'date > $timeNow & (region = ${IGDBRegions.NORTH_AMERICA.id} | region = ${IGDBRegions.NONE.id} | region = ${IGDBRegions.WORLDWIDE.id})',
    order: 'date asc'
  ));
  printResponse(releaseResponse);

  var gameIdResponse = await client.games(new IGDBRequestParameters(
    ids: [43378],
  ));
  printResponse(gameIdResponse);
}

printResponse(IGDBResponse resp) {
  print(IGDBClient.getPrettyStringFromMap(resp.toMap()));
}
3
likes
0
pub points
0%
popularity

Publisher

unverified uploader

A dart library for IGDB API

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

http

More

Packages that depend on igdb_client