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 subscriptionsResponse = await subscriptions.list(
        part: argResults!['part'],
        channelId: argResults?['channel-id'],
        id: argResults?['id'],
        mine: argResults?['mine'] != null ? argResults!['mine'] : null,
        myRecentSubscribers: argResults?['my-recent-subscribers'] != null
            ? argResults!['my-recent-subscribers']
            : null,
        mySubscribers: argResults?['my-subscribers'] != null
            ? argResults!['my-subscribers']
            : null,
        forChannelId: argResults?['for-channel-id'],
        maxResults: int.parse(argResults!['max-results']),
        order: argResults!['order']);

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

  done();
}