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();
try {
final searchListResponse = await search.list(
part: argResults!['part'],
channelId: argResults?['channel-id'],
channelType: argResults?['channel-type'],
eventType: argResults?['event-type'],
forMine:
argResults?['for-mine'] != null && argResults?['for-mine'] == 'true'
? true
: null,
maxResults: int.parse(argResults!['max-results']),
order: argResults?['order'],
pageToken: argResults?['page-token'],
publishedAfter: argResults?['published-after'],
publishedBefore: argResults?['published-before'],
q: argResults?['q'],
safeSearch: argResults?['safe-search'],
type: argResults!['type'],
videoCaption: argResults?['video-caption'],
videoCategoryId: argResults?['video-category-id'],
videoDefinition: argResults?['video-definition'],
videoDimension: argResults?['video-dimension'],
videoDuration: argResults?['video-duration'],
videoEmbeddable: argResults?['video-embeddable'],
videoLicense: argResults?['video-license'],
videoSyndicated: argResults?['video-syndicated'],
videoType: argResults?['video-type'],
);
print(searchListResponse);
} on DioException catch (err) {
throw UsageException('API usage error:', err.usage);
}
}