glitch-javascript-sdk 0.2.6 → 0.2.8

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
@@ -1,87 +1,5 @@
1
1
  import { AxiosPromise } from 'axios';
2
2
 
3
- interface Template {
4
- id?: string;
5
- name?: string;
6
- description?: string;
7
- version?: string;
8
- directory?: string;
9
- entry_point_file?: string;
10
- author_name?: string;
11
- author_website?: string;
12
- author_email?: string;
13
- main_image?: string;
14
- logo?: string;
15
- is_private?: boolean;
16
- }
17
-
18
- interface User {
19
- id?: string;
20
- first_name?: string;
21
- last_name?: string;
22
- username?: string;
23
- display_name?: string;
24
- bio?: string;
25
- avatar?: string;
26
- banner_image?: string;
27
- twitter_page?: string;
28
- facebook_page?: string;
29
- instagram_page?: string;
30
- snapchat_page?: string;
31
- tiktok_page?: string;
32
- twitch_page?: string;
33
- youtube_page?: string;
34
- paetron_page?: string;
35
- twitter_handle?: string;
36
- facebook_handle?: string;
37
- instagram_handle?: string;
38
- snapchat_handle?: string;
39
- tiktok_handle?: string;
40
- twitch_handle?: string;
41
- youtube_handle?: string;
42
- paetron_handle?: string;
43
- created_at?: string;
44
- updated_at?: string;
45
- }
46
-
47
- interface Community {
48
- id?: string;
49
- name?: string;
50
- description?: string;
51
- logo?: string;
52
- banner_image?: string;
53
- video_logo?: string;
54
- subdomain?: string;
55
- cname?: string;
56
- bannner_image?: string;
57
- cname_enabled?: boolean;
58
- require_attendee_rsvp?: boolean;
59
- is_private?: boolean;
60
- disable_streams?: boolean;
61
- disable_competitions?: boolean;
62
- disable_forums?: boolean;
63
- disable_teams?: boolean;
64
- custom_css?: boolean;
65
- twitter_page?: string;
66
- facebook_page?: string;
67
- instagram_page?: string;
68
- snapchat_page?: string;
69
- tiktok_page?: string;
70
- twitch_page?: string;
71
- youtube_page?: string;
72
- paetron_page?: string;
73
- twitter_handle?: string;
74
- facebook_handle?: string;
75
- instagram_handle?: string;
76
- snapchat_handle?: string;
77
- tiktok_handle?: string;
78
- twitch_handle?: string;
79
- youtube_handle?: string;
80
- paetron_handle?: string;
81
- template?: Template;
82
- admins?: User[];
83
- }
84
-
85
3
  /**
86
4
  * Config
87
5
  *
@@ -116,9 +34,9 @@ declare class Config {
116
34
  /**
117
35
  * Set the community to be associated with this config through
118
36
  *
119
- * @param authToken The JWT
37
+ * @param community The object of the community
120
38
  */
121
- static setCommunity(community: Community): void;
39
+ static setCommunity(community: Record<string, any>): void;
122
40
  /**
123
41
  * Gets base url
124
42
  */
@@ -130,7 +48,7 @@ declare class Config {
130
48
  /**
131
49
  * Gets the community currently associated
132
50
  */
133
- static get getCommunity(): Community;
51
+ static get getCommunity(): object;
134
52
  }
135
53
 
