35 lines
918 B
Dart
35 lines
918 B
Dart
import 'package:overfast_api/client.dart';
|
|
import 'package:overfast_api/heroes/heroes_data.dart' as data;
|
|
import 'package:overfast_api/utils/types.dart';
|
|
|
|
class Heroes {
|
|
final Overfast _client;
|
|
|
|
const Heroes(this._client);
|
|
|
|
Future<List<data.Hero>> heroes({Role? role, Locale? locale}) =>
|
|
_client.getList<data.Hero>(
|
|
'/heroes',
|
|
{
|
|
if (role != null) 'role': role.toString(),
|
|
if (locale != null) 'locale': locale.toString(),
|
|
},
|
|
);
|
|
|
|
Future<data.HeroDetails> hero(HeroKey hero, {Locale? locale}) =>
|
|
_client.get<data.HeroDetails>(
|
|
'/heroes/${hero.heroName}',
|
|
{
|
|
if (locale != null) 'locale': locale.toString(),
|
|
},
|
|
);
|
|
|
|
Future<List<data.Roles>> roles({Locale? locale}) =>
|
|
_client.getList<data.Roles>(
|
|
'/roles',
|
|
{
|
|
if (locale != null) 'locale': locale.toString(),
|
|
},
|
|
);
|
|
}
|