glitch-javascript-sdk 0.2.7 → 0.2.9

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/dist/index.d.ts CHANGED
@@ -784,6 +784,16 @@ declare class Communities {
784
784
  * @returns promise
785
785
  */
786
786
  static findByDomain<T>(domain: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
787
+ /**
788
+ * Has a user join a community. The join is executed using the current user's authentication token.
789
+ *
790
+ * @see https://api.glitch.fun/api/documentation#/Community%20Route/updateCommunityStorage
791
+ *
792
+ * @param community_id The id of the community to update.
793
+ *
794
+ * @returns promise
795
+ */
796
+ static join<T>(community_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
787
797
  }
788
798
 
789
799
  declare class Users {
@@ -992,7 +1002,7 @@ declare class Events {
992
1002
  *
993
1003
  * @returns promise
994
1004
  */
995
- static removeRTMPSource<T>(event_id: string, stream_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
1005
+ static removeRTMPSource<T>(event_id: string, stream_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
996
1006
  /**
997
1007
  * A function that should be run on an interval to set the event as live when the live stream is active.
998
1008
  *
@@ -1002,7 +1012,7 @@ declare class Events {
1002
1012
  *
1003
1013
  * @returns promise
1004
1014
  */
1005
- static syncAsLive<T>(event_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
1015
+ static syncAsLive<T>(event_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
1006
1016
  /**
1007
1017
  * Updates the main image for the event using a File object.
1008
1018
  *
@@ -1057,7 +1067,7 @@ declare class Events {
1057
1067
  *
1058
1068
  * @returns promise
1059
1069
  */
1060
- static enableBroadcastMode<T>(event_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
1070
+ static enableBroadcastMode<T>(event_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
1061
1071
  /**
1062
1072
  * Enable livestream mode, in which the stream will be delivered to the invirtu RTMP endpoint for
1063
1073
  * streaming.
@@ -1066,7 +1076,7 @@ declare class Events {
1066
1076
  *
1067
1077
  * @returns promise
1068
1078
  */
1069
- static enableLivestreamMode<T>(event_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
1079
+ static enableLivestreamMode<T>(event_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
1070
1080
  /**
1071
1081
  * Sends content that will appear on-screen to the user.
1072
1082
  *
@@ -1101,7 +1111,7 @@ declare class Events {
1101
1111
  *
1102
1112
  * @returns promise
1103
1113
  */
1104
- static addOverlayAsBlob<T>(event_id: string, blob: Blob, data?: object): AxiosPromise<Response<T>>;
1114
+ static addOverlayAsBlob<T>(event_id: string, blob: Blob, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
1105
1115
  /**
1106
1116
  * Deletes an overlay image.
1107
1117
  *
@@ -1112,7 +1122,7 @@ declare class Events {
1112
1122
  *
1113
1123
  * @returns promise
1114
1124
  */
1115
- static removeOverlay<T>(event_id: string, overlay_id: string): AxiosPromise<Response<T>>;
1125
+ static removeOverlay<T>(event_id: string, overlay_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
1116
1126
  /**
1117
1127
  * Enables an overlay so that it will appear on screen.
1118
1128
  *
@@ -1123,7 +1133,7 @@ declare class Events {
1123
1133
  *
1124
1134
  * @returns promise
1125
1135
  */
1126
- static enableOverlay<T>(event_id: string, overlay_id: string): AxiosPromise<Response<T>>;
1136
+ static enableOverlay<T>(event_id: string, overlay_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
1127
1137
  /**
1128
1138
  * Disables the overlay so it no longer appears on-screen.
1129
1139
  *
@@ -1133,7 +1143,7 @@ declare class Events {
1133
1143
  *
1134
1144
  * @returns promise
1135
1145
  */
1136
- static disableOverlay<T>(event_id: string): AxiosPromise<Response<T>>;
1146
+ static disableOverlay<T>(event_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
1137
1147
  /**
1138
1148
  * Enable the donations to appear on-screen
1139
1149
  *
@@ -1143,16 +1153,16 @@ declare class Events {
1143
1153
  *
1144
1154
  * @returns promise
1145
1155
  */
1146
- static enableDonations<T>(event_id: string): AxiosPromise<Response<T>>;
1156
+ static enableDonations<T>(event_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
1147
1157
  /**
1148
1158
  * Disable the donations and remove from the screen.
1149
1159
  *
1150
1160
  * @param event_id
1151
1161
  * @returns
1152
1162
  */
1153
- static disableDonations<T>(event_id: string): AxiosPromise<Response<T>>;
1154
- static sendInvite<T>(event_id: string, data: object): AxiosPromise<Response<T>>;
1155
- static acceptInvite<T>(event_id: string, token: string): AxiosPromise<Response<T>>;
1163
+ static disableDonations<T>(event_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
1164
+ static sendInvite<T>(event_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
1165
+ static acceptInvite<T>(event_id: string, token: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
1156
1166
  }
1157
1167
 
1158
1168
  declare class Teams {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -253,7 +253,7 @@ class Communities {
253
253
  * @returns promise
254
254
  */
255
255
  public static getUser<T>(community_id : string, user_id : string, params?: Record<string, any>): AxiosPromise<Response<T>> {
256
- return Requests.processRoute(CommunitiesRoute.routes.showUser, {}, {community_id : community_id, user_id}, params);
256
+ return Requests.processRoute(CommunitiesRoute.routes.showUser, {}, {community_id : community_id, user_id : user_id}, params);
257
257
  }
258
258
 
259
259
  /**
@@ -265,7 +265,7 @@ class Communities {
265
265
  * @returns promise
266
266
  */
267
267
  public static updatetUser<T>(community_id : string, user_id : string, data? : object, params?: Record<string, any>): AxiosPromise<Response<T>> {
268
- return Requests.processRoute(CommunitiesRoute.routes.updateUser, data, {community_id : community_id, user_id}, params);
268
+ return Requests.processRoute(CommunitiesRoute.routes.updateUser, data, {community_id : community_id, user_id : user_id}, params);
269
269
  }
270
270
 
271
271
  /**
@@ -277,7 +277,7 @@ class Communities {
277
277
  * @returns promise
278
278
  */
279
279
  public static removetUser<T>(community_id : string, user_id : string, params?: Record<string, any>): AxiosPromise<Response<T>> {
280
- return Requests.processRoute(CommunitiesRoute.routes.removeUser, {}, {community_id : community_id, user_id}, params);
280
+ return Requests.processRoute(CommunitiesRoute.routes.removeUser, {}, {community_id : community_id, user_id : user_id}, params);
281
281
  }
282
282
 
283
283
  /**
@@ -291,6 +291,21 @@ class Communities {
291
291
  return Requests.processRoute(CommunitiesRoute.routes.findByDomain, {}, {domain : domain}, params);
292
292
  }
293
293
 
294
+ /**
295
+ * Has a user join a community. The join is executed using the current user's authentication token.
296
+ *
297
+ * @see https://api.glitch.fun/api/documentation#/Community%20Route/updateCommunityStorage
298
+ *
299
+ * @param community_id The id of the community to update.
300
+ *
301
+ * @returns promise
302
+ */
303
+ public static join<T>(community_id : string, data : object, params?: Record<string, any>) : AxiosPromise<Response<T>>{
304
+
305
+ return Requests.processRoute(CommunitiesRoute.routes.join, data, {community_id : community_id}, params);
306
+ }
307
+
308
+
294
309
 
295
310
 
296
311
 
package/src/api/Events.ts CHANGED
@@ -69,7 +69,7 @@ class Events {
69
69
  */
70
70
  public static delete<T>(event_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
71
71
 
72
- return Requests.processRoute(EventsRoutes.routes.delete, {}, { event_id: event_id });
72
+ return Requests.processRoute(EventsRoutes.routes.delete, {}, { event_id: event_id }, params);
73
73
  }
74
74
 
75
75
  /**
@@ -85,7 +85,7 @@ class Events {
85
85
  */
86
86
  public static updateInvirtuEvent<T>(event_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
87
87
 
88
- return Requests.processRoute(EventsRoutes.routes.updateInvirtu, data, { event_id: event_id });
88
+ return Requests.processRoute(EventsRoutes.routes.updateInvirtu, data, { event_id: event_id }, params);
89
89
  }
90
90
 
91
91
  /**
@@ -100,7 +100,7 @@ class Events {
100
100
  */
101
101
  public static addRTMPSource<T>(event_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
102
102
 
103
- return Requests.processRoute(EventsRoutes.routes.addRTMPSource, data, { event_id: event_id });
103
+ return Requests.processRoute(EventsRoutes.routes.addRTMPSource, data, { event_id: event_id }, params);
104
104
  }
105
105
 
106
106
  /**
@@ -115,7 +115,7 @@ class Events {
115
115
  */
116
116
  public static updateRTMPSource<T>(event_id: string, stream_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
117
117
 
118
- return Requests.processRoute(EventsRoutes.routes.updateRTMPSource, data, { event_id: event_id, subid: stream_id });
118
+ return Requests.processRoute(EventsRoutes.routes.updateRTMPSource, data, { event_id: event_id, subid: stream_id }, params);
119
119
  }
120
120
 
121
121
  /**
@@ -128,9 +128,9 @@ class Events {
128
128
  *
129
129
  * @returns promise
130
130
  */
131
- public static removeRTMPSource<T>(event_id: string, stream_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
131
+ public static removeRTMPSource<T>(event_id: string, stream_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
132
132
 
133
- return Requests.processRoute(EventsRoutes.routes.removeRTMPSource, {}, { event_id: event_id, subid: stream_id });
133
+ return Requests.processRoute(EventsRoutes.routes.removeRTMPSource, data, { event_id: event_id, subid: stream_id }, params);
134
134
  }
135
135
 
136
136
  /**
@@ -142,9 +142,9 @@ class Events {
142
142
  *
143
143
  * @returns promise
144
144
  */
145
- public static syncAsLive<T>(event_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
145
+ public static syncAsLive<T>(event_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
146
146
 
147
- return Requests.processRoute(EventsRoutes.routes.syncAsLive, {}, { event_id: event_id });
147
+ return Requests.processRoute(EventsRoutes.routes.syncAsLive, data, { event_id: event_id }, params);
148
148
  }
149
149
 
150
150
  /**
@@ -225,9 +225,9 @@ class Events {
225
225
  *
226
226
  * @returns promise
227
227
  */
228
- public static enableBroadcastMode<T>(event_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
228
+ public static enableBroadcastMode<T>(event_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
229
229
 
230
- return Requests.processRoute(EventsRoutes.routes.enableBroadcastMode, {}, { event_id: event_id });
230
+ return Requests.processRoute(EventsRoutes.routes.enableBroadcastMode, data, { event_id: event_id }, params);
231
231
  }
232
232
 
233
233
  /**
@@ -238,9 +238,9 @@ class Events {
238
238
  *
239
239
  * @returns promise
240
240
  */
241
- public static enableLivestreamMode<T>(event_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
241
+ public static enableLivestreamMode<T>(event_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
242
242
 
243
- return Requests.processRoute(EventsRoutes.routes.enableLivestreamMode, {}, { event_id: event_id });
243
+ return Requests.processRoute(EventsRoutes.routes.enableLivestreamMode, data, { event_id: event_id }, params);
244
244
  }
245
245
 
246
246
  /**
@@ -255,7 +255,7 @@ class Events {
255
255
  */
256
256
  public static sendOnScreenContent<T>(event_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
257
257
 
258
- return Requests.processRoute(EventsRoutes.routes.enableLivestreamMode, data, { event_id: event_id });
258
+ return Requests.processRoute(EventsRoutes.routes.enableLivestreamMode, data, { event_id: event_id }, params);
259
259
  }
260
260
 
261
261
  /**
@@ -287,7 +287,7 @@ class Events {
287
287
  *
288
288
  * @returns promise
289
289
  */
290
- public static addOverlayAsBlob<T>(event_id: string, blob: Blob, data?: object): AxiosPromise<Response<T>> {
290
+ public static addOverlayAsBlob<T>(event_id: string, blob: Blob, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
291
291
 
292
292
  let url = EventsRoutes.routes.addOverlay.url.replace('{event_id}', event_id);
293
293
 
@@ -304,9 +304,9 @@ class Events {
304
304
  *
305
305
  * @returns promise
306
306
  */
307
- public static removeOverlay<T>(event_id: string, overlay_id: string): AxiosPromise<Response<T>> {
307
+ public static removeOverlay<T>(event_id: string, overlay_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
308
308
 
309
- return Requests.processRoute(EventsRoutes.routes.removeOverlay, {}, { event_id: event_id, subid: overlay_id });
309
+ return Requests.processRoute(EventsRoutes.routes.removeOverlay, {}, { event_id: event_id, subid: overlay_id }, params);
310
310
  }
311
311
 
312
312
  /**
@@ -319,9 +319,9 @@ class Events {
319
319
  *
320
320
  * @returns promise
321
321
  */
322
- public static enableOverlay<T>(event_id: string, overlay_id: string): AxiosPromise<Response<T>> {
322
+ public static enableOverlay<T>(event_id: string, overlay_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
323
323
 
324
- return Requests.processRoute(EventsRoutes.routes.enableOverlay, {}, { event_id: event_id, subid: overlay_id });
324
+ return Requests.processRoute(EventsRoutes.routes.enableOverlay, data, { event_id: event_id, subid: overlay_id }, params);
325
325
  }
326
326
 
327
327
  /**
@@ -333,9 +333,9 @@ class Events {
333
333
  *
334
334
  * @returns promise
335
335
  */
336
- public static disableOverlay<T>(event_id: string): AxiosPromise<Response<T>> {
336
+ public static disableOverlay<T>(event_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
337
337
 
338
- return Requests.processRoute(EventsRoutes.routes.disableOverlay, {}, { event_id: event_id });
338
+ return Requests.processRoute(EventsRoutes.routes.disableOverlay, data, { event_id: event_id }, params);
339
339
  }
340
340
 
341
341
  /**
@@ -347,30 +347,30 @@ class Events {
347
347
  *
348
348
  * @returns promise
349
349
  */
350
- public static enableDonations<T>(event_id: string): AxiosPromise<Response<T>> {
350
+ public static enableDonations<T>(event_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
351
351
 
352
- return Requests.processRoute(EventsRoutes.routes.enableDonations, {}, { event_id: event_id });
352
+ return Requests.processRoute(EventsRoutes.routes.enableDonations, data, { event_id: event_id }, params);
353
353
  }
354
354
 
355
355
  /**
356
356
  * Disable the donations and remove from the screen.
357
357
  *
358
358
  * @param event_id
359
- * @returns
359
+ * @returns
360
360
  */
361
- public static disableDonations<T>(event_id: string): AxiosPromise<Response<T>> {
361
+ public static disableDonations<T>(event_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
362
362
 
363
- return Requests.processRoute(EventsRoutes.routes.disableDonations, {}, { event_id: event_id });
363
+ return Requests.processRoute(EventsRoutes.routes.disableDonations, data, { event_id: event_id }, params);
364
364
  }
365
365
 
366
- public static sendInvite<T>(event_id: string, data: object): AxiosPromise<Response<T>> {
366
+ public static sendInvite<T>(event_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
367
367
 
368
- return Requests.processRoute(EventsRoutes.routes.sendInvite, data, { event_id: event_id });
368
+ return Requests.processRoute(EventsRoutes.routes.sendInvite, data, { event_id: event_id }, params);
369
369
  }
370
370
 
371
- public static acceptInvite<T>(event_id: string, token: string): AxiosPromise<Response<T>> {
371
+ public static acceptInvite<T>(event_id: string, token: string , params?: Record<string, any>): AxiosPromise<Response<T>> {
372
372
 
373
- return Requests.processRoute(EventsRoutes.routes.acceptInvite, { token: token }, { event_id: event_id });
373
+ return Requests.processRoute(EventsRoutes.routes.acceptInvite, { token: token }, { event_id: event_id }, params);
374
374
  }
375
375
 
376
376
 
@@ -20,6 +20,7 @@ class CommunitiesRoute {
20
20
  showUser : {url : '/communities/{community_id}/users/{user_id}', method : HTTP_METHODS.GET},
21
21
  updateUser : {url : '/communities/{community_id}/users/{user_id}', method : HTTP_METHODS.PUT},
22
22
  removeUser : {url : '/communities/{community_id}/users/{user_id}', method : HTTP_METHODS.DELETE},
23
+ join : {url : '/communities/{community_id}/join', method : HTTP_METHODS.POST},
23
24
  findByDomain : {url : '/communities/findByDomain/{domain}', method : HTTP_METHODS.GET}
24
25
  };
25
26
 
@@ -46,7 +46,6 @@ class Requests {
46
46
  * @param token
47
47
  */
48
48
  public static setCommunityID(community_id : string | undefined) {
49
- console.log("setting communty_id", community_id);
50
49
  this.community_id = community_id;
51
50
  }
52
51
 
@@ -103,8 +102,7 @@ class Requests {
103
102
  .join('&');
104
103
  url = `${url}?${queryString}`;
105
104
  }
106
-
107
- console.log("Community ID in Request", this.community_id);
105
+
108
106
  if (this.community_id) {
109
107
  // Check if the URL already contains query parameters
110
108
  const separator = url.includes('?') ? '&' : '?';