run method

  1. @override
void run()
override

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();

  try {
    final commentThreadListResponse = await commentThreads.list(
      part: argResults!['part'],
      allThreadsRelatedToChannelId:
          argResults?['all-threads-related-to-channel-id'],
      channelId: argResults?['channel-id'],
      id: argResults?['id'],
      videoId: argResults?['video-id'],
      maxResults: int.parse(argResults!['max-results']),
      moderationStatus: argResults?['moderation-status'],
      order: argResults?['order'],
      pageToken: argResults?['page-token'],
      searchTerms: argResults?['search-terms'],
      textFormat: argResults?['text-format'],
    );

    print(commentThreadListResponse);
  } on DioException catch (err) {
    throw UsageException('API usage error:', err.usage);
  }
}