aboutsummaryrefslogtreecommitdiff
path: root/src/client/apis
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/apis')
-rw-r--r--src/client/apis/IBM_Recommender.ts40
-rw-r--r--src/client/apis/google_docs/GooglePhotosClientUtils.ts4
-rw-r--r--src/client/apis/youtube/YoutubeBox.tsx4
3 files changed, 44 insertions, 4 deletions
diff --git a/src/client/apis/IBM_Recommender.ts b/src/client/apis/IBM_Recommender.ts
new file mode 100644
index 000000000..da6257f28
--- /dev/null
+++ b/src/client/apis/IBM_Recommender.ts
@@ -0,0 +1,40 @@
+import { Opt } from "../../new_fields/Doc";
+
+const NaturalLanguageUnderstandingV1 = require('ibm-watson/natural-language-understanding/v1');
+const { IamAuthenticator } = require('ibm-watson/auth');
+
+export namespace IBM_Recommender {
+
+ // pass to IBM account is Browngfx1
+
+ const naturalLanguageUnderstanding = new NaturalLanguageUnderstandingV1({
+ version: '2019-07-12',
+ authenticator: new IamAuthenticator({
+ apikey: 'tLiYwbRim3CnBcCO4phubpf-zEiGcub1uh0V-sD9OKhw',
+ }),
+ url: 'https://gateway-wdc.watsonplatform.net/natural-language-understanding/api'
+ });
+
+ const analyzeParams = {
+ 'text': 'this is a test of the keyword extraction feature I am integrating into the program',
+ 'features': {
+ 'keywords': {
+ 'sentiment': true,
+ 'emotion': true,
+ 'limit': 3
+ },
+ }
+ };
+
+ export const analyze = async (_parameters: any): Promise<Opt<string>> => {
+ try {
+ const response = await naturalLanguageUnderstanding.analyze(_parameters);
+ console.log(response);
+ return (JSON.stringify(response, null, 2));
+ } catch (err) {
+ console.log('error: ', err);
+ return undefined;
+ }
+ };
+
+} \ No newline at end of file
diff --git a/src/client/apis/google_docs/GooglePhotosClientUtils.ts b/src/client/apis/google_docs/GooglePhotosClientUtils.ts
index 966d8053a..7e5d5fe1b 100644
--- a/src/client/apis/google_docs/GooglePhotosClientUtils.ts
+++ b/src/client/apis/google_docs/GooglePhotosClientUtils.ts
@@ -136,7 +136,7 @@ export namespace GooglePhotos {
document.contentSize = upload.contentSize;
return document;
});
- const options = { width: 500, height: 500 };
+ const options = { _width: 500, _height: 500 };
return constructor(children, options);
};
@@ -340,7 +340,7 @@ export namespace GooglePhotos {
const url = data.url.href;
const target = Doc.MakeAlias(source);
const description = parseDescription(target, descriptionKey);
- await DocumentView.makeCustomViewClicked(target, undefined);
+ await DocumentView.makeCustomViewClicked(target, undefined, Docs.Create.FreeformDocument);
media.push({ url, description });
}
if (media.length) {
diff --git a/src/client/apis/youtube/YoutubeBox.tsx b/src/client/apis/youtube/YoutubeBox.tsx
index fd3d9e2f1..c940bba43 100644
--- a/src/client/apis/youtube/YoutubeBox.tsx
+++ b/src/client/apis/youtube/YoutubeBox.tsx
@@ -46,7 +46,7 @@ export class YoutubeBox extends React.Component<FieldViewProps> {
* When component mounts, last search's results are laoded in based on the back up stored
* in the document of the props.
*/
- async componentWillMount() {
+ async componentDidMount() {
//DocServer.getYoutubeChannels();
const castedSearchBackUp = Cast(this.props.Document.cachedSearchResults, Doc);
const awaitedBackUp = await castedSearchBackUp;
@@ -337,7 +337,7 @@ export class YoutubeBox extends React.Component<FieldViewProps> {
const newVideoX = NumCast(this.props.Document.x);
const newVideoY = NumCast(this.props.Document.y) + NumCast(this.props.Document.height);
- addFunction(Docs.Create.VideoDocument(embeddedUrl, { title: filteredTitle, width: 400, height: 315, x: newVideoX, y: newVideoY }));
+ addFunction(Docs.Create.VideoDocument(embeddedUrl, { title: filteredTitle, _width: 400, _height: 315, x: newVideoX, y: newVideoY }));
this.videoClicked = true;
}