TypeScript typings for YouTube Data API v3 v3
The YouTube Data API v3 is an API that provides access to YouTube data, such as videos, playlists, and channels.
For detailed description please check documentation.
Installing
Install typings for YouTube Data API v3:
npm install @types/gapi.client.youtube@v3 --save-dev
Usage
You need to initialize Google API client in your code:
gapi.load('client', () => {
});
Then load api client wrapper:
gapi.client.load('youtube', 'v3', () => {
});
Don't forget to authenticate your client before sending any request to resources:
var client_id = '',
scope = [
'https://www.googleapis.com/auth/youtube',
'https://www.googleapis.com/auth/youtube.channel-memberships.creator',
'https://www.googleapis.com/auth/youtube.force-ssl',
'https://www.googleapis.com/auth/youtube.readonly',
'https://www.googleapis.com/auth/youtube.upload',
'https://www.googleapis.com/auth/youtubepartner',
'https://www.googleapis.com/auth/youtubepartner-channel-audit',
],
immediate = true;
gapi.auth.authorize(
{ client_id: client_id, scope: scope, immediate: immediate },
authResult => {
if (authResult && !authResult.error) {
} else {
}
});
After that you can use YouTube Data API v3 resources:
await gapi.client.youtube.abuseReports.insert({ part: "part", });
await gapi.client.youtube.activities.list({ part: "part", });
await gapi.client.youtube.captions.delete({ id: "id", });
await gapi.client.youtube.captions.download({ id: "id", });
await gapi.client.youtube.captions.insert({ part: "part", });
await gapi.client.youtube.captions.list({ part: "part", videoId: "videoId", });
await gapi.client.youtube.captions.update({ part: "part", });
await gapi.client.youtube.channelBanners.insert({ });
await gapi.client.youtube.channels.list({ part: "part", });
await gapi.client.youtube.channels.update({ part: "part", });
await gapi.client.youtube.channelSections.delete({ id: "id", });
await gapi.client.youtube.channelSections.insert({ part: "part", });
await gapi.client.youtube.channelSections.list({ part: "part", });
await gapi.client.youtube.channelSections.update({ part: "part", });
await gapi.client.youtube.comments.delete({ id: "id", });
await gapi.client.youtube.comments.insert({ part: "part", });
await gapi.client.youtube.comments.list({ part: "part", });
await gapi.client.youtube.comments.markAsSpam({ id: "id", });
await gapi.client.youtube.comments.setModerationStatus({ id: "id", moderationStatus: "moderationStatus", });
await gapi.client.youtube.comments.update({ part: "part", });
await gapi.client.youtube.commentThreads.insert({ part: "part", });
await gapi.client.youtube.commentThreads.list({ part: "part", });
await gapi.client.youtube.i18nLanguages.list({ part: "part", });
await gapi.client.youtube.i18nRegions.list({ part: "part", });
await gapi.client.youtube.liveBroadcasts.bind({ id: "id", part: "part", });
await gapi.client.youtube.liveBroadcasts.delete({ id: "id", });
await gapi.client.youtube.liveBroadcasts.insert({ part: "part", });
await gapi.client.youtube.liveBroadcasts.insertCuepoint({ });
await gapi.client.youtube.liveBroadcasts.list({ part: "part", });
await gapi.client.youtube.liveBroadcasts.transition({ broadcastStatus: "broadcastStatus", id: "id", part: "part", });
await gapi.client.youtube.liveBroadcasts.update({ part: "part", });
await gapi.client.youtube.liveChatBans.delete({ id: "id", });
await gapi.client.youtube.liveChatBans.insert({ part: "part", });
await gapi.client.youtube.liveChatMessages.delete({ id: "id", });
await gapi.client.youtube.liveChatMessages.insert({ part: "part", });
await gapi.client.youtube.liveChatMessages.list({ liveChatId: "liveChatId", part: "part", });
await gapi.client.youtube.liveChatModerators.delete({ id: "id", });
await gapi.client.youtube.liveChatModerators.insert({ part: "part", });
await gapi.client.youtube.liveChatModerators.list({ liveChatId: "liveChatId", part: "part", });
await gapi.client.youtube.liveStreams.delete({ id: "id", });
await gapi.client.youtube.liveStreams.insert({ part: "part", });
await gapi.client.youtube.liveStreams.list({ part: "part", });
await gapi.client.youtube.liveStreams.update({ part: "part", });
await gapi.client.youtube.members.list({ part: "part", });
await gapi.client.youtube.membershipsLevels.list({ part: "part", });
await gapi.client.youtube.playlistItems.delete({ id: "id", });
await gapi.client.youtube.playlistItems.insert({ part: "part", });
await gapi.client.youtube.playlistItems.list({ part: "part", });
await gapi.client.youtube.playlistItems.update({ part: "part", });
await gapi.client.youtube.playlists.delete({ id: "id", });
await gapi.client.youtube.playlists.insert({ part: "part", });
await gapi.client.youtube.playlists.list({ part: "part", });
await gapi.client.youtube.playlists.update({ part: "part", });
await gapi.client.youtube.search.list({ part: "part", });
await gapi.client.youtube.subscriptions.delete({ id: "id", });
await gapi.client.youtube.subscriptions.insert({ part: "part", });
await gapi.client.youtube.subscriptions.list({ part: "part", });
await gapi.client.youtube.superChatEvents.list({ part: "part", });
await gapi.client.youtube.tests.insert({ part: "part", });
await gapi.client.youtube.thirdPartyLinks.delete({ linkingToken: "linkingToken", type: "type", });
await gapi.client.youtube.thirdPartyLinks.insert({ part: "part", });
await gapi.client.youtube.thirdPartyLinks.list({ part: "part", });
await gapi.client.youtube.thirdPartyLinks.update({ part: "part", });
await gapi.client.youtube.thumbnails.set({ videoId: "videoId", });
await gapi.client.youtube.videoAbuseReportReasons.list({ part: "part", });
await gapi.client.youtube.videoCategories.list({ part: "part", });
await gapi.client.youtube.videos.delete({ id: "id", });
await gapi.client.youtube.videos.getRating({ id: "id", });
await gapi.client.youtube.videos.insert({ part: "part", });
await gapi.client.youtube.videos.list({ part: "part", });
await gapi.client.youtube.videos.rate({ id: "id", rating: "rating", });
await gapi.client.youtube.videos.reportAbuse({ });
await gapi.client.youtube.videos.update({ part: "part", });
await gapi.client.youtube.watermarks.set({ channelId: "channelId", });
await gapi.client.youtube.watermarks.unset({ channelId: "channelId", });