@reactoo/watchtogether-sdk-js 2.8.60 → 2.8.61

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.8.60",
3
+ "version": "2.8.61",
4
4
  "description": "Javascript SDK for Reactoo",
5
5
  "main": "dist/watchtogether-sdk.min.js",
6
6
  "module": "dist/watchtogether-sdk.min.js",
@@ -124,6 +124,48 @@ let liveBarn = function() {
124
124
  return this.__privates.auth.__client
125
125
  .then(client => client.apis.livebarn.publishTeamLogo({id: fileId, teamId}));
126
126
  },
127
+
128
+ getLiveBarnLeagueList: ({instanceType, fulltextPhrase, sports, type, ids, size, startKey, sort} = {}) => {
129
+ return chunkArray(ids, 30)
130
+ .reduce((promiseChain, idsChunk) => {
131
+ return promiseChain.then(chainResponse => {
132
+ const apiParams = {
133
+ operation: 'listLeagues',
134
+ ...(fulltextPhrase && {fulltextPhrase}),
135
+ ...(sports?.length && {sports}),
136
+ ...(type && {type}),
137
+ ...(idsChunk?.length && {ids: idsChunk}),
138
+ ...(size && !ids?.length && {size}),
139
+ ...(startKey && {startKey}),
140
+ ...(sort && {sort}),
141
+ };
142
+ return this.system.getIntegrationPublic(instanceType, apiParams)
143
+ .then(response => ids?.length ? ({
144
+ data: {
145
+ items: [...chainResponse.data.items, ...response.data.items],
146
+ size: chainResponse.data.size + response.data.size,
147
+ startKey: null,
148
+ },
149
+ }) : response);
150
+ });
151
+ }, Promise.resolve({data: {items: [], size: 0, startKey: null}}));
152
+ },
153
+ getLiveBarnLeagueById: ({type, id} = {}) => {
154
+ const apiParams = {
155
+ operation: 'getLeague',
156
+ id,
157
+ };
158
+ return this.system.getIntegrationPublic(type, apiParams);
159
+ },
160
+ uploadLeagueLogo: (file, leagueId) => {
161
+ return this.__privates.auth.__client
162
+ .then(client => Promise.all([client, client.apis.livebarn.initiateLeagueLogoUpload({id: generateUUID(), leagueId})]))
163
+ .then(([client, response]) => Promise.all([client.http({url: response.data.signedUrl, method: response.data.httpMethod, headers: {"Content-Type": file.type}, body: file}), response.data.id]));
164
+ },
165
+ publishLeagueLogo: (fileId, leagueId) => {
166
+ return this.__privates.auth.__client
167
+ .then(client => client.apis.livebarn.publishLeagueLogo({id: fileId, leagueId}));
168
+ },
127
169
  };
128
170
  };
129
171