glitch-javascript-sdk 0.0.3 → 0.0.4

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.
@@ -0,0 +1,7 @@
1
+ import Route from "./interface";
2
+ declare class TeamsRoute {
3
+ static routes: {
4
+ [key: string]: Route;
5
+ };
6
+ }
7
+ export default TeamsRoute;
@@ -36,6 +36,8 @@ declare class Requests {
36
36
  static post<T>(url: string, data: any): AxiosPromise<Response<T>>;
37
37
  static put<T>(url: string, data: any): AxiosPromise<Response<T>>;
38
38
  static delete<T>(url: string): AxiosPromise<Response<T>>;
39
+ static uploadFile<T>(url: string, filename: string, file: File, data?: any): AxiosPromise<Response<T>>;
40
+ static uploadBlob<T>(url: string, filename: string, blob: Blob, data?: any): AxiosPromise<Response<T>>;
39
41
  /**
40
42
  * The Route class contains the method and url, thereforce items can be
41
43
  * automatically routed depending on the configuration.
package/dist/index.d.ts CHANGED
@@ -164,6 +164,59 @@ declare class Users {
164
164
  * @returns promise
165
165
  */
166
166
  static oneTimeLoginToken<T>(): AxiosPromise<Response<T>>;
167
+ /**
168
+ * Updates the avatar image for the user using a File object.
169
+ *
170
+ * @see https://api.glitch.fun/api/documentation#/Users%20Route/userUploadAvatarImage
171
+ *
172
+ * @param file The file object to upload.
173
+ * @param data Any additional data to pass along to the upload.
174
+ *
175
+ * @returns promise
176
+ */
177
+ static uploadAvatarImageFile<T>(file: File, data?: object): AxiosPromise<Response<T>>;
178
+ /**
179
+ * Updates the avatar image for the user using a Blob.
180
+ *
181
+ * @see https://api.glitch.fun/api/documentation#/Users%20Route/userUploadAvatarImage
182
+ *
183
+ * @param blob The blob to upload.
184
+ * @param data Any additional data to pass along to the upload
185
+ *
186
+ * @returns promise
187
+ */
188
+ static uploadAvatarImageBlob<T>(blob: Blob, data?: object): AxiosPromise<Response<T>>;
189
+ /**
190
+ * Upload a banner image for the user, as a File object.
191
+ *
192
+ * @see https://api.glitch.fun/api/documentation#/Users%20Route/userUploadBannerImage
193
+ *
194
+ * @param file The file object to upload.
195
+ * @param data Any additional data to pass along to the upload.
196
+ *
197
+ * @returns promise
198
+ */
199
+ static uploadBannerImageFile<T>(file: File, data?: object): AxiosPromise<Response<T>>;
200
+ /**
201
+ * Upload a banner image for the user, as a Blob.
202
+ *
203
+ * @see https://api.glitch.fun/api/documentation#/Users%20Route/userUploadBannerImage
204
+ *
205
+ * @param file The blob to upload.
206
+ * @param data Any additional data to pass along to the upload.
207
+ *
208
+ * @returns promise
209
+ */
210
+ static uploadBannerImageBlob<T>(blob: Blob, data?: object): AxiosPromise<Response<T>>;
211
+ /**
212
+ * Creates a donation page for that user by syncing their information with various
213
+ * payment service.
214
+ *
215
+ * @see https://api.glitch.fun/api/documentation#/Users%20Route/userCreateDonationPage
216
+ *
217
+ * @returns promise
218
+ */
219
+ static createDonationPage<T>(): AxiosPromise<Response<T>>;
167
220
  }
168
221
 
