How to use the tencentcloud-sdk-nodejs.common 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 airingursb / 2life-server / src / routes / notes.js View on Github external
NLP_ID,
  NLP_SECRET
} from '../config'

import { wechatContentCheck, wechatImgCheck } from '../utils'

import Promise from 'Promise'

const tencentcloud = require('tencentcloud-sdk-nodejs')

const NlpClient = tencentcloud.nlp.v20190408.Client
const models = tencentcloud.nlp.v20190408.Models

const Credential = tencentcloud.common.Credential
const ClientProfile = tencentcloud.common.ClientProfile
const HttpProfile = tencentcloud.common.HttpProfile

const router = express.Router()

/* notes/publish
 * 该接口弃用,仅用于兼容2.0.8以下版本(20180726)
 */
router.post('/publish', (req, res) => {

  const {
    uid,
    token,
    timestamp,
    title,
    content,
    location,
    longitude,
github TencentCloudBase / image-node-sdk / libs / BaseService.js View on Github external
const {
    rp,
    sign
} = require('./utils');
const urlUtil = require('url');
const randomInt = require('random-int');
const config = require('./config');
const ERR = require('./error');

// 部分接口陆续使用 API 3.0
const tencentcloud = require('tencentcloud-sdk-nodejs');
const Credential = tencentcloud.common.Credential;
const ClientProfile = tencentcloud.common.ClientProfile;
const HttpProfile = tencentcloud.common.HttpProfile;


class BaseService {

    constructor({ AppId, SecretId, SecretKey } = {}) {
        let {
            APPID,
            SECRETID,
            SECRETKEY,
            TENCENTCLOUD_APPID,
            TENCENTCLOUD_SECRETID,
            TENCENTCLOUD_SECRETKEY
        } = process.env;
        this.rp = rp;
        this.AppId = AppId || TENCENTCLOUD_APPID || APPID;
        this.SecretId = SecretId || TENCENTCLOUD_SECRETID || SECRETID;
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);
  return new Promise((resolve, reject) => {
github tencentyun / scf-demo-repo / Nodejs8.9-SmsVerificationCode / index.js View on Github external
async function sendSms(phone, code) {
  const SmsClient = tencentcloud.sms.v20190711.Client;
  const Credential = tencentcloud.common.Credential;
  const ClientProfile = tencentcloud.common.ClientProfile;
  const HttpProfile = tencentcloud.common.HttpProfile;
  const secretId = process.env.TENCENTCLOUD_SECRETID;
  const secretKey = process.env.TENCENTCLOUD_SECRETKEY;
  const token = process.env.TENCENTCLOUD_SESSIONTOKEN;

  let cred = new Credential(secretId, secretKey, token);
  let httpProfile = new HttpProfile();
  httpProfile.endpoint = "sms.tencentcloudapi.com";
  let clientProfile = new ClientProfile();
  clientProfile.httpProfile = httpProfile;
  let client = new SmsClient(cred, "ap-guangzhou", clientProfile);

  let req = {
      PhoneNumberSet: ["+" + phone], //大陆手机号861856624****
      TemplateID: process.env.SMS_TEMPLATE_ID, //腾讯云短信模板id
      Sign: process.env.SMS_SIGN, //腾讯云短信签名
github TencentCloudBase / cloudbase-cli / src / utils.ts View on Github external
export function callCloudApi(secretId, secretKey) {
    const CvmClient = tencentcloud.cvm.v20170312.Client;
    const models = tencentcloud.cvm.v20170312.Models;
    const Credential = tencentcloud.common.Credential;
    let cred = new Credential(secretId, secretKey);
    let client = new CvmClient(cred, "ap-shanghai");
    let req = new models.DescribeZonesRequest();

    return new Promise((resolve, reject) => {
        client.DescribeZones(req, function (err, response) {
            if (err) {
                reject(err)
                return;
            }
            resolve(response)
        });
    })
}
github TencentCloudBase / cloudbase-cli / lib / utils.js View on Github external
function callCloudApi(secretId, secretKey) {
    const CvmClient = tencentcloud.cvm.v20170312.Client;
    const models = tencentcloud.cvm.v20170312.Models;
    const Credential = tencentcloud.common.Credential;
    let cred = new Credential(secretId, secretKey);
    let client = new CvmClient(cred, 'ap-shanghai');
    let req = new models.DescribeZonesRequest();
    return new Promise((resolve, reject) => {
        client.DescribeZones(req, function (err, response) {
            if (err) {
                reject(err);
                return;
            }
            resolve(response);
        });
    });
}
exports.callCloudApi = callCloudApi;
github tencentyun / scf-demo-repo / Nodejs8.9-SmsVerificationCode / index.js View on Github external
async function sendSms(phone, code) {
  const SmsClient = tencentcloud.sms.v20190711.Client;
  const Credential = tencentcloud.common.Credential;
  const ClientProfile = tencentcloud.common.ClientProfile;
  const HttpProfile = tencentcloud.common.HttpProfile;
  const secretId = process.env.TENCENTCLOUD_SECRETID;
  const secretKey = process.env.TENCENTCLOUD_SECRETKEY;
  const token = process.env.TENCENTCLOUD_SESSIONTOKEN;

  let cred = new Credential(secretId, secretKey, token);
  let httpProfile = new HttpProfile();
  httpProfile.endpoint = "sms.tencentcloudapi.com";
  let clientProfile = new ClientProfile();
  clientProfile.httpProfile = httpProfile;
  let client = new SmsClient(cred, "ap-guangzhou", clientProfile);

  let req = {
      PhoneNumberSet: ["+" + phone], //大陆手机号861856624****
      TemplateID: process.env.SMS_TEMPLATE_ID, //腾讯云短信模板id
      Sign: process.env.SMS_SIGN, //腾讯云短信签名
      TemplateParamSet: [code],