How to use the tencentcloud-sdk-nodejs.tmt function in tencentcloud-sdk-nodejs

To help you get started, we’ve selected a few tencentcloud-sdk-nodejs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github teadocs / matplotlib-cn / scripts / gallery / module / translation.js View on Github external
const t = async function (englishText) {
  const tencentcloud = require('tencentcloud-sdk-nodejs');
  const TmtClient = tencentcloud.tmt.v20180321.Client;
  const models = tencentcloud.tmt.v20180321.Models;
  const Credential = tencentcloud.common.Credential;
  const ClientProfile = tencentcloud.common.ClientProfile;
  const HttpProfile = tencentcloud.common.HttpProfile;

  let cred = new Credential(
    "AKIDcAEB4ous9MYv5ZhFm5c0XdfwzoX4FDtp",
    "wgC9vVtBFC1PdHIDzmNjcKvHSN2XLyQh"
  );
  let httpProfile = new HttpProfile();
  httpProfile.endpoint = "tmt.tencentcloudapi.com";
  let clientProfile = new ClientProfile();
  clientProfile.httpProfile = httpProfile;
  let client = new TmtClient(cred, "ap-guangzhou", clientProfile);
  let req = new models.TextTranslateRequest();
  let params = '{"SourceText":"'+ englishText +'","Source":"en","Target":"zh","ProjectId":0}'
github teadocs / matplotlib-cn / scripts / gallery / module / translation.js View on Github external
const t = async function (englishText) {
  const tencentcloud = require('tencentcloud-sdk-nodejs');
  const TmtClient = tencentcloud.tmt.v20180321.Client;
  const models = tencentcloud.tmt.v20180321.Models;
  const Credential = tencentcloud.common.Credential;
  const ClientProfile = tencentcloud.common.ClientProfile;
  const HttpProfile = tencentcloud.common.HttpProfile;

  let cred = new Credential(
    "AKIDcAEB4ous9MYv5ZhFm5c0XdfwzoX4FDtp",
    "wgC9vVtBFC1PdHIDzmNjcKvHSN2XLyQh"
  );
  let httpProfile = new HttpProfile();
  httpProfile.endpoint = "tmt.tencentcloudapi.com";
  let clientProfile = new ClientProfile();
  clientProfile.httpProfile = httpProfile;
  let client = new TmtClient(cred, "ap-guangzhou", clientProfile);
  let req = new models.TextTranslateRequest();
  let params = '{"SourceText":"'+ englishText +'","Source":"en","Target":"zh","ProjectId":0}'
  req.from_json_string(params);