@eluvio/elv-client-js 4.1.0 → 4.2.1
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/client/Shares.js +9 -3
package/package.json
CHANGED
package/src/client/Shares.js
CHANGED
|
@@ -10,17 +10,23 @@ const UrlJoin = require("url-join");
|
|
|
10
10
|
* Create a share
|
|
11
11
|
*
|
|
12
12
|
* @namedParams
|
|
13
|
-
* @param {string} objectId - The object to
|
|
13
|
+
* @param {string} objectId - The ID of the object to share
|
|
14
|
+
* @param {Array<string>} objectIds - Additional object IDs to authorize
|
|
14
15
|
* @param {Date} expiresAt - The expiration time of the share
|
|
15
16
|
* @param {Object=} params - Additional parameters
|
|
16
17
|
*
|
|
17
18
|
* @returns {Promise<Object>} - Info about the created share
|
|
18
19
|
*/
|
|
19
|
-
exports.CreateShare = async function({objectId, expiresAt, params={}}) {
|
|
20
|
+
exports.CreateShare = async function({objectId, objectIds=[], expiresAt, params={}}) {
|
|
20
21
|
const tenantId = await this.userProfileClient.TenantContractId();
|
|
21
22
|
const token = await this.CreateFabricToken({});
|
|
23
|
+
|
|
24
|
+
if(objectId) {
|
|
25
|
+
objectIds = [objectId, ...objectIds]
|
|
26
|
+
.filter((x, i, a) => x && a.indexOf(x) == i);
|
|
27
|
+
}
|
|
22
28
|
|
|
23
|
-
params.
|
|
29
|
+
params.object_ids = objectIds;
|
|
24
30
|
|
|
25
31
|
if(expiresAt) {
|
|
26
32
|
params.end_time = Math.floor(new Date(expiresAt).getTime() / 1000);
|