glitch-javascript-sdk 0.3.1 → 0.3.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
@@ -10,6 +10,34 @@ var require$$1$1 = require('util');
10
10
  var require$$1$2 = require('path');
11
11
  var require$$6 = require('fs');
12
12
 
13
+ var LabelManager = /** @class */ (function () {
14
+ function LabelManager() {
15
+ }
16
+ LabelManager.initialize = function (community) {
17
+ LabelManager.community = community;
18
+ };
19
+ LabelManager.getLabel = function (labelName, plural, capitalize) {
20
+ var label = LabelManager.community[labelName + (plural ? "_plural" : "_singular")];
21
+ if (capitalize) {
22
+ label = label.charAt(0).toUpperCase() + label.slice(1);
23
+ }
24
+ return label;
25
+ };
26
+ LabelManager.getUserLabel = function (plural, capitalize) {
27
+ return LabelManager.getLabel("label_users", plural, capitalize);
28
+ };
29
+ LabelManager.getCompetitionLabel = function (plural, capitalize) {
30
+ return LabelManager.getLabel("label_competitions", plural, capitalize);
31
+ };
32
+ LabelManager.getStreamLabel = function (plural, capitalize) {
33
+ return LabelManager.getLabel("label_streams", plural, capitalize);
34
+ };
35
+ LabelManager.getPostLabel = function (plural, capitalize) {
36
+ return LabelManager.getLabel("label_posts", plural, capitalize);
37
+ };
38
+ return LabelManager;
39
+ }());
40
+
13
41
  /******************************************************************************
14
42
  Copyright (c) Microsoft Corporation.
15
43
 
@@ -15872,6 +15900,7 @@ var Config = /** @class */ (function () {
15872
15900
  Config.setCommunity = function (community) {
15873
15901
  Config._community = community;
15874
15902
  Requests.setCommunityID(community.id);
15903
+ LabelManager.initialize(community);
15875
15904
  };
15876
15905
  Object.defineProperty(Config, "baseUrl", {
15877
15906
  /**
@@ -17724,6 +17753,83 @@ var Waitlists = /** @class */ (function () {
17724
17753
  return Waitlists;
17725
17754
  }());
17726
17755
 
17756
+ var PostsRoute = /** @class */ (function () {
17757
+ function PostsRoute() {
17758
+ }
17759
+ PostsRoute.routes = {
17760
+ list: { url: '/posts', method: HTTP_METHODS.GET },
17761
+ create: { url: '/posts', method: HTTP_METHODS.POST },
17762
+ view: { url: '/posts/{post_id}', method: HTTP_METHODS.GET },
17763
+ update: { url: '/posts/{post_id}', method: HTTP_METHODS.PUT },
17764
+ delete: { url: '/posts/{post_id}', method: HTTP_METHODS.DELETE },
17765
+ };
17766
+ return PostsRoute;
17767
+ }());
17768
+
17769
+ var Posts = /** @class */ (function () {
17770
+ function Posts() {
17771
+ }
17772
+ /**
17773
+ * List all the Posts.
17774
+ *
17775
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/resourcePostList
17776
+ *
17777
+ * @returns promise
17778
+ */
17779
+ Posts.list = function (params) {
17780
+ return Requests.processRoute(PostsRoute.routes.list, undefined, undefined, params);
17781
+ };
17782
+ /**
17783
+ * Create a new post.
17784
+ *
17785
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/newPostResourceStorage
17786
+ *
17787
+ * @param data The data to be passed when creating a post.
17788
+ *
17789
+ * @returns Promise
17790
+ */
17791
+ Posts.create = function (data, params) {
17792
+ return Requests.processRoute(PostsRoute.routes.create, data, undefined, params);
17793
+ };
17794
+ /**
17795
+ * Update a post.
17796
+ *
17797
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/updatePostStorage
17798
+ *
17799
+ * @param post_id The id of the post to update.
17800
+ * @param data The data to update.
17801
+ *
17802
+ * @returns promise
17803
+ */
17804
+ Posts.update = function (post_id, data, params) {
17805
+ return Requests.processRoute(PostsRoute.routes.update, data, { post_id: post_id }, params);
17806
+ };
17807
+ /**
17808
+ * Retrieve the information for a single post.
17809
+ *
17810
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/showPostStorage
17811
+ *
17812
+ * @param post_id The id fo the post to retrieve.
17813
+ *
17814
+ * @returns promise
17815
+ */
17816
+ Posts.view = function (post_id, params) {
17817
+ return Requests.processRoute(PostsRoute.routes.view, {}, { post_id: post_id }, params);
17818
+ };
17819
+ /**
17820
+ * Deletes a post.
17821
+ *
17822
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/destoryPostStorage
17823
+ *
17824
+ * @param post_id The id of the post to delete.
17825
+ * @returns promise
17826
+ */
17827
+ Posts.delete = function (post_id, params) {
17828
+ return Requests.processRoute(PostsRoute.routes.delete, {}, { post_id: post_id }, params);
17829
+ };
17830
+ return Posts;
17831
+ }());
17832
+
17727
17833
  var TemplatesRoute = /** @class */ (function () {
17728
17834
  function TemplatesRoute() {
17729
17835
  }
@@ -18066,6 +18172,16 @@ var AddressLocationType = Object.freeze({
18066
18172
  HYBRID: 3,
18067
18173
  });
18068
18174
 
18175
+ var ContentStatus = Object.freeze({
18176
+ UNAPPROVED: 0,
18177
+ APPROVED: 1,
18178
+ IN_REVIEW: 2,
18179
+ PENDING: 3,
18180
+ FLAGGED: 4,
18181
+ REMOVED: 5,
18182
+ DELETED: 6,
18183
+ });
18184
+
18069
18185
  var CompetitionTypes = Object.freeze({
18070
18186
  SINGLE_ELIMINATION: 1,
18071
18187
  DOUBLE_ELIMINATION: 2,
@@ -18085,6 +18201,14 @@ var Modes;
18085
18201
  Modes[Modes["RTMP"] = 2] = "RTMP";
18086
18202
  })(Modes || (Modes = {}));
18087
18203
 
18204
+ var PostTypes = Object.freeze({
18205
+ TEXT: 'text',
18206
+ LINK: 'link',
18207
+ POLL: 'poll',
18208
+ IMAGE: 'image',
18209
+ VIDEO: 'video',
18210
+ });
18211
+
18088
18212
  var Roles;
18089
18213
  (function (Roles) {
18090
18214
  Roles[Roles["NONE"] = 0] = "NONE";
@@ -18161,6 +18285,7 @@ var Glitch = /** @class */ (function () {
18161
18285
  Users: Users,
18162
18286
  Events: Events,
18163
18287
  Teams: Teams,
18288
+ Posts: Posts,
18164
18289
  Templates: Templates,
18165
18290
  Waitlists: Waitlists
18166
18291
  };
@@ -18170,12 +18295,15 @@ var Glitch = /** @class */ (function () {
18170
18295
  Session: Session,
18171
18296
  Storage: Storage,
18172
18297
  Data: Data,
18298
+ LabelManager: LabelManager,
18173
18299
  };
18174
18300
  Glitch.constants = {
18175
18301
  AcceptanceStatus: AcceptanceStatus,
18176
18302
  AddressLocationType: AddressLocationType,
18177
18303
  CompetitionTypes: CompetitionTypes,
18304
+ ContentStatus: ContentStatus,
18178
18305
  Modes: Modes,
18306
+ PostTypes: PostTypes,
18179
18307
  Roles: Roles,
18180
18308
  TeamJoinProcess: TeamJoinProcess,
18181
18309
  TicketTypes: TicketTypes$1,