169
222
  declare class Events {
@@ -215,6 +268,388 @@ declare class Events {
215
268
  * @returns promise
216
269
  */
217
270
  static delete<T>(event_id: string): AxiosPromise<Response<T>>;
271
+ /**
272
+ * The event is synced with Invirtu for the lie streams. This will allow you to update
273
+ *
274
+ *
275
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/updateEventStorage
276
+ *
277
+ * @param event_id The id of the event to update.
278
+ * @param data The data to update.
279
+ *
280
+ * @returns promise
281
+ */
282
+ static updateInvirtuEvent<T>(event_id: string, data: object): AxiosPromise<Response<T>>;
283
+ /**
284
+ * Add an RTMP source to multicast a stream too.
285
+ *
286
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/addRTMPSource
287
+ *
288
+ * @param event_id The id of the event.
289
+ * @param data The data to be passed when adding an RTMP source.
290
+ *
291
+ * @returns promise
292
+ */
293
+ static addRTMPSource<T>(event_id: string, data?: object): AxiosPromise<Response<T>>;
294
+ /**
295
+ * Update an RTMP Source for multicasing.
296
+ *
297
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/addRTMPSource
298
+ *
299
+ * @param event_id The id of the event.
300
+ * @param data The data to be passed when adding an RTMP source.
301
+ *
302
+ * @returns promise
303
+ */
304
+ static updateRTMPSource<T>(event_id: string, stream_id: string, data?: object): AxiosPromise<Response<T>>;
305
+ /**
306
+ * Remove a RTMP source for multicasing.
307
+ *
308
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/addRTMPSource
309
+ *
310
+ * @param event_id The id of the event.
311
+ * @param data The data to be passed when adding an RTMP source.
312
+ *
313
+ * @returns promise
314
+ */
315
+ static removeRTMPSource<T>(event_id: string, stream_id: string): AxiosPromise<Response<T>>;
316
+ /**
317
+ * A function that should be run on an interval to set the event as live when the live stream is active.
318
+ *
319
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/syncLive
320
+ *
321
+ * @param event_id The id of the event.
322
+ *
323
+ * @returns promise
324
+ */
325
+ static syncAsLive<T>(event_id: string): AxiosPromise<Response<T>>;
326
+ /**
327
+ * Updates the main image for the event using a File object.
328
+ *
329
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/uploadMainEventImage
330
+ *
331
+ * @param file The file object to upload.
332
+ * @param data Any additional data to pass along to the upload.
333
+ *
334
+ * @returns promise
335
+ */
336
+ static uploadMainImageFile<T>(event_id: string, file: File, data?: object): AxiosPromise<Response<T>>;
337
+ /**
338
+ * Updates the main image for the event using a Blob.
339
+ *
340
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/uploadMainEventImage
341
+ *
342
+ * @param blob The blob to upload.
343
+ * @param data Any additional data to pass along to the upload
344
+ *
345
+ * @returns promise
346
+ */
347
+ static uploadMainImageBlob<T>(event_id: string, blob: Blob, data?: object): AxiosPromise<Response<T>>;
348
+ /**
349
+ * Updates the banner image for the team using a File object.
350
+ *
351
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/uploadBannerEventImage
352
+ *
353
+ * @param file The file object to upload.
354
+ * @param data Any additional data to pass along to the upload.
355
+ *
356
+ * @returns promise
357
+ */
358
+ static uploadBannerImageFile<T>(event_id: string, file: File, data?: object): AxiosPromise<Response<T>>;
359
+ /**
360
+ * Updates the banner image for the team using a Blob.
361
+ *
362
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/uploadBannerEventImage
363
+ *
364
+ * @param blob The blob to upload.
365
+ * @param data Any additional data to pass along to the upload
366
+ *
367
+ * @returns promise
368
+ */
369
+ static uploadBannerImageBlob<T>(event_id: string, blob: Blob, data?: object): AxiosPromise<Response<T>>;
370
+ /**
371
+ * Enable Broadcast Mode. Broadcast mode is when the live stream is broadcasted from the game play through a protocol
372
+ * such as screen sharing.
373
+ *
374
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/enableBroadcastMode
375
+ *
376
+ * @param event_id The id of the event.
377
+ *
378
+ * @returns promise
379
+ */
380
+ static enableBroadcastMode<T>(event_id: string): AxiosPromise<Response<T>>;
381
+ /**
382
+ * Enable livestream mode, in which the stream will be delivered to the invirtu RTMP endpoint for
383
+ * streaming.
384
+ *
385
+ * @param event_id The id of the event.
386
+ *
387
+ * @returns promise
388
+ */
389
+ static enableLivestreamMode<T>(event_id: string): AxiosPromise<Response<T>>;
390
+ /**
391
+ * Sends content that will appear on-screen to the user.
392
+ *
393
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/sendOnScreenContent
394
+ *
395
+ * @param event_id The id of the event.
396
+ * @param data The information to send on-screen.
397
+ *
398
+ * @returns promise
399
+ */
400
+ static sendOnScreenContent<T>(event_id: string, data: object): AxiosPromise<Response<T>>;
401
+ /**
402
+ * Uploads an image that can be used and overlay later. A File object is used.
403
+ *
404
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/uploadOverlayImage
405
+ *
406
+ * @param event_id The id of the event.
407
+ * @param file The image as a file.
408
+ * @param data Any additional data to be sent in the request.
409
+ *
410
+ * @returns promise
411
+ */
412
+ static addOverlayAsFile<T>(event_id: string, file: File, data?: object): AxiosPromise<Response<T>>;
413
+ /**
414
+ * Uploads an image that can be used and overlay later. A blob is used.
415
+ *
416
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/uploadOverlayImage
417
+ *
418
+ * @param event_id The id of the event.
419
+ * @param blob Image data as a blob
420
+ * @param data Any additional data to be sent in the request.
421
+ *
422
+ * @returns promise
423
+ */
424
+ static addOverlayAsBlob<T>(event_id: string, blob: Blob, data?: object): AxiosPromise<Response<T>>;
425
+ /**
426
+ * Deletes an overlay image.
427
+ *
428
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/destoryOverlayStorage
429
+ *
430
+ * @param event_id The id of the event.
431
+ * @param overlay_id The id of the overlay.
432
+ *
433
+ * @returns promise
434
+ */
435
+ static removeOverlay<T>(event_id: string, overlay_id: string): AxiosPromise<Response<T>>;
436
+ /**
437
+ * Enables an overlay so that it will appear on screen.
438
+ *
439
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/enableOverlayImage
440
+ *
441
+ * @param event_id The id of the event.
442
+ * @param overlay_id The id of the overlay.
443
+ *
444
+ * @returns promise
445
+ */
446
+ static enableOverlay<T>(event_id: string, overlay_id: string): AxiosPromise<Response<T>>;
447
+ /**
448
+ * Disables the overlay so it no longer appears on-screen.
449
+ *
450
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/disableOverlay
451
+ *
452
+ * @param event_id The id of the event.
453
+ *
454
+ * @returns promise
455
+ */
456
+ static disableOverlay<T>(event_id: string): AxiosPromise<Response<T>>;
457
+ /**
458
+ * Enable the donations to appear on-screen
459
+ *
460
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/enableDonations
461
+ *
462
+ * @param event_id The id of the event.
463
+ *
464
+ * @returns promise
465
+ */
466
+ static enableDonations<T>(event_id: string): AxiosPromise<Response<T>>;
467
+ /**
468
+ * Disable the donations and remove from the screen.
469
+ *
470
+ * @param event_id
471
+ * @returns
472
+ */
473
+ static disableDonations<T>(event_id: string): AxiosPromise<Response<T>>;
474
+ static sendInvite<T>(event_id: string, data: object): AxiosPromise<Response<T>>;
475
+ static acceptInvite<T>(event_id: string, token: string): AxiosPromise<Response<T>>;
476
+ }
477
+
478
+ declare class Teams {
479
+ /**
480
+ * List all the teams
481
+ *
482
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamsList
483
+ *
484
+ * @returns promise
485
+ */
486
+ static list<T>(): AxiosPromise<Response<T>>;
487
+ /**
488
+ * Create a new team.
489
+ *
490
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamCreate
491
+ *
492
+ * @param data The data to be passed when creating a team.
493
+ *
494
+ * @returns Promise
495
+ */
496
+ static create<T>(data: object): AxiosPromise<Response<T>>;
497
+ /**
498
+ * Update a team.
499
+ *
500
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamUpdate
501
+ *
502
+ * @param team_id The id of the team to update.
503
+ * @param data The data to update.
504
+ *
505
+ * @returns promise
506
+ */
507
+ static update<T>(team_id: string, data: object): AxiosPromise<Response<T>>;
508
+ /**
509
+ * Retrieve the information for a single team.
510
+ *
511
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamShow
512
+ *
513
+ * @param team_id The id fo the team to retrieve.
514
+ *
515
+ * @returns promise
516
+ */
517
+ static view<T>(team_id: string): AxiosPromise<Response<T>>;
518
+ /**
519
+ * Deletes a team.
520
+ *
521
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamDelete
522
+ *
523
+ * @param team_id The id of the team to delete.
524
+ * @returns promise
525
+ */
526
+ static delete<T>(team_id: string): AxiosPromise<Response<T>>;
527
+ /**
528
+ * Updates the main image for the team using a File object.
529
+ *
530
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamUploadMainImage
531
+ *
532
+ * @param file The file object to upload.
533
+ * @param data Any additional data to pass along to the upload.
534
+ *
535
+ * @returns promise
536
+ */
537
+ static uploadMainImageFile<T>(team_id: string, file: File, data?: object): AxiosPromise<Response<T>>;
538
+ /**
539
+ * Updates the main image for the team using a Blob.
540
+ *
541
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamUploadMainImage
542
+ *
543
+ * @param blob The blob to upload.
544
+ * @param data Any additional data to pass along to the upload
545
+ *
546
+ * @returns promise
547
+ */
548
+ static uploadMainImageBlob<T>(team_id: string, blob: Blob, data?: object): AxiosPromise<Response<T>>;
549
+ /**
550
+ * Updates the banner image for the team using a File object.
551
+ *
552
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamUploadMainImage
553
+ *
554
+ * @param file The file object to upload.
555
+ * @param data Any additional data to pass along to the upload.
556
+ *
557
+ * @returns promise
558
+ */
559
+ static uploadBannerImageFile<T>(team_id: string, file: File, data?: object): AxiosPromise<Response<T>>;
560
+ /**
561
+ * Updates the banner image for the team using a Blob.
562
+ *
563
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamUploadMainImage
564
+ *
565
+ * @param blob The blob to upload.
566
+ * @param data Any additional data to pass along to the upload
567
+ *
568
+ * @returns promise
569
+ */
570
+ static uploadBannerImageBlob<T>(team_id: string, blob: Blob, data?: object): AxiosPromise<Response<T>>;
571
+ /**
572
+ * List the invites that have been sent for the team to users.
573
+ *
574
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamsUserInviteList
575
+ *
576
+ * @param team_id The id of the team
577
+ *
578
+ * @returns promise
579
+ */
580
+ static listInvites<T>(team_id: string): AxiosPromise<Response<T>>;
581
+ /**
582
+ * Send an invitation to a user to join the team.
583
+ *
584
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamSendInvite
585
+ *
586
+ * @param team_id The id of the team.
587
+ * @param data The data that will be passed into sending an invite.
588
+ *
589
+ * @returns promise
590
+ */
591
+ static sendInvite<T>(team_id: string, data?: object): AxiosPromise<Response<T>>;
592
+ /**
593
+ * Accept an invite to a team. The JSON Web Token (JWT) must be related to the token.
594
+ *
595
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamAcceptInvite
596
+ *
597
+ * @param team_id The id of the team
598
+ * @param token The token required to accept the user.
599
+ *
600
+ * @returns promise
601
+ */
602
+ static acceptInvite<T>(team_id: string, token: string): AxiosPromise<Response<T>>;
603
+ /**
604
+ * List the users who are currently associated with the team.
605
+ *
606
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamUserList
607
+ *
608
+ * @param team_id The id of the team.
609
+ *
610
+ * @returns promise
611
+ */
612
+ static listUsers<T>(team_id: string): AxiosPromise<Response<T>>;
613
+ /**
614
+ * Add a user to a team.
615
+ *
616
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/createTeamUser
617
+ *
618
+ * @param team_id The id of the team.
619
+ * @param data The data to be passed when adding a user.
620
+ *
621
+ * @returns promise
622
+ */
623
+ static addUser<T>(team_id: string, data?: object): AxiosPromise<Response<T>>;
624
+ /**
625
+ * Retrieves a single user and their information that is associated with a team.
626
+ *
627
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/showTeamUser
628
+ *
629
+ * @param team_id The id of the team.
630
+ * @param user_id The id of the user.
631
+ *
632
+ * @returns promise
633
+ */
634
+ static getUser<T>(team_id: string, user_id: string): AxiosPromise<Response<T>>;
635
+ /**
636
+ * Updates the users information associated with the team.
637
+ *
638
+ * @param team_id The id of the team.
639
+ * @param user_id The id of the user.
640
+ *
641
+ * @returns promise
642
+ */
643
+ static updatetUser<T>(team_id: string, user_id: string, data?: object): AxiosPromise<Response<T>>;
644
+ /**
645
+ * Removes a user from a team.
646
+ *
647
+ * @param team_id The id of team.
648
+ * @param user_id The id of the user.
649
+ *
650
+ * @returns promise
651
+ */
652
+ static removetUser<T>(team_id: string, user_id: string): AxiosPromise<Response<T>>;
218
653
  }
219
654
 
220
655
  declare class Glitch {
@@ -224,6 +659,7 @@ declare class Glitch {
224
659
  Competitions: typeof Competitions;
225
660
  Users: typeof Users;
226
661
  Events: typeof Events;
662
+ Teams: typeof Teams;
227
663
  };
228
664
  }
229
665
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "Javascrip SDK for GLitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",