glitch-javascript-sdk 0.4.7 → 0.4.9

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.
@@ -0,0 +1,53 @@
1
+ import Response from "../util/Response";
2
+ import { AxiosPromise } from "axios";
3
+ declare class TipEmojis {
4
+ /**
5
+ * Retrieve a list of emojis for tupping.
6
+ *
7
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/resourcePostList
8
+ *
9
+ * @returns promise
10
+ */
11
+ static list<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
12
+ /**
13
+ * Create a new emoji to use when tipping.
14
+ *
15
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/newPostResourceStorage
16
+ *
17
+ * @param data The data to be passed when creating a post.
18
+ *
19
+ * @returns Promise
20
+ */
21
+ static create<T>(data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
22
+ /**
23
+ * Update an emoji for tipping.
24
+ *
25
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/updatePostStorage
26
+ *
27
+ * @param type_id The id of the post to update.
28
+ * @param data The data to update.
29
+ *
30
+ * @returns promise
31
+ */
32
+ static update<T>(type_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
33
+ /**
34
+ * Retrieve a single emoji resource to be used when tipping.
35
+ *
36
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/showPostStorage
37
+ *
38
+ * @param type_id The id fo the post to retrieve.
39
+ *
40
+ * @returns promise
41
+ */
42
+ static view<T>(type_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
43
+ /**
44
+ * Delete an emoji resource.
45
+ *
46
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/destoryPostStorage
47
+ *
48
+ * @param type_id The id of the post to delete.
49
+ * @returns promise
50
+ */
51
+ static delete<T>(type_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
52
+ }
53
+ export default TipEmojis;
@@ -0,0 +1,13 @@
1
+ import Response from "../util/Response";
2
+ import { AxiosPromise } from "axios";
3
+ declare class TipPackagePurchases {
4
+ /**
5
+ * Purchase a package with Stripe as the processor.
6
+ *
7
+ * @see https://api.glitch.fun/api/documentation#/Authentication%20Route/authLogin
8
+ *
9
+ * @returns A promise
10
+ */
11
+ static stripe<T>(data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
12
+ }
13
+ export default TipPackagePurchases;
@@ -0,0 +1,53 @@
1
+ import Response from "../util/Response";
2
+ import { AxiosPromise } from "axios";
3
+ declare class TipPackages {
4
+ /**
5
+ * Retrieve a list of tip packages.
6
+ *
7
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/resourcePostList
8
+ *
9
+ * @returns promise
10
+ */
11
+ static list<T>(params?: Record<string, any>): AxiosPromise<Response<T>>;
12
+ /**
13
+ * Create a new tip package.
14
+ *
15
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/newPostResourceStorage
16
+ *
17
+ * @param data The data to be passed when creating a post.
18
+ *
19
+ * @returns Promise
20
+ */
21
+ static create<T>(data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
22
+ /**
23
+ * Update a tip package.
24
+ *
25
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/updatePostStorage
26
+ *
27
+ * @param package_id The id of the post to update.
28
+ * @param data The data to update.
29
+ *
30
+ * @returns promise
31
+ */
32
+ static update<T>(package_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
33
+ /**
34
+ * Retrieve a single tip package resource.
35
+ *
36
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/showPostStorage
37
+ *
38
+ * @param package_id The id fo the post to retrieve.
39
+ *
40
+ * @returns promise
41
+ */
42
+ static view<T>(package_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
43
+ /**
44
+ * Delete a tip package.
45
+ *
46
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/destoryPostStorage
47
+ *
48
+ * @param package_id The id of the post to delete.
49
+ * @returns promise
50
+ */
51
+ static delete<T>(package_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
52
+ }
53
+ export default TipPackages;
@@ -0,0 +1,13 @@
1
+ import Response from "../util/Response";
2
+ import { AxiosPromise } from "axios";
3
+ declare class Tips {
4
+ /**
5
+ * Give a tip to another user
6
+ *
7
+ * @see https://api.glitch.fun/api/documentation#/Authentication%20Route/authLogin
8
+ *
9
+ * @returns A promise
10
+ */
11
+ static give<T>(data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
12
+ }
13
+ export default Tips;
@@ -8,6 +8,10 @@ import Waitlists from "./Waitlist";
8
8
  import Posts from "./Posts";
9
9
  import Templates from "./Templates";
10
10
  import Utility from "./Utility";
11
+ import Tips from "./Tips";
12
+ import TipEmojis from "./TipEmojis";
13
+ import TipPackages from "./TipPackages";
14
+ import TipPackagePurchases from "./TipPackagePurchases";
11
15
  export { Auth };
12
16
  export { Competitions };
13
17
  export { Communities };
@@ -18,3 +22,7 @@ export { Waitlists };
18
22
  export { Posts };
19
23
  export { Templates };
20
24
  export { Utility };
25
+ export { Tips };
26
+ export { TipEmojis };
27
+ export { TipPackages };
28
+ export { TipPackagePurchases };
@@ -9,6 +9,10 @@ import { Posts } from "./api";
9
9
  import { Templates } from "./api";
10
10
  import { Waitlists } from "./api";
11
11
  import { Utility } from "./api";
12
+ import { Tips } from "./api";
13
+ import { TipPackages } from "./api";
14
+ import { TipEmojis } from "./api";
15
+ import { TipPackagePurchases } from "./api";
12
16
  import Requests from "./util/Requests";
13
17
  import Parser from "./util/Parser";
14
18
  import Session from "./util/Session";
@@ -38,6 +42,10 @@ declare class Glitch {
38
42
  Templates: typeof Templates;
39
43
  Waitlists: typeof Waitlists;
40
44
  Utility: typeof Utility;
45
+ Tips: typeof Tips;
46
+ TipPackages: typeof TipPackages;
47
+ TipEmojis: typeof TipEmojis;
48
+ TipPackagePurchases: typeof TipPackagePurchases;
41
49
  };
42
50
  static util: {
43
51
  Requests: typeof Requests;
package/dist/esm/index.js CHANGED
@@ -29873,16 +29873,9 @@ var HTTP_METHODS = {
29873
29873
  var Requests = /** @class */ (function () {
29874
29874
  function Requests(config) {
29875
29875
  Requests.config = config;
29876
- Requests.axiosInstance = axios.create({
29877
- baseURL: Requests.baseUrl,
29878
- headers: { 'Content-Type': 'application/json' },
29879
- });
29880
29876
  }
29881
29877
  Requests.setBaseUrl = function (url) {
29882
29878
  Requests.baseUrl = url;
29883
- if (Requests.axiosInstance && Requests.axiosInstance.defaults) {
29884
- Requests.axiosInstance.defaults.baseURL = url;
29885
- }
29886
29879
  };
29887
29880
  Requests.setAuthToken = function (token) {
29888
29881
  Requests.authToken = token;
@@ -29902,7 +29895,7 @@ var Requests = /** @class */ (function () {
29902
29895
  }
29903
29896
  url = url.replace(/\/\//g, '/');
29904
29897
  var uri = "".concat(Requests.baseUrl).concat(url);
29905
- var axiosPromise = Requests.axiosInstance({
29898
+ var axiosPromise = axios({
29906
29899
  method: method,
29907
29900
  url: uri,
29908
29901
  data: fileData || data,
@@ -32450,6 +32443,210 @@ var Utility = /** @class */ (function () {
32450
32443
  return Utility;
32451
32444
  }());
32452
32445
 
32446
+ var TipRoute = /** @class */ (function () {
32447
+ function TipRoute() {
32448
+ }
32449
+ TipRoute.routes = {
32450
+ give: { url: '/tips/give', method: HTTP_METHODS.POST },
32451
+ };
32452
+ return TipRoute;
32453
+ }());
32454
+
32455
+ var Tips = /** @class */ (function () {
32456
+ function Tips() {
32457
+ }
32458
+ /**
32459
+ * Give a tip to another user
32460
+ *
32461
+ * @see https://api.glitch.fun/api/documentation#/Authentication%20Route/authLogin
32462
+ *
32463
+ * @returns A promise
32464
+ */
32465
+ Tips.give = function (data, params) {
32466
+ return Requests.processRoute(TipRoute.routes.give, data, {}, params);
32467
+ };
32468
+ return Tips;
32469
+ }());
32470
+
32471
+ var TipEmojiRoute = /** @class */ (function () {
32472
+ function TipEmojiRoute() {
32473
+ }
32474
+ TipEmojiRoute.routes = {
32475
+ list: { url: '/tipstypes', method: HTTP_METHODS.GET },
32476
+ create: { url: '/tipstypes', method: HTTP_METHODS.POST },
32477
+ view: { url: '/tipstypes/{type_id}', method: HTTP_METHODS.GET },
32478
+ update: { url: '/tipstypes/{type_id}', method: HTTP_METHODS.PUT },
32479
+ DELETE: { url: '/tipstypes/{type_id}', method: HTTP_METHODS.DELETE },
32480
+ };
32481
+ return TipEmojiRoute;
32482
+ }());
32483
+
32484
+ var TipEmojis = /** @class */ (function () {
32485
+ function TipEmojis() {
32486
+ }
32487
+ /**
32488
+ * Retrieve a list of emojis for tupping.
32489
+ *
32490
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/resourcePostList
32491
+ *
32492
+ * @returns promise
32493
+ */
32494
+ TipEmojis.list = function (params) {
32495
+ return Requests.processRoute(TipEmojiRoute.routes.list, undefined, undefined, params);
32496
+ };
32497
+ /**
32498
+ * Create a new emoji to use when tipping.
32499
+ *
32500
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/newPostResourceStorage
32501
+ *
32502
+ * @param data The data to be passed when creating a post.
32503
+ *
32504
+ * @returns Promise
32505
+ */
32506
+ TipEmojis.create = function (data, params) {
32507
+ return Requests.processRoute(TipEmojiRoute.routes.create, data, undefined, params);
32508
+ };
32509
+ /**
32510
+ * Update an emoji for tipping.
32511
+ *
32512
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/updatePostStorage
32513
+ *
32514
+ * @param type_id The id of the post to update.
32515
+ * @param data The data to update.
32516
+ *
32517
+ * @returns promise
32518
+ */
32519
+ TipEmojis.update = function (type_id, data, params) {
32520
+ return Requests.processRoute(TipEmojiRoute.routes.update, data, { type_id: type_id }, params);
32521
+ };
32522
+ /**
32523
+ * Retrieve a single emoji resource to be used when tipping.
32524
+ *
32525
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/showPostStorage
32526
+ *
32527
+ * @param type_id The id fo the post to retrieve.
32528
+ *
32529
+ * @returns promise
32530
+ */
32531
+ TipEmojis.view = function (type_id, params) {
32532
+ return Requests.processRoute(TipEmojiRoute.routes.view, {}, { type_id: type_id }, params);
32533
+ };
32534
+ /**
32535
+ * Delete an emoji resource.
32536
+ *
32537
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/destoryPostStorage
32538
+ *
32539
+ * @param type_id The id of the post to delete.
32540
+ * @returns promise
32541
+ */
32542
+ TipEmojis.delete = function (type_id, params) {
32543
+ return Requests.processRoute(TipEmojiRoute.routes.delete, {}, { type_id: type_id }, params);
32544
+ };
32545
+ return TipEmojis;
32546
+ }());
32547
+
32548
+ var TipPackagesRoute = /** @class */ (function () {
32549
+ function TipPackagesRoute() {
32550
+ }
32551
+ TipPackagesRoute.routes = {
32552
+ list: { url: '/tipspackages', method: HTTP_METHODS.GET },
32553
+ create: { url: '/tipspackages', method: HTTP_METHODS.POST },
32554
+ view: { url: '/tipspackages/{package_id}', method: HTTP_METHODS.GET },
32555
+ update: { url: '/tipspackages/{package_id}', method: HTTP_METHODS.PUT },
32556
+ DELETE: { url: '/tipspackages/{package_id}', method: HTTP_METHODS.DELETE },
32557
+ };
32558
+ return TipPackagesRoute;
32559
+ }());
32560
+
32561
+ var TipPackages = /** @class */ (function () {
32562
+ function TipPackages() {
32563
+ }
32564
+ /**
32565
+ * Retrieve a list of tip packages.
32566
+ *
32567
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/resourcePostList
32568
+ *
32569
+ * @returns promise
32570
+ */
32571
+ TipPackages.list = function (params) {
32572
+ return Requests.processRoute(TipPackagesRoute.routes.list, undefined, undefined, params);
32573
+ };
32574
+ /**
32575
+ * Create a new tip package.
32576
+ *
32577
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/newPostResourceStorage
32578
+ *
32579
+ * @param data The data to be passed when creating a post.
32580
+ *
32581
+ * @returns Promise
32582
+ */
32583
+ TipPackages.create = function (data, params) {
32584
+ return Requests.processRoute(TipPackagesRoute.routes.create, data, undefined, params);
32585
+ };
32586
+ /**
32587
+ * Update a tip package.
32588
+ *
32589
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/updatePostStorage
32590
+ *
32591
+ * @param package_id The id of the post to update.
32592
+ * @param data The data to update.
32593
+ *
32594
+ * @returns promise
32595
+ */
32596
+ TipPackages.update = function (package_id, data, params) {
32597
+ return Requests.processRoute(TipPackagesRoute.routes.update, data, { package_id: package_id }, params);
32598
+ };
32599
+ /**
32600
+ * Retrieve a single tip package resource.
32601
+ *
32602
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/showPostStorage
32603
+ *
32604
+ * @param package_id The id fo the post to retrieve.
32605
+ *
32606
+ * @returns promise
32607
+ */
32608
+ TipPackages.view = function (package_id, params) {
32609
+ return Requests.processRoute(TipPackagesRoute.routes.view, {}, { package_id: package_id }, params);
32610
+ };
32611
+ /**
32612
+ * Delete a tip package.
32613
+ *
32614
+ * @see https://api.glitch.fun/api/documentation#/Post%20Route/destoryPostStorage
32615
+ *
32616
+ * @param package_id The id of the post to delete.
32617
+ * @returns promise
32618
+ */
32619
+ TipPackages.delete = function (package_id, params) {
32620
+ return Requests.processRoute(TipPackagesRoute.routes.delete, {}, { package_id: package_id }, params);
32621
+ };
32622
+ return TipPackages;
32623
+ }());
32624
+
32625
+ var TipPackagePurchaseRoute = /** @class */ (function () {
32626
+ function TipPackagePurchaseRoute() {
32627
+ }
32628
+ TipPackagePurchaseRoute.routes = {
32629
+ stripe: { url: '/tipspackagepurchases/stripe', method: HTTP_METHODS.POST },
32630
+ };
32631
+ return TipPackagePurchaseRoute;
32632
+ }());
32633
+
32634
+ var TipPackagePurchases = /** @class */ (function () {
32635
+ function TipPackagePurchases() {
32636
+ }
32637
+ /**
32638
+ * Purchase a package with Stripe as the processor.
32639
+ *
32640
+ * @see https://api.glitch.fun/api/documentation#/Authentication%20Route/authLogin
32641
+ *
32642
+ * @returns A promise
32643
+ */
32644
+ TipPackagePurchases.stripe = function (data, params) {
32645
+ return Requests.processRoute(TipPackagePurchaseRoute.routes.stripe, data, {}, params);
32646
+ };
32647
+ return TipPackagePurchases;
32648
+ }());
32649
+
32453
32650
  var Parser = /** @class */ (function () {
32454
32651
  function Parser() {
32455
32652
  }
@@ -32829,6 +33026,10 @@ var Glitch = /** @class */ (function () {
32829
33026
  Templates: Templates,
32830
33027
  Waitlists: Waitlists,
32831
33028
  Utility: Utility,
33029
+ Tips: Tips,
33030
+ TipPackages: TipPackages,
33031
+ TipEmojis: TipEmojis,
33032
+ TipPackagePurchases: TipPackagePurchases
32832
33033
  };
32833
33034
  Glitch.util = {
32834
33035
  Requests: Requests,