glitch-javascript-sdk 1.2.6 → 1.2.8

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,187 @@
1
+ import GameShowsRoute from "../routes/GameShowsRoute";
2
+ import Requests from "../util/Requests";
3
+ import Response from "../util/Response";
4
+ import { AxiosPromise } from "axios";
5
+
6
+ class GameShows {
7
+
8
+ /**
9
+ * List all the GameShows.
10
+ *
11
+ * @see https://api.glitch.fun/api/documentation#/GameShows/getGameShows
12
+ *
13
+ * @returns promise
14
+ */
15
+ public static list<T>(params?: Record<string, any>): AxiosPromise<Response<T>> {
16
+ return Requests.processRoute(GameShowsRoute.routes.list, undefined, undefined, params);
17
+ }
18
+
19
+ /**
20
+ * Create a new game show.
21
+ *
22
+ * @see https://api.glitch.fun/api/documentation#/GameShows/createGameShow
23
+ *
24
+ * @param data The data to be passed when creating a game show.
25
+ *
26
+ * @returns Promise
27
+ */
28
+ public static create<T>(data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
29
+
30
+ return Requests.processRoute(GameShowsRoute.routes.create, data, undefined, params);
31
+ }
32
+
33
+ /**
34
+ * Update a game show.
35
+ *
36
+ * @see https://api.glitch.fun/api/documentation#/GameShows/updateGameShow
37
+ *
38
+ * @param show_id The id of the game show to update.
39
+ * @param data The data to update.
40
+ *
41
+ * @returns promise
42
+ */
43
+ public static update<T>(show_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
44
+
45
+ return Requests.processRoute(GameShowsRoute.routes.update, data, { show_id: show_id }, params);
46
+ }
47
+
48
+ /**
49
+ * Retrieve the information for a single game show.
50
+ *
51
+ * @see https://api.glitch.fun/api/documentation#/GameShows/getGameShowByUuid
52
+ *
53
+ * @param show_id The id fo the game show to retrieve.
54
+ *
55
+ * @returns promise
56
+ */
57
+ public static view<T>(show_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
58
+
59
+ return Requests.processRoute(GameShowsRoute.routes.view, {}, { show_id: show_id }, params);
60
+ }
61
+
62
+ /**
63
+ * Deletes a game show.
64
+ *
65
+ * @see https://api.glitch.fun/api/documentation#/GameShows/deleteGameShow
66
+ *
67
+ * @param show_id The id of the game show to delete.
68
+ * @returns promise
69
+ */
70
+ public static delete<T>(show_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
71
+
72
+ return Requests.processRoute(GameShowsRoute.routes.delete, {}, { show_id: show_id }, params);
73
+ }
74
+
75
+ /**
76
+ * Updates the main image for the game show using a File object.
77
+ *
78
+ * @see https://api.glitch.fun/api/documentation#/GameShows/uploadGameShowLogo
79
+ *
80
+ * @param file The file object to upload.
81
+ * @param data Any additional data to pass along to the upload.
82
+ *
83
+ * @returns promise
84
+ */
85
+ public static uploadLogoFile<T>(show_id: string, file: File, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
86
+
87
+ let url = GameShowsRoute.routes.uploadLogo.url.replace('{show_id}', show_id);
88
+
89
+ return Requests.uploadFile(url, 'image', file, data);
90
+ }
91
+
92
+ /**
93
+ * Updates the main image for the game show using a Blob.
94
+ *
95
+ * @see https://api.glitch.fun/api/documentation#/GameShows/uploadGameShowLogo
96
+ *
97
+ * @param blob The blob to upload.
98
+ * @param data Any additional data to pass along to the upload
99
+ *
100
+ * @returns promise
101
+ */
102
+ public static uploadLogoBlob<T>(show_id: string, blob: Blob, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
103
+
104
+ let url = GameShowsRoute.routes.uploadLogo.url.replace('{show_id}', show_id);
105
+
106
+ return Requests.uploadBlob(url, 'image', blob, data);
107
+ }
108
+
109
+ /**
110
+ * Updates the banner image for the game show using a File object.
111
+ *
112
+ * @see https://api.glitch.fun/api/documentation#/GameShows/uploadGameShowBannerImage
113
+ *
114
+ * @param file The file object to upload.
115
+ * @param data Any additional data to pass along to the upload.
116
+ *
117
+ * @returns promise
118
+ */
119
+ public static uploadBannerImageFile<T>(show_id: string, file: File, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
120
+
121
+ let url = GameShowsRoute.routes.uploadBannerImage.url.replace('{show_id}', show_id);
122
+
123
+ return Requests.uploadFile(url, 'image', file, data);
124
+ }
125
+
126
+ /**
127
+ * Updates the banner image for the game show using a Blob.
128
+ *
129
+ * @see https://api.glitch.fun/api/documentation#/GameShows/uploadGameShowBannerImage
130
+ *
131
+ * @param blob The blob to upload.
132
+ * @param data Any additional data to pass along to the upload
133
+ *
134
+ * @returns promise
135
+ */
136
+ public static uploadBannerImageBlob<T>(show_id: string, blob: Blob, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
137
+
138
+ let url = GameShowsRoute.routes.uploadBannerImage.url.replace('{show_id}', show_id);
139
+
140
+ return Requests.uploadBlob(url, 'image', blob, data);
141
+ }
142
+
143
+ /**
144
+ * Register a title to a game show.
145
+ */
146
+ public static registerTitle<T>(show_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
147
+ return Requests.processRoute(GameShowsRoute.routes.registerTitle, data, { show_id: show_id }, params);
148
+ }
149
+
150
+ /**
151
+ * Add a title to a game show by admin.
152
+ */
153
+ public static addTitle<T>(show_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
154
+ return Requests.processRoute(GameShowsRoute.routes.addTitle, data, { show_id: show_id }, params);
155
+ }
156
+
157
+ /**
158
+ * List all titles for a game show.
159
+ */
160
+ public static listTitles<T>(show_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
161
+ return Requests.processRoute(GameShowsRoute.routes.listTitles, {}, { show_id: show_id }, params);
162
+ }
163
+
164
+ /**
165
+ * Get details of a specific title in a game show.
166
+ */
167
+ public static getTitle<T>(show_id: string, title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
168
+ return Requests.processRoute(GameShowsRoute.routes.getTitle, {}, { show_id: show_id, title_id: title_id }, params);
169
+ }
170
+
171
+ /**
172
+ * Update a specific title in a game show.
173
+ */
174
+ public static updateTitle<T>(show_id: string, title_id: string, data: object, params?: Record<string, any>): AxiosPromise<Response<T>> {
175
+ return Requests.processRoute(GameShowsRoute.routes.updateTitle, data, { show_id: show_id, title_id: title_id }, params);
176
+ }
177
+
178
+ /**
179
+ * Delete a specific title from a game show.
180
+ */
181
+ public static deleteTitle<T>(show_id: string, title_id: string, params?: Record<string, any>): AxiosPromise<Response<T>> {
182
+ return Requests.processRoute(GameShowsRoute.routes.deleteTitle, {}, { show_id: show_id, title_id: title_id }, params);
183
+ }
184
+
185
+ }
186
+
187
+ export default GameShows;
@@ -115,6 +115,17 @@ class Influencers {
115
115
  return Requests.processRoute(InfluencerRoutes.routes.listContracts, undefined, undefined, params);
116
116
  }
