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 +76 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Posts.d.ts +22 -0
- package/dist/esm/constants/ContentStatus.d.ts +9 -0
- package/dist/esm/constants/PostTypes.d.ts +7 -0
- package/dist/esm/index.d.ts +18 -0
- package/dist/esm/index.js +76 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/util/LabelManager.d.ts +13 -0
- package/dist/index.d.ts +52 -0
- package/package.json +1 -1
- package/src/api/Posts.ts +31 -0
- package/src/config/Config.ts +3 -0
- package/src/constants/ContentStatus.ts +9 -0
- package/src/constants/PostTypes.ts +7 -0
- package/src/index.ts +6 -0
- package/src/util/LabelManager.ts +39 -0
- package/src/constants/api_routes.js +0 -397
package/dist/esm/api/Posts.d.ts
CHANGED
|
@@ -19,6 +19,28 @@ declare class Posts {
|
|
|
19
19
|
* @returns Promise
|
|
20
20
|
*/
|
|
21
21
|
static create<T>(data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
|
|
22
|
+
/**
|
|
23
|
+
* Create a new post with a file. The file should either be an image or video.
|
|
24
|
+
*
|
|
25
|
+
* @see https://api.glitch.fun/api/documentation#/Post%20Route/newPostResourceStorage
|
|
26
|
+
*
|
|
27
|
+
* @param file The file object to upload.
|
|
28
|
+
* @param data Any additional data to pass along to the upload.
|
|
29
|
+
*
|
|
30
|
+
* @returns promise
|
|
31
|
+
*/
|
|
32
|
+
static createWithFile<T>(file: File, data?: object): AxiosPromise<Response<T>>;
|
|
33
|
+
/**
|
|
34
|
+
* Create a new post with a blob. The blob should either be an image or video.
|
|
35
|
+
*
|
|
36
|
+
* @see https://api.glitch.fun/api/documentation#/Post%20Route/newPostResourceStorage
|
|
37
|
+
*
|
|
38
|
+
* @param file The blob to upload.
|
|
39
|
+
* @param data Any additional data to pass along to the upload.
|
|
40
|
+
*
|
|
41
|
+
* @returns promise
|
|
42
|
+
*/
|
|
43
|
+
static createWithBlob<T>(blob: Blob, data?: object): AxiosPromise<Response<T>>;
|
|
22
44
|
/**
|
|
23
45
|
* Update a post.
|
|
24
46
|
*
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ import Parser from "./util/Parser";
|
|
|
13
13
|
import Session from "./util/Session";
|
|
14
14
|
import Storage from "./util/Storage";
|
|
15
15
|
import Data from './util/Data';
|
|
16
|
+
import LabelManager from "./util/LabelManager";
|
|
16
17
|
import { Modes } from "./constants/Modes";
|
|
17
18
|
import { Roles } from "./constants/Roles";
|
|
18
19
|
import { TeamJoinProcess } from "./constants/TeamJoinProcess";
|
|
@@ -41,6 +42,7 @@ declare class Glitch {
|
|
|
41
42
|
Session: typeof Session;
|
|
42
43
|
Storage: typeof Storage;
|
|
43
44
|
Data: typeof Data;
|
|
45
|
+
LabelManager: typeof LabelManager;
|
|
44
46
|
};
|
|
45
47
|
static constants: {
|
|
46
48
|
AcceptanceStatus: Readonly<{
|
|
@@ -69,7 +71,23 @@ declare class Glitch {
|
|
|
69
71
|
SEMI_ROUND_ROBINS: 8;
|
|
70
72
|
EXTENDED: 9;
|
|
71
73
|
}>;
|
|
74
|
+
ContentStatus: Readonly<{
|
|
75
|
+
UNAPPROVED: 0;
|
|
76
|
+
APPROVED: 1;
|
|
77
|
+
IN_REVIEW: 2;
|
|
78
|
+
PENDING: 3;
|
|
79
|
+
FLAGGED: 4;
|
|
80
|
+
REMOVED: 5;
|
|
81
|
+
DELETED: 6;
|
|
82
|
+
}>;
|
|
72
83
|
Modes: typeof Modes;
|
|
84
|
+
PostTypes: Readonly<{
|
|
85
|
+
TEXT: "text";
|
|
86
|
+
LINK: "link";
|
|
87
|
+
POLL: "poll";
|
|
88
|
+
IMAGE: "image";
|
|
89
|
+
VIDEO: "video";
|
|
90
|
+
}>;
|
|
73
91
|
Roles: typeof Roles;
|
|
74
92
|
TeamJoinProcess: typeof TeamJoinProcess;
|
|
75
93
|
TicketTypes: typeof TicketTypes;
|
package/dist/esm/index.js
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
var LabelManager = /** @class */ (function () {
|
|
2
|
+
function LabelManager() {
|
|
3
|
+
}
|
|
4
|
+
LabelManager.initialize = function (community) {
|
|
5
|
+
LabelManager.community = community;
|
|
6
|
+
};
|
|
7
|
+
LabelManager.getLabel = function (labelName, plural, capitalize) {
|
|
8
|
+
var label = LabelManager.community[labelName + (plural ? "_plural" : "_singular")];
|
|
9
|
+
if (capitalize) {
|
|
10
|
+
label = label.charAt(0).toUpperCase() + label.slice(1);
|
|
11
|
+
}
|
|
12
|
+
return label;
|
|
13
|
+
};
|
|
14
|
+
LabelManager.getUserLabel = function (plural, capitalize) {
|
|
15
|
+
return LabelManager.getLabel("label_users", plural, capitalize);
|
|
16
|
+
};
|
|
17
|
+
LabelManager.getCompetitionLabel = function (plural, capitalize) {
|
|
18
|
+
return LabelManager.getLabel("label_competitions", plural, capitalize);
|
|
19
|
+
};
|
|
20
|
+
LabelManager.getStreamLabel = function (plural, capitalize) {
|
|
21
|
+
return LabelManager.getLabel("label_streams", plural, capitalize);
|
|
22
|
+
};
|
|
23
|
+
LabelManager.getPostLabel = function (plural, capitalize) {
|
|
24
|
+
return LabelManager.getLabel("label_posts", plural, capitalize);
|
|
25
|
+
};
|
|
26
|
+
return LabelManager;
|
|
27
|
+
}());
|
|
28
|
+
|
|
1
29
|
/******************************************************************************
|
|
2
30
|
Copyright (c) Microsoft Corporation.
|
|
3
31
|
|
|
@@ -30094,6 +30122,7 @@ var Config = /** @class */ (function () {
|
|
|
30094
30122
|
Config.setCommunity = function (community) {
|
|
30095
30123
|
Config._community = community;
|
|
30096
30124
|
Requests.setCommunityID(community.id);
|
|
30125
|
+
LabelManager.initialize(community);
|
|
30097
30126
|
};
|
|
30098
30127
|
Object.defineProperty(Config, "baseUrl", {
|
|
30099
30128
|
/**
|
|
@@ -31984,6 +32013,32 @@ var Posts = /** @class */ (function () {
|
|
|
31984
32013
|
Posts.create = function (data, params) {
|
|
31985
32014
|
return Requests.processRoute(PostsRoute.routes.create, data, undefined, params);
|
|
31986
32015
|
};
|
|
32016
|
+
/**
|
|
32017
|
+
* Create a new post with a file. The file should either be an image or video.
|
|
32018
|
+
*
|
|
32019
|
+
* @see https://api.glitch.fun/api/documentation#/Post%20Route/newPostResourceStorage
|
|
32020
|
+
*
|
|
32021
|
+
* @param file The file object to upload.
|
|
32022
|
+
* @param data Any additional data to pass along to the upload.
|
|
32023
|
+
*
|
|
32024
|
+
* @returns promise
|
|
32025
|
+
*/
|
|
32026
|
+
Posts.createWithFile = function (file, data) {
|
|
32027
|
+
return Requests.uploadFile(PostsRoute.routes.create.url, 'file', file, data);
|
|
32028
|
+
};
|
|
32029
|
+
/**
|
|
32030
|
+
* Create a new post with a blob. The blob should either be an image or video.
|
|
32031
|
+
*
|
|
32032
|
+
* @see https://api.glitch.fun/api/documentation#/Post%20Route/newPostResourceStorage
|
|
32033
|
+
*
|
|
32034
|
+
* @param file The blob to upload.
|
|
32035
|
+
* @param data Any additional data to pass along to the upload.
|
|
32036
|
+
*
|
|
32037
|
+
* @returns promise
|
|
32038
|
+
*/
|
|
32039
|
+
Posts.createWithBlob = function (blob, data) {
|
|
32040
|
+
return Requests.uploadBlob(PostsRoute.routes.create.url, 'file', blob, data);
|
|
32041
|
+
};
|
|
31987
32042
|
/**
|
|
31988
32043
|
* Update a post.
|
|
31989
32044
|
*
|
|
@@ -32365,6 +32420,16 @@ var AddressLocationType = Object.freeze({
|
|
|
32365
32420
|
HYBRID: 3,
|
|
32366
32421
|
});
|
|
32367
32422
|
|
|
32423
|
+
var ContentStatus = Object.freeze({
|
|
32424
|
+
UNAPPROVED: 0,
|
|
32425
|
+
APPROVED: 1,
|
|
32426
|
+
IN_REVIEW: 2,
|
|
32427
|
+
PENDING: 3,
|
|
32428
|
+
FLAGGED: 4,
|
|
32429
|
+
REMOVED: 5,
|
|
32430
|
+
DELETED: 6,
|
|
32431
|
+
});
|
|
32432
|
+
|
|
32368
32433
|
var CompetitionTypes = Object.freeze({
|
|
32369
32434
|
SINGLE_ELIMINATION: 1,
|
|
32370
32435
|
DOUBLE_ELIMINATION: 2,
|
|
@@ -32384,6 +32449,14 @@ var Modes;
|
|
|
32384
32449
|
Modes[Modes["RTMP"] = 2] = "RTMP";
|
|
32385
32450
|
})(Modes || (Modes = {}));
|
|
32386
32451
|
|
|
32452
|
+
var PostTypes = Object.freeze({
|
|
32453
|
+
TEXT: 'text',
|
|
32454
|
+
LINK: 'link',
|
|
32455
|
+
POLL: 'poll',
|
|
32456
|
+
IMAGE: 'image',
|
|
32457
|
+
VIDEO: 'video',
|
|
32458
|
+
});
|
|
32459
|
+
|
|
32387
32460
|
var Roles;
|
|
32388
32461
|
(function (Roles) {
|
|
32389
32462
|
Roles[Roles["NONE"] = 0] = "NONE";
|
|
@@ -32470,12 +32543,15 @@ var Glitch = /** @class */ (function () {
|
|
|
32470
32543
|
Session: Session,
|
|
32471
32544
|
Storage: Storage,
|
|
32472
32545
|
Data: Data,
|
|
32546
|
+
LabelManager: LabelManager,
|
|
32473
32547
|
};
|
|
32474
32548
|
Glitch.constants = {
|
|
32475
32549
|
AcceptanceStatus: AcceptanceStatus,
|
|
32476
32550
|
AddressLocationType: AddressLocationType,
|
|
32477
32551
|
CompetitionTypes: CompetitionTypes,
|
|
32552
|
+
ContentStatus: ContentStatus,
|
|
32478
32553
|
Modes: Modes,
|
|
32554
|
+
PostTypes: PostTypes,
|
|
32479
32555
|
Roles: Roles,
|
|
32480
32556
|
TeamJoinProcess: TeamJoinProcess,
|
|
32481
32557
|
TicketTypes: TicketTypes$1,
|