glitch-javascript-sdk 1.2.9 → 1.3.1

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,7 @@
1
+ import Route from "./interface";
2
+ declare class NewslettersRoutes {
3
+ static routes: {
4
+ [key: string]: Route;
5
+ };
6
+ }
7
+ export default NewslettersRoutes;
@@ -0,0 +1,7 @@
1
+ import Route from "./interface";
2
+ declare class PlayTestsRoute {
3
+ static routes: {
4
+ [key: string]: Route;
5
+ };
6
+ }
7
+ export default PlayTestsRoute;
package/dist/index.d.ts CHANGED
@@ -3707,6 +3707,112 @@ declare class GameShows {
3707
3707
  static deleteTitle<T>(show_id: string, title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
3708
3708
  }
3709
3709
 
3710
+ declare class Newsletters {
3711
+ /**
3712
+ * Download the list of publictions, podcasts and blogs.
3713
+ *
3714
+ * @see https://api.glitch.fun/api/documentation#/Newsletters/downloadMarketingChecklists
3715
+ *
3716
+ * @param data The data to be passed when creating a team.
3717
+ *
3718
+ * @returns Promise
3719
+ */
3720
+ static downloadMarketingChecklist<T>(data: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
3721
+ }
3722
+
3723
+ declare class PlayTests {
3724
+ /**
3725
+ * Get a list of play tests associated with a title.
3726
+ *
3727
+ * @param title_id The ID of the title.
3728
+ * @param params Optional query parameters.
3729
+ * @returns Promise
3730
+ */
3731
+ static index<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
3732
+ /**
3733
+ * User requests to test a title.
3734
+ *
3735
+ * @param title_id The ID of the title.
3736
+ * @param data Optional data for the request.
3737
+ * @returns Promise
3738
+ */
3739
+ static requestPlayTest<T>(title_id: string, data?: object): AxiosPromise<Response<T>>;
3740
+ /**
3741
+ * Title administrator invites a user to test a title.
3742
+ *
3743
+ * @param title_id The ID of the title.
3744
+ * @param data The data containing user_id and other optional fields.
3745
+ * @returns Promise
3746
+ */
3747
+ static invitePlayTester<T>(title_id: string, data: object): AxiosPromise<Response<T>>;
3748
+ /**
3749
+ * User submits or updates their answers for a play test.
3750
+ *
3751
+ * @param title_id The ID of the title.
3752
+ * @param playtest_id The ID of the play test.
3753
+ * @param data The answers data.
3754
+ * @returns Promise
3755
+ */
3756
+ static submitAnswers<T>(title_id: string, playtest_id: string, data: object): AxiosPromise<Response<T>>;
3757
+ /**
3758
+ * Title admin updates test questions for a play test.
3759
+ *
3760
+ * @param title_id The ID of the title.
3761
+ * @param playtest_id The ID of the play test.
3762
+ * @param data The questions data.
3763
+ * @returns Promise
3764
+ */
3765
+ static updateQuestions<T>(title_id: string, playtest_id: string, data: object): AxiosPromise<Response<T>>;
3766
+ /**
3767
+ * User accepts an invite to a play test.
3768
+ *
3769
+ * @param title_id The ID of the title.
3770
+ * @param playtest_id The ID of the play test.
3771
+ * @returns Promise
3772
+ */
3773
+ static acceptInvite<T>(title_id: string, playtest_id: string): AxiosPromise<Response<T>>;
3774
+ /**
3775
+ * User rejects an invite to a play test.
3776
+ *
3777
+ * @param title_id The ID of the title.
3778
+ * @param playtest_id The ID of the play test.
3779
+ * @returns Promise
3780
+ */
3781
+ static rejectInvite<T>(title_id: string, playtest_id: string): AxiosPromise<Response<T>>;
3782
+ /**
3783
+ * Title admin approves a user's play test request.
3784
+ *
3785
+ * @param title_id The ID of the title.
3786
+ * @param playtest_id The ID of the play test.
3787
+ * @returns Promise
3788
+ */
3789
+ static approveRequest<T>(title_id: string, playtest_id: string): AxiosPromise<Response<T>>;
3790
+ /**
3791
+ * Title admin declines a user's play test request.
3792
+ *
3793
+ * @param title_id The ID of the title.
3794
+ * @param playtest_id The ID of the play test.
3795
+ * @returns Promise
3796
+ */
3797
+ static declineRequest<T>(title_id: string, playtest_id: string): AxiosPromise<Response<T>>;
3798
+ /**
3799
+ * User cancels their own play test request.
3800
+ *
3801
+ * @param title_id The ID of the title.
3802
+ * @param playtest_id The ID of the play test.
3803
+ * @returns Promise
3804
+ */
3805
+ static cancelRequest<T>(title_id: string, playtest_id: string): AxiosPromise<Response<T>>;
3806
+ /**
3807
+ * Retrieve a single play test.
3808
+ *
3809
+ * @param title_id The ID of the title.
3810
+ * @param playtest_id The ID of the play test.
3811
+ * @returns Promise
3812
+ */
3813
+ static show<T>(title_id: string, playtest_id: string): AxiosPromise<Response<T>>;
3814
+ }
3815
+
3710
3816
  interface Route {
3711
3817
  url: string;
3712
3818
  method: string;
@@ -4031,6 +4137,8 @@ declare class Glitch {
4031
4137
  TipEmojis: typeof TipEmojis;
4032
4138
  TipPackagePurchases: typeof TipPackagePurchases;
4033
4139
  Publications: typeof Publications;
4140
+ Newsletters: typeof Newsletters;
4141
+ PlayTests: typeof PlayTests;
4034
4142
  };
4035
4143
  static util: {
4036
4144
  Requests: typeof Requests;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "1.2.9",
3
+ "version": "1.3.1",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -0,0 +1,28 @@
1
+ import NewslettersRoutes from "../routes/NewslettersRoutes";
2
+ import Requests from "../util/Requests";
3
+ import Response from "../util/Response";
4
+ import { AxiosPromise } from "axios";
5
+
6
+ class Newsletters {
7
+
8
+
9
+ /**
10
+ * Download the list of publictions, podcasts and blogs.
11
+ *
12
+ * @see https://api.glitch.fun/api/documentation#/Newsletters/downloadMarketingChecklists
13
+ *
14
+ * @param data The data to be passed when creating a team.
15
+ *
16
+ * @returns Promise
17
+ */
18
+ public static downloadMarketingChecklist<T>(data : object, params?: Record<string, any>) : AxiosPromise<Response<T>> {
19
+
20
+ return Requests.processRoute(NewslettersRoutes.routes.downloadMarketingChecklist, data, undefined, params);
21
+ }
22
+
23
+
24
+
25
+
26
+ }
27
+
28
+ export default Newsletters;
@@ -0,0 +1,131 @@
1
+ import PlayTestsRoute from "../routes/PlayTestsRoute";
2
+ import Requests from "../util/Requests";
3
+ import Response from "../util/Response";
4
+ import { AxiosPromise } from "axios";
5
+
6
+ class PlayTests {
7
+ /**
8
+ * Get a list of play tests associated with a title.
9
+ *
10
+ * @param title_id The ID of the title.
11
+ * @param params Optional query parameters.
12
+ * @returns Promise
13
+ */
14
+ public static index<T>(title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
15
+ return Requests.processRoute(PlayTestsRoute.routes.index, undefined, { title_id }, params);
16
+ }
17
+
18
+ /**
19
+ * User requests to test a title.
20
+ *
21
+ * @param title_id The ID of the title.
22
+ * @param data Optional data for the request.
23
+ * @returns Promise
24
+ */
25
+ public static requestPlayTest<T>(title_id: string, data?: object): AxiosPromise<Response<T>> {
26
+ return Requests.processRoute(PlayTestsRoute.routes.request, data, { title_id });
27
+ }
28
+
29
+ /**
30
+ * Title administrator invites a user to test a title.
31
+ *
32
+ * @param title_id The ID of the title.
33
+ * @param data The data containing user_id and other optional fields.
34
+ * @returns Promise
35
+ */
36
+ public static invitePlayTester<T>(title_id: string, data: object): AxiosPromise<Response<T>> {
37
+ return Requests.processRoute(PlayTestsRoute.routes.invite, data, { title_id });
38
+ }
39
+
40
+ /**
41
+ * User submits or updates their answers for a play test.
42
+ *
43
+ * @param title_id The ID of the title.
44
+ * @param playtest_id The ID of the play test.
45
+ * @param data The answers data.
46
+ * @returns Promise
47
+ */
48
+ public static submitAnswers<T>(title_id: string, playtest_id: string, data: object): AxiosPromise<Response<T>> {
49
+ return Requests.processRoute(PlayTestsRoute.routes.submitAnswers, data, { title_id, playtest_id });
50
+ }
51
+
52
+ /**
53
+ * Title admin updates test questions for a play test.
54
+ *
55
+ * @param title_id The ID of the title.
56
+ * @param playtest_id The ID of the play test.
57
+ * @param data The questions data.
58
+ * @returns Promise
59
+ */
60
+ public static updateQuestions<T>(title_id: string, playtest_id: string, data: object): AxiosPromise<Response<T>> {
61
+ return Requests.processRoute(PlayTestsRoute.routes.updateQuestions, data, { title_id, playtest_id });
62
+ }
63
+
64
+ /**
65
+ * User accepts an invite to a play test.
66
+ *
67
+ * @param title_id The ID of the title.
68
+ * @param playtest_id The ID of the play test.
69
+ * @returns Promise
70
+ */
71
+ public static acceptInvite<T>(title_id: string, playtest_id: string): AxiosPromise<Response<T>> {
72
+ return Requests.processRoute(PlayTestsRoute.routes.acceptInvite, {}, { title_id, playtest_id });
73
+ }
74
+
75
+ /**
76
+ * User rejects an invite to a play test.
77
+ *
78
+ * @param title_id The ID of the title.
79
+ * @param playtest_id The ID of the play test.
80
+ * @returns Promise
81
+ */
82
+ public static rejectInvite<T>(title_id: string, playtest_id: string): AxiosPromise<Response<T>> {
83
+ return Requests.processRoute(PlayTestsRoute.routes.rejectInvite, {}, { title_id, playtest_id });
84
+ }
85
+
86
+ /**
87
+ * Title admin approves a user's play test request.
88
+ *
89
+ * @param title_id The ID of the title.
90
+ * @param playtest_id The ID of the play test.
91
+ * @returns Promise
92
+ */
93
+ public static approveRequest<T>(title_id: string, playtest_id: string): AxiosPromise<Response<T>> {
94
+ return Requests.processRoute(PlayTestsRoute.routes.approveRequest, {}, { title_id, playtest_id });
95
+ }
96
+
97
+ /**
98
+ * Title admin declines a user's play test request.
99
+ *
100
+ * @param title_id The ID of the title.
101
+ * @param playtest_id The ID of the play test.
102
+ * @returns Promise
103
+ */
104
+ public static declineRequest<T>(title_id: string, playtest_id: string): AxiosPromise<Response<T>> {
105
+ return Requests.processRoute(PlayTestsRoute.routes.declineRequest, {}, { title_id, playtest_id });
106
+ }
107
+
108
+ /**
109
+ * User cancels their own play test request.
110
+ *
111
+ * @param title_id The ID of the title.
112
+ * @param playtest_id The ID of the play test.
113
+ * @returns Promise
114
+ */
115
+ public static cancelRequest<T>(title_id: string, playtest_id: string): AxiosPromise<Response<T>> {
116
+ return Requests.processRoute(PlayTestsRoute.routes.cancelRequest, {}, { title_id, playtest_id });
117
+ }
118
+
119
+ /**
120
+ * Retrieve a single play test.
121
+ *
122
+ * @param title_id The ID of the title.
123
+ * @param playtest_id The ID of the play test.
124
+ * @returns Promise
125
+ */
126
+ public static show<T>(title_id: string, playtest_id: string): AxiosPromise<Response<T>> {
127
+ return Requests.processRoute(PlayTestsRoute.routes.show, {}, { title_id, playtest_id });
128
+ }
129
+ }
130
+
131
+ export default PlayTests;
package/src/api/index.ts CHANGED
@@ -23,6 +23,8 @@ import Influencers from "./Influencers";
23
23
  import Games from "./Games";
24
24
  import Publications from "./Publications";
25
25
  import GameShows from "./GameShows";
26
+ import Newsletters from "./Newsletters"
27
+ import PlayTests from "./PlayTests";
26
28
 
27
29
  export {Auth};
28
30
  export {Competitions};
@@ -48,4 +50,6 @@ export {Feedback};
48
50
  export {Influencers};
49
51
  export {Games};
50
52
  export {Publications};
51
- export {GameShows};
53
+ export {GameShows};
54
+ export {Newsletters};
55
+ export {PlayTests};
package/src/index.ts CHANGED
@@ -27,6 +27,8 @@ import {Influencers} from "./api";
27
27
  import {Games} from "./api";
28
28
  import {Publications} from "./api";
29
29
  import {GameShows} from "./api";
30
+ import {Newsletters} from "./api";
31
+ import {PlayTests} from "./api";
30
32
 
31
33
 
32
34
 
@@ -84,7 +86,9 @@ class Glitch {
84
86
  TipPackages : TipPackages,
85
87
  TipEmojis : TipEmojis ,
86
88
  TipPackagePurchases: TipPackagePurchases,
87
- Publications : Publications
89
+ Publications : Publications,
90
+ Newsletters : Newsletters,
91
+ PlayTests : PlayTests
88
92
  }
89
93
 
90
94
  public static util = {
@@ -0,0 +1,12 @@
1
+ import Route from "./interface";
2
+ import HTTP_METHODS from "../constants/HttpMethods";
3
+
4
+ class NewslettersRoutes {
5
+
6
+ public static routes: { [key: string]: Route } = {
7
+ downloadMarketingChecklist: { url: '/newsletters/downloadMarketingChecklist', method: HTTP_METHODS.POST },
8
+ };
9
+
10
+ }
11
+
12
+ export default NewslettersRoutes;
@@ -0,0 +1,20 @@
1
+ import Route from "./interface";
2
+ import HTTP_METHODS from "../constants/HttpMethods";
3
+
4
+ class PlayTestsRoute {
5
+ public static routes: { [key: string]: Route } = {
6
+ index: { url: '/playtests/{title_id}', method: HTTP_METHODS.GET },
7
+ request: { url: '/playtests/{title_id}/request', method: HTTP_METHODS.POST },
8
+ invite: { url: '/playtests/{title_id}/invite', method: HTTP_METHODS.POST },
9
+ submitAnswers: { url: '/playtests/{title_id}/answers/{playtest_id}', method: HTTP_METHODS.PUT },
10
+ updateQuestions: { url: '/playtests/{title_id}/questions/{playtest_id}', method: HTTP_METHODS.PUT },
11
+ acceptInvite: { url: '/playtests/{title_id}/accept/{playtest_id}', method: HTTP_METHODS.POST },
12
+ rejectInvite: { url: '/playtests/{title_id}/reject/{playtest_id}', method: HTTP_METHODS.POST },
13
+ approveRequest: { url: '/playtests/{title_id}/approve/{playtest_id}', method: HTTP_METHODS.POST },
14
+ declineRequest: { url: '/playtests/{title_id}/decline/{playtest_id}', method: HTTP_METHODS.POST },
15
+ cancelRequest: { url: '/playtests/{title_id}/cancel/{playtest_id}', method: HTTP_METHODS.POST },
16
+ show: { url: '/playtests/{title_id}/view/{playtest_id}', method: HTTP_METHODS.GET },
17
+ };
18
+ }
19
+
20
+ export default PlayTestsRoute;