- requestCallback :
function .request的请求回调
Kind: global class
API 构造函数
| Param | Type | Default | Description |
|---|---|---|---|
| [defaults] | Object |
默认参数及配置 | |
| defaults.serviceType | String |
服务类型. 如: cvm, vpc, dfw, lb 等. 根据 serviceType 和 baseHost 将拼装成请求域名, 如: vpc.api.qcloud.com |
|
| defaults.path | String |
'/v2/index.php' |
Api 请求路径 |
| defaults.method | String |
'POST' |
请求方法 |
| defaults.baseHost | String |
'api.qcloud.com' |
Api 的基础域名. 与 serviceType 拼装成请求域名. |
| defaults.SecretId | String |
secretId | |
| defaults.SecretKey | String |
secretKey |
生成 API 的请求地址
Kind: instance method of QcloudApi
| Param | Type |
|---|---|
| opts | Object |
生成请求参数.
Kind: instance method of QcloudApi
Returns: string - 包括签名的参数字符串
| Param | Type | Description |
|---|---|---|
| data | Object |
该次请求的参数. 同 request 方法的 data 参数 |
| [opts] | Object |
请求配置. 同 request 方法的 opts 参数 |
请求 API
Kind: instance method of QcloudApi
| Param | Type | Description |
|---|---|---|
| data | Object |
该次请求的参数. |
| [data.SecretId] | Object |
Api SecrectId, 通过 data 参数传入时将覆盖 opt 传入及默认的 secretId |
| [opts] | Object |
请求配置. 配置里的参数缺省使用默认配置 (this.defaults) 里的对应项 |
| opts.host | String |
该次请求使用的 API host. 当传入该参数的时候, 将忽略 serviceType 及默认 host |
| callback | requestCallback |
请求回调 |
| [extra] | Object |
传给 request 库的额外参数 |
生成签名
Kind: instance method of QcloudApi
Returns: String - 签名
| Param | Type | Description |
|---|---|---|
| str | String |
需签名的参数串 |
| secretKey | String |
.request 的请求回调
Kind: global typedef
| Param | Type | Description |
|---|---|---|
| error | Error |
请求错误 |
| body | Object |
API 请求结果 |