glitch-javascript-sdk 0.3.2 → 0.3.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.
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
  /**
@@ -17762,6 +17791,32 @@ var Posts = /** @class */ (function () {
17762
17791
  Posts.create = function (data, params) {
17763
17792
  return Requests.processRoute(PostsRoute.routes.create, data, undefined, params);
17764
17793
  };
17794
+ /**
17795
+ * Create a new post with a file. The file should either be an image or video.
17796
+ *
17797
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/newPostResourceStorage
17798
+ *
17799
+ * @param file The file object to upload.
17800
+ * @param data Any additional data to pass along to the upload.
17801
+ *
17802
+ * @returns promise
17803
+ */
17804
+ Posts.createWithFile = function (file, data) {
17805
+ return Requests.uploadFile(PostsRoute.routes.create.url, 'file', file, data);
17806
+ };
17807
+ /**
17808
+ * Create a new post with a blob. The blob should either be an image or video.
17809
+ *
17810
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/newPostResourceStorage
17811
+ *
17812
+ * @param file The blob to upload.
17813
+ * @param data Any additional data to pass along to the upload.
17814
+ *
17815
+ * @returns promise
17816
+ */
17817
+ Posts.createWithBlob = function (blob, data) {
17818
+ return Requests.uploadBlob(PostsRoute.routes.create.url, 'file', blob, data);
17819
+ };
17765
17820
  /**
17766
17821
  * Update a post.
17767
17822
  *
@@ -18143,6 +18198,16 @@ var AddressLocationType = Object.freeze({
18143
18198
  HYBRID: 3,
18144
18199
  });
18145
18200
 
18201
+ var ContentStatus = Object.freeze({
18202
+ UNAPPROVED: 0,
18203
+ APPROVED: 1,
18204
+ IN_REVIEW: 2,
18205
+ PENDING: 3,
18206
+ FLAGGED: 4,
18207
+ REMOVED: 5,
18208
+ DELETED: 6,
18209
+ });
18210
+
18146
18211
  var CompetitionTypes = Object.freeze({
18147
18212
  SINGLE_ELIMINATION: 1,
18148
18213
  DOUBLE_ELIMINATION: 2,
@@ -18162,6 +18227,14 @@ var Modes;
18162
18227
  Modes[Modes["RTMP"] = 2] = "RTMP";
18163
18228
  })(Modes || (Modes = {}));
18164
18229
 
18230
+ var PostTypes = Object.freeze({
18231
+ TEXT: 'text',
18232
+ LINK: 'link',
18233
+ POLL: 'poll',
18234
+ IMAGE: 'image',
18235
+ VIDEO: 'video',
18236
+ });
18237
+
18165
18238
  var Roles;
18166
18239
  (function (Roles) {
18167
18240
  Roles[Roles["NONE"] = 0] = "NONE";
@@ -18248,12 +18321,15 @@ var Glitch = /** @class */ (function () {
18248
18321
  Session: Session,
18249
18322
  Storage: Storage,
18250
18323
  Data: Data,
18324
+ LabelManager: LabelManager,
18251
18325
  };
18252
18326
  Glitch.constants = {
18253
18327
  AcceptanceStatus: AcceptanceStatus,
18254
18328
  AddressLocationType: AddressLocationType,
18255
18329
  CompetitionTypes: CompetitionTypes,
18330
+ ContentStatus: ContentStatus,
18256
18331
  Modes: Modes,
18332
+ PostTypes: PostTypes,
18257
18333
  Roles: Roles,
18258
18334
  TeamJoinProcess: TeamJoinProcess,
18259
18335
  TicketTypes: TicketTypes$1,