![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
@tencent-sdk/capi
Advanced tools
Package description
@tencent-sdk/capi is an npm package that provides a client for interacting with Tencent Cloud's API Gateway. It allows developers to easily integrate Tencent Cloud services into their Node.js applications by providing a set of tools and methods for making API requests.
Initialize the Client
This feature allows you to initialize the client with your Tencent Cloud credentials and region. This is the first step to start making API requests.
const { Capi } = require('@tencent-sdk/capi');
const client = new Capi({
SecretId: 'your-secret-id',
SecretKey: 'your-secret-key',
Region: 'ap-guangzhou'
});
Make an API Request
This feature allows you to make an API request to Tencent Cloud. In this example, it requests a list of instances in the specified region.
client.request({
Action: 'DescribeInstances',
Version: '2017-03-12',
Region: 'ap-guangzhou'
}).then(response => {
console.log(response);
}).catch(error => {
console.error(error);
});
Set Custom Endpoint
This feature allows you to set a custom endpoint for the API requests. This can be useful if you need to interact with a specific service or region.
client.setEndpoint('cvm.tencentcloudapi.com');
The aws-sdk package is the official AWS SDK for JavaScript, available for browsers and Node.js. It provides a comprehensive set of tools for interacting with AWS services. Compared to @tencent-sdk/capi, aws-sdk offers a broader range of services and is more widely used due to AWS's larger market share.
The googleapis package is the official Node.js client library for Google's APIs. It allows developers to interact with various Google services, such as Google Cloud, YouTube, and Gmail. Similar to @tencent-sdk/capi, it provides methods for making API requests, but it is specific to Google's ecosystem.
The azure-sdk-for-js package is the official Azure SDK for JavaScript. It provides libraries for interacting with Azure services, including storage, databases, and machine learning. Like @tencent-sdk/capi, it simplifies the process of integrating cloud services into Node.js applications, but it is tailored for Microsoft's Azure platform.
Readme
This is a basement api tool for all tencent cloud apis.
Capi
is the only class for create a client request instance, and the instance only has one method request
.
You can use it like below:
import { Capi } from '@tencent-sdk/capi';
const client = new Capi({
Region: 'ap-guangzhou',
SecretId: 'Please input your SecretId',
SecretKey: 'Please input your SecretKey',
Token: 'Please input your Token',
ServiceType: 'tmt',
});
try {
const res = await client.request(
{
Action: 'TextTranslate',
Version: '2018-03-21',
SourceText: 'hello',
Source: 'auto',
Target: 'zh',
ProjectId: 0,
},
{
debug: true,
host: 'tmt.tencentcloudapi.com',
},
);
console.log('res', res);
} catch (e) {
console.log(e);
}
This is a demo for using Tencent Machine Translator.
const client = new Capi(CapiOptions);
client.request(RequestData, RequestOptions, isV3);
CapiOptions
for Capi ConstructorName | Description | Type | Required | Default |
---|---|---|---|---|
ServiceType | tencent service type | string | true | '' |
Region | request region | string | true | ap-guangzhou |
SecretId | tencent account secret id | string | true | '' |
SecretKey | tencent account secret key | string | true | '' |
Token | tencent account token | string | false | '' |
debug | whether enable log debug info | boolean | false | false |
host | request host | string | false | false |
baseHost | request domain | string | false | 'api.qcloud.com' |
path | request path | string | false | '/' |
method | request method | string | false | 'POST' |
protocol | request protocol | string | false | 'https' |
SignatureMethod | request signature | string | false | 'sha1' |
RequestData
for reqeust methodName | Description | Type | Required | Default |
---|---|---|---|---|
Action | api action | string | true | '' |
Version | api version | string | true | '2018-03-21' |
RequestClient | specify your service | string | false | 'TSS-CAPI' |
[propName] | left api parameters | any | false | '' |
RequestOptions
for reqeust methodIt is a copy from CapiOptions
, if you set this, you can rewrite the properties in CapiOptions
.
isV3
for request methodisV3
is used to specify to use version for authentication.
true
: usingTC3-HMAC-SHA256
false
: usingHmacSHA256
orSha1
MIT
FAQs
Tencent cloud api sdk
The npm package @tencent-sdk/capi receives a total of 85,950 weekly downloads. As such, @tencent-sdk/capi popularity was classified as popular.
We found that @tencent-sdk/capi demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.