getCall<T> method
Generic method for authenticated GET calls.
Implementation
@override
Future<T> getCall<T>(
Iterable<String> pathSegments, {
Map<String, dynamic> queryParameters = const {},
}) async {
final token = await validateToken();
final options = Options(
headers: {
'Client-Id': clientId,
'Authorization': 'Bearer ${token.accessToken}',
},
);
final response = await dio.getUri<T>(
DiscordClient.baseUrl.replace(
pathSegments: <String>[
DiscordClient.apiPath,
DiscordClient.versionPath,
...pathSegments
],
queryParameters: queryParameters,
),
options: options,
);
return response.data!;
}