@alicloud/mns
Advanced tools
Comparing version 1.0.0-beta7 to 1.0.0-beta8
@@ -174,4 +174,4 @@ 'use strict'; | ||
key: 'delete', | ||
value: function _delete(resource) { | ||
return this.request('DELETE', resource, undefined, ''); | ||
value: function _delete(resource, type, body) { | ||
return this.request('DELETE', resource, type, body); | ||
} | ||
@@ -465,3 +465,3 @@ }, { | ||
case 0: | ||
body = toXMLBuffer('ReceiptHandles', receiptHandles); | ||
body = toXMLBuffer('ReceiptHandles', receiptHandles, 'ReceiptHandle'); | ||
url = `/queues/${queueName}/messages`; | ||
@@ -473,8 +473,13 @@ _context6.next = 4; | ||
response = _context6.sent; | ||
subType = 'Error'; | ||
response.body = response.body[subType]; | ||
// 3种情况,普通失败,部分失败,全部成功 | ||
if (response.body) { | ||
subType = 'Error'; | ||
// 部分失败 | ||
response.body = response.body[subType]; | ||
} | ||
return _context6.abrupt('return', response); | ||
case 8: | ||
case 7: | ||
case 'end': | ||
@@ -481,0 +486,0 @@ return _context6.stop(); |
@@ -31,2 +31,6 @@ 'use strict'; | ||
function format(params) { | ||
if (typeof params === 'string') { | ||
return params; | ||
} | ||
var xml = ''; | ||
@@ -33,0 +37,0 @@ Object.keys(params).forEach(function (key) { |
@@ -102,4 +102,4 @@ 'use strict'; | ||
delete(resource) { | ||
return this.request('DELETE', resource, undefined, ''); | ||
delete(resource, type, body) { | ||
return this.request('DELETE', resource, type, body); | ||
} | ||
@@ -262,7 +262,11 @@ | ||
async batchDeleteMessage(queueName, receiptHandles) { | ||
const body = toXMLBuffer('ReceiptHandles', receiptHandles); | ||
const body = toXMLBuffer('ReceiptHandles', receiptHandles, 'ReceiptHandle'); | ||
const url = `/queues/${queueName}/messages`; | ||
const response = await this.delete(url, 'Errors', body); | ||
const subType = 'Error'; | ||
response.body = response.body[subType]; | ||
// 3种情况,普通失败,部分失败,全部成功 | ||
if (response.body) { | ||
const subType = 'Error'; | ||
// 部分失败 | ||
response.body = response.body[subType]; | ||
} | ||
return response; | ||
@@ -269,0 +273,0 @@ } |
@@ -31,2 +31,6 @@ 'use strict'; | ||
function format (params) { | ||
if (typeof params === 'string') { | ||
return params; | ||
} | ||
var xml = ''; | ||
@@ -36,5 +40,5 @@ Object.keys(params).forEach((key) => { | ||
if (typeof value === 'object') { | ||
xml += `<${key}>${format(value)}</${key}>`; | ||
xml += `<${key}>${format(value)}</${key}>`; | ||
} else { | ||
xml += `<${key}>${value}</${key}>`; | ||
xml += `<${key}>${value}</${key}>`; | ||
} | ||
@@ -41,0 +45,0 @@ }); |
{ | ||
"name": "@alicloud/mns", | ||
"version": "1.0.0-beta7", | ||
"version": "1.0.0-beta8", | ||
"description": "> 该 SDK 并未完全实现所有文档所提及的功能,如果您想使用的功能并未实现,请提[issue](https://github.com/aliyun/aliyun-mns-nodejs-sdk/issues/new)以增加优先级。", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40436
969