run method
Runs this command.
The return value is wrapped in a Future
if necessary and returned by
CommandRunner.runCommand
.
Implementation
@override
Future<void> run() async {
final apiKey = Platform.environment['KENALL_API_KEY'];
if (apiKey == null) {
printErrorAndExit('--- KENALL_API_KEY is not found ---');
}
final config = Config(apiKey: apiKey!);
final kenallClient = KenallClient(config, http.Client());
try {
final response = await kenallClient.getWhoami(GetWhoamiRequest());
printInfo('type: ${response.remoteAddr.type}');
printInfo('address: ${response.remoteAddr.address}');
exit(0);
} catch (error) {
printErrorAndExit('--- $error ---');
}
}