battle_net 0.1.2 copy "battle_net: ^0.1.2" to clipboard
battle_net: ^0.1.2 copied to clipboard

Dart wrapper client for Battle.Net API https://develop.battle.net/documentation

example/battle_net.dart

import 'package:battle_net/battle_net.dart';

/// This example shows how to fetch [TokenResponse] data with additional information
Future<void> main() async {
  /// Provide client id and client secret
  final BattleNet battleNet =
      BattleNet(clientId: 'clientId', clientSecret: 'clientSecret');

  /// Fetch access token providing region of the data to retrieve.
  final ClientCredentialsResponse clientCredentialsResponse =
      await battleNet.postClientCredentials();

  /// Fetch Token index price for EU region Retail version
  final TokenIndexResponse tokenIndex = await battleNet.getTokenIndex(
      accessToken: clientCredentialsResponse.accessToken,
      region: BattleNetRegion.eu,
      namespace: BattleNetNamespace.dynamic,
      locale: BattleNetLocale.enGB);
  print(tokenIndex);

  /// Fetch Token index price for EU region Classic version
  final TokenIndexResponse tokenIndexClassic = await battleNet
      .postClientCredentials()
      .then((ClientCredentialsResponse response) => battleNet.getTokenIndex(
          accessToken: response.accessToken,
          region: BattleNetRegion.eu,
          namespace: BattleNetNamespace.dynamicClassic,
          locale: BattleNetLocale.enGB));
  print(tokenIndexClassic);

  /// Fetch connected 'Outland' realm details
  const int connectedRealmId = 1301;
  final ConnectedRealmSearchData connectedRealm =
      await battleNet.getConnectedRealm(
          accessToken: clientCredentialsResponse.accessToken,
          region: BattleNetRegion.eu,
          namespace: BattleNetNamespace.dynamic,
          id: connectedRealmId);
  print(connectedRealm);
}
1
likes
0
points
32
downloads

Publisher

verified publishervmpay.eu

Weekly Downloads

Dart wrapper client for Battle.Net API https://develop.battle.net/documentation

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

collection, http, meta

More

Packages that depend on battle_net