glitch-javascript-sdk 0.3.4 → 0.3.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/dist/index.d.ts CHANGED
@@ -1163,6 +1163,18 @@ declare class Events {
1163
1163
  static disableDonations<T>(event_id: string, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
1164
1164
  static sendInvite<T>(event_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
1165
1165
  static acceptInvite<T>(event_id: string, token: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
1166
+ /**
1167
+ * Update a recording related to an event.
1168
+ *
1169
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/updateEventRecording
1170
+ *
1171
+ * @param event_id The id of the event to update.
1172
+ * @param recording_id The id of the recording to update.
1173
+ * @param data The data to update.
1174
+ *
1175
+ * @returns promise
1176
+ */
1177
+ static updateRecording<T>(event_id: string, recording_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
1166
1178
  }
1167
1179
 
1168
1180
  declare class Teams {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
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
@@ -1,4 +1,5 @@
1
1
  import EventsRoutes from "../routes/EventsRoute";
2
+ import RecordingsRoute from "../routes/RecordingRoute";
2
3
  import Requests from "../util/Requests";
3
4
  import Response from "../util/Response";
4
5
  import { AxiosPromise } from "axios";
@@ -373,6 +374,22 @@ class Events {
373
374
  return Requests.processRoute(EventsRoutes.routes.acceptInvite, { token: token }, { event_id: event_id }, params);
374
375
  }
375
376
 
377
+ /**
378
+ * Update a recording related to an event.
379
+ *
380
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/updateEventRecording
381
+ *
382
+ * @param event_id The id of the event to update.
383
+ * @param recording_id The id of the recording to update.
384
+ * @param data The data to update.
385
+ *
386
+ * @returns promise
387
+ */
388
+ public static updateRecording<T>(event_id: string, recording_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
389
+
390
+ return Requests.processRoute(RecordingsRoute.routes.update, data, { event_id: event_id, recording_id : recording_id }, params);
391
+ }
392
+
376
393
 
377
394
  }
378
395
 
@@ -4,11 +4,7 @@ import HTTP_METHODS from "../constants/HttpMethods";
4
4
  class RecordingsRoute {
5
5
 
6
6
  public static routes: { [key: string]: Route } = {
7
- login: { url: '/auth/login', method: HTTP_METHODS.POST },
8
- register: { url: '/auth/register', method: HTTP_METHODS.POST },
9
- one_time_login : { url: '/auth/oneTimeLoginWithToken', method: HTTP_METHODS.POST },
10
- forgot_password :{ url: '/auth/forgotpassword', method: HTTP_METHODS.POST },
11
- reset_password : { url: '/auth/resetpassword', method: HTTP_METHODS.POST },
7
+ update: { url: '/events/{event_id}/recording/{recording_id}', method: HTTP_METHODS.PUT },
12
8
  };
13
9
 
14
10
  }
@@ -197,6 +197,14 @@ class Requests {
197
197
 
198
198
  formData.append(filename, file);
199
199
 
200
+ if (this.community_id) {
201
+ // Add the community_id to the request body
202
+ data = {
203
+ ...data,
204
+ communities: [ this.community_id ]
205
+ };
206
+ }
207
+
200
208
  for (let key in data) {
201
209
  formData.append(key, data[key]);
202
210
  }
@@ -223,6 +231,15 @@ class Requests {
223
231
 
224
232
  formData.append(filename, blob);
225
233
 
234
+ if (this.community_id) {
235
+ // Add the community_id to the request body
236
+ data = {
237
+ ...data,
238
+ communities: [ this.community_id ]
239
+ };
240
+ }
241
+
242
+
226
243
  for (let key in data) {
227
244
  formData.append(key, data[key]);
228
245
  }