117
117
 
118
+ /**
119
+ * Download the influencer work
120
+ *
121
+ * @see https://api.glitch.fun/api/documentation#/Influencers/downloadInfluencersWorkbook
122
+ *
123
+ * @returns promise
124
+ */
125
+ public static workbook<T>(data?: object, params?: Record<string, any>) : AxiosPromise<Response<T>> {
126
+ return Requests.processRoute(InfluencerRoutes.routes.workbook, data, {}, params);
127
+ }
128
+
118
129
 
119
130
  }
120
131
 
@@ -25,7 +25,7 @@ class Publications {
25
25
  *
26
26
  * @returns Promise
27
27
  */
28
- public static create<T>(data : object, params?: Record<string, any>) : AxiosPromise<Response<T>> {
28
+ public static download<T>(data : object, params?: Record<string, any>) : AxiosPromise<Response<T>> {
29
29
 
30
30
  return Requests.processRoute(PublicationsRoutes.routes.download, data, undefined, params);
31
31
  }
package/src/api/index.ts CHANGED
@@ -22,6 +22,7 @@ import Feedback from "./Feedback";
22
22
  import Influencers from "./Influencers";
23
23
  import Games from "./Games";
24
24
  import Publications from "./Publications";
25
+ import GameShows from "./GameShows";
25
26
 
26
27
  export {Auth};
27
28
  export {Competitions};
@@ -46,4 +47,5 @@ export {Messages};
46
47
  export {Feedback};
47
48
  export {Influencers};
48
49
  export {Games};
49
- export {Publications};
50
+ export {Publications};
51
+ export {GameShows};
package/src/index.ts CHANGED
@@ -26,6 +26,7 @@ import {Feedback} from "./api";
26
26
  import {Influencers} from "./api";
27
27
  import {Games} from "./api";
28
28
  import {Publications} from "./api";
29
+ import {GameShows} from "./api";
29
30
 
30
31
 
31
32
 
@@ -66,6 +67,7 @@ class Glitch {
66
67
  Users: Users,
67
68
  Events: Events,
68
69
  Games : Games,
70
+ GameShows : GameShows,
69
71
  Feedback : Feedback,
70
72
  Influencers : Influencers,
71
73
  Teams: Teams,
@@ -2,42 +2,72 @@ import Route from "./interface";
2
2
  import HTTP_METHODS from "../constants/HttpMethods";
3
3
 
4
4
  class CommunitiesRoute {
5
-
6
- public static routes: { [key: string]: Route } = {
7
- list: { url: '/communities', method: HTTP_METHODS.GET },
8
- create: { url: '/communities', method: HTTP_METHODS.POST },
9
- view : { url: '/communities/{community_id}', method: HTTP_METHODS.GET },
10
- update :{ url: '/communities/{community_id}', method: HTTP_METHODS.PUT },
11
- delete : { url: '/communities/{community_id}', method: HTTP_METHODS.DELETE },
12
- uploadLogo : {url: '/communities/{community_id}/uploadLogo', method : HTTP_METHODS.POST },
13
- uploadBannerImage : {url : '/communities/{community_id}/uploadBannerImage', method : HTTP_METHODS.POST },
14
- uploadVideoLogo : {url : '/communities/{community_id}/uploadVideoLogo', method : HTTP_METHODS.POST },
15
- listInvites : {url : '/communities/{community_id}/invites', method : HTTP_METHODS.GET },
16
- sendInvite : {url: '/communities/{community_id}/sendInvite', method : HTTP_METHODS.POST},
17
- acceptInvite : {url : '/communities/{community_id}/acceptInvite', method: HTTP_METHODS.POST},
18
- retrieveInvite : {url : '/communities/{community_id}/invites/{token}', method: HTTP_METHODS.GET},
19
- listUsers : {url : '/communities/{community_id}/users', method : HTTP_METHODS.GET},
20
- addUser : {url : '/communities/{community_id}/users', method : HTTP_METHODS.POST},
21
- showUser : {url : '/communities/{community_id}/users/{user_id}', method : HTTP_METHODS.GET},
22
- updateUser : {url : '/communities/{community_id}/users/{user_id}', method : HTTP_METHODS.PUT},
23
- removeUser : {url : '/communities/{community_id}/users/{user_id}', method : HTTP_METHODS.DELETE},
24
- join : {url : '/communities/{community_id}/join', method : HTTP_METHODS.POST},
25
- findByDomain : {url : '/communities/findByDomain/{domain}', method : HTTP_METHODS.GET},
26
- addPaymentMethod : {url : '/communities/{community_id}/payment/methods', method : HTTP_METHODS.POST},
27
- getPaymentMethods : {url : '/communities/{community_id}/payment/methods', method : HTTP_METHODS.GET},
28
- setDefaultPaymentMethod : {url : '/communities/{community_id}/payment/methods/default', method : HTTP_METHODS.POST},
29
- getLedger : {url : '/communities/{community_id}/payment/ledger', method : HTTP_METHODS.GET},
30
- clearDocusignAuth : { url: '/communities/{community_id}/clearDocusignAuth', method: HTTP_METHODS.DELETE },
31
- clearHellosignAuth : { url: '/communities/{community_id}/clearHellosignAuth', method: HTTP_METHODS.DELETE },
32
- clearSimplesignAuth : { url: '/communities/{community_id}/clearSimplesignAuth', method: HTTP_METHODS.DELETE },
33
- listEmailTemplates : { url: '/communities/{community_id}/emails/templates', method: HTTP_METHODS.GET },
34
- createEmailTemplate: { url: '/communities/{community_id}/emails/templates', method: HTTP_METHODS.POST },
35
- viewEmailTemplate : { url: '/communities/{community_id}/emails/templates/{template_id}', method: HTTP_METHODS.GET },
36
- updateEmailTemplate :{ url: '/communities/{community_id}/emails/templates/{template_id}', method: HTTP_METHODS.PUT },
37
- deleteEmailTemplate : { url: '/communities/{community_id}/emails/templates/{template_id}', method: HTTP_METHODS.DELETE },
38
- populateEmailTemplate: { url: '/communities/{community_id}/emails/templates/{template_id}/populate', method: HTTP_METHODS.POST },
39
- };
40
-
41
- }
42
-
43
- export default CommunitiesRoute;
5
+
6
+ public static routes: { [key: string]: Route } = {
7
+ list: { url: '/communities', method: HTTP_METHODS.GET },
8
+ create: { url: '/communities', method: HTTP_METHODS.POST },
9
+ view: { url: '/communities/{community_id}', method: HTTP_METHODS.GET },
10
+ update: { url: '/communities/{community_id}', method: HTTP_METHODS.PUT },
11
+ delete: { url: '/communities/{community_id}', method: HTTP_METHODS.DELETE },
12
+ uploadLogo: { url: '/communities/{community_id}/uploadLogo', method: HTTP_METHODS.POST },
13
+ uploadBannerImage: { url: '/communities/{community_id}/uploadBannerImage', method: HTTP_METHODS.POST },
14
+ uploadVideoLogo: { url: '/communities/{community_id}/uploadVideoLogo', method: HTTP_METHODS.POST },
15
+ listInvites: { url: '/communities/{community_id}/invites', method: HTTP_METHODS.GET },
16
+ sendInvite: { url: '/communities/{community_id}/sendInvite', method: HTTP_METHODS.POST },
17
+ acceptInvite: { url: '/communities/{community_id}/acceptInvite', method: HTTP_METHODS.POST },
18
+ retrieveInvite: { url: '/communities/{community_id}/invites/{token}', method: HTTP_METHODS.GET },
19
+ listUsers: { url: '/communities/{community_id}/users', method: HTTP_METHODS.GET },
20
+ addUser: { url: '/communities/{community_id}/users', method: HTTP_METHODS.POST },
21
+ showUser: { url: '/communities/{community_id}/users/{user_id}', method: HTTP_METHODS.GET },
22
+ updateUser: { url: '/communities/{community_id}/users/{user_id}', method: HTTP_METHODS.PUT },
23
+ removeUser: { url: '/communities/{community_id}/users/{user_id}', method: HTTP_METHODS.DELETE },
24
+ join: { url: '/communities/{community_id}/join', method: HTTP_METHODS.POST },
25
+ findByDomain: { url: '/communities/findByDomain/{domain}', method: HTTP_METHODS.GET },
26
+ addPaymentMethod: { url: '/communities/{community_id}/payment/methods', method: HTTP_METHODS.POST },
27
+ getPaymentMethods: { url: '/communities/{community_id}/payment/methods', method: HTTP_METHODS.GET },
28
+ setDefaultPaymentMethod: { url: '/communities/{community_id}/payment/methods/default', method: HTTP_METHODS.POST },
29
+ getLedger: { url: '/communities/{community_id}/payment/ledger', method: HTTP_METHODS.GET },
30
+ clearDocusignAuth: { url: '/communities/{community_id}/clearDocusignAuth', method: HTTP_METHODS.DELETE },
31
+ clearHellosignAuth: { url: '/communities/{community_id}/clearHellosignAuth', method: HTTP_METHODS.DELETE },
32
+ clearSimplesignAuth: { url: '/communities/{community_id}/clearSimplesignAuth', method: HTTP_METHODS.DELETE },
33
+ listEmailTemplates: { url: '/communities/{community_id}/emails/templates', method: HTTP_METHODS.GET },
34
+ createEmailTemplate: { url: '/communities/{community_id}/emails/templates', method: HTTP_METHODS.POST },
35
+ viewEmailTemplate: { url: '/communities/{community_id}/emails/templates/{template_id}', method: HTTP_METHODS.GET },
36
+ updateEmailTemplate: { url: '/communities/{community_id}/emails/templates/{template_id}', method: HTTP_METHODS.PUT },
37
+ deleteEmailTemplate: { url: '/communities/{community_id}/emails/templates/{template_id}', method: HTTP_METHODS.DELETE },
38
+ populateEmailTemplate: { url: '/communities/{community_id}/emails/templates/{template_id}/populate', method: HTTP_METHODS.POST },
39
+
40
+ // Newsletters
41
+ listNewsletters: { url: '/communities/{community_id}/newsletters', method: HTTP_METHODS.GET },
42
+ createNewsletter: { url: '/communities/{community_id}/newsletters', method: HTTP_METHODS.POST },
43
+ viewNewsletter: { url: '/communities/{community_id}/newsletters/{newsletter_id}', method: HTTP_METHODS.GET },
44
+ updateNewsletter: { url: '/communities/{community_id}/newsletters/{newsletter_id}', method: HTTP_METHODS.PUT },
45
+ deleteNewsletter: { url: '/communities/{community_id}/newsletters/{newsletter_id}', method: HTTP_METHODS.DELETE },
46
+ importNewsletterSubscribers: { url: '/communities/{community_id}/newsletters/{newsletter_id}/subscribers/import', method: HTTP_METHODS.POST },
47
+ uploadNewsletterBannerImage: { url: '/communities/{community_id}/newsletters/{newsletter_id}/uploadBannerImage', method: HTTP_METHODS.POST },
48
+
49
+ // Campaigns
50
+ listCampaigns: { url: '/communities/{community_id}/newsletters/{newsletter_id}/campaigns', method: HTTP_METHODS.GET },
51
+ createCampaign: { url: '/communities/{community_id}/newsletters/{newsletter_id}/campaigns', method: HTTP_METHODS.POST },
52
+ viewCampaign: { url: '/communities/{community_id}/newsletters/{newsletter_id}/campaigns/{campaign_id}', method: HTTP_METHODS.GET },
53
+ updateCampaign: { url: '/communities/{community_id}/newsletters/{newsletter_id}/campaigns/{campaign_id}', method: HTTP_METHODS.PUT },
54
+ deleteCampaign: { url: '/communities/{community_id}/newsletters/{newsletter_id}/campaigns/{campaign_id}', method: HTTP_METHODS.DELETE },
55
+ sendCampaign: { url: '/communities/{community_id}/newsletters/{newsletter_id}/campaigns/{campaign_id}/send', method: HTTP_METHODS.POST },
56
+ scheduleCampaign: { url: '/communities/{community_id}/newsletters/{newsletter_id}/campaigns/{campaign_id}/schedule', method: HTTP_METHODS.POST },
57
+
58
+ // Emails
59
+ listCampaignEmails: { url: '/communities/{community_id}/newsletters/{newsletter_id}/campaigns/{campaign_id}/emails', method: HTTP_METHODS.GET },
60
+
61
+ // Subscribers (admin routes)
62
+ listNewsletterSubscribers: { url: '/communities/{community_id}/newsletters/{newsletter_id}/subscribers', method: HTTP_METHODS.GET },
63
+ viewNewsletterSubscriber: { url: '/communities/{community_id}/newsletters/{newsletter_id}/subscribers/{subscriber_id}', method: HTTP_METHODS.GET },
64
+ updateNewsletterSubscriber: { url: '/communities/{community_id}/newsletters/{newsletter_id}/subscribers/{subscriber_id}', method: HTTP_METHODS.PUT },
65
+ deleteNewsletterSubscriber: { url: '/communities/{community_id}/newsletters/{newsletter_id}/subscribers/{subscriber_id}', method: HTTP_METHODS.DELETE },
66
+
67
+ // Subscriber registration (open route)
68
+ registerNewsletterSubscriber: { url: '/communities/{community_id}/newsletters/{newsletter_id}/subscribers', method: HTTP_METHODS.POST },
69
+ };
70
+
71
+ }
72
+
73
+ export default CommunitiesRoute;
@@ -0,0 +1,24 @@
1
+ import Route from "./interface";
2
+ import HTTP_METHODS from "../constants/HttpMethods";
3
+
4
+ class GameShowsRoute {
5
+
6
+ public static routes: { [key: string]: Route } = {
7
+ list: { url: '/gameshows', method: HTTP_METHODS.GET },
8
+ create: { url: '/gameshows', method: HTTP_METHODS.POST },
9
+ view : { url: '/gameshows/{show_id}', method: HTTP_METHODS.GET },
10
+ update :{ url: '/gameshows/{show_id}', method: HTTP_METHODS.PUT },
11
+ delete : { url: '/gameshows/{show_id}', method: HTTP_METHODS.DELETE },
12
+ uploadLogo : {url : '/gameshows/{show_id}/uploadLogo', method: HTTP_METHODS.POST},
13
+ uploadBannerImage : {url : '/gameshows/{show_id}/uploadBannerImage', method: HTTP_METHODS.POST},
14
+ registerTitle: { url: '/gameshows/{show_id}/registerTitle', method: HTTP_METHODS.POST },
15
+ listTitles: { url: '/gameshows/{show_id}/titles', method: HTTP_METHODS.GET },
16
+ addTitle: { url: '/gameshows/{show_id}/addTitle', method: HTTP_METHODS.POST },
17
+ viewTitle: { url: '/gameshows/{show_id}/titles/{title_id}', method: HTTP_METHODS.GET },
18
+ updateTitle: { url: '/gameshows/{show_id}/titles/{title_id}', method: HTTP_METHODS.PUT },
19
+ deleteTitle: { url: '/gameshows/{show_id}/titles/{title_id}', method: HTTP_METHODS.DELETE },
20
+ };
21
+
22
+ }
23
+
24
+ export default GameShowsRoute;
@@ -14,6 +14,7 @@ class InfluencerRoutes {
14
14
  updateNote: { url: '/influencers/{influencer_id}/notes/{note_id}', method: HTTP_METHODS.PUT },
15
15
  deleteNote: { url: '/influencers/{influencer_id}/notes/{note_id}', method: HTTP_METHODS.DELETE },
16
16
  listContracts: { url: '/influencers/contracts', method: HTTP_METHODS.GET },
17
+ workbook : { url: '/influencers/workbook', method: HTTP_METHODS.POST },
17
18
  };
18
19
 
19
20
  }