mirror of
https://github.com/certd/certd.git
synced 2026-07-17 11:37:32 +08:00
2814 lines
78 KiB
JavaScript
2814 lines
78 KiB
JavaScript
/*
|
|
* Copyright 2018 JDCLOUD.COM
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http:#www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*
|
|
* Iotlink-Related-API
|
|
* 物联网卡服务相关API
|
|
*
|
|
* OpenAPI spec version: v1
|
|
* Contact:
|
|
*
|
|
* NOTE: This class is auto generated by the jdcloud code generator program.
|
|
*/
|
|
|
|
require('../../../lib/node_loader')
|
|
var JDCloud = require('../../../lib/core')
|
|
var Service = JDCloud.Service
|
|
var serviceId = 'iotlink'
|
|
Service._services[serviceId] = true
|
|
|
|
/**
|
|
* iotlink service.
|
|
* @version 1.0.8
|
|
*/
|
|
|
|
class IOTLINK extends Service {
|
|
constructor (options = {}) {
|
|
options._defaultEndpoint = {}
|
|
options._defaultEndpoint.protocol =
|
|
options._defaultEndpoint.protocol || 'https'
|
|
options._defaultEndpoint.host =
|
|
options._defaultEndpoint.host || 'iotlink.jdcloud-api.com'
|
|
options.basePath = '/v1' // 默认要设为空""
|
|
super(serviceId, options)
|
|
}
|
|
|
|
/**
|
|
* 物联网卡实名制信息清除
|
|
* @param {Object} opts - parameters
|
|
* @param {string} opts.requestParam - 物联网卡实名制信息清除请求参数
|
|
* @param {string} regionId - ID of the region
|
|
* @param {string} callback - callback
|
|
@return {Object} result
|
|
* @param string status 请求状态(0:成功;其他:失败)
|
|
* @param string message 消息描述
|
|
* @param boolean result 物联网卡实名制信息清除返回结果集
|
|
*/
|
|
|
|
ordinaryRealNameClear (opts, regionId = this.config.regionId, callback) {
|
|
if (typeof regionId === 'function') {
|
|
callback = regionId
|
|
regionId = this.config.regionId
|
|
}
|
|
|
|
if (regionId === undefined || regionId === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'regionId' when calling ordinaryRealNameClear"
|
|
)
|
|
}
|
|
|
|
opts = opts || {}
|
|
|
|
if (opts.requestParam === undefined || opts.requestParam === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'opts.requestParam' when calling ordinaryRealNameClear"
|
|
)
|
|
}
|
|
|
|
let postBody = {}
|
|
if (opts.requestParam !== undefined && opts.requestParam !== null) {
|
|
postBody['requestParam'] = opts.requestParam
|
|
}
|
|
|
|
let queryParams = {}
|
|
|
|
let pathParams = {
|
|
regionId: regionId
|
|
}
|
|
|
|
let headerParams = {
|
|
'User-Agent': 'JdcloudSdkNode/1.0.0 iotlink/1.0.8'
|
|
}
|
|
|
|
let contentTypes = ['application/json']
|
|
let accepts = ['application/json']
|
|
|
|
// 扩展自定义头
|
|
if (opts['x-extra-header']) {
|
|
for (let extraHeader in opts['x-extra-header']) {
|
|
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
|
contentTypes = opts['x-extra-header']['content-type']
|
|
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
|
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
|
accepts = opts['x-extra-header']['accept']
|
|
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
|
accepts = opts['x-extra-header']['accept'].split(',')
|
|
}
|
|
}
|
|
|
|
let formParams = {}
|
|
|
|
let returnType = null
|
|
|
|
this.config.logger(
|
|
`call ordinaryRealNameClear with params:\npathParams:${JSON.stringify(
|
|
pathParams
|
|
)},\nqueryParams:${JSON.stringify(
|
|
queryParams
|
|
)}, \nheaderParams:${JSON.stringify(
|
|
headerParams
|
|
)}, \nformParams:${JSON.stringify(
|
|
formParams
|
|
)}, \npostBody:${JSON.stringify(postBody)}`,
|
|
'DEBUG'
|
|
)
|
|
|
|
let request = super.makeRequest(
|
|
'/regions/{regionId}/ordinaryRealNameClear',
|
|
'POST',
|
|
pathParams,
|
|
queryParams,
|
|
headerParams,
|
|
formParams,
|
|
postBody,
|
|
contentTypes,
|
|
accepts,
|
|
returnType,
|
|
callback
|
|
)
|
|
|
|
return request.then(
|
|
function (result) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(null, result)
|
|
}
|
|
return result
|
|
},
|
|
function (error) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(error)
|
|
}
|
|
return Promise.reject(error)
|
|
}
|
|
)
|
|
}
|
|
|
|
/**
|
|
* 机卡分离状态查询
|
|
* @param {Object} opts - parameters
|
|
* @param {string} opts.iccid - 物联网卡iccid
|
|
* @param {string} regionId - ID of the region
|
|
* @param {string} callback - callback
|
|
@return {Object} result
|
|
* @param string status 请求状态(0:成功;1:失败)
|
|
* @param string message 消息描述
|
|
* @param cardBindStatusResp result 机卡分离状态查询结果
|
|
*/
|
|
|
|
cardBindStatus (opts, regionId = this.config.regionId, callback) {
|
|
if (typeof regionId === 'function') {
|
|
callback = regionId
|
|
regionId = this.config.regionId
|
|
}
|
|
|
|
if (regionId === undefined || regionId === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'regionId' when calling cardBindStatus"
|
|
)
|
|
}
|
|
|
|
opts = opts || {}
|
|
|
|
if (opts.iccid === undefined || opts.iccid === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'opts.iccid' when calling cardBindStatus"
|
|
)
|
|
}
|
|
|
|
let postBody = null
|
|
let queryParams = {}
|
|
if (opts.iccid !== undefined && opts.iccid !== null) {
|
|
queryParams['iccid'] = opts.iccid
|
|
}
|
|
|
|
let pathParams = {
|
|
regionId: regionId
|
|
}
|
|
|
|
let headerParams = {
|
|
'User-Agent': 'JdcloudSdkNode/1.0.0 iotlink/1.0.8'
|
|
}
|
|
|
|
let contentTypes = ['application/json']
|
|
let accepts = ['application/json']
|
|
|
|
// 扩展自定义头
|
|
if (opts['x-extra-header']) {
|
|
for (let extraHeader in opts['x-extra-header']) {
|
|
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
|
contentTypes = opts['x-extra-header']['content-type']
|
|
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
|
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
|
accepts = opts['x-extra-header']['accept']
|
|
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
|
accepts = opts['x-extra-header']['accept'].split(',')
|
|
}
|
|
}
|
|
|
|
let formParams = {}
|
|
|
|
let returnType = null
|
|
|
|
this.config.logger(
|
|
`call cardBindStatus with params:\npathParams:${JSON.stringify(
|
|
pathParams
|
|
)},\nqueryParams:${JSON.stringify(
|
|
queryParams
|
|
)}, \nheaderParams:${JSON.stringify(
|
|
headerParams
|
|
)}, \nformParams:${JSON.stringify(
|
|
formParams
|
|
)}, \npostBody:${JSON.stringify(postBody)}`,
|
|
'DEBUG'
|
|
)
|
|
|
|
let request = super.makeRequest(
|
|
'/regions/{regionId}/cardBindStatus',
|
|
'GET',
|
|
pathParams,
|
|
queryParams,
|
|
headerParams,
|
|
formParams,
|
|
postBody,
|
|
contentTypes,
|
|
accepts,
|
|
returnType,
|
|
callback
|
|
)
|
|
|
|
return request.then(
|
|
function (result) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(null, result)
|
|
}
|
|
return result
|
|
},
|
|
function (error) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(error)
|
|
}
|
|
return Promise.reject(error)
|
|
}
|
|
)
|
|
}
|
|
|
|
/**
|
|
* 在线状态和会话信息查询
|
|
* @param {Object} opts - parameters
|
|
* @param {string} opts.iccid - 物联网卡iccid
|
|
* @param {string} regionId - ID of the region
|
|
* @param {string} callback - callback
|
|
@return {Object} result
|
|
* @param string status 请求状态(0:成功;1:失败)
|
|
* @param string message 消息描述
|
|
* @param getOnlineStatusResp result 在线状态和会话信息查询结果
|
|
*/
|
|
|
|
getOnlineStatus (opts, regionId = this.config.regionId, callback) {
|
|
if (typeof regionId === 'function') {
|
|
callback = regionId
|
|
regionId = this.config.regionId
|
|
}
|
|
|
|
if (regionId === undefined || regionId === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'regionId' when calling getOnlineStatus"
|
|
)
|
|
}
|
|
|
|
opts = opts || {}
|
|
|
|
if (opts.iccid === undefined || opts.iccid === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'opts.iccid' when calling getOnlineStatus"
|
|
)
|
|
}
|
|
|
|
let postBody = null
|
|
let queryParams = {}
|
|
if (opts.iccid !== undefined && opts.iccid !== null) {
|
|
queryParams['iccid'] = opts.iccid
|
|
}
|
|
|
|
let pathParams = {
|
|
regionId: regionId
|
|
}
|
|
|
|
let headerParams = {
|
|
'User-Agent': 'JdcloudSdkNode/1.0.0 iotlink/1.0.8'
|
|
}
|
|
|
|
let contentTypes = ['application/json']
|
|
let accepts = ['application/json']
|
|
|
|
// 扩展自定义头
|
|
if (opts['x-extra-header']) {
|
|
for (let extraHeader in opts['x-extra-header']) {
|
|
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
|
contentTypes = opts['x-extra-header']['content-type']
|
|
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
|
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
|
accepts = opts['x-extra-header']['accept']
|
|
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
|
accepts = opts['x-extra-header']['accept'].split(',')
|
|
}
|
|
}
|
|
|
|
let formParams = {}
|
|
|
|
let returnType = null
|
|
|
|
this.config.logger(
|
|
`call getOnlineStatus with params:\npathParams:${JSON.stringify(
|
|
pathParams
|
|
)},\nqueryParams:${JSON.stringify(
|
|
queryParams
|
|
)}, \nheaderParams:${JSON.stringify(
|
|
headerParams
|
|
)}, \nformParams:${JSON.stringify(
|
|
formParams
|
|
)}, \npostBody:${JSON.stringify(postBody)}`,
|
|
'DEBUG'
|
|
)
|
|
|
|
let request = super.makeRequest(
|
|
'/regions/{regionId}/getOnlineStatus',
|
|
'GET',
|
|
pathParams,
|
|
queryParams,
|
|
headerParams,
|
|
formParams,
|
|
postBody,
|
|
contentTypes,
|
|
accepts,
|
|
returnType,
|
|
callback
|
|
)
|
|
|
|
return request.then(
|
|
function (result) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(null, result)
|
|
}
|
|
return result
|
|
},
|
|
function (error) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(error)
|
|
}
|
|
return Promise.reject(error)
|
|
}
|
|
)
|
|
}
|
|
|
|
/**
|
|
* NB卡有效期查询
|
|
* @param {Object} opts - parameters
|
|
* @param {string} opts.requestParam - 物联网卡NB卡有效期查询请求参数
|
|
* @param {string} regionId - ID of the region
|
|
* @param {string} callback - callback
|
|
@return {Object} result
|
|
* @param string status 请求状态(0:成功;其他:失败)
|
|
* @param string message 消息描述
|
|
* @param queryValidPeriodForNBResp result
|
|
*/
|
|
|
|
queryValidPeriodForNB (opts, regionId = this.config.regionId, callback) {
|
|
if (typeof regionId === 'function') {
|
|
callback = regionId
|
|
regionId = this.config.regionId
|
|
}
|
|
|
|
if (regionId === undefined || regionId === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'regionId' when calling queryValidPeriodForNB"
|
|
)
|
|
}
|
|
|
|
opts = opts || {}
|
|
|
|
if (opts.requestParam === undefined || opts.requestParam === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'opts.requestParam' when calling queryValidPeriodForNB"
|
|
)
|
|
}
|
|
|
|
let postBody = {}
|
|
if (opts.requestParam !== undefined && opts.requestParam !== null) {
|
|
postBody['requestParam'] = opts.requestParam
|
|
}
|
|
|
|
let queryParams = {}
|
|
|
|
let pathParams = {
|
|
regionId: regionId
|
|
}
|
|
|
|
let headerParams = {
|
|
'User-Agent': 'JdcloudSdkNode/1.0.0 iotlink/1.0.8'
|
|
}
|
|
|
|
let contentTypes = ['application/json']
|
|
let accepts = ['application/json']
|
|
|
|
// 扩展自定义头
|
|
if (opts['x-extra-header']) {
|
|
for (let extraHeader in opts['x-extra-header']) {
|
|
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
|
contentTypes = opts['x-extra-header']['content-type']
|
|
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
|
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
|
accepts = opts['x-extra-header']['accept']
|
|
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
|
accepts = opts['x-extra-header']['accept'].split(',')
|
|
}
|
|
}
|
|
|
|
let formParams = {}
|
|
|
|
let returnType = null
|
|
|
|
this.config.logger(
|
|
`call queryValidPeriodForNB with params:\npathParams:${JSON.stringify(
|
|
pathParams
|
|
)},\nqueryParams:${JSON.stringify(
|
|
queryParams
|
|
)}, \nheaderParams:${JSON.stringify(
|
|
headerParams
|
|
)}, \nformParams:${JSON.stringify(
|
|
formParams
|
|
)}, \npostBody:${JSON.stringify(postBody)}`,
|
|
'DEBUG'
|
|
)
|
|
|
|
let request = super.makeRequest(
|
|
'/regions/{regionId}/queryValidPeriodForNB',
|
|
'POST',
|
|
pathParams,
|
|
queryParams,
|
|
headerParams,
|
|
formParams,
|
|
postBody,
|
|
contentTypes,
|
|
accepts,
|
|
returnType,
|
|
callback
|
|
)
|
|
|
|
return request.then(
|
|
function (result) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(null, result)
|
|
}
|
|
return result
|
|
},
|
|
function (error) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(error)
|
|
}
|
|
return Promise.reject(error)
|
|
}
|
|
)
|
|
}
|
|
|
|
/**
|
|
* 物联网卡日历史流量查询接口
|
|
* @param {Object} opts - parameters
|
|
* @param {string} opts.requestParam - 物联网卡日历史流量查询请求参数
|
|
* @param {string} regionId - ID of the region
|
|
* @param {string} callback - callback
|
|
@return {Object} result
|
|
* @param string status 请求状态(0:成功;其他:失败)
|
|
* @param string message 消息描述
|
|
* @param object result
|
|
*/
|
|
|
|
queryDayHistoryTraffic (opts, regionId = this.config.regionId, callback) {
|
|
if (typeof regionId === 'function') {
|
|
callback = regionId
|
|
regionId = this.config.regionId
|
|
}
|
|
|
|
if (regionId === undefined || regionId === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'regionId' when calling queryDayHistoryTraffic"
|
|
)
|
|
}
|
|
|
|
opts = opts || {}
|
|
|
|
if (opts.requestParam === undefined || opts.requestParam === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'opts.requestParam' when calling queryDayHistoryTraffic"
|
|
)
|
|
}
|
|
|
|
let postBody = {}
|
|
if (opts.requestParam !== undefined && opts.requestParam !== null) {
|
|
postBody['requestParam'] = opts.requestParam
|
|
}
|
|
|
|
let queryParams = {}
|
|
|
|
let pathParams = {
|
|
regionId: regionId
|
|
}
|
|
|
|
let headerParams = {
|
|
'User-Agent': 'JdcloudSdkNode/1.0.0 iotlink/1.0.8'
|
|
}
|
|
|
|
let contentTypes = ['application/json']
|
|
let accepts = ['application/json']
|
|
|
|
// 扩展自定义头
|
|
if (opts['x-extra-header']) {
|
|
for (let extraHeader in opts['x-extra-header']) {
|
|
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
|
contentTypes = opts['x-extra-header']['content-type']
|
|
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
|
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
|
accepts = opts['x-extra-header']['accept']
|
|
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
|
accepts = opts['x-extra-header']['accept'].split(',')
|
|
}
|
|
}
|
|
|
|
let formParams = {}
|
|
|
|
let returnType = null
|
|
|
|
this.config.logger(
|
|
`call queryDayHistoryTraffic with params:\npathParams:${JSON.stringify(
|
|
pathParams
|
|
)},\nqueryParams:${JSON.stringify(
|
|
queryParams
|
|
)}, \nheaderParams:${JSON.stringify(
|
|
headerParams
|
|
)}, \nformParams:${JSON.stringify(
|
|
formParams
|
|
)}, \npostBody:${JSON.stringify(postBody)}`,
|
|
'DEBUG'
|
|
)
|
|
|
|
let request = super.makeRequest(
|
|
'/regions/{regionId}/queryDayHistoryTraffic',
|
|
'POST',
|
|
pathParams,
|
|
queryParams,
|
|
headerParams,
|
|
formParams,
|
|
postBody,
|
|
contentTypes,
|
|
accepts,
|
|
returnType,
|
|
callback
|
|
)
|
|
|
|
return request.then(
|
|
function (result) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(null, result)
|
|
}
|
|
return result
|
|
},
|
|
function (error) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(error)
|
|
}
|
|
return Promise.reject(error)
|
|
}
|
|
)
|
|
}
|
|
|
|
/**
|
|
* 物联网卡移动实名登记接口
|
|
* @param {Object} opts - parameters
|
|
* @param {string} opts.requestParam - 物联网卡移动实名登记请求参数
|
|
* @param {string} regionId - ID of the region
|
|
* @param {string} callback - callback
|
|
@return {Object} result
|
|
* @param string status 请求状态(0:成功;其他:失败)
|
|
* @param string message 消息描述
|
|
* @param simRealNameRegResp result 物联网卡移动实名登记信息
|
|
*/
|
|
|
|
simRealNameReg (opts, regionId = this.config.regionId, callback) {
|
|
if (typeof regionId === 'function') {
|
|
callback = regionId
|
|
regionId = this.config.regionId
|
|
}
|
|
|
|
if (regionId === undefined || regionId === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'regionId' when calling simRealNameReg"
|
|
)
|
|
}
|
|
|
|
opts = opts || {}
|
|
|
|
if (opts.requestParam === undefined || opts.requestParam === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'opts.requestParam' when calling simRealNameReg"
|
|
)
|
|
}
|
|
|
|
let postBody = {}
|
|
if (opts.requestParam !== undefined && opts.requestParam !== null) {
|
|
postBody['requestParam'] = opts.requestParam
|
|
}
|
|
|
|
let queryParams = {}
|
|
|
|
let pathParams = {
|
|
regionId: regionId
|
|
}
|
|
|
|
let headerParams = {
|
|
'User-Agent': 'JdcloudSdkNode/1.0.0 iotlink/1.0.8'
|
|
}
|
|
|
|
let contentTypes = ['application/json']
|
|
let accepts = ['application/json']
|
|
|
|
// 扩展自定义头
|
|
if (opts['x-extra-header']) {
|
|
for (let extraHeader in opts['x-extra-header']) {
|
|
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
|
contentTypes = opts['x-extra-header']['content-type']
|
|
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
|
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
|
accepts = opts['x-extra-header']['accept']
|
|
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
|
accepts = opts['x-extra-header']['accept'].split(',')
|
|
}
|
|
}
|
|
|
|
let formParams = {}
|
|
|
|
let returnType = null
|
|
|
|
this.config.logger(
|
|
`call simRealNameReg with params:\npathParams:${JSON.stringify(
|
|
pathParams
|
|
)},\nqueryParams:${JSON.stringify(
|
|
queryParams
|
|
)}, \nheaderParams:${JSON.stringify(
|
|
headerParams
|
|
)}, \nformParams:${JSON.stringify(
|
|
formParams
|
|
)}, \npostBody:${JSON.stringify(postBody)}`,
|
|
'DEBUG'
|
|
)
|
|
|
|
let request = super.makeRequest(
|
|
'/regions/{regionId}/simRealNameReg',
|
|
'POST',
|
|
pathParams,
|
|
queryParams,
|
|
headerParams,
|
|
formParams,
|
|
postBody,
|
|
contentTypes,
|
|
accepts,
|
|
returnType,
|
|
callback
|
|
)
|
|
|
|
return request.then(
|
|
function (result) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(null, result)
|
|
}
|
|
return result
|
|
},
|
|
function (error) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(error)
|
|
}
|
|
return Promise.reject(error)
|
|
}
|
|
)
|
|
}
|
|
|
|
/**
|
|
* 物联网卡流量查询(时间段)查询接口
|
|
* @param {Object} opts - parameters
|
|
* @param {string} opts.requestParam - 物联网卡流量查询(时间段)查询请求参数
|
|
* @param {string} regionId - ID of the region
|
|
* @param {string} callback - callback
|
|
@return {Object} result
|
|
* @param string status 请求状态(0:成功;其他:失败)
|
|
* @param string message 消息描述
|
|
* @param string result 物联网卡时间段总使用流量
|
|
*/
|
|
|
|
queryTrafficByDate (opts, regionId = this.config.regionId, callback) {
|
|
if (typeof regionId === 'function') {
|
|
callback = regionId
|
|
regionId = this.config.regionId
|
|
}
|
|
|
|
if (regionId === undefined || regionId === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'regionId' when calling queryTrafficByDate"
|
|
)
|
|
}
|
|
|
|
opts = opts || {}
|
|
|
|
if (opts.requestParam === undefined || opts.requestParam === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'opts.requestParam' when calling queryTrafficByDate"
|
|
)
|
|
}
|
|
|
|
let postBody = {}
|
|
if (opts.requestParam !== undefined && opts.requestParam !== null) {
|
|
postBody['requestParam'] = opts.requestParam
|
|
}
|
|
|
|
let queryParams = {}
|
|
|
|
let pathParams = {
|
|
regionId: regionId
|
|
}
|
|
|
|
let headerParams = {
|
|
'User-Agent': 'JdcloudSdkNode/1.0.0 iotlink/1.0.8'
|
|
}
|
|
|
|
let contentTypes = ['application/json']
|
|
let accepts = ['application/json']
|
|
|
|
// 扩展自定义头
|
|
if (opts['x-extra-header']) {
|
|
for (let extraHeader in opts['x-extra-header']) {
|
|
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
|
contentTypes = opts['x-extra-header']['content-type']
|
|
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
|
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
|
accepts = opts['x-extra-header']['accept']
|
|
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
|
accepts = opts['x-extra-header']['accept'].split(',')
|
|
}
|
|
}
|
|
|
|
let formParams = {}
|
|
|
|
let returnType = null
|
|
|
|
this.config.logger(
|
|
`call queryTrafficByDate with params:\npathParams:${JSON.stringify(
|
|
pathParams
|
|
)},\nqueryParams:${JSON.stringify(
|
|
queryParams
|
|
)}, \nheaderParams:${JSON.stringify(
|
|
headerParams
|
|
)}, \nformParams:${JSON.stringify(
|
|
formParams
|
|
)}, \npostBody:${JSON.stringify(postBody)}`,
|
|
'DEBUG'
|
|
)
|
|
|
|
let request = super.makeRequest(
|
|
'/regions/{regionId}/queryTrafficByDate',
|
|
'POST',
|
|
pathParams,
|
|
queryParams,
|
|
headerParams,
|
|
formParams,
|
|
postBody,
|
|
contentTypes,
|
|
accepts,
|
|
returnType,
|
|
callback
|
|
)
|
|
|
|
return request.then(
|
|
function (result) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(null, result)
|
|
}
|
|
return result
|
|
},
|
|
function (error) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(error)
|
|
}
|
|
return Promise.reject(error)
|
|
}
|
|
)
|
|
}
|
|
|
|
/**
|
|
* 物联网卡自主限速接口
|
|
* @param {Object} opts - parameters
|
|
* @param {string} opts.requestParam - 物联网卡自主限速请求参数
|
|
* @param {string} regionId - ID of the region
|
|
* @param {string} callback - callback
|
|
@return {Object} result
|
|
* @param string status 请求状态(0:成功;其他:失败)
|
|
* @param string message 消息描述
|
|
* @param boolean result 物联网卡自主限速返回结果集
|
|
*/
|
|
|
|
speedLimitAction (opts, regionId = this.config.regionId, callback) {
|
|
if (typeof regionId === 'function') {
|
|
callback = regionId
|
|
regionId = this.config.regionId
|
|
}
|
|
|
|
if (regionId === undefined || regionId === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'regionId' when calling speedLimitAction"
|
|
)
|
|
}
|
|
|
|
opts = opts || {}
|
|
|
|
if (opts.requestParam === undefined || opts.requestParam === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'opts.requestParam' when calling speedLimitAction"
|
|
)
|
|
}
|
|
|
|
let postBody = {}
|
|
if (opts.requestParam !== undefined && opts.requestParam !== null) {
|
|
postBody['requestParam'] = opts.requestParam
|
|
}
|
|
|
|
let queryParams = {}
|
|
|
|
let pathParams = {
|
|
regionId: regionId
|
|
}
|
|
|
|
let headerParams = {
|
|
'User-Agent': 'JdcloudSdkNode/1.0.0 iotlink/1.0.8'
|
|
}
|
|
|
|
let contentTypes = ['application/json']
|
|
let accepts = ['application/json']
|
|
|
|
// 扩展自定义头
|
|
if (opts['x-extra-header']) {
|
|
for (let extraHeader in opts['x-extra-header']) {
|
|
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
|
contentTypes = opts['x-extra-header']['content-type']
|
|
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
|
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
|
accepts = opts['x-extra-header']['accept']
|
|
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
|
accepts = opts['x-extra-header']['accept'].split(',')
|
|
}
|
|
}
|
|
|
|
let formParams = {}
|
|
|
|
let returnType = null
|
|
|
|
this.config.logger(
|
|
`call speedLimitAction with params:\npathParams:${JSON.stringify(
|
|
pathParams
|
|
)},\nqueryParams:${JSON.stringify(
|
|
queryParams
|
|
)}, \nheaderParams:${JSON.stringify(
|
|
headerParams
|
|
)}, \nformParams:${JSON.stringify(
|
|
formParams
|
|
)}, \npostBody:${JSON.stringify(postBody)}`,
|
|
'DEBUG'
|
|
)
|
|
|
|
let request = super.makeRequest(
|
|
'/regions/{regionId}/speedLimitAction',
|
|
'POST',
|
|
pathParams,
|
|
queryParams,
|
|
headerParams,
|
|
formParams,
|
|
postBody,
|
|
contentTypes,
|
|
accepts,
|
|
returnType,
|
|
callback
|
|
)
|
|
|
|
return request.then(
|
|
function (result) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(null, result)
|
|
}
|
|
return result
|
|
},
|
|
function (error) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(error)
|
|
}
|
|
return Promise.reject(error)
|
|
}
|
|
)
|
|
}
|
|
|
|
/**
|
|
* 根据物联网卡iccid查询该卡的基本信息
|
|
* @param {Object} opts - parameters
|
|
* @param {string} opts.iccid - 物联网卡iccid
|
|
* @param {string} regionId - ID of the region
|
|
* @param {string} callback - callback
|
|
@return {Object} result
|
|
* @param string status 请求状态(0:成功;1:失败)
|
|
* @param string message 消息描述
|
|
* @param cardInfoResp result 指定物联网卡的卡基本信息
|
|
*/
|
|
|
|
cardInfo (opts, regionId = this.config.regionId, callback) {
|
|
if (typeof regionId === 'function') {
|
|
callback = regionId
|
|
regionId = this.config.regionId
|
|
}
|
|
|
|
if (regionId === undefined || regionId === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'regionId' when calling cardInfo"
|
|
)
|
|
}
|
|
|
|
opts = opts || {}
|
|
|
|
if (opts.iccid === undefined || opts.iccid === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'opts.iccid' when calling cardInfo"
|
|
)
|
|
}
|
|
|
|
let postBody = null
|
|
let queryParams = {}
|
|
if (opts.iccid !== undefined && opts.iccid !== null) {
|
|
queryParams['iccid'] = opts.iccid
|
|
}
|
|
|
|
let pathParams = {
|
|
regionId: regionId
|
|
}
|
|
|
|
let headerParams = {
|
|
'User-Agent': 'JdcloudSdkNode/1.0.0 iotlink/1.0.8'
|
|
}
|
|
|
|
let contentTypes = ['application/json']
|
|
let accepts = ['application/json']
|
|
|
|
// 扩展自定义头
|
|
if (opts['x-extra-header']) {
|
|
for (let extraHeader in opts['x-extra-header']) {
|
|
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
|
contentTypes = opts['x-extra-header']['content-type']
|
|
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
|
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
|
accepts = opts['x-extra-header']['accept']
|
|
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
|
accepts = opts['x-extra-header']['accept'].split(',')
|
|
}
|
|
}
|
|
|
|
let formParams = {}
|
|
|
|
let returnType = null
|
|
|
|
this.config.logger(
|
|
`call cardInfo with params:\npathParams:${JSON.stringify(
|
|
pathParams
|
|
)},\nqueryParams:${JSON.stringify(
|
|
queryParams
|
|
)}, \nheaderParams:${JSON.stringify(
|
|
headerParams
|
|
)}, \nformParams:${JSON.stringify(
|
|
formParams
|
|
)}, \npostBody:${JSON.stringify(postBody)}`,
|
|
'DEBUG'
|
|
)
|
|
|
|
let request = super.makeRequest(
|
|
'/regions/{regionId}/cardInfo',
|
|
'GET',
|
|
pathParams,
|
|
queryParams,
|
|
headerParams,
|
|
formParams,
|
|
postBody,
|
|
contentTypes,
|
|
accepts,
|
|
returnType,
|
|
callback
|
|
)
|
|
|
|
return request.then(
|
|
function (result) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(null, result)
|
|
}
|
|
return result
|
|
},
|
|
function (error) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(error)
|
|
}
|
|
return Promise.reject(error)
|
|
}
|
|
)
|
|
}
|
|
|
|
/**
|
|
* 根据物联网卡iccid查询该卡的实名认证信息
|
|
* @param {Object} opts - parameters
|
|
* @param {string} opts.iccid - 物联网卡iccid
|
|
* @param {string} regionId - ID of the region
|
|
* @param {string} callback - callback
|
|
@return {Object} result
|
|
* @param string status 请求状态(0:成功;1:失败)
|
|
* @param string message 消息描述
|
|
* @param realNameQueryIotResp result 指定物联网卡的实名认证状态信息
|
|
*/
|
|
|
|
realNameQueryIot (opts, regionId = this.config.regionId, callback) {
|
|
if (typeof regionId === 'function') {
|
|
callback = regionId
|
|
regionId = this.config.regionId
|
|
}
|
|
|
|
if (regionId === undefined || regionId === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'regionId' when calling realNameQueryIot"
|
|
)
|
|
}
|
|
|
|
opts = opts || {}
|
|
|
|
if (opts.iccid === undefined || opts.iccid === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'opts.iccid' when calling realNameQueryIot"
|
|
)
|
|
}
|
|
|
|
let postBody = null
|
|
let queryParams = {}
|
|
if (opts.iccid !== undefined && opts.iccid !== null) {
|
|
queryParams['iccid'] = opts.iccid
|
|
}
|
|
|
|
let pathParams = {
|
|
regionId: regionId
|
|
}
|
|
|
|
let headerParams = {
|
|
'User-Agent': 'JdcloudSdkNode/1.0.0 iotlink/1.0.8'
|
|
}
|
|
|
|
let contentTypes = ['application/json']
|
|
let accepts = ['application/json']
|
|
|
|
// 扩展自定义头
|
|
if (opts['x-extra-header']) {
|
|
for (let extraHeader in opts['x-extra-header']) {
|
|
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
|
contentTypes = opts['x-extra-header']['content-type']
|
|
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
|
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
|
accepts = opts['x-extra-header']['accept']
|
|
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
|
accepts = opts['x-extra-header']['accept'].split(',')
|
|
}
|
|
}
|
|
|
|
let formParams = {}
|
|
|
|
let returnType = null
|
|
|
|
this.config.logger(
|
|
`call realNameQueryIot with params:\npathParams:${JSON.stringify(
|
|
pathParams
|
|
)},\nqueryParams:${JSON.stringify(
|
|
queryParams
|
|
)}, \nheaderParams:${JSON.stringify(
|
|
headerParams
|
|
)}, \nformParams:${JSON.stringify(
|
|
formParams
|
|
)}, \npostBody:${JSON.stringify(postBody)}`,
|
|
'DEBUG'
|
|
)
|
|
|
|
let request = super.makeRequest(
|
|
'/regions/{regionId}/realNameQueryIot',
|
|
'GET',
|
|
pathParams,
|
|
queryParams,
|
|
headerParams,
|
|
formParams,
|
|
postBody,
|
|
contentTypes,
|
|
accepts,
|
|
returnType,
|
|
callback
|
|
)
|
|
|
|
return request.then(
|
|
function (result) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(null, result)
|
|
}
|
|
return result
|
|
},
|
|
function (error) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(error)
|
|
}
|
|
return Promise.reject(error)
|
|
}
|
|
)
|
|
}
|
|
|
|
/**
|
|
* 根据物联网卡IMSI查询该卡的GPRS状态信息
|
|
* @param {Object} opts - parameters
|
|
* @param {string} opts.imsi - 物联网卡IMSI
|
|
* @param {string} regionId - ID of the region
|
|
* @param {string} callback - callback
|
|
@return {Object} result
|
|
* @param string status 请求状态(0:成功;1:失败)
|
|
* @param string message 消息描述
|
|
* @param gprsStatusResp result 指定物联网卡的gprs状态信息
|
|
*/
|
|
|
|
gprsStatusByIMSI (opts, regionId = this.config.regionId, callback) {
|
|
if (typeof regionId === 'function') {
|
|
callback = regionId
|
|
regionId = this.config.regionId
|
|
}
|
|
|
|
if (regionId === undefined || regionId === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'regionId' when calling gprsStatusByIMSI"
|
|
)
|
|
}
|
|
|
|
opts = opts || {}
|
|
|
|
if (opts.imsi === undefined || opts.imsi === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'opts.imsi' when calling gprsStatusByIMSI"
|
|
)
|
|
}
|
|
|
|
let postBody = null
|
|
let queryParams = {}
|
|
if (opts.imsi !== undefined && opts.imsi !== null) {
|
|
queryParams['imsi'] = opts.imsi
|
|
}
|
|
|
|
let pathParams = {
|
|
regionId: regionId
|
|
}
|
|
|
|
let headerParams = {
|
|
'User-Agent': 'JdcloudSdkNode/1.0.0 iotlink/1.0.8'
|
|
}
|
|
|
|
let contentTypes = ['application/json']
|
|
let accepts = ['application/json']
|
|
|
|
// 扩展自定义头
|
|
if (opts['x-extra-header']) {
|
|
for (let extraHeader in opts['x-extra-header']) {
|
|
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
|
contentTypes = opts['x-extra-header']['content-type']
|
|
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
|
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
|
accepts = opts['x-extra-header']['accept']
|
|
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
|
accepts = opts['x-extra-header']['accept'].split(',')
|
|
}
|
|
}
|
|
|
|
let formParams = {}
|
|
|
|
let returnType = null
|
|
|
|
this.config.logger(
|
|
`call gprsStatusByIMSI with params:\npathParams:${JSON.stringify(
|
|
pathParams
|
|
)},\nqueryParams:${JSON.stringify(
|
|
queryParams
|
|
)}, \nheaderParams:${JSON.stringify(
|
|
headerParams
|
|
)}, \nformParams:${JSON.stringify(
|
|
formParams
|
|
)}, \npostBody:${JSON.stringify(postBody)}`,
|
|
'DEBUG'
|
|
)
|
|
|
|
let request = super.makeRequest(
|
|
'/regions/{regionId}/gprsStatusByIMSI',
|
|
'GET',
|
|
pathParams,
|
|
queryParams,
|
|
headerParams,
|
|
formParams,
|
|
postBody,
|
|
contentTypes,
|
|
accepts,
|
|
returnType,
|
|
callback
|
|
)
|
|
|
|
return request.then(
|
|
function (result) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(null, result)
|
|
}
|
|
return result
|
|
},
|
|
function (error) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(error)
|
|
}
|
|
return Promise.reject(error)
|
|
}
|
|
)
|
|
}
|
|
|
|
/**
|
|
* 根据物联网卡imsi查询该卡的开关机状态信息
|
|
* @param {Object} opts - parameters
|
|
* @param {string} opts.imsi - 物联网卡imsi
|
|
* @param {string} regionId - ID of the region
|
|
* @param {string} callback - callback
|
|
@return {Object} result
|
|
* @param string status 请求状态(0:成功;1:失败)
|
|
* @param string message 消息描述
|
|
* @param onOffStatusResp result 指定物联网卡的开关机状态信息
|
|
*/
|
|
|
|
onOffStatusByIMSI (opts, regionId = this.config.regionId, callback) {
|
|
if (typeof regionId === 'function') {
|
|
callback = regionId
|
|
regionId = this.config.regionId
|
|
}
|
|
|
|
if (regionId === undefined || regionId === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'regionId' when calling onOffStatusByIMSI"
|
|
)
|
|
}
|
|
|
|
opts = opts || {}
|
|
|
|
if (opts.imsi === undefined || opts.imsi === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'opts.imsi' when calling onOffStatusByIMSI"
|
|
)
|
|
}
|
|
|
|
let postBody = null
|
|
let queryParams = {}
|
|
if (opts.imsi !== undefined && opts.imsi !== null) {
|
|
queryParams['imsi'] = opts.imsi
|
|
}
|
|
|
|
let pathParams = {
|
|
regionId: regionId
|
|
}
|
|
|
|
let headerParams = {
|
|
'User-Agent': 'JdcloudSdkNode/1.0.0 iotlink/1.0.8'
|
|
}
|
|
|
|
let contentTypes = ['application/json']
|
|
let accepts = ['application/json']
|
|
|
|
// 扩展自定义头
|
|
if (opts['x-extra-header']) {
|
|
for (let extraHeader in opts['x-extra-header']) {
|
|
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
|
contentTypes = opts['x-extra-header']['content-type']
|
|
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
|
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
|
accepts = opts['x-extra-header']['accept']
|
|
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
|
accepts = opts['x-extra-header']['accept'].split(',')
|
|
}
|
|
}
|
|
|
|
let formParams = {}
|
|
|
|
let returnType = null
|
|
|
|
this.config.logger(
|
|
`call onOffStatusByIMSI with params:\npathParams:${JSON.stringify(
|
|
pathParams
|
|
)},\nqueryParams:${JSON.stringify(
|
|
queryParams
|
|
)}, \nheaderParams:${JSON.stringify(
|
|
headerParams
|
|
)}, \nformParams:${JSON.stringify(
|
|
formParams
|
|
)}, \npostBody:${JSON.stringify(postBody)}`,
|
|
'DEBUG'
|
|
)
|
|
|
|
let request = super.makeRequest(
|
|
'/regions/{regionId}/onOffStatusByIMSI',
|
|
'GET',
|
|
pathParams,
|
|
queryParams,
|
|
headerParams,
|
|
formParams,
|
|
postBody,
|
|
contentTypes,
|
|
accepts,
|
|
returnType,
|
|
callback
|
|
)
|
|
|
|
return request.then(
|
|
function (result) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(null, result)
|
|
}
|
|
return result
|
|
},
|
|
function (error) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(error)
|
|
}
|
|
return Promise.reject(error)
|
|
}
|
|
)
|
|
}
|
|
|
|
/**
|
|
* 根据物联网卡imsi查询该卡的生命周期信息
|
|
* @param {Object} opts - parameters
|
|
* @param {string} opts.imsi - 物联网卡imsi
|
|
* @param {string} regionId - ID of the region
|
|
* @param {string} callback - callback
|
|
@return {Object} result
|
|
* @param string status 请求状态(0:成功;1:失败)
|
|
* @param string message 消息描述
|
|
* @param lifeStatusResp result 指定物联网卡的生命周期信息
|
|
*/
|
|
|
|
lifeStatusByIMSI (opts, regionId = this.config.regionId, callback) {
|
|
if (typeof regionId === 'function') {
|
|
callback = regionId
|
|
regionId = this.config.regionId
|
|
}
|
|
|
|
if (regionId === undefined || regionId === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'regionId' when calling lifeStatusByIMSI"
|
|
)
|
|
}
|
|
|
|
opts = opts || {}
|
|
|
|
if (opts.imsi === undefined || opts.imsi === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'opts.imsi' when calling lifeStatusByIMSI"
|
|
)
|
|
}
|
|
|
|
let postBody = null
|
|
let queryParams = {}
|
|
if (opts.imsi !== undefined && opts.imsi !== null) {
|
|
queryParams['imsi'] = opts.imsi
|
|
}
|
|
|
|
let pathParams = {
|
|
regionId: regionId
|
|
}
|
|
|
|
let headerParams = {
|
|
'User-Agent': 'JdcloudSdkNode/1.0.0 iotlink/1.0.8'
|
|
}
|
|
|
|
let contentTypes = ['application/json']
|
|
let accepts = ['application/json']
|
|
|
|
// 扩展自定义头
|
|
if (opts['x-extra-header']) {
|
|
for (let extraHeader in opts['x-extra-header']) {
|
|
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
|
contentTypes = opts['x-extra-header']['content-type']
|
|
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
|
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
|
accepts = opts['x-extra-header']['accept']
|
|
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
|
accepts = opts['x-extra-header']['accept'].split(',')
|
|
}
|
|
}
|
|
|
|
let formParams = {}
|
|
|
|
let returnType = null
|
|
|
|
this.config.logger(
|
|
`call lifeStatusByIMSI with params:\npathParams:${JSON.stringify(
|
|
pathParams
|
|
)},\nqueryParams:${JSON.stringify(
|
|
queryParams
|
|
)}, \nheaderParams:${JSON.stringify(
|
|
headerParams
|
|
)}, \nformParams:${JSON.stringify(
|
|
formParams
|
|
)}, \npostBody:${JSON.stringify(postBody)}`,
|
|
'DEBUG'
|
|
)
|
|
|
|
let request = super.makeRequest(
|
|
'/regions/{regionId}/lifeStatusByIMSI',
|
|
'GET',
|
|
pathParams,
|
|
queryParams,
|
|
headerParams,
|
|
formParams,
|
|
postBody,
|
|
contentTypes,
|
|
accepts,
|
|
returnType,
|
|
callback
|
|
)
|
|
|
|
return request.then(
|
|
function (result) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(null, result)
|
|
}
|
|
return result
|
|
},
|
|
function (error) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(error)
|
|
}
|
|
return Promise.reject(error)
|
|
}
|
|
)
|
|
}
|
|
|
|
/**
|
|
* 根据物联网卡imsi查询该卡的当月套餐内的GPRS实时使用量
|
|
* @param {Object} opts - parameters
|
|
* @param {string} opts.imsi - 物联网卡imsi
|
|
* @param {string} regionId - ID of the region
|
|
* @param {string} callback - callback
|
|
@return {Object} result
|
|
* @param string status 请求状态(0:成功;1:失败)
|
|
* @param string message 消息描述
|
|
* @param gprsRealtimeInfoResp result 指定物联网卡的当月套餐内的GPRS实时使用量
|
|
*/
|
|
|
|
gprsRealtimeInfoByIMSI (opts, regionId = this.config.regionId, callback) {
|
|
if (typeof regionId === 'function') {
|
|
callback = regionId
|
|
regionId = this.config.regionId
|
|
}
|
|
|
|
if (regionId === undefined || regionId === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'regionId' when calling gprsRealtimeInfoByIMSI"
|
|
)
|
|
}
|
|
|
|
opts = opts || {}
|
|
|
|
if (opts.imsi === undefined || opts.imsi === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'opts.imsi' when calling gprsRealtimeInfoByIMSI"
|
|
)
|
|
}
|
|
|
|
let postBody = null
|
|
let queryParams = {}
|
|
if (opts.imsi !== undefined && opts.imsi !== null) {
|
|
queryParams['imsi'] = opts.imsi
|
|
}
|
|
|
|
let pathParams = {
|
|
regionId: regionId
|
|
}
|
|
|
|
let headerParams = {
|
|
'User-Agent': 'JdcloudSdkNode/1.0.0 iotlink/1.0.8'
|
|
}
|
|
|
|
let contentTypes = ['application/json']
|
|
let accepts = ['application/json']
|
|
|
|
// 扩展自定义头
|
|
if (opts['x-extra-header']) {
|
|
for (let extraHeader in opts['x-extra-header']) {
|
|
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
|
contentTypes = opts['x-extra-header']['content-type']
|
|
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
|
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
|
accepts = opts['x-extra-header']['accept']
|
|
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
|
accepts = opts['x-extra-header']['accept'].split(',')
|
|
}
|
|
}
|
|
|
|
let formParams = {}
|
|
|
|
let returnType = null
|
|
|
|
this.config.logger(
|
|
`call gprsRealtimeInfoByIMSI with params:\npathParams:${JSON.stringify(
|
|
pathParams
|
|
)},\nqueryParams:${JSON.stringify(
|
|
queryParams
|
|
)}, \nheaderParams:${JSON.stringify(
|
|
headerParams
|
|
)}, \nformParams:${JSON.stringify(
|
|
formParams
|
|
)}, \npostBody:${JSON.stringify(postBody)}`,
|
|
'DEBUG'
|
|
)
|
|
|
|
let request = super.makeRequest(
|
|
'/regions/{regionId}/gprsRealtimeInfoByIMSI',
|
|
'GET',
|
|
pathParams,
|
|
queryParams,
|
|
headerParams,
|
|
formParams,
|
|
postBody,
|
|
contentTypes,
|
|
accepts,
|
|
returnType,
|
|
callback
|
|
)
|
|
|
|
return request.then(
|
|
function (result) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(null, result)
|
|
}
|
|
return result
|
|
},
|
|
function (error) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(error)
|
|
}
|
|
return Promise.reject(error)
|
|
}
|
|
)
|
|
}
|
|
|
|
/**
|
|
* 根据物联网卡iccid查询该卡的gprs状态信息
|
|
* @param {Object} opts - parameters
|
|
* @param {string} opts.iccid - 物联网卡iccid
|
|
* @param {string} regionId - ID of the region
|
|
* @param {string} callback - callback
|
|
@return {Object} result
|
|
* @param string status 请求状态(0:成功;1:失败)
|
|
* @param string message 消息描述
|
|
* @param gprsStatusResp result 指定物联网卡的gprs状态信息
|
|
*/
|
|
|
|
gprsStatus (opts, regionId = this.config.regionId, callback) {
|
|
if (typeof regionId === 'function') {
|
|
callback = regionId
|
|
regionId = this.config.regionId
|
|
}
|
|
|
|
if (regionId === undefined || regionId === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'regionId' when calling gprsStatus"
|
|
)
|
|
}
|
|
|
|
opts = opts || {}
|
|
|
|
if (opts.iccid === undefined || opts.iccid === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'opts.iccid' when calling gprsStatus"
|
|
)
|
|
}
|
|
|
|
let postBody = null
|
|
let queryParams = {}
|
|
if (opts.iccid !== undefined && opts.iccid !== null) {
|
|
queryParams['iccid'] = opts.iccid
|
|
}
|
|
|
|
let pathParams = {
|
|
regionId: regionId
|
|
}
|
|
|
|
let headerParams = {
|
|
'User-Agent': 'JdcloudSdkNode/1.0.0 iotlink/1.0.8'
|
|
}
|
|
|
|
let contentTypes = ['application/json']
|
|
let accepts = ['application/json']
|
|
|
|
// 扩展自定义头
|
|
if (opts['x-extra-header']) {
|
|
for (let extraHeader in opts['x-extra-header']) {
|
|
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
|
contentTypes = opts['x-extra-header']['content-type']
|
|
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
|
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
|
accepts = opts['x-extra-header']['accept']
|
|
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
|
accepts = opts['x-extra-header']['accept'].split(',')
|
|
}
|
|
}
|
|
|
|
let formParams = {}
|
|
|
|
let returnType = null
|
|
|
|
this.config.logger(
|
|
`call gprsStatus with params:\npathParams:${JSON.stringify(
|
|
pathParams
|
|
)},\nqueryParams:${JSON.stringify(
|
|
queryParams
|
|
)}, \nheaderParams:${JSON.stringify(
|
|
headerParams
|
|
)}, \nformParams:${JSON.stringify(
|
|
formParams
|
|
)}, \npostBody:${JSON.stringify(postBody)}`,
|
|
'DEBUG'
|
|
)
|
|
|
|
let request = super.makeRequest(
|
|
'/regions/{regionId}/gprsStatus',
|
|
'GET',
|
|
pathParams,
|
|
queryParams,
|
|
headerParams,
|
|
formParams,
|
|
postBody,
|
|
contentTypes,
|
|
accepts,
|
|
returnType,
|
|
callback
|
|
)
|
|
|
|
return request.then(
|
|
function (result) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(null, result)
|
|
}
|
|
return result
|
|
},
|
|
function (error) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(error)
|
|
}
|
|
return Promise.reject(error)
|
|
}
|
|
)
|
|
}
|
|
|
|
/**
|
|
* 根据物联网卡iccid查询该卡的开关机状态信息
|
|
* @param {Object} opts - parameters
|
|
* @param {string} opts.iccid - 物联网卡iccid
|
|
* @param {string} regionId - ID of the region
|
|
* @param {string} callback - callback
|
|
@return {Object} result
|
|
* @param string status 请求状态(0:成功;1:失败)
|
|
* @param string message 消息描述
|
|
* @param onOffStatusResp result 指定物联网卡的开关机状态信息
|
|
*/
|
|
|
|
onOffStatus (opts, regionId = this.config.regionId, callback) {
|
|
if (typeof regionId === 'function') {
|
|
callback = regionId
|
|
regionId = this.config.regionId
|
|
}
|
|
|
|
if (regionId === undefined || regionId === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'regionId' when calling onOffStatus"
|
|
)
|
|
}
|
|
|
|
opts = opts || {}
|
|
|
|
if (opts.iccid === undefined || opts.iccid === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'opts.iccid' when calling onOffStatus"
|
|
)
|
|
}
|
|
|
|
let postBody = null
|
|
let queryParams = {}
|
|
if (opts.iccid !== undefined && opts.iccid !== null) {
|
|
queryParams['iccid'] = opts.iccid
|
|
}
|
|
|
|
let pathParams = {
|
|
regionId: regionId
|
|
}
|
|
|
|
let headerParams = {
|
|
'User-Agent': 'JdcloudSdkNode/1.0.0 iotlink/1.0.8'
|
|
}
|
|
|
|
let contentTypes = ['application/json']
|
|
let accepts = ['application/json']
|
|
|
|
// 扩展自定义头
|
|
if (opts['x-extra-header']) {
|
|
for (let extraHeader in opts['x-extra-header']) {
|
|
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
|
contentTypes = opts['x-extra-header']['content-type']
|
|
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
|
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
|
accepts = opts['x-extra-header']['accept']
|
|
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
|
accepts = opts['x-extra-header']['accept'].split(',')
|
|
}
|
|
}
|
|
|
|
let formParams = {}
|
|
|
|
let returnType = null
|
|
|
|
this.config.logger(
|
|
`call onOffStatus with params:\npathParams:${JSON.stringify(
|
|
pathParams
|
|
)},\nqueryParams:${JSON.stringify(
|
|
queryParams
|
|
)}, \nheaderParams:${JSON.stringify(
|
|
headerParams
|
|
)}, \nformParams:${JSON.stringify(
|
|
formParams
|
|
)}, \npostBody:${JSON.stringify(postBody)}`,
|
|
'DEBUG'
|
|
)
|
|
|
|
let request = super.makeRequest(
|
|
'/regions/{regionId}/onOffStatus',
|
|
'GET',
|
|
pathParams,
|
|
queryParams,
|
|
headerParams,
|
|
formParams,
|
|
postBody,
|
|
contentTypes,
|
|
accepts,
|
|
returnType,
|
|
callback
|
|
)
|
|
|
|
return request.then(
|
|
function (result) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(null, result)
|
|
}
|
|
return result
|
|
},
|
|
function (error) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(error)
|
|
}
|
|
return Promise.reject(error)
|
|
}
|
|
)
|
|
}
|
|
|
|
/**
|
|
* 根据物联网卡iccid查询该卡的生命周期信息
|
|
* @param {Object} opts - parameters
|
|
* @param {string} opts.iccid - 物联网卡iccid
|
|
* @param {string} regionId - ID of the region
|
|
* @param {string} callback - callback
|
|
@return {Object} result
|
|
* @param string status 请求状态(0:成功;1:失败)
|
|
* @param string message 消息描述
|
|
* @param lifeStatusResp result 指定物联网卡的生命周期信息
|
|
*/
|
|
|
|
lifeStatus (opts, regionId = this.config.regionId, callback) {
|
|
if (typeof regionId === 'function') {
|
|
callback = regionId
|
|
regionId = this.config.regionId
|
|
}
|
|
|
|
if (regionId === undefined || regionId === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'regionId' when calling lifeStatus"
|
|
)
|
|
}
|
|
|
|
opts = opts || {}
|
|
|
|
if (opts.iccid === undefined || opts.iccid === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'opts.iccid' when calling lifeStatus"
|
|
)
|
|
}
|
|
|
|
let postBody = null
|
|
let queryParams = {}
|
|
if (opts.iccid !== undefined && opts.iccid !== null) {
|
|
queryParams['iccid'] = opts.iccid
|
|
}
|
|
|
|
let pathParams = {
|
|
regionId: regionId
|
|
}
|
|
|
|
let headerParams = {
|
|
'User-Agent': 'JdcloudSdkNode/1.0.0 iotlink/1.0.8'
|
|
}
|
|
|
|
let contentTypes = ['application/json']
|
|
let accepts = ['application/json']
|
|
|
|
// 扩展自定义头
|
|
if (opts['x-extra-header']) {
|
|
for (let extraHeader in opts['x-extra-header']) {
|
|
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
|
contentTypes = opts['x-extra-header']['content-type']
|
|
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
|
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
|
accepts = opts['x-extra-header']['accept']
|
|
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
|
accepts = opts['x-extra-header']['accept'].split(',')
|
|
}
|
|
}
|
|
|
|
let formParams = {}
|
|
|
|
let returnType = null
|
|
|
|
this.config.logger(
|
|
`call lifeStatus with params:\npathParams:${JSON.stringify(
|
|
pathParams
|
|
)},\nqueryParams:${JSON.stringify(
|
|
queryParams
|
|
)}, \nheaderParams:${JSON.stringify(
|
|
headerParams
|
|
)}, \nformParams:${JSON.stringify(
|
|
formParams
|
|
)}, \npostBody:${JSON.stringify(postBody)}`,
|
|
'DEBUG'
|
|
)
|
|
|
|
let request = super.makeRequest(
|
|
'/regions/{regionId}/lifeStatus',
|
|
'GET',
|
|
pathParams,
|
|
queryParams,
|
|
headerParams,
|
|
formParams,
|
|
postBody,
|
|
contentTypes,
|
|
accepts,
|
|
returnType,
|
|
callback
|
|
)
|
|
|
|
return request.then(
|
|
function (result) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(null, result)
|
|
}
|
|
return result
|
|
},
|
|
function (error) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(error)
|
|
}
|
|
return Promise.reject(error)
|
|
}
|
|
)
|
|
}
|
|
|
|
/**
|
|
* 根据物联网卡iccid查询该卡的当月套餐内的GPRS实时使用量
|
|
* @param {Object} opts - parameters
|
|
* @param {string} opts.iccid - 物联网卡iccid
|
|
* @param {string} regionId - ID of the region
|
|
* @param {string} callback - callback
|
|
@return {Object} result
|
|
* @param string status 请求状态(0:成功;1:失败)
|
|
* @param string message 消息描述
|
|
* @param gprsRealtimeInfoResp result 指定物联网卡的当月套餐内的GPRS实时使用量
|
|
*/
|
|
|
|
gprsRealtimeInfo (opts, regionId = this.config.regionId, callback) {
|
|
if (typeof regionId === 'function') {
|
|
callback = regionId
|
|
regionId = this.config.regionId
|
|
}
|
|
|
|
if (regionId === undefined || regionId === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'regionId' when calling gprsRealtimeInfo"
|
|
)
|
|
}
|
|
|
|
opts = opts || {}
|
|
|
|
if (opts.iccid === undefined || opts.iccid === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'opts.iccid' when calling gprsRealtimeInfo"
|
|
)
|
|
}
|
|
|
|
let postBody = null
|
|
let queryParams = {}
|
|
if (opts.iccid !== undefined && opts.iccid !== null) {
|
|
queryParams['iccid'] = opts.iccid
|
|
}
|
|
|
|
let pathParams = {
|
|
regionId: regionId
|
|
}
|
|
|
|
let headerParams = {
|
|
'User-Agent': 'JdcloudSdkNode/1.0.0 iotlink/1.0.8'
|
|
}
|
|
|
|
let contentTypes = ['application/json']
|
|
let accepts = ['application/json']
|
|
|
|
// 扩展自定义头
|
|
if (opts['x-extra-header']) {
|
|
for (let extraHeader in opts['x-extra-header']) {
|
|
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
|
contentTypes = opts['x-extra-header']['content-type']
|
|
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
|
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
|
accepts = opts['x-extra-header']['accept']
|
|
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
|
accepts = opts['x-extra-header']['accept'].split(',')
|
|
}
|
|
}
|
|
|
|
let formParams = {}
|
|
|
|
let returnType = null
|
|
|
|
this.config.logger(
|
|
`call gprsRealtimeInfo with params:\npathParams:${JSON.stringify(
|
|
pathParams
|
|
)},\nqueryParams:${JSON.stringify(
|
|
queryParams
|
|
)}, \nheaderParams:${JSON.stringify(
|
|
headerParams
|
|
)}, \nformParams:${JSON.stringify(
|
|
formParams
|
|
)}, \npostBody:${JSON.stringify(postBody)}`,
|
|
'DEBUG'
|
|
)
|
|
|
|
let request = super.makeRequest(
|
|
'/regions/{regionId}/gprsRealtimeInfo',
|
|
'GET',
|
|
pathParams,
|
|
queryParams,
|
|
headerParams,
|
|
formParams,
|
|
postBody,
|
|
contentTypes,
|
|
accepts,
|
|
returnType,
|
|
callback
|
|
)
|
|
|
|
return request.then(
|
|
function (result) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(null, result)
|
|
}
|
|
return result
|
|
},
|
|
function (error) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(error)
|
|
}
|
|
return Promise.reject(error)
|
|
}
|
|
)
|
|
}
|
|
|
|
/**
|
|
* 物联网卡开机操作
|
|
* @param {Object} opts - parameters
|
|
* @param {array} [opts.iccids] - 物联网卡号码列表(单次提交最多不超过200个号码) optional
|
|
* @param {string} regionId - ID of the region
|
|
* @param {string} callback - callback
|
|
@return {Object} result
|
|
* @param string status 请求状态(0:成功;1:失败)
|
|
* @param string message 消息描述
|
|
* @param operationIotlinkResp result
|
|
*/
|
|
|
|
openIotCard (opts, regionId = this.config.regionId, callback) {
|
|
if (typeof regionId === 'function') {
|
|
callback = regionId
|
|
regionId = this.config.regionId
|
|
}
|
|
|
|
if (regionId === undefined || regionId === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'regionId' when calling openIotCard"
|
|
)
|
|
}
|
|
|
|
opts = opts || {}
|
|
|
|
let postBody = {}
|
|
if (opts.iccids !== undefined && opts.iccids !== null) {
|
|
postBody['iccids'] = opts.iccids
|
|
}
|
|
|
|
let queryParams = {}
|
|
|
|
let pathParams = {
|
|
regionId: regionId
|
|
}
|
|
|
|
let headerParams = {
|
|
'User-Agent': 'JdcloudSdkNode/1.0.0 iotlink/1.0.8'
|
|
}
|
|
|
|
let contentTypes = ['application/json']
|
|
let accepts = ['application/json']
|
|
|
|
// 扩展自定义头
|
|
if (opts['x-extra-header']) {
|
|
for (let extraHeader in opts['x-extra-header']) {
|
|
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
|
contentTypes = opts['x-extra-header']['content-type']
|
|
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
|
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
|
accepts = opts['x-extra-header']['accept']
|
|
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
|
accepts = opts['x-extra-header']['accept'].split(',')
|
|
}
|
|
}
|
|
|
|
let formParams = {}
|
|
|
|
let returnType = null
|
|
|
|
this.config.logger(
|
|
`call openIotCard with params:\npathParams:${JSON.stringify(
|
|
pathParams
|
|
)},\nqueryParams:${JSON.stringify(
|
|
queryParams
|
|
)}, \nheaderParams:${JSON.stringify(
|
|
headerParams
|
|
)}, \nformParams:${JSON.stringify(
|
|
formParams
|
|
)}, \npostBody:${JSON.stringify(postBody)}`,
|
|
'DEBUG'
|
|
)
|
|
|
|
let request = super.makeRequest(
|
|
'/regions/{regionId}/openIotCard',
|
|
'POST',
|
|
pathParams,
|
|
queryParams,
|
|
headerParams,
|
|
formParams,
|
|
postBody,
|
|
contentTypes,
|
|
accepts,
|
|
returnType,
|
|
callback
|
|
)
|
|
|
|
return request.then(
|
|
function (result) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(null, result)
|
|
}
|
|
return result
|
|
},
|
|
function (error) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(error)
|
|
}
|
|
return Promise.reject(error)
|
|
}
|
|
)
|
|
}
|
|
|
|
/**
|
|
* 物联网卡停机操作
|
|
* @param {Object} opts - parameters
|
|
* @param {array} [opts.iccids] - 物联网卡号码列表(单次提交最多不超过200个号码) optional
|
|
* @param {string} regionId - ID of the region
|
|
* @param {string} callback - callback
|
|
@return {Object} result
|
|
* @param string status 请求状态(0:成功;1:失败)
|
|
* @param string message 消息描述
|
|
* @param operationIotlinkResp result
|
|
*/
|
|
|
|
closeIotCard (opts, regionId = this.config.regionId, callback) {
|
|
if (typeof regionId === 'function') {
|
|
callback = regionId
|
|
regionId = this.config.regionId
|
|
}
|
|
|
|
if (regionId === undefined || regionId === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'regionId' when calling closeIotCard"
|
|
)
|
|
}
|
|
|
|
opts = opts || {}
|
|
|
|
let postBody = {}
|
|
if (opts.iccids !== undefined && opts.iccids !== null) {
|
|
postBody['iccids'] = opts.iccids
|
|
}
|
|
|
|
let queryParams = {}
|
|
|
|
let pathParams = {
|
|
regionId: regionId
|
|
}
|
|
|
|
let headerParams = {
|
|
'User-Agent': 'JdcloudSdkNode/1.0.0 iotlink/1.0.8'
|
|
}
|
|
|
|
let contentTypes = ['application/json']
|
|
let accepts = ['application/json']
|
|
|
|
// 扩展自定义头
|
|
if (opts['x-extra-header']) {
|
|
for (let extraHeader in opts['x-extra-header']) {
|
|
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
|
contentTypes = opts['x-extra-header']['content-type']
|
|
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
|
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
|
accepts = opts['x-extra-header']['accept']
|
|
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
|
accepts = opts['x-extra-header']['accept'].split(',')
|
|
}
|
|
}
|
|
|
|
let formParams = {}
|
|
|
|
let returnType = null
|
|
|
|
this.config.logger(
|
|
`call closeIotCard with params:\npathParams:${JSON.stringify(
|
|
pathParams
|
|
)},\nqueryParams:${JSON.stringify(
|
|
queryParams
|
|
)}, \nheaderParams:${JSON.stringify(
|
|
headerParams
|
|
)}, \nformParams:${JSON.stringify(
|
|
formParams
|
|
)}, \npostBody:${JSON.stringify(postBody)}`,
|
|
'DEBUG'
|
|
)
|
|
|
|
let request = super.makeRequest(
|
|
'/regions/{regionId}/closeIotCard',
|
|
'POST',
|
|
pathParams,
|
|
queryParams,
|
|
headerParams,
|
|
formParams,
|
|
postBody,
|
|
contentTypes,
|
|
accepts,
|
|
returnType,
|
|
callback
|
|
)
|
|
|
|
return request.then(
|
|
function (result) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(null, result)
|
|
}
|
|
return result
|
|
},
|
|
function (error) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(error)
|
|
}
|
|
return Promise.reject(error)
|
|
}
|
|
)
|
|
}
|
|
|
|
/**
|
|
* 物联网卡开启流量操作
|
|
* @param {Object} opts - parameters
|
|
* @param {array} [opts.iccids] - 物联网卡号码列表(单次提交最多不超过200个号码) optional
|
|
* @param {string} regionId - ID of the region
|
|
* @param {string} callback - callback
|
|
@return {Object} result
|
|
* @param string status 请求状态(0:成功;1:失败)
|
|
* @param string message 消息描述
|
|
* @param operationIotlinkResp result
|
|
*/
|
|
|
|
openIotFlow (opts, regionId = this.config.regionId, callback) {
|
|
if (typeof regionId === 'function') {
|
|
callback = regionId
|
|
regionId = this.config.regionId
|
|
}
|
|
|
|
if (regionId === undefined || regionId === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'regionId' when calling openIotFlow"
|
|
)
|
|
}
|
|
|
|
opts = opts || {}
|
|
|
|
let postBody = {}
|
|
if (opts.iccids !== undefined && opts.iccids !== null) {
|
|
postBody['iccids'] = opts.iccids
|
|
}
|
|
|
|
let queryParams = {}
|
|
|
|
let pathParams = {
|
|
regionId: regionId
|
|
}
|
|
|
|
let headerParams = {
|
|
'User-Agent': 'JdcloudSdkNode/1.0.0 iotlink/1.0.8'
|
|
}
|
|
|
|
let contentTypes = ['application/json']
|
|
let accepts = ['application/json']
|
|
|
|
// 扩展自定义头
|
|
if (opts['x-extra-header']) {
|
|
for (let extraHeader in opts['x-extra-header']) {
|
|
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
|
contentTypes = opts['x-extra-header']['content-type']
|
|
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
|
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
|
accepts = opts['x-extra-header']['accept']
|
|
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
|
accepts = opts['x-extra-header']['accept'].split(',')
|
|
}
|
|
}
|
|
|
|
let formParams = {}
|
|
|
|
let returnType = null
|
|
|
|
this.config.logger(
|
|
`call openIotFlow with params:\npathParams:${JSON.stringify(
|
|
pathParams
|
|
)},\nqueryParams:${JSON.stringify(
|
|
queryParams
|
|
)}, \nheaderParams:${JSON.stringify(
|
|
headerParams
|
|
)}, \nformParams:${JSON.stringify(
|
|
formParams
|
|
)}, \npostBody:${JSON.stringify(postBody)}`,
|
|
'DEBUG'
|
|
)
|
|
|
|
let request = super.makeRequest(
|
|
'/regions/{regionId}/openIotFlow',
|
|
'POST',
|
|
pathParams,
|
|
queryParams,
|
|
headerParams,
|
|
formParams,
|
|
postBody,
|
|
contentTypes,
|
|
accepts,
|
|
returnType,
|
|
callback
|
|
)
|
|
|
|
return request.then(
|
|
function (result) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(null, result)
|
|
}
|
|
return result
|
|
},
|
|
function (error) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(error)
|
|
}
|
|
return Promise.reject(error)
|
|
}
|
|
)
|
|
}
|
|
|
|
/**
|
|
* 物联网卡停流量操作
|
|
* @param {Object} opts - parameters
|
|
* @param {array} [opts.iccids] - 物联网卡号码列表(单次提交最多不超过200个号码) optional
|
|
* @param {string} regionId - ID of the region
|
|
* @param {string} callback - callback
|
|
@return {Object} result
|
|
* @param string status 请求状态(0:成功;1:失败)
|
|
* @param string message 消息描述
|
|
* @param operationIotlinkResp result
|
|
*/
|
|
|
|
closeIotFlow (opts, regionId = this.config.regionId, callback) {
|
|
if (typeof regionId === 'function') {
|
|
callback = regionId
|
|
regionId = this.config.regionId
|
|
}
|
|
|
|
if (regionId === undefined || regionId === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'regionId' when calling closeIotFlow"
|
|
)
|
|
}
|
|
|
|
opts = opts || {}
|
|
|
|
let postBody = {}
|
|
if (opts.iccids !== undefined && opts.iccids !== null) {
|
|
postBody['iccids'] = opts.iccids
|
|
}
|
|
|
|
let queryParams = {}
|
|
|
|
let pathParams = {
|
|
regionId: regionId
|
|
}
|
|
|
|
let headerParams = {
|
|
'User-Agent': 'JdcloudSdkNode/1.0.0 iotlink/1.0.8'
|
|
}
|
|
|
|
let contentTypes = ['application/json']
|
|
let accepts = ['application/json']
|
|
|
|
// 扩展自定义头
|
|
if (opts['x-extra-header']) {
|
|
for (let extraHeader in opts['x-extra-header']) {
|
|
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
|
contentTypes = opts['x-extra-header']['content-type']
|
|
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
|
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
|
accepts = opts['x-extra-header']['accept']
|
|
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
|
accepts = opts['x-extra-header']['accept'].split(',')
|
|
}
|
|
}
|
|
|
|
let formParams = {}
|
|
|
|
let returnType = null
|
|
|
|
this.config.logger(
|
|
`call closeIotFlow with params:\npathParams:${JSON.stringify(
|
|
pathParams
|
|
)},\nqueryParams:${JSON.stringify(
|
|
queryParams
|
|
)}, \nheaderParams:${JSON.stringify(
|
|
headerParams
|
|
)}, \nformParams:${JSON.stringify(
|
|
formParams
|
|
)}, \npostBody:${JSON.stringify(postBody)}`,
|
|
'DEBUG'
|
|
)
|
|
|
|
let request = super.makeRequest(
|
|
'/regions/{regionId}/closeIotFlow',
|
|
'POST',
|
|
pathParams,
|
|
queryParams,
|
|
headerParams,
|
|
formParams,
|
|
postBody,
|
|
contentTypes,
|
|
accepts,
|
|
returnType,
|
|
callback
|
|
)
|
|
|
|
return request.then(
|
|
function (result) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(null, result)
|
|
}
|
|
return result
|
|
},
|
|
function (error) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(error)
|
|
}
|
|
return Promise.reject(error)
|
|
}
|
|
)
|
|
}
|
|
|
|
/**
|
|
* 物联网卡查询通用操作
|
|
* @param {Object} opts - parameters
|
|
* @param {string} opts.requestType - 物联网卡查询请求类型
|
|
* @param {string} opts.requestParam - 物联网卡查询请求参数json串
|
|
* @param {string} regionId - ID of the region
|
|
* @param {string} callback - callback
|
|
@return {Object} result
|
|
* @param string status 请求状态(0:成功;1:失败)
|
|
* @param string message 消息描述
|
|
* @param string result 物联网卡查询返回结果集
|
|
*/
|
|
|
|
search (opts, regionId = this.config.regionId, callback) {
|
|
if (typeof regionId === 'function') {
|
|
callback = regionId
|
|
regionId = this.config.regionId
|
|
}
|
|
|
|
if (regionId === undefined || regionId === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'regionId' when calling search"
|
|
)
|
|
}
|
|
|
|
opts = opts || {}
|
|
|
|
if (opts.requestType === undefined || opts.requestType === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'opts.requestType' when calling search"
|
|
)
|
|
}
|
|
if (opts.requestParam === undefined || opts.requestParam === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'opts.requestParam' when calling search"
|
|
)
|
|
}
|
|
|
|
let postBody = {}
|
|
if (opts.requestType !== undefined && opts.requestType !== null) {
|
|
postBody['requestType'] = opts.requestType
|
|
}
|
|
if (opts.requestParam !== undefined && opts.requestParam !== null) {
|
|
postBody['requestParam'] = opts.requestParam
|
|
}
|
|
|
|
let queryParams = {}
|
|
|
|
let pathParams = {
|
|
regionId: regionId
|
|
}
|
|
|
|
let headerParams = {
|
|
'User-Agent': 'JdcloudSdkNode/1.0.0 iotlink/1.0.8'
|
|
}
|
|
|
|
let contentTypes = ['application/json']
|
|
let accepts = ['application/json']
|
|
|
|
// 扩展自定义头
|
|
if (opts['x-extra-header']) {
|
|
for (let extraHeader in opts['x-extra-header']) {
|
|
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
|
contentTypes = opts['x-extra-header']['content-type']
|
|
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
|
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
|
accepts = opts['x-extra-header']['accept']
|
|
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
|
accepts = opts['x-extra-header']['accept'].split(',')
|
|
}
|
|
}
|
|
|
|
let formParams = {}
|
|
|
|
let returnType = null
|
|
|
|
this.config.logger(
|
|
`call search with params:\npathParams:${JSON.stringify(
|
|
pathParams
|
|
)},\nqueryParams:${JSON.stringify(
|
|
queryParams
|
|
)}, \nheaderParams:${JSON.stringify(
|
|
headerParams
|
|
)}, \nformParams:${JSON.stringify(
|
|
formParams
|
|
)}, \npostBody:${JSON.stringify(postBody)}`,
|
|
'DEBUG'
|
|
)
|
|
|
|
let request = super.makeRequest(
|
|
'/regions/{regionId}/search',
|
|
'POST',
|
|
pathParams,
|
|
queryParams,
|
|
headerParams,
|
|
formParams,
|
|
postBody,
|
|
contentTypes,
|
|
accepts,
|
|
returnType,
|
|
callback
|
|
)
|
|
|
|
return request.then(
|
|
function (result) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(null, result)
|
|
}
|
|
return result
|
|
},
|
|
function (error) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(error)
|
|
}
|
|
return Promise.reject(error)
|
|
}
|
|
)
|
|
}
|
|
|
|
/**
|
|
* 物联网卡卡操作通用操作
|
|
* @param {Object} opts - parameters
|
|
* @param {string} opts.requestType - 物联网卡操作请求类型
|
|
* @param {string} opts.requestParam - 物联网卡操作请求参数json串
|
|
* @param {string} regionId - ID of the region
|
|
* @param {string} callback - callback
|
|
@return {Object} result
|
|
* @param string status 请求状态(0:成功;1:失败)
|
|
* @param string message 消息描述
|
|
* @param string result 物联网卡操作返回结果集
|
|
*/
|
|
|
|
operate (opts, regionId = this.config.regionId, callback) {
|
|
if (typeof regionId === 'function') {
|
|
callback = regionId
|
|
regionId = this.config.regionId
|
|
}
|
|
|
|
if (regionId === undefined || regionId === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'regionId' when calling operate"
|
|
)
|
|
}
|
|
|
|
opts = opts || {}
|
|
|
|
if (opts.requestType === undefined || opts.requestType === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'opts.requestType' when calling operate"
|
|
)
|
|
}
|
|
if (opts.requestParam === undefined || opts.requestParam === null) {
|
|
throw new Error(
|
|
"Missing the required parameter 'opts.requestParam' when calling operate"
|
|
)
|
|
}
|
|
|
|
let postBody = {}
|
|
if (opts.requestType !== undefined && opts.requestType !== null) {
|
|
postBody['requestType'] = opts.requestType
|
|
}
|
|
if (opts.requestParam !== undefined && opts.requestParam !== null) {
|
|
postBody['requestParam'] = opts.requestParam
|
|
}
|
|
|
|
let queryParams = {}
|
|
|
|
let pathParams = {
|
|
regionId: regionId
|
|
}
|
|
|
|
let headerParams = {
|
|
'User-Agent': 'JdcloudSdkNode/1.0.0 iotlink/1.0.8'
|
|
}
|
|
|
|
let contentTypes = ['application/json']
|
|
let accepts = ['application/json']
|
|
|
|
// 扩展自定义头
|
|
if (opts['x-extra-header']) {
|
|
for (let extraHeader in opts['x-extra-header']) {
|
|
headerParams[extraHeader] = opts['x-extra-header'][extraHeader]
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['content-type'])) {
|
|
contentTypes = opts['x-extra-header']['content-type']
|
|
} else if (typeof opts['x-extra-header']['content-type'] === 'string') {
|
|
contentTypes = opts['x-extra-header']['content-type'].split(',')
|
|
}
|
|
|
|
if (Array.isArray(opts['x-extra-header']['accept'])) {
|
|
accepts = opts['x-extra-header']['accept']
|
|
} else if (typeof opts['x-extra-header']['accept'] === 'string') {
|
|
accepts = opts['x-extra-header']['accept'].split(',')
|
|
}
|
|
}
|
|
|
|
let formParams = {}
|
|
|
|
let returnType = null
|
|
|
|
this.config.logger(
|
|
`call operate with params:\npathParams:${JSON.stringify(
|
|
pathParams
|
|
)},\nqueryParams:${JSON.stringify(
|
|
queryParams
|
|
)}, \nheaderParams:${JSON.stringify(
|
|
headerParams
|
|
)}, \nformParams:${JSON.stringify(
|
|
formParams
|
|
)}, \npostBody:${JSON.stringify(postBody)}`,
|
|
'DEBUG'
|
|
)
|
|
|
|
let request = super.makeRequest(
|
|
'/regions/{regionId}/operate',
|
|
'POST',
|
|
pathParams,
|
|
queryParams,
|
|
headerParams,
|
|
formParams,
|
|
postBody,
|
|
contentTypes,
|
|
accepts,
|
|
returnType,
|
|
callback
|
|
)
|
|
|
|
return request.then(
|
|
function (result) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(null, result)
|
|
}
|
|
return result
|
|
},
|
|
function (error) {
|
|
if (callback && typeof callback === 'function') {
|
|
return callback(error)
|
|
}
|
|
return Promise.reject(error)
|
|
}
|
|
)
|
|
}
|
|
}
|
|
module.exports = IOTLINK
|