addComment method
Future<CommentThread>
addComment({
- required String videoId,
- required String text,
- String? channelId,
- GoogleApisClientApiKey? googleApisClientApiKey,
Implementation
Future<CommentThread> addComment({
required String videoId,
required String text,
String? channelId,
GoogleApisClientApiKey? googleApisClientApiKey,
}) async {
YouTubeApi youTubeApi =
await youTubeApiClient(googleApisClientApiKey: googleApisClientApiKey);
String channel_id = await () async {
if (channelId is String) {
if (channelId.isNotEmpty) {
return channelId;
}
}
// youTubeApi.channels.list([]);
return "";
}.call();
return (await youTubeApi.commentThreads.insert(
CommentThread(
snippet: CommentThreadSnippet(
videoId: videoId,
channelId: channel_id,
topLevelComment: Comment(
snippet: CommentSnippet(
textOriginal: text,
),
),
),
),
["snippet"],
));
}