diff options
author | fawn <fangrui_tong@brown.edu> | 2019-07-30 16:52:12 -0400 |
---|---|---|
committer | fawn <fangrui_tong@brown.edu> | 2019-07-30 16:52:12 -0400 |
commit | f7c0948910182f5f6cb2c10c216994e2bc7b91b0 (patch) | |
tree | 6d443543c7475f4104bf7b8a3be788bb3ce2a3ec /src/client/DocServer.ts | |
parent | 78999b8b35267db9236bbb69e7e90e8691c59ba9 (diff) | |
parent | 8ca17d379ce7d3cc751408553b6819223d31a3e0 (diff) |
merged
Diffstat (limited to 'src/client/DocServer.ts')
-rw-r--r-- | src/client/DocServer.ts | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/client/DocServer.ts b/src/client/DocServer.ts index cb460799f..258acd9cd 100644 --- a/src/client/DocServer.ts +++ b/src/client/DocServer.ts @@ -1,5 +1,5 @@ import * as OpenSocket from 'socket.io-client'; -import { MessageStore, Diff } from "./../server/Message"; +import { MessageStore, Diff, YoutubeQueryTypes } from "./../server/Message"; import { Opt } from '../new_fields/Doc'; import { Utils, emptyFunction } from '../Utils'; import { SerializationHelper } from './util/SerializationHelper'; @@ -156,6 +156,20 @@ export namespace DocServer { return _GetRefField(id); } + export async function getYoutubeChannels() { + let apiKey = await Utils.EmitCallback(_socket, MessageStore.YoutubeApiQuery, { type: YoutubeQueryTypes.Channels }); + return apiKey; + } + + export function getYoutubeVideos(videoTitle: string, callBack: (videos: any[]) => void) { + Utils.EmitCallback(_socket, MessageStore.YoutubeApiQuery, { type: YoutubeQueryTypes.SearchVideo, userInput: videoTitle }, callBack); + } + + export function getYoutubeVideoDetails(videoIds: string, callBack: (videoDetails: any[]) => void) { + Utils.EmitCallback(_socket, MessageStore.YoutubeApiQuery, { type: YoutubeQueryTypes.VideoDetails, videoIds: videoIds }, callBack); + } + + /** * Given a list of Doc GUIDs, this utility function will asynchronously attempt to each id's associated * field, first looking in the RefField cache and then communicating with |