hollaex-node-lib 2.15.1 → 2.15.2
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/README.md +2 -0
- package/example/hollaex.js +2 -2
- package/kit.js +65 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -107,6 +107,8 @@ client
|
|
|
107
107
|
| `deactivateExchangeUserOtp` | <ul><li>**userId**: The identifier of the user to deactivate their otp</li></ul> | Deactivate user otp by admin |
|
|
108
108
|
| `getExchangeUserReferrals` | <ul><li>**userId**: The identifier of the user to filter by</li><li>**opts.limit**: Amount of referrals per page. Maximum: 50. Default: 50</li><li>**opts.page**: Page of referral data. Default: 1</li><li>**opts.orderBy**: The field to order data by e.g. amount, id.</li><li>**opts.order**: Ascending (asc) or descending (desc).</li><li>**opts.startDate**: Start date of query in ISO8601 format.</li><li>**opts.endDate**: End date of query in ISO8601 format.</li></ul> | Retrieve user's referrals info by admin |
|
|
109
109
|
| `getExchangeUserReferrer` | <ul><li>**userId**: The identifier of the user to filter by</li></ul> | Retrieve user's referer info by admin |
|
|
110
|
+
| `sendExchangeUserEmail` | <ul><li>**userId**: The identifier of the user</li><li>**mailType**: The mail type for the email payload</li><li>**data**: The content of the mail</li></ul> | Send email to exchange user account by admin |
|
|
111
|
+
| `sendRawEmail` | <ul><li>**receivers**: The array of emails to send mail</li><li>**html**: The stringified html content</li><li>**opts.title**: The title of the mail</li><li>**opts.text**: The text of the mail</li></ul> | Send email to users with custom html by admin |
|
|
110
112
|
|
|
111
113
|
|
|
112
114
|
### Websocket
|
package/example/hollaex.js
CHANGED
|
@@ -22,7 +22,7 @@ client
|
|
|
22
22
|
symbols : xht-usdt
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
client.connect(['
|
|
25
|
+
client.connect(['orderbook']);
|
|
26
26
|
|
|
27
27
|
client.ws.on('message', (data) => {
|
|
28
28
|
data = JSON.parse(data);
|
|
@@ -33,4 +33,4 @@ client.ws.on('message', (data) => {
|
|
|
33
33
|
|
|
34
34
|
setTimeout(() => {
|
|
35
35
|
client.disconnect();
|
|
36
|
-
}, 10000);
|
|
36
|
+
}, 10000);
|
package/kit.js
CHANGED
|
@@ -2172,7 +2172,72 @@ class HollaExKit {
|
|
|
2172
2172
|
return createRequest(verb, `${this.apiUrl}${path}`, headers);
|
|
2173
2173
|
}
|
|
2174
2174
|
|
|
2175
|
+
/**
|
|
2176
|
+
* Send email to exchange user account by admin
|
|
2177
|
+
* @param {number} userId - The identifier of the user
|
|
2178
|
+
* @param {string} mailType - The mail type for the email payload
|
|
2179
|
+
* @param {object} data - The content of the mail
|
|
2180
|
+
* @return {object} A JSON object with message
|
|
2181
|
+
*/
|
|
2182
|
+
sendExchangeUserEmail(userId, mailType, data) {
|
|
2183
|
+
const verb = 'POST';
|
|
2184
|
+
let path = `${this.baseUrl}/admin/send-email`;
|
|
2185
|
+
const data = {
|
|
2186
|
+
user_id: userId,
|
|
2187
|
+
mail_type: mailType,
|
|
2188
|
+
data
|
|
2189
|
+
};
|
|
2190
|
+
|
|
2191
|
+
const headers = generateHeaders(
|
|
2192
|
+
this.headers,
|
|
2193
|
+
this.apiSecret,
|
|
2194
|
+
verb,
|
|
2195
|
+
path,
|
|
2196
|
+
this.apiExpiresAfter,
|
|
2197
|
+
data
|
|
2198
|
+
);
|
|
2199
|
+
return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
|
|
2200
|
+
}
|
|
2201
|
+
|
|
2202
|
+
/**
|
|
2203
|
+
* Send email to users with custom html by admin
|
|
2204
|
+
* @param {array} receivers - The array of emails to send mail
|
|
2205
|
+
* @param {string} html - The stringified html content
|
|
2206
|
+
* @param {string} opts.title - The title of the mail
|
|
2207
|
+
* @param {string} opts.text - The text of the mail
|
|
2208
|
+
* @return {object} A JSON object with message
|
|
2209
|
+
*/
|
|
2210
|
+
sendRawEmail(receivers, html, opts = {
|
|
2211
|
+
title: null,
|
|
2212
|
+
text: null
|
|
2213
|
+
}) {
|
|
2214
|
+
const verb = 'POST';
|
|
2215
|
+
let path = `${this.baseUrl}/admin/send-email/raw`;
|
|
2216
|
+
const data = {
|
|
2217
|
+
receivers,
|
|
2218
|
+
html,
|
|
2219
|
+
};
|
|
2175
2220
|
|
|
2221
|
+
if(isString(opts.title)) {
|
|
2222
|
+
data.title = opts.title
|
|
2223
|
+
}
|
|
2224
|
+
|
|
2225
|
+
if(isString(opts.text)) {
|
|
2226
|
+
data.text = opts.text
|
|
2227
|
+
}
|
|
2228
|
+
|
|
2229
|
+
const headers = generateHeaders(
|
|
2230
|
+
this.headers,
|
|
2231
|
+
this.apiSecret,
|
|
2232
|
+
verb,
|
|
2233
|
+
path,
|
|
2234
|
+
this.apiExpiresAfter,
|
|
2235
|
+
data
|
|
2236
|
+
);
|
|
2237
|
+
return createRequest(verb, `${this.apiUrl}${path}`, headers, { data });
|
|
2238
|
+
}
|
|
2239
|
+
|
|
2240
|
+
|
|
2176
2241
|
/**
|
|
2177
2242
|
* Connect to hollaEx websocket and listen to an event
|
|
2178
2243
|
* @param {array} events - The events to listen to
|