run method
Runs this command.
The return value is wrapped in a Future
if necessary and returned by
CommandRunner.runCommand
.
Implementation
@override
void run() async {
await initializeYt();
final content = argResults!['body'] as String;
// won't work with a file name that starts with the '{' character
final isJson = content.trimLeft().startsWith('{');
final body = isJson ? content : File(content).readAsStringSync();
try {
final liveBroadcastItem = await broadcast.insert(
body: json.decode(body), part: argResults!['part']);
print(liveBroadcastItem);
} on DioException catch (err) {
throw UsageException('API usage error:', err.usage);
}
}