@homecloud-platform/sdk 0.5.1 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/mq.js +8 -8
package/package.json
CHANGED
package/src/mq.js
CHANGED
|
@@ -60,13 +60,13 @@ class MqAPI {
|
|
|
60
60
|
return this._c.dataPlaneRequest("mq", "POST", reqPath, { json: payload });
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
async receive(queueName, { maxMessages = 1, waitSeconds = 20 } = {}) {
|
|
63
|
+
async receive(queueName, { maxMessages = 1, waitSeconds = 20, delete: shouldDelete = false } = {}) {
|
|
64
64
|
this._c.requireAccessKey();
|
|
65
65
|
const accountId = this._c.accountId;
|
|
66
66
|
const reqPath = `/${accountId}/${queueName}/messages`;
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
});
|
|
67
|
+
const params = { max_messages: maxMessages, wait_seconds: waitSeconds };
|
|
68
|
+
if (shouldDelete) params.delete = "true";
|
|
69
|
+
const data = await this._c.dataPlaneRequest("mq", "GET", reqPath, { params });
|
|
70
70
|
return data.items || [];
|
|
71
71
|
}
|
|
72
72
|
|
|
@@ -84,13 +84,13 @@ class MqAPI {
|
|
|
84
84
|
await this._c.dataPlaneRequest("mq", "POST", reqPath);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
async receiveDlq(queueName, { maxMessages = 1, waitSeconds = 20 } = {}) {
|
|
87
|
+
async receiveDlq(queueName, { maxMessages = 1, waitSeconds = 20, delete: shouldDelete = false } = {}) {
|
|
88
88
|
this._c.requireAccessKey();
|
|
89
89
|
const accountId = this._c.accountId;
|
|
90
90
|
const reqPath = `/${accountId}/${queueName}/dlq/messages`;
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
});
|
|
91
|
+
const params = { max_messages: maxMessages, wait_seconds: waitSeconds };
|
|
92
|
+
if (shouldDelete) params.delete = "true";
|
|
93
|
+
const data = await this._c.dataPlaneRequest("mq", "GET", reqPath, { params });
|
|
94
94
|
return data.items || [];
|
|
95
95
|
}
|
|
96
96
|
|