@reactoo/watchtogether-sdk-js 2.6.4 → 2.6.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactoo/watchtogether-sdk-js",
3
- "version": "2.6.4",
3
+ "version": "2.6.6",
4
4
  "description": "Javascript SDK for Reactoo",
5
5
  "main": "src/index.js",
6
6
  "unpkg": "dist/watchtogether-sdk.min.js",
@@ -4,7 +4,6 @@ import {generateUUID} from "../modules/wt-utils";
4
4
 
5
5
  let asset = function() {
6
6
  return {
7
-
8
7
  getAssetList: ({type = 'instanceType', instanceType, assetType, size = 20, startKey = null, roomId, ids}) => {
9
8
  let apiParams = {
10
9
  type,
@@ -20,7 +19,7 @@ let asset = function() {
20
19
  },
21
20
  getAssetById: (id) => {
22
21
  return this.__privates.auth.__client
23
- .then(client => client.apis.user.getAssetById({id}))
22
+ .then(client => client.apis.asset.getAssetById({id}))
24
23
  },
25
24
  updateAsset: ({id, assetType, title, roomIds} = {}) => {
26
25
  return this.__privates.auth.__client
@@ -30,9 +29,15 @@ let asset = function() {
30
29
  return this.__privates.auth.__client
31
30
  .then(client => client.apis.asset.deleteAsset({id}))
32
31
  },
33
- uploadAsset: (file, roomIds, id = null) => {
32
+
33
+ initiateAssetUpload: (id = null) => {
34
+ return this.__privates.auth.__client
35
+ .then(client => client.apis.asset.initiateAssetUpload())
36
+ },
37
+
38
+ uploadAsset: (file, roomIds, id = null, initiationData = null) => {
34
39
  return this.__privates.auth.__client
35
- .then(client => Promise.all([client, client.apis.asset.initiateAssetUpload({id: id || generateUUID()})]))
40
+ .then(client => Promise.all([client, initiationData ? Promise.resolve(initiationData) : client.apis.asset.initiateAssetUpload({id: id || generateUUID()})]))
36
41
  .then(([client, response]) => Promise.all([client, client.http({url: response.data.signedUrl, method: response.data.httpMethod, headers: {"Content-Type":file.type}, body:file}), response.data.id]))
37
42
  .then(([client, response, idn]) => Promise.all([client.apis.asset.publishAsset({id:idn}, {requestBody: {title: file.name, ...(roomIds ? {roomIds} : {})}}), idn]))
38
43
  ;