136
54
  interface Response<T> {
@@ -1074,7 +992,7 @@ declare class Events {
1074
992
  *
1075
993
  * @returns promise
1076
994
  */
1077
- static removeRTMPSource<T>(event_id: string, stream_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
995
+ static removeRTMPSource<T>(event_id: string, stream_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
1078
996
  /**
1079
997
  * A function that should be run on an interval to set the event as live when the live stream is active.
1080
998
  *
@@ -1084,7 +1002,7 @@ declare class Events {
1084
1002
  *
1085
1003
  * @returns promise
1086
1004
  */
1087
- static syncAsLive<T>(event_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
1005
+ static syncAsLive<T>(event_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
1088
1006
  /**
1089
1007
  * Updates the main image for the event using a File object.
1090
1008
  *
@@ -1139,7 +1057,7 @@ declare class Events {
1139
1057
  *
1140
1058
  * @returns promise
1141
1059
  */
1142
- static enableBroadcastMode<T>(event_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
1060
+ static enableBroadcastMode<T>(event_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
1143
1061
  /**
1144
1062
  * Enable livestream mode, in which the stream will be delivered to the invirtu RTMP endpoint for
1145
1063
  * streaming.
@@ -1148,7 +1066,7 @@ declare class Events {
1148
1066
  *
1149
1067
  * @returns promise
1150
1068
  */
1151
- static enableLivestreamMode<T>(event_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
1069
+ static enableLivestreamMode<T>(event_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
1152
1070
  /**
1153
1071
  * Sends content that will appear on-screen to the user.
1154
1072
  *
@@ -1183,7 +1101,7 @@ declare class Events {
1183
1101
  *
1184
1102
  * @returns promise
1185
1103
  */
1186
- static addOverlayAsBlob<T>(event_id: string, blob: Blob, data?: object): AxiosPromise<Response<T>>;
1104
+ static addOverlayAsBlob<T>(event_id: string, blob: Blob, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
1187
1105
  /**
1188
1106
  * Deletes an overlay image.
1189
1107
  *
@@ -1194,7 +1112,7 @@ declare class Events {
1194
1112
  *
1195
1113
  * @returns promise
1196
1114
  */
1197
- static removeOverlay<T>(event_id: string, overlay_id: string): AxiosPromise<Response<T>>;
1115
+ static removeOverlay<T>(event_id: string, overlay_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
1198
1116
  /**
1199
1117
  * Enables an overlay so that it will appear on screen.
1200
1118
  *
@@ -1205,7 +1123,7 @@ declare class Events {
1205
1123
  *
1206
1124
  * @returns promise
1207
1125
  */
1208
- static enableOverlay<T>(event_id: string, overlay_id: string): AxiosPromise<Response<T>>;
1126
+ static enableOverlay<T>(event_id: string, overlay_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
1209
1127
  /**
1210
1128
  * Disables the overlay so it no longer appears on-screen.
1211
1129
  *
@@ -1215,7 +1133,7 @@ declare class Events {
1215
1133
  *
1216
1134
  * @returns promise
1217
1135
  */
1218
- static disableOverlay<T>(event_id: string): AxiosPromise<Response<T>>;
1136
+ static disableOverlay<T>(event_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
1219
1137
  /**
1220
1138
  * Enable the donations to appear on-screen
1221
1139
  *
@@ -1225,16 +1143,16 @@ declare class Events {
1225
1143
  *
1226
1144
  * @returns promise
1227
1145
  */
1228
- static enableDonations<T>(event_id: string): AxiosPromise<Response<T>>;
1146
+ static enableDonations<T>(event_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
1229
1147
  /**
1230
1148
  * Disable the donations and remove from the screen.
1231
1149
  *
1232
1150
  * @param event_id
1233
1151
  * @returns
1234
1152
  */
1235
- static disableDonations<T>(event_id: string): AxiosPromise<Response<T>>;
1236
- static sendInvite<T>(event_id: string, data: object): AxiosPromise<Response<T>>;
1237
- static acceptInvite<T>(event_id: string, token: string): AxiosPromise<Response<T>>;
1153
+ static disableDonations<T>(event_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
1154
+ static sendInvite<T>(event_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
1155
+ static acceptInvite<T>(event_id: string, token: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
1238
1156
  }
1239
1157
 
1240
1158
  declare class Teams {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
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
 
@@ -64,9 +64,9 @@ class Config {
64
64
  /**
65
65
  * Set the community to be associated with this config through
66
66
  *
67
- * @param authToken The JWT
67
+ * @param community The object of the community
68
68
  */
69
- public static setCommunity(community: Community) {
69
+ public static setCommunity(community: Record<string, any>) {
70
70
  Config._community = community;
71
71
 
72
72
  Requests.setCommunityID(community.id);
@@ -89,7 +89,7 @@ class Config {
89
89
  /**
90
90
  * Gets the community currently associated
91
91
  */
92
- public static get getCommunity(): Community {
92
+ public static get getCommunity(): object {
93
93
  return Config._community;
94
94
  }
95
95
  }
@@ -102,7 +102,7 @@ class Requests {
102
102
  .join('&');
103
103
  url = `${url}?${queryString}`;
104
104
  }
105
-
105
+
106
106
  if (this.community_id) {
107
107
  // Check if the URL already contains query parameters
108
108
  const separator = url.includes('?') ? '&' : '?';