How to use tencentcloud-sdk-nodejs - 10 common examples

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 serverless-components / tencent-cam-policy / serverless.js View on Github external
getCamClient(credentials, region) {
    // create cam client

    const secret_id = credentials.SecretId
    const secret_key = credentials.SecretKey
    const cred = new tencentcloud.common.Credential(secret_id, secret_key)
    const httpProfile = new HttpProfile()
    httpProfile.reqTimeout = 30
    const clientProfile = new ClientProfile('HmacSHA256', httpProfile)
    return new CamClient(cred, region, clientProfile)
  }
github serverless-components / tencent-cam-policy / serverless.js View on Github external
getCamClient(credentials, region) {
    // create cam client

    const secret_id = credentials.SecretId
    const secret_key = credentials.SecretKey
    const cred = new tencentcloud.common.Credential(secret_id, secret_key)
    const httpProfile = new HttpProfile()
    httpProfile.reqTimeout = 30
    const clientProfile = new ClientProfile('HmacSHA256', httpProfile)
    return new CamClient(cred, region, clientProfile)
  }
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 serverless-components / tencent-scf / library / deployFunction.js View on Github external
const tencentcloud = require('tencentcloud-sdk-nodejs')
const Abstract = require('./abstract')
const utils = require('./utils')
const fs = require('fs')
const _ = require('lodash')
const util = require('util')
const models = tencentcloud.scf.v20180416.Models
const camModels = tencentcloud.cam.v20190116.Models

class DeployFunction extends Abstract {
  async deploy(ns, funcObject) {
    const func = await this.getFunction(ns, funcObject.FuncName)
    if (!func) {
      await this.createFunction(ns, funcObject)
    } else {
      if (func.Runtime != funcObject.Properties.Runtime) {
        throw `Runtime error: Release runtime(${func.Runtime}) and local runtime(${funcObject.Properties.Runtime}) are inconsistent`
      }
      this.context.debug('Updating code... ')
      await this.updateFunctionCode(ns, funcObject)
      // when update code Status is Active, continue
      let status = 'updating'
      while (status != 'Active') {
github serverless-components / tencent-scf / library / deployFunction.js View on Github external
const tencentcloud = require('tencentcloud-sdk-nodejs')
const Abstract = require('./abstract')
const utils = require('./utils')
const fs = require('fs')
const _ = require('lodash')
const util = require('util')
const models = tencentcloud.scf.v20180416.Models
const camModels = tencentcloud.cam.v20190116.Models

class DeployFunction extends Abstract {
  async deploy(ns, funcObject) {
    const func = await this.getFunction(ns, funcObject.FuncName)
    if (!func) {
      await this.createFunction(ns, funcObject)
    } else {
      if (func.Runtime != funcObject.Properties.Runtime) {
        throw `Runtime error: Release runtime(${func.Runtime}) and local runtime(${funcObject.Properties.Runtime}) are inconsistent`
      }
      this.context.debug('Updating code... ')
      await this.updateFunctionCode(ns, funcObject)
      // when update code Status is Active, continue
      let status = 'updating'
      while (status != 'Active') {
        const tempFunc = await this.getFunction(ns, funcObject.FuncName)
github serverless-components / tencent-cam-policy / serverless.js View on Github external
const { mergeDeepRight } = require('ramda')
const util = require('util')
const { utils } = require('@serverless/core')
const { Component } = require('@serverless/core')
const tencentcloud = require('tencentcloud-sdk-nodejs')
const CamClient = tencentcloud.cam.v20190116.Client
const camModels = tencentcloud.cam.v20190116.Models
const ClientProfile = require('tencentcloud-sdk-nodejs/tencentcloud/common/profile/client_profile.js')
const HttpProfile = require('tencentcloud-sdk-nodejs/tencentcloud/common/profile/http_profile.js')

class TencentCamPolicy extends Component {
  getCamClient(credentials, region) {
    // create cam client

    const secret_id = credentials.SecretId
    const secret_key = credentials.SecretKey
    const cred = new tencentcloud.common.Credential(secret_id, secret_key)
    const httpProfile = new HttpProfile()
    httpProfile.reqTimeout = 30
    const clientProfile = new ClientProfile('HmacSHA256', httpProfile)
    return new CamClient(cred, region, clientProfile)
  }
github serverless-components / tencent-cam-policy / serverless.js View on Github external
const { mergeDeepRight } = require('ramda')
const util = require('util')
const { utils } = require('@serverless/core')
const { Component } = require('@serverless/core')
const tencentcloud = require('tencentcloud-sdk-nodejs')
const CamClient = tencentcloud.cam.v20190116.Client
const camModels = tencentcloud.cam.v20190116.Models
const ClientProfile = require('tencentcloud-sdk-nodejs/tencentcloud/common/profile/client_profile.js')
const HttpProfile = require('tencentcloud-sdk-nodejs/tencentcloud/common/profile/http_profile.js')

class TencentCamPolicy extends Component {
  getCamClient(credentials, region) {
    // create cam client

    const secret_id = credentials.SecretId
    const secret_key = credentials.SecretKey
    const cred = new tencentcloud.common.Credential(secret_id, secret_key)
    const httpProfile = new HttpProfile()
    httpProfile.reqTimeout = 30
    const clientProfile = new ClientProfile('HmacSHA256', httpProfile)
    return new CamClient(cred, region, clientProfile)
  }
github airingursb / 2life-server / src / routes / notes.js View on Github external
import {
  MESSAGE,
  validate,
  JiGuangPush,
  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,
github airingursb / 2life-server / src / routes / notes.js View on Github external
import {
  MESSAGE,
  validate,
  JiGuangPush,
  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,