glitch-javascript-sdk 0.2.1 → 0.2.3

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/cjs/index.js CHANGED
@@ -15624,6 +15624,8 @@ var Requests = /** @class */ (function () {
15624
15624
  if (fileData) {
15625
15625
  headers['Content-Type'] = 'multipart/form-data';
15626
15626
  }
15627
+ //Remove double slashes
15628
+ url = url.replace(/\/\//g, '/');
15627
15629
  var uri = "".concat(this.baseUrl).concat(url);
15628
15630
  var axiosPromise = axios({
15629
15631
  method: method,
@@ -16475,6 +16477,276 @@ var Competitions = /** @class */ (function () {
16475
16477
  return Competitions;
16476
16478
  }());
16477
16479
 
16480
+ var CommunitiesRoute = /** @class */ (function () {
16481
+ function CommunitiesRoute() {
16482
+ }
16483
+ CommunitiesRoute.routes = {
16484
+ list: { url: '/communities', method: HTTP_METHODS.GET },
16485
+ create: { url: '/communities', method: HTTP_METHODS.POST },
16486
+ view: { url: '/communities/{community_id}', method: HTTP_METHODS.GET },
16487
+ update: { url: '/communities/{community_id}', method: HTTP_METHODS.PUT },
16488
+ delete: { url: '/communities/{community_id}', method: HTTP_METHODS.DELETE },
16489
+ uploadLogo: { url: '/communities/{community_id}/uploadLogo', method: HTTP_METHODS.POST },
16490
+ uploadBannerImage: { url: '/communities/{community_id}/uploadBannerImage', method: HTTP_METHODS.POST },
16491
+ uploadVideoLogo: { url: '/communities/{community_id}/uploadVideoLogo', method: HTTP_METHODS.POST },
16492
+ listInvites: { url: '/communities/{community_id}/invites', method: HTTP_METHODS.GET },
16493
+ sendInvite: { url: '/communities/{community_id}/sendInvite', method: HTTP_METHODS.POST },
16494
+ acceptInvite: { url: '/communities/{community_id}/acceptInvite', method: HTTP_METHODS.POST },
16495
+ listUsers: { url: '/communities/{community_id}/users', method: HTTP_METHODS.GET },
16496
+ addUser: { url: '/communities/{community_id}/users', method: HTTP_METHODS.POST },
16497
+ showUser: { url: '/communities/{community_id}/users/{user_id}', method: HTTP_METHODS.GET },
16498
+ updateUser: { url: '/communities/{community_id}/users/{user_id}', method: HTTP_METHODS.PUT },
16499
+ removeUser: { url: '/communities/{community_id}/users/{user_id}', method: HTTP_METHODS.DELETE }
16500
+ };
16501
+ return CommunitiesRoute;
16502
+ }());
16503
+
16504
+ var Communities = /** @class */ (function () {
16505
+ function Communities() {
16506
+ }
16507
+ /**
16508
+ * List all the communities.
16509
+ *
16510
+ * @see https://api.glitch.fun/api/documentation#/Community%20Route/resourceCommunityList
16511
+ *
16512
+ * @returns promise
16513
+ */
16514
+ Communities.list = function () {
16515
+ return Requests.processRoute(CommunitiesRoute.routes.list);
16516
+ };
16517
+ /**
16518
+ * Create a new community.
16519
+ *
16520
+ * @see https://api.glitch.fun/api/documentation#/Community%20Route/newCommunityResourceStorage
16521
+ *
16522
+ * @param data The data to be passed when creating a community.
16523
+ *
16524
+ * @returns Promise
16525
+ */
16526
+ Communities.create = function (data) {
16527
+ return Requests.processRoute(CommunitiesRoute.routes.create, data);
16528
+ };
16529
+ /**
16530
+ * Update a community.
16531
+ *
16532
+ * @see https://api.glitch.fun/api/documentation#/Community%20Route/updateCommunityStorage
16533
+ *
16534
+ * @param community_id The id of the community to update.
16535
+ * @param data The data to update.
16536
+ *
16537
+ * @returns promise
16538
+ */
16539
+ Communities.update = function (community_id, data) {
16540
+ return Requests.processRoute(CommunitiesRoute.routes.create, data, { community_id: community_id });
16541
+ };
16542
+ /**
16543
+ * Retrieve the information for a single community.
16544
+ *
16545
+ * @see https://api.glitch.fun/api/documentation#/Community%20Route/showCommunityStorage
16546
+ *
16547
+ * @param community_id The id fo the community to retrieve.
16548
+ *
16549
+ * @returns promise
16550
+ */
16551
+ Communities.view = function (community_id) {
16552
+ return Requests.processRoute(CommunitiesRoute.routes.view, {}, { community_id: community_id });
16553
+ };
16554
+ /**
16555
+ * Deletes a community.
16556
+ *
16557
+ * @see https://api.glitch.fun/api/documentation#/Community%20Route/destoryCommunityStorage
16558
+ *
16559
+ * @param community_id The id of the community to delete.
16560
+ * @returns promise
16561
+ */
16562
+ Communities.delete = function (community_id) {
16563
+ return Requests.processRoute(CommunitiesRoute.routes.delete, {}, { community_id: community_id });
16564
+ };
16565
+ /**
16566
+ * Updates the main image for the community using a File object.
16567
+ *
16568
+ * @see https://api.glitch.fun/api/documentation#/Community%20Route/uploadLogoCommunityImage
16569
+ *
16570
+ * @param file The file object to upload.
16571
+ * @param data Any additional data to pass along to the upload.
16572
+ *
16573
+ * @returns promise
16574
+ */
16575
+ Communities.uploadLogoFile = function (community_id, file, data) {
16576
+ var url = CommunitiesRoute.routes.uploadLogo.url.replace('{community_id}', community_id);
16577
+ return Requests.uploadFile(url, 'image', file, data);
16578
+ };
16579
+ /**
16580
+ * Updates the main image for the community using a Blob.
16581
+ *
16582
+ * @see https://api.glitch.fun/api/documentation#/Community%20Route/uploadLogoCommunityImage
16583
+ *
16584
+ * @param blob The blob to upload.
16585
+ * @param data Any additional data to pass along to the upload
16586
+ *
16587
+ * @returns promise
16588
+ */
16589
+ Communities.uploadLogoBlob = function (community_id, blob, data) {
16590
+ var url = CommunitiesRoute.routes.uploadLogo.url.replace('{community_id}', community_id);
16591
+ return Requests.uploadBlob(url, 'image', blob, data);
16592
+ };
16593
+ /**
16594
+ * Updates the banner image for the community using a File object.
16595
+ *
16596
+ * @see https://api.glitch.fun/api/documentation#/Community%20Route/uploadBannerCommunityImage
16597
+ *
16598
+ * @param file The file object to upload.
16599
+ * @param data Any additional data to pass along to the upload.
16600
+ *
16601
+ * @returns promise
16602
+ */
16603
+ Communities.uploadBannerImageFile = function (community_id, file, data) {
16604
+ var url = CommunitiesRoute.routes.uploadBannerImage.url.replace('{community_id}', community_id);
16605
+ return Requests.uploadFile(url, 'image', file, data);
16606
+ };
16607
+ /**
16608
+ * Updates the banner image for the community using a Blob.
16609
+ *
16610
+ * @see https://api.glitch.fun/api/documentation#/Community%20Route/uploadBannerCommunityImage
16611
+ *
16612
+ * @param blob The blob to upload.
16613
+ * @param data Any additional data to pass along to the upload
16614
+ *
16615
+ * @returns promise
16616
+ */
16617
+ Communities.uploadBannerImageBlob = function (community_id, blob, data) {
16618
+ var url = CommunitiesRoute.routes.uploadBannerImage.url.replace('{community_id}', community_id);
16619
+ return Requests.uploadBlob(url, 'image', blob, data);
16620
+ };
16621
+ /**
16622
+ * Updates the banner image for the community using a File object.
16623
+ *
16624
+ * @see https://api.glitch.fun/api/documentation#/Community%20Route/uploadBannerCommunityImage
16625
+ *
16626
+ * @param file The file object to upload.
16627
+ * @param data Any additional data to pass along to the upload.
16628
+ *
16629
+ * @returns promise
16630
+ */
16631
+ Communities.uploadVideoLogoFile = function (community_id, file, data) {
16632
+ var url = CommunitiesRoute.routes.uploadVideoLogo.url.replace('{community_id}', community_id);
16633
+ return Requests.uploadFile(url, 'image', file, data);
16634
+ };
16635
+ /**
16636
+ * Updates the banner image for the community using a Blob.
16637
+ *
16638
+ * @see https://api.glitch.fun/api/documentation#/Community%20Route/uploadBannerCommunityImage
16639
+ *
16640
+ * @param blob The blob to upload.
16641
+ * @param data Any additional data to pass along to the upload
16642
+ *
16643
+ * @returns promise
16644
+ */
16645
+ Communities.uploadVideoLogoBlob = function (community_id, blob, data) {
16646
+ var url = CommunitiesRoute.routes.uploadVideoLogo.url.replace('{community_id}', community_id);
16647
+ return Requests.uploadBlob(url, 'image', blob, data);
16648
+ };
16649
+ /**
16650
+ * List the invites that have been sent for the community to users.
16651
+ *
16652
+ * @see https://api.glitch.fun/api/documentation#/communitys%20Route/communitysUserInviteList
16653
+ *
16654
+ * @param community_id The id of the community
16655
+ *
16656
+ * @returns promise
16657
+ */
16658
+ Communities.listInvites = function (community_id) {
16659
+ return Requests.processRoute(CommunitiesRoute.routes.listInvites, {}, { community_id: community_id });
16660
+ };
16661
+ /**
16662
+ * Send an invitation to a user to join the community.
16663
+ *
16664
+ * @see https://api.glitch.fun/api/documentation#/communitys%20Route/communitySendInvite
16665
+ *
16666
+ * @param community_id The id of the community.
16667
+ * @param data The data that will be passed into sending an invite.
16668
+ *
16669
+ * @returns promise
16670
+ */
16671
+ Communities.sendInvite = function (community_id, data) {
16672
+ return Requests.processRoute(CommunitiesRoute.routes.sendInvite, data, { community_id: community_id });
16673
+ };
16674
+ /**
16675
+ * Accept an invite to a community. The JSON Web Token (JWT) must be related to the token.
16676
+ *
16677
+ * @see https://api.glitch.fun/api/documentation#/communitys%20Route/communityAcceptInvite
16678
+ *
16679
+ * @param community_id The id of the community
16680
+ * @param token The token required to accept the user.
16681
+ *
16682
+ * @returns promise
16683
+ */
16684
+ Communities.acceptInvite = function (community_id, token) {
16685
+ return Requests.processRoute(CommunitiesRoute.routes.acceptInvite, {}, { community_id: community_id });
16686
+ };
16687
+ /**
16688
+ * List the users who are currently associated with the community.
16689
+ *
16690
+ * @see https://api.glitch.fun/api/documentation#/communitys%20Route/communityUserList
16691
+ *
16692
+ * @param community_id The id of the community.
16693
+ *
16694
+ * @returns promise
16695
+ */
16696
+ Communities.listUsers = function (community_id) {
16697
+ return Requests.processRoute(CommunitiesRoute.routes.listUsers, {}, { community_id: community_id });
16698
+ };
16699
+ /**
16700
+ * Add a user to a community.
16701
+ *
16702
+ * @see https://api.glitch.fun/api/documentation#/communitys%20Route/createcommunityUser
16703
+ *
16704
+ * @param community_id The id of the community.
16705
+ * @param data The data to be passed when adding a user.
16706
+ *
16707
+ * @returns promise
16708
+ */
16709
+ Communities.addUser = function (community_id, data) {
16710
+ return Requests.processRoute(CommunitiesRoute.routes.addUser, data, { community_id: community_id });
16711
+ };
16712
+ /**
16713
+ * Retrieves a single user and their information that is associated with a community.
16714
+ *
16715
+ * @see https://api.glitch.fun/api/documentation#/communitys%20Route/showcommunityUser
16716
+ *
16717
+ * @param community_id The id of the community.
16718
+ * @param user_id The id of the user.
16719
+ *
16720
+ * @returns promise
16721
+ */
16722
+ Communities.getUser = function (community_id, user_id) {
16723
+ return Requests.processRoute(CommunitiesRoute.routes.showUser, {}, { community_id: community_id, user_id: user_id });
16724
+ };
16725
+ /**
16726
+ * Updates the users information associated with the community.
16727
+ *
16728
+ * @param community_id The id of the community.
16729
+ * @param user_id The id of the user.
16730
+ *
16731
+ * @returns promise
16732
+ */
16733
+ Communities.updatetUser = function (community_id, user_id, data) {
16734
+ return Requests.processRoute(CommunitiesRoute.routes.updateUser, data, { community_id: community_id, user_id: user_id });
16735
+ };
16736
+ /**
16737
+ * Removes a user from a community.
16738
+ *
16739
+ * @param community_id The id of community.
16740
+ * @param user_id The id of the user.
16741
+ *
16742
+ * @returns promise
16743
+ */
16744
+ Communities.removetUser = function (community_id, user_id) {
16745
+ return Requests.processRoute(CommunitiesRoute.routes.removeUser, {}, { community_id: community_id, user_id: user_id });
16746
+ };
16747
+ return Communities;
16748
+ }());
16749
+
16478
16750
  var UserRoutes = /** @class */ (function () {
16479
16751
  function UserRoutes() {
16480
16752
  }
@@ -17296,6 +17568,141 @@ var Waitlists = /** @class */ (function () {
17296
17568
  return Waitlists;
17297
17569
  }());
17298
17570
 
17571
+ var TemplatesRoute = /** @class */ (function () {
17572
+ function TemplatesRoute() {
17573
+ }
17574
+ TemplatesRoute.routes = {
17575
+ list: { url: '/templates', method: HTTP_METHODS.GET },
17576
+ create: { url: '/templates', method: HTTP_METHODS.POST },
17577
+ view: { url: '/templates/{template_id}', method: HTTP_METHODS.GET },
17578
+ update: { url: '/templates/{template_id}', method: HTTP_METHODS.PUT },
17579
+ delete: { url: '/templates/{template_id}', method: HTTP_METHODS.DELETE },
17580
+ uploadLogo: { url: '/templates/{template_id}/uploadLogo', method: HTTP_METHODS.POST },
17581
+ uploadMainImage: { url: '/templates/{template_id}/uploadMainImage', method: HTTP_METHODS.POST },
17582
+ };
17583
+ return TemplatesRoute;
17584
+ }());
17585
+
17586
+ var Templates = /** @class */ (function () {
17587
+ function Templates() {
17588
+ }
17589
+ /**
17590
+ * List all the templates.
17591
+ *
17592
+ * @see https://api.glitch.fun/api/documentation#/Template%20Route/resourceTemplateList
17593
+ *
17594
+ * @returns promise
17595
+ */
17596
+ Templates.list = function () {
17597
+ return Requests.processRoute(TemplatesRoute.routes.list);
17598
+ };
17599
+ /**
17600
+ * Create a new template.
17601
+ *
17602
+ * @see https://api.glitch.fun/api/documentation#/Template%20Route/newTemplateResourceStorage
17603
+ *
17604
+ * @param data The data to be passed when creating a template.
17605
+ *
17606
+ * @returns Promise
17607
+ */
17608
+ Templates.create = function (data) {
17609
+ return Requests.processRoute(TemplatesRoute.routes.create, data);
17610
+ };
17611
+ /**
17612
+ * Update a template.
17613
+ *
17614
+ * @see https://api.glitch.fun/api/documentation#/Template%20Route/updateTemplateStorage
17615
+ *
17616
+ * @param template_id The id of the template to update.
17617
+ * @param data The data to update.
17618
+ *
17619
+ * @returns promise
17620
+ */
17621
+ Templates.update = function (template_id, data) {
17622
+ return Requests.processRoute(TemplatesRoute.routes.create, data, { template_id: template_id });
17623
+ };
17624
+ /**
17625
+ * Retrieve the information for a single template.
17626
+ *
17627
+ * @see https://api.glitch.fun/api/documentation#/Template%20Route/showTemplateStorage
17628
+ *
17629
+ * @param template_id The id fo the template to retrieve.
17630
+ *
17631
+ * @returns promise
17632
+ */
17633
+ Templates.view = function (template_id) {
17634
+ return Requests.processRoute(TemplatesRoute.routes.view, {}, { template_id: template_id });
17635
+ };
17636
+ /**
17637
+ * Deletes a template.
17638
+ *
17639
+ * @see https://api.glitch.fun/api/documentation#/Template%20Route/destoryTemplateStorage
17640
+ *
17641
+ * @param template_id The id of the template to delete.
17642
+ * @returns promise
17643
+ */
17644
+ Templates.delete = function (template_id) {
17645
+ return Requests.processRoute(TemplatesRoute.routes.delete, {}, { template_id: template_id });
17646
+ };
17647
+ /**
17648
+ * Updates the logo for the template using a File object.
17649
+ *
17650
+ * @see https://api.glitch.fun/api/documentation#/Template%20Route/uploadLogoTemplateImage
17651
+ *
17652
+ * @param file The file object to upload.
17653
+ * @param data Any additional data to pass along to the upload.
17654
+ *
17655
+ * @returns promise
17656
+ */
17657
+ Templates.uploadLogoFile = function (template_id, file, data) {
17658
+ var url = TemplatesRoute.routes.uploadLogo.url.replace('{template_id}', template_id);
17659
+ return Requests.uploadFile(url, 'image', file, data);
17660
+ };
17661
+ /**
17662
+ * Updates the logo for the template using a Blob.
17663
+ *
17664
+ * @see https://api.glitch.fun/api/documentation#/Template%20Route/uploadLogoTemplateImage
17665
+ *
17666
+ * @param blob The blob to upload.
17667
+ * @param data Any additional data to pass along to the upload
17668
+ *
17669
+ * @returns promise
17670
+ */
17671
+ Templates.uploadLogoBlob = function (template_id, blob, data) {
17672
+ var url = TemplatesRoute.routes.uploadLogo.url.replace('{template_id}', template_id);
17673
+ return Requests.uploadBlob(url, 'image', blob, data);
17674
+ };
17675
+ /**
17676
+ * Updates the main image for the template using a File object.
17677
+ *
17678
+ * @see https://api.glitch.fun/api/documentation#/Template%20Route/uploadMainTemplateImage
17679
+ *
17680
+ * @param file The file object to upload.
17681
+ * @param data Any additional data to pass along to the upload.
17682
+ *
17683
+ * @returns promise
17684
+ */
17685
+ Templates.uploadMainImageFile = function (template_id, file, data) {
17686
+ var url = TemplatesRoute.routes.uploadMainImage.url.replace('{template_id}', template_id);
17687
+ return Requests.uploadFile(url, 'image', file, data);
17688
+ };
17689
+ /**
17690
+ * Updates the main image for the template using a Blob.
17691
+ *
17692
+ * @see https://api.glitch.fun/api/documentation#/Template%20Route/uploadMainTemplateImage
17693
+ *
17694
+ * @param blob The blob to upload.
17695
+ * @param data Any additional data to pass along to the upload
17696
+ *
17697
+ * @returns promise
17698
+ */
17699
+ Templates.uploadMainImageBlob = function (template_id, blob, data) {
17700
+ var url = TemplatesRoute.routes.uploadMainImage.url.replace('{template_id}', template_id);
17701
+ return Requests.uploadBlob(url, 'image', blob, data);
17702
+ };
17703
+ return Templates;
17704
+ }());
17705
+
17299
17706
  var Parser = /** @class */ (function () {
17300
17707
  function Parser() {
17301
17708
  }
@@ -17586,9 +17993,11 @@ var Glitch = /** @class */ (function () {
17586
17993
  Glitch.api = {
17587
17994
  Auth: Auth,
17588
17995
  Competitions: Competitions,
17996
+ Communities: Communities,
17589
17997
  Users: Users,
17590
17998
  Events: Events,
17591
17999
  Teams: Teams,
18000
+ Templates: Templates,
17592
18001
  Waitlists: Waitlists
17593
18002
  };
17594
18003
  Glitch.util = {