glitch-javascript-sdk 0.3.0 → 0.3.2

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
@@ -15681,6 +15681,9 @@ var Requests = /** @class */ (function () {
15681
15681
  var queryString = Object.entries(params)
15682
15682
  .map(function (_a) {
15683
15683
  var key = _a[0], value = _a[1];
15684
+ if (Array.isArray(value)) {
15685
+ return value.map(function (item) { return "".concat(key, "[]=").concat(encodeURIComponent(item)); }).join('&');
15686
+ }
15684
15687
  return "".concat(key, "=").concat(encodeURIComponent(value));
15685
15688
  })
15686
15689
  .join('&');
@@ -17721,6 +17724,83 @@ var Waitlists = /** @class */ (function () {
17721
17724
  return Waitlists;
17722
17725
  }());
17723
17726
 
17727
+ var PostsRoute = /** @class */ (function () {
17728
+ function PostsRoute() {
17729
+ }
17730
+ PostsRoute.routes = {
17731
+ list: { url: '/posts', method: HTTP_METHODS.GET },
17732
+ create: { url: '/posts', method: HTTP_METHODS.POST },
17733
+ view: { url: '/posts/{post_id}', method: HTTP_METHODS.GET },
17734
+ update: { url: '/posts/{post_id}', method: HTTP_METHODS.PUT },
17735
+ delete: { url: '/posts/{post_id}', method: HTTP_METHODS.DELETE },
17736
+ };
17737
+ return PostsRoute;
17738
+ }());
17739
+
17740
+ var Posts = /** @class */ (function () {
17741
+ function Posts() {
17742
+ }
17743
+ /**
17744
+ * List all the Posts.
17745
+ *
17746
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/resourcePostList
17747
+ *
17748
+ * @returns promise
17749
+ */
17750
+ Posts.list = function (params) {
17751
+ return Requests.processRoute(PostsRoute.routes.list, undefined, undefined, params);
17752
+ };
17753
+ /**
17754
+ * Create a new post.
17755
+ *
17756
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/newPostResourceStorage
17757
+ *
17758
+ * @param data The data to be passed when creating a post.
17759
+ *
17760
+ * @returns Promise
17761
+ */
17762
+ Posts.create = function (data, params) {
17763
+ return Requests.processRoute(PostsRoute.routes.create, data, undefined, params);
17764
+ };
17765
+ /**
17766
+ * Update a post.
17767
+ *
17768
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/updatePostStorage
17769
+ *
17770
+ * @param post_id The id of the post to update.
17771
+ * @param data The data to update.
17772
+ *
17773
+ * @returns promise
17774
+ */
17775
+ Posts.update = function (post_id, data, params) {
17776
+ return Requests.processRoute(PostsRoute.routes.update, data, { post_id: post_id }, params);
17777
+ };
17778
+ /**
17779
+ * Retrieve the information for a single post.
17780
+ *
17781
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/showPostStorage
17782
+ *
17783
+ * @param post_id The id fo the post to retrieve.
17784
+ *
17785
+ * @returns promise
17786
+ */
17787
+ Posts.view = function (post_id, params) {
17788
+ return Requests.processRoute(PostsRoute.routes.view, {}, { post_id: post_id }, params);
17789
+ };
17790
+ /**
17791
+ * Deletes a post.
17792
+ *
17793
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/destoryPostStorage
17794
+ *
17795
+ * @param post_id The id of the post to delete.
17796
+ * @returns promise
17797
+ */
17798
+ Posts.delete = function (post_id, params) {
17799
+ return Requests.processRoute(PostsRoute.routes.delete, {}, { post_id: post_id }, params);
17800
+ };
17801
+ return Posts;
17802
+ }());
17803
+
17724
17804
  var TemplatesRoute = /** @class */ (function () {
17725
17805
  function TemplatesRoute() {
17726
17806
  }
@@ -18158,6 +18238,7 @@ var Glitch = /** @class */ (function () {
18158
18238
  Users: Users,
18159
18239
  Events: Events,
18160
18240
  Teams: Teams,
18241
+ Posts: Posts,
18161
18242
  Templates: Templates,
18162
18243
  Waitlists: Waitlists
18163
18244
  };