diff --git a/labscore/api/endpoints.js b/labscore/api/endpoints.js index 92ea77c..7f4ba6f 100644 --- a/labscore/api/endpoints.js +++ b/labscore/api/endpoints.js @@ -7,27 +7,39 @@ const Hosts = Object.freeze({ const Api = Object.freeze({ HOST: Hosts.prod, - - GOOGLE_VISION_OCR: '/google/vision/ocr', - SEARCH_LYRICS: '/search/lyrics', + GOOGLE_PERSPECTIVE: '/google/perspective/analyze', + GOOGLE_TRANSLATE: '/google/translate/text', + GOOGLE_VISION_COLORS: '/google/vision/colors', + GOOGLE_VISION_FACES: '/google/vision/faces', + GOOGLE_VISION_LABELS: '/google/vision/labels', + GOOGLE_VISION_OCR: '/google/vision/ocr', + GOOGLE_VISION_SAFETY_LABELS: '/google/vision/safety', + GOOGLE_VISION_WEBDETECTION: '/google/vision/webdetection', + + IMAGE_DEEPDREAM: '/image/deepdream', + IMAGE_SUPERRESOLUTION: '/image/superresolution', + IMAGE_WAIFU2X: '/image/waifu2x', + + PHOTOFUNIA_RETRO_WAVE: '/photofunia/retro-wave', + PHOTOFUNIA_YACHT: '/photofunia/yacht', SEARCH_AUDIO: '/search/audio', - SEARCH_GOOGLE: '/search/google', - SEARCH_GOOGLE_IMAGES: '/search/google-images', SEARCH_BING: '/search/bing', SEARCH_BING_IMAGES: '/search/bing-images', + SEARCH_GOOGLE: '/search/google', + SEARCH_GOOGLE_IMAGES: '/search/google-images', + SEARCH_LYRICS: '/search/lyrics', SEARCH_WOLFRAM_ALPHA: '/search/wolfram-alpha', SEARCH_YOUTUBE: '/search/youtube', - PHOTOFUNIA_YACHT: '/photofunia/yacht', - PHOTOFUNIA_RETRO_WAVE: '/photofunia/retro-wave', - - IMAGE_DEEPDREAM: '/image/deepdream', - IMAGE_WAIFU2X: '/image/waifu2x', - IMAGE_SUPERRESOLUTION: '/image/superresolution', + TTS_IMTRANSLATOR: '/tts/imtranslator', + TTS_POLLY: '/tts/polly', + TTS_TIKTOK: '/tts/tiktok', + TTS_VOICEFORGE: '/tts/voiceforge', - INFERKIT: '/utils/inferkit', + UTILS_INFERKIT: '/utils/inferkit', + UTILS_SCREENSHOT: '/utils/screenshot', }) const Static = Object.freeze({ diff --git a/labscore/api/index.js b/labscore/api/index.js index 954bc0c..2a00eed 100644 --- a/labscore/api/index.js +++ b/labscore/api/index.js @@ -41,12 +41,56 @@ async function request(path, type, headers, args, host) { throw new Error("unsupported, must either use GET or POST"); } +module.exports.googlePerspective = async function(context, text){ + return await request(Api.GOOGLE_PERSPECTIVE, "GET", {}, { + text: text + }) +} + +module.exports.googleTranslate = async function(context, text, to, from){ + return await request(Api.GOOGLE_TRANSLATE, "GET", {}, { + text: text, + to: to, + from: from + }) +} + +module.exports.googleVisionColors = async function(context, url){ + return await request(Api.GOOGLE_VISION_COLORS, "GET", {}, { + url: url + }) +} + +module.exports.googleVisionFaces = async function(context, url){ + return await request(Api.GOOGLE_VISION_FACES, "GET", {}, { + url: url + }) +} + +module.exports.googleVisionLabels = async function(context, url){ + return await request(Api.GOOGLE_VISION_LABELS, "GET", {}, { + url: url + }) +} + module.exports.googleVisionOcr = async function(context, url){ return await request(Api.GOOGLE_VISION_OCR, "GET", {}, { url: url }) } +module.exports.googleVisionSafetyLabels = async function(context, url){ + return await request(Api.GOOGLE_VISION_SAFETY_LABELS, "GET", {}, { + url: url + }) +} + +module.exports.googleVisionWebDetection = async function(context, url){ + return await request(Api.GOOGLE_VISION_WEBDETECTION, "GET", {}, { + url: url + }) +} + module.exports.searchAudio = async function(context, url){ return await request(Api.SEARCH_AUDIO, "GET", {}, { url: url @@ -129,12 +173,46 @@ module.exports.superresolution = async function(context, url){ }) } +module.exports.imtranslator = async function(context, text, voice){ + return await request(Api.TTS_IMTRANSLATOR, "GET", {}, { + text: text, + voice: voice + }) +} + +module.exports.polly = async function(context, text, voice){ + return await request(Api.TTS_POLLY, "GET", {}, { + text: text, + voice: voice + }) +} + +module.exports.tiktok = async function(context, text, voice){ + return await request(Api.TTS_TIKTOK, "GET", {}, { + text: text, + voice: voice + }) +} + +module.exports.voiceforge = async function(context, text, voice){ + return await request(Api.TTS_VOICEFORGE, "GET", {}, { + text: text, + voice: voice + }) +} + module.exports.inferkit = async function(context, input){ - return await request(Api.INFERKIT, "GET", {}, { + return await request(Api.UTILS_INFERKIT, "GET", {}, { input: input }) } +module.exports.screenshot = async function(context, url){ + return await request(Api.UTILS_SCREENSHOT, "GET", {}, { + url: url + }) +} + module.exports.emojiTwitter = async function(codepoint){ return Static.HOST + Static.TWITTER(codepoint) } \ No newline at end of file