glitch-javascript-sdk 0.0.3 → 0.0.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 +28 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Events.d.ts +205 -0
- package/dist/esm/api/Teams.d.ts +179 -0
- package/dist/esm/api/Users.d.ts +53 -0
- package/dist/esm/api/index.d.ts +2 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +28 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/TeamsRoute.d.ts +7 -0
- package/dist/esm/util/Requests.d.ts +2 -0
- package/dist/index.d.ts +436 -0
- package/package.json +1 -1
- package/src/api/Events.ts +306 -8
- package/src/api/Teams.ts +256 -0
- package/src/api/Users.ts +74 -0
- package/src/api/index.ts +3 -1
- package/src/index.ts +4 -2
- package/src/routes/EventsRoute.ts +18 -16
- package/src/routes/TeamsRoute.ts +26 -0
- package/src/routes/UserRoutes.ts +1 -1
- package/src/util/Requests.ts +53 -6
package/src/api/Events.ts
CHANGED
|
@@ -12,7 +12,7 @@ class Events {
|
|
|
12
12
|
*
|
|
13
13
|
* @returns promise
|
|
14
14
|
*/
|
|
15
|
-
public static list<T>()
|
|
15
|
+
public static list<T>(): AxiosPromise<Response<T>> {
|
|
16
16
|
return Requests.processRoute(EventsRoutes.routes.list);
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -25,7 +25,7 @@ class Events {
|
|
|
25
25
|
*
|
|
26
26
|
* @returns Promise
|
|
27
27
|
*/
|
|
28
|
-
public static create<T>(data
|
|
28
|
+
public static create<T>(data: object): AxiosPromise<Response<T>> {
|
|
29
29
|
|
|
30
30
|
return Requests.processRoute(EventsRoutes.routes.create, data);
|
|
31
31
|
}
|
|
@@ -40,9 +40,9 @@ class Events {
|
|
|
40
40
|
*
|
|
41
41
|
* @returns promise
|
|
42
42
|
*/
|
|
43
|
-
public static update<T>(event_id
|
|
43
|
+
public static update<T>(event_id: string, data: object): AxiosPromise<Response<T>> {
|
|
44
44
|
|
|
45
|
-
return Requests.processRoute(EventsRoutes.routes.create, data, {event_id
|
|
45
|
+
return Requests.processRoute(EventsRoutes.routes.create, data, { event_id: event_id });
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
/**
|
|
@@ -54,9 +54,9 @@ class Events {
|
|
|
54
54
|
*
|
|
55
55
|
* @returns promise
|
|
56
56
|
*/
|
|
57
|
-
public static view<T>(event_id
|
|
57
|
+
public static view<T>(event_id: string): AxiosPromise<Response<T>> {
|
|
58
58
|
|
|
59
|
-
return Requests.processRoute(EventsRoutes.routes.view, {}, {event_id
|
|
59
|
+
return Requests.processRoute(EventsRoutes.routes.view, {}, { event_id: event_id });
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/**
|
|
@@ -67,14 +67,312 @@ class Events {
|
|
|
67
67
|
* @param event_id The id of the event to delete.
|
|
68
68
|
* @returns promise
|
|
69
69
|
*/
|
|
70
|
-
public static delete<T>(event_id
|
|
70
|
+
public static delete<T>(event_id: string): AxiosPromise<Response<T>> {
|
|
71
71
|
|
|
72
|
-
return Requests.processRoute(EventsRoutes.routes.delete, {}, {event_id
|
|
72
|
+
return Requests.processRoute(EventsRoutes.routes.delete, {}, { event_id: event_id });
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
/**
|
|
76
|
+
* The event is synced with Invirtu for the lie streams. This will allow you to update
|
|
77
|
+
*
|
|
78
|
+
*
|
|
79
|
+
* @see https://api.glitch.fun/api/documentation#/Event%20Route/updateEventStorage
|
|
80
|
+
*
|
|
81
|
+
* @param event_id The id of the event to update.
|
|
82
|
+
* @param data The data to update.
|
|
83
|
+
*
|
|
84
|
+
* @returns promise
|
|
85
|
+
*/
|
|
86
|
+
public static updateInvirtuEvent<T>(event_id: string, data: object): AxiosPromise<Response<T>> {
|
|
87
|
+
|
|
88
|
+
return Requests.processRoute(EventsRoutes.routes.updateInvirtu, data, { event_id: event_id });
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Add an RTMP source to multicast a stream too.
|
|
93
|
+
*
|
|
94
|
+
* @see https://api.glitch.fun/api/documentation#/Event%20Route/addRTMPSource
|
|
95
|
+
*
|
|
96
|
+
* @param event_id The id of the event.
|
|
97
|
+
* @param data The data to be passed when adding an RTMP source.
|
|
98
|
+
*
|
|
99
|
+
* @returns promise
|
|
100
|
+
*/
|
|
101
|
+
public static addRTMPSource<T>(event_id: string, data?: object): AxiosPromise<Response<T>> {
|
|
102
|
+
|
|
103
|
+
return Requests.processRoute(EventsRoutes.routes.addRTMPSource, data, { event_id: event_id });
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Update an RTMP Source for multicasing.
|
|
108
|
+
*
|
|
109
|
+
* @see https://api.glitch.fun/api/documentation#/Event%20Route/addRTMPSource
|
|
110
|
+
*
|
|
111
|
+
* @param event_id The id of the event.
|
|
112
|
+
* @param data The data to be passed when adding an RTMP source.
|
|
113
|
+
*
|
|
114
|
+
* @returns promise
|
|
115
|
+
*/
|
|
116
|
+
public static updateRTMPSource<T>(event_id: string, stream_id: string, data?: object): AxiosPromise<Response<T>> {
|
|
117
|
+
|
|
118
|
+
return Requests.processRoute(EventsRoutes.routes.updateRTMPSource, data, { event_id: event_id, subid: stream_id });
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Remove a RTMP source for multicasing.
|
|
123
|
+
*
|
|
124
|
+
* @see https://api.glitch.fun/api/documentation#/Event%20Route/addRTMPSource
|
|
125
|
+
*
|
|
126
|
+
* @param event_id The id of the event.
|
|
127
|
+
* @param data The data to be passed when adding an RTMP source.
|
|
128
|
+
*
|
|
129
|
+
* @returns promise
|
|
130
|
+
*/
|
|
131
|
+
public static removeRTMPSource<T>(event_id: string, stream_id: string): AxiosPromise<Response<T>> {
|
|
132
|
+
|
|
133
|
+
return Requests.processRoute(EventsRoutes.routes.removeRTMPSource, {}, { event_id: event_id, subid: stream_id });
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* A function that should be run on an interval to set the event as live when the live stream is active.
|
|
138
|
+
*
|
|
139
|
+
* @see https://api.glitch.fun/api/documentation#/Event%20Route/syncLive
|
|
140
|
+
*
|
|
141
|
+
* @param event_id The id of the event.
|
|
142
|
+
*
|
|
143
|
+
* @returns promise
|
|
144
|
+
*/
|
|
145
|
+
public static syncAsLive<T>(event_id: string): AxiosPromise<Response<T>> {
|
|
146
|
+
|
|
147
|
+
return Requests.processRoute(EventsRoutes.routes.syncAsLive, {}, { event_id: event_id });
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Updates the main image for the event using a File object.
|
|
152
|
+
*
|
|
153
|
+
* @see https://api.glitch.fun/api/documentation#/Event%20Route/uploadMainEventImage
|
|
154
|
+
*
|
|
155
|
+
* @param file The file object to upload.
|
|
156
|
+
* @param data Any additional data to pass along to the upload.
|
|
157
|
+
*
|
|
158
|
+
* @returns promise
|
|
159
|
+
*/
|
|
160
|
+
public static uploadMainImageFile<T>(event_id: string, file: File, data?: object): AxiosPromise<Response<T>> {
|
|
161
|
+
|
|
162
|
+
let url = EventsRoutes.routes.uploadMainImage.url.replace('{event_id}', event_id);
|
|
163
|
+
|
|
164
|
+
return Requests.uploadFile(url, 'image', file, data);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Updates the main image for the event using a Blob.
|
|
169
|
+
*
|
|
170
|
+
* @see https://api.glitch.fun/api/documentation#/Event%20Route/uploadMainEventImage
|
|
171
|
+
*
|
|
172
|
+
* @param blob The blob to upload.
|
|
173
|
+
* @param data Any additional data to pass along to the upload
|
|
174
|
+
*
|
|
175
|
+
* @returns promise
|
|
176
|
+
*/
|
|
177
|
+
public static uploadMainImageBlob<T>(event_id: string, blob: Blob, data?: object): AxiosPromise<Response<T>> {
|
|
178
|
+
|
|
179
|
+
let url = EventsRoutes.routes.uploadMainImage.url.replace('{event_id}', event_id);
|
|
180
|
+
|
|
181
|
+
return Requests.uploadBlob(url, 'image', blob, data);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Updates the banner image for the team using a File object.
|
|
186
|
+
*
|
|
187
|
+
* @see https://api.glitch.fun/api/documentation#/Event%20Route/uploadBannerEventImage
|
|
188
|
+
*
|
|
189
|
+
* @param file The file object to upload.
|
|
190
|
+
* @param data Any additional data to pass along to the upload.
|
|
191
|
+
*
|
|
192
|
+
* @returns promise
|
|
193
|
+
*/
|
|
194
|
+
public static uploadBannerImageFile<T>(event_id: string, file: File, data?: object): AxiosPromise<Response<T>> {
|
|
195
|
+
|
|
196
|
+
let url = EventsRoutes.routes.uploadBannerImage.url.replace('{event_id}', event_id);
|
|
197
|
+
|
|
198
|
+
return Requests.uploadFile(url, 'image', file, data);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Updates the banner image for the team using a Blob.
|
|
203
|
+
*
|
|
204
|
+
* @see https://api.glitch.fun/api/documentation#/Event%20Route/uploadBannerEventImage
|
|
205
|
+
*
|
|
206
|
+
* @param blob The blob to upload.
|
|
207
|
+
* @param data Any additional data to pass along to the upload
|
|
208
|
+
*
|
|
209
|
+
* @returns promise
|
|
210
|
+
*/
|
|
211
|
+
public static uploadBannerImageBlob<T>(event_id: string, blob: Blob, data?: object): AxiosPromise<Response<T>> {
|
|
212
|
+
|
|
213
|
+
let url = EventsRoutes.routes.uploadBannerImage.url.replace('{event_id}', event_id);
|
|
214
|
+
|
|
215
|
+
return Requests.uploadBlob(url, 'image', blob, data);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Enable Broadcast Mode. Broadcast mode is when the live stream is broadcasted from the game play through a protocol
|
|
220
|
+
* such as screen sharing.
|
|
221
|
+
*
|
|
222
|
+
* @see https://api.glitch.fun/api/documentation#/Event%20Route/enableBroadcastMode
|
|
223
|
+
*
|
|
224
|
+
* @param event_id The id of the event.
|
|
225
|
+
*
|
|
226
|
+
* @returns promise
|
|
227
|
+
*/
|
|
228
|
+
public static enableBroadcastMode<T>(event_id: string): AxiosPromise<Response<T>> {
|
|
229
|
+
|
|
230
|
+
return Requests.processRoute(EventsRoutes.routes.enableBroadcastMode, {}, { event_id: event_id });
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Enable livestream mode, in which the stream will be delivered to the invirtu RTMP endpoint for
|
|
235
|
+
* streaming.
|
|
236
|
+
*
|
|
237
|
+
* @param event_id The id of the event.
|
|
238
|
+
*
|
|
239
|
+
* @returns promise
|
|
240
|
+
*/
|
|
241
|
+
public static enableLivestreamMode<T>(event_id: string): AxiosPromise<Response<T>> {
|
|
242
|
+
|
|
243
|
+
return Requests.processRoute(EventsRoutes.routes.enableLivestreamMode, {}, { event_id: event_id });
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Sends content that will appear on-screen to the user.
|
|
248
|
+
*
|
|
249
|
+
* @see https://api.glitch.fun/api/documentation#/Event%20Route/sendOnScreenContent
|
|
250
|
+
*
|
|
251
|
+
* @param event_id The id of the event.
|
|
252
|
+
* @param data The information to send on-screen.
|
|
253
|
+
*
|
|
254
|
+
* @returns promise
|
|
255
|
+
*/
|
|
256
|
+
public static sendOnScreenContent<T>(event_id: string, data : object): AxiosPromise<Response<T>> {
|
|
257
|
+
|
|
258
|
+
return Requests.processRoute(EventsRoutes.routes.enableLivestreamMode, data, { event_id: event_id });
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Uploads an image that can be used and overlay later. A File object is used.
|
|
263
|
+
*
|
|
264
|
+
* @see https://api.glitch.fun/api/documentation#/Event%20Route/uploadOverlayImage
|
|
265
|
+
*
|
|
266
|
+
* @param event_id The id of the event.
|
|
267
|
+
* @param file The image as a file.
|
|
268
|
+
* @param data Any additional data to be sent in the request.
|
|
269
|
+
*
|
|
270
|
+
* @returns promise
|
|
271
|
+
*/
|
|
272
|
+
public static addOverlayAsFile<T>(event_id: string, file: File, data?: object): AxiosPromise<Response<T>> {
|
|
273
|
+
|
|
274
|
+
let url = EventsRoutes.routes.addOverlay.url.replace('{event_id}', event_id);
|
|
75
275
|
|
|
276
|
+
return Requests.uploadFile(url, 'image', file, data);
|
|
277
|
+
}
|
|
76
278
|
|
|
279
|
+
/**
|
|
280
|
+
* Uploads an image that can be used and overlay later. A blob is used.
|
|
281
|
+
*
|
|
282
|
+
* @see https://api.glitch.fun/api/documentation#/Event%20Route/uploadOverlayImage
|
|
283
|
+
*
|
|
284
|
+
* @param event_id The id of the event.
|
|
285
|
+
* @param blob Image data as a blob
|
|
286
|
+
* @param data Any additional data to be sent in the request.
|
|
287
|
+
*
|
|
288
|
+
* @returns promise
|
|
289
|
+
*/
|
|
290
|
+
public static addOverlayAsBlob<T>(event_id: string, blob: Blob, data?: object): AxiosPromise<Response<T>> {
|
|
291
|
+
|
|
292
|
+
let url = EventsRoutes.routes.addOverlay.url.replace('{event_id}', event_id);
|
|
77
293
|
|
|
294
|
+
return Requests.uploadBlob(url, 'image', blob, data);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Deletes an overlay image.
|
|
299
|
+
*
|
|
300
|
+
* @see https://api.glitch.fun/api/documentation#/Event%20Route/destoryOverlayStorage
|
|
301
|
+
*
|
|
302
|
+
* @param event_id The id of the event.
|
|
303
|
+
* @param overlay_id The id of the overlay.
|
|
304
|
+
*
|
|
305
|
+
* @returns promise
|
|
306
|
+
*/
|
|
307
|
+
public static removeOverlay<T>(event_id: string, overlay_id : string): AxiosPromise<Response<T>> {
|
|
308
|
+
|
|
309
|
+
return Requests.processRoute(EventsRoutes.routes.removeOverlay, {}, { event_id: event_id, subid : overlay_id });
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Enables an overlay so that it will appear on screen.
|
|
314
|
+
*
|
|
315
|
+
* @see https://api.glitch.fun/api/documentation#/Event%20Route/enableOverlayImage
|
|
316
|
+
*
|
|
317
|
+
* @param event_id The id of the event.
|
|
318
|
+
* @param overlay_id The id of the overlay.
|
|
319
|
+
*
|
|
320
|
+
* @returns promise
|
|
321
|
+
*/
|
|
322
|
+
public static enableOverlay<T>(event_id: string, overlay_id : string): AxiosPromise<Response<T>> {
|
|
323
|
+
|
|
324
|
+
return Requests.processRoute(EventsRoutes.routes.enableOverlay, {}, { event_id: event_id, subid : overlay_id });
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Disables the overlay so it no longer appears on-screen.
|
|
329
|
+
*
|
|
330
|
+
* @see https://api.glitch.fun/api/documentation#/Event%20Route/disableOverlay
|
|
331
|
+
*
|
|
332
|
+
* @param event_id The id of the event.
|
|
333
|
+
*
|
|
334
|
+
* @returns promise
|
|
335
|
+
*/
|
|
336
|
+
public static disableOverlay<T>(event_id: string): AxiosPromise<Response<T>> {
|
|
337
|
+
|
|
338
|
+
return Requests.processRoute(EventsRoutes.routes.disableOverlay, {}, { event_id: event_id });
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Enable the donations to appear on-screen
|
|
343
|
+
*
|
|
344
|
+
* @see https://api.glitch.fun/api/documentation#/Event%20Route/enableDonations
|
|
345
|
+
*
|
|
346
|
+
* @param event_id The id of the event.
|
|
347
|
+
*
|
|
348
|
+
* @returns promise
|
|
349
|
+
*/
|
|
350
|
+
public static enableDonations<T>(event_id: string): AxiosPromise<Response<T>> {
|
|
351
|
+
|
|
352
|
+
return Requests.processRoute(EventsRoutes.routes.enableDonations, {}, { event_id: event_id });
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Disable the donations and remove from the screen.
|
|
357
|
+
*
|
|
358
|
+
* @param event_id
|
|
359
|
+
* @returns
|
|
360
|
+
*/
|
|
361
|
+
public static disableDonations<T>(event_id: string): AxiosPromise<Response<T>> {
|
|
362
|
+
|
|
363
|
+
return Requests.processRoute(EventsRoutes.routes.disableDonations, {}, { event_id: event_id });
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
public static sendInvite<T>(event_id: string, data : object): AxiosPromise<Response<T>> {
|
|
367
|
+
|
|
368
|
+
return Requests.processRoute(EventsRoutes.routes.sendInvite, data, { event_id: event_id });
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
public static acceptInvite<T>(event_id: string, token : string): AxiosPromise<Response<T>> {
|
|
372
|
+
|
|
373
|
+
return Requests.processRoute(EventsRoutes.routes.acceptInvite, {token : token}, { event_id: event_id });
|
|
374
|
+
}
|
|
375
|
+
|
|
78
376
|
|
|
79
377
|
}
|
|
80
378
|
|
package/src/api/Teams.ts
ADDED
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import TeamsRoutes from "../routes/TeamsRoute";
|
|
2
|
+
import Requests from "../util/Requests";
|
|
3
|
+
import Response from "../util/Response";
|
|
4
|
+
import { AxiosPromise } from "axios";
|
|
5
|
+
|
|
6
|
+
class Teams {
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* List all the teams
|
|
10
|
+
*
|
|
11
|
+
* @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamsList
|
|
12
|
+
*
|
|
13
|
+
* @returns promise
|
|
14
|
+
*/
|
|
15
|
+
public static list<T>() : AxiosPromise<Response<T>> {
|
|
16
|
+
return Requests.processRoute(TeamsRoutes.routes.list);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Create a new team.
|
|
21
|
+
*
|
|
22
|
+
* @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamCreate
|
|
23
|
+
*
|
|
24
|
+
* @param data The data to be passed when creating a team.
|
|
25
|
+
*
|
|
26
|
+
* @returns Promise
|
|
27
|
+
*/
|
|
28
|
+
public static create<T>(data : object) : AxiosPromise<Response<T>> {
|
|
29
|
+
|
|
30
|
+
return Requests.processRoute(TeamsRoutes.routes.create, data);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Update a team.
|
|
35
|
+
*
|
|
36
|
+
* @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamUpdate
|
|
37
|
+
*
|
|
38
|
+
* @param team_id The id of the team to update.
|
|
39
|
+
* @param data The data to update.
|
|
40
|
+
*
|
|
41
|
+
* @returns promise
|
|
42
|
+
*/
|
|
43
|
+
public static update<T>(team_id : string, data : object) : AxiosPromise<Response<T>>{
|
|
44
|
+
|
|
45
|
+
return Requests.processRoute(TeamsRoutes.routes.create, data, {team_id : team_id});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Retrieve the information for a single team.
|
|
50
|
+
*
|
|
51
|
+
* @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamShow
|
|
52
|
+
*
|
|
53
|
+
* @param team_id The id fo the team to retrieve.
|
|
54
|
+
*
|
|
55
|
+
* @returns promise
|
|
56
|
+
*/
|
|
57
|
+
public static view<T>(team_id : string) : AxiosPromise<Response<T>> {
|
|
58
|
+
|
|
59
|
+
return Requests.processRoute(TeamsRoutes.routes.view, {}, {team_id : team_id});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Deletes a team.
|
|
64
|
+
*
|
|
65
|
+
* @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamDelete
|
|
66
|
+
*
|
|
67
|
+
* @param team_id The id of the team to delete.
|
|
68
|
+
* @returns promise
|
|
69
|
+
*/
|
|
70
|
+
public static delete<T>(team_id : string) : AxiosPromise<Response<T>> {
|
|
71
|
+
|
|
72
|
+
return Requests.processRoute(TeamsRoutes.routes.delete, {}, {team_id : team_id});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Updates the main image for the team using a File object.
|
|
77
|
+
*
|
|
78
|
+
* @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamUploadMainImage
|
|
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 uploadMainImageFile<T>(team_id: string, file : File, data? : object): AxiosPromise<Response<T>> {
|
|
86
|
+
|
|
87
|
+
let url = TeamsRoutes.routes.uploadMainImage.url.replace('{team_id}', team_id);
|
|
88
|
+
|
|
89
|
+
return Requests.uploadFile(url, 'image', file, data);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Updates the main image for the team using a Blob.
|
|
94
|
+
*
|
|
95
|
+
* @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamUploadMainImage
|
|
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 uploadMainImageBlob<T>(team_id: string, blob : Blob, data? : object): AxiosPromise<Response<T>> {
|
|
103
|
+
|
|
104
|
+
let url = TeamsRoutes.routes.uploadMainImage.url.replace('{team_id}', team_id);
|
|
105
|
+
|
|
106
|
+
return Requests.uploadBlob(url, 'image', blob, data);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Updates the banner image for the team using a File object.
|
|
111
|
+
*
|
|
112
|
+
* @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamUploadMainImage
|
|
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>(team_id: string, file : File, data? : object): AxiosPromise<Response<T>> {
|
|
120
|
+
|
|
121
|
+
let url = TeamsRoutes.routes.uploadBannerImage.url.replace('{team_id}', team_id);
|
|
122
|
+
|
|
123
|
+
return Requests.uploadFile(TeamsRoutes.routes.uploadBannerImage.url, 'image', file, data);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Updates the banner image for the team using a Blob.
|
|
128
|
+
*
|
|
129
|
+
* @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamUploadMainImage
|
|
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>(team_id: string, blob : Blob, data? : object): AxiosPromise<Response<T>> {
|
|
137
|
+
|
|
138
|
+
let url = TeamsRoutes.routes.uploadBannerImage.url.replace('{team_id}', team_id);
|
|
139
|
+
|
|
140
|
+
return Requests.uploadBlob(url, 'image', blob, data);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* List the invites that have been sent for the team to users.
|
|
145
|
+
*
|
|
146
|
+
* @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamsUserInviteList
|
|
147
|
+
*
|
|
148
|
+
* @param team_id The id of the team
|
|
149
|
+
*
|
|
150
|
+
* @returns promise
|
|
151
|
+
*/
|
|
152
|
+
public static listInvites<T>(team_id : string): AxiosPromise<Response<T>> {
|
|
153
|
+
return Requests.processRoute(TeamsRoutes.routes.listInvites, {}, {team_id : team_id});
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Send an invitation to a user to join the team.
|
|
158
|
+
*
|
|
159
|
+
* @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamSendInvite
|
|
160
|
+
*
|
|
161
|
+
* @param team_id The id of the team.
|
|
162
|
+
* @param data The data that will be passed into sending an invite.
|
|
163
|
+
*
|
|
164
|
+
* @returns promise
|
|
165
|
+
*/
|
|
166
|
+
public static sendInvite<T>(team_id : string, data? : object): AxiosPromise<Response<T>> {
|
|
167
|
+
return Requests.processRoute(TeamsRoutes.routes.sendInvite, data, {team_id : team_id});
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Accept an invite to a team. The JSON Web Token (JWT) must be related to the token.
|
|
172
|
+
*
|
|
173
|
+
* @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamAcceptInvite
|
|
174
|
+
*
|
|
175
|
+
* @param team_id The id of the team
|
|
176
|
+
* @param token The token required to accept the user.
|
|
177
|
+
*
|
|
178
|
+
* @returns promise
|
|
179
|
+
*/
|
|
180
|
+
public static acceptInvite<T>(team_id : string, token : string): AxiosPromise<Response<T>> {
|
|
181
|
+
return Requests.processRoute(TeamsRoutes.routes.acceptInvite, {}, {team_id : team_id});
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* List the users who are currently associated with the team.
|
|
186
|
+
*
|
|
187
|
+
* @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamUserList
|
|
188
|
+
*
|
|
189
|
+
* @param team_id The id of the team.
|
|
190
|
+
*
|
|
191
|
+
* @returns promise
|
|
192
|
+
*/
|
|
193
|
+
public static listUsers<T>(team_id : string): AxiosPromise<Response<T>> {
|
|
194
|
+
return Requests.processRoute(TeamsRoutes.routes.listTeamUsers, {}, {team_id : team_id});
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Add a user to a team.
|
|
199
|
+
*
|
|
200
|
+
* @see https://api.glitch.fun/api/documentation#/Teams%20Route/createTeamUser
|
|
201
|
+
*
|
|
202
|
+
* @param team_id The id of the team.
|
|
203
|
+
* @param data The data to be passed when adding a user.
|
|
204
|
+
*
|
|
205
|
+
* @returns promise
|
|
206
|
+
*/
|
|
207
|
+
public static addUser<T>(team_id : string, data? : object): AxiosPromise<Response<T>> {
|
|
208
|
+
return Requests.processRoute(TeamsRoutes.routes.addTeamUser, data, {team_id : team_id});
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Retrieves a single user and their information that is associated with a team.
|
|
213
|
+
*
|
|
214
|
+
* @see https://api.glitch.fun/api/documentation#/Teams%20Route/showTeamUser
|
|
215
|
+
*
|
|
216
|
+
* @param team_id The id of the team.
|
|
217
|
+
* @param user_id The id of the user.
|
|
218
|
+
*
|
|
219
|
+
* @returns promise
|
|
220
|
+
*/
|
|
221
|
+
public static getUser<T>(team_id : string, user_id : string): AxiosPromise<Response<T>> {
|
|
222
|
+
return Requests.processRoute(TeamsRoutes.routes.showTeamUser, {}, {team_id : team_id, user_id});
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Updates the users information associated with the team.
|
|
227
|
+
*
|
|
228
|
+
* @param team_id The id of the team.
|
|
229
|
+
* @param user_id The id of the user.
|
|
230
|
+
*
|
|
231
|
+
* @returns promise
|
|
232
|
+
*/
|
|
233
|
+
public static updatetUser<T>(team_id : string, user_id : string, data? : object): AxiosPromise<Response<T>> {
|
|
234
|
+
return Requests.processRoute(TeamsRoutes.routes.updateTeamUser, data, {team_id : team_id, user_id});
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Removes a user from a team.
|
|
239
|
+
*
|
|
240
|
+
* @param team_id The id of team.
|
|
241
|
+
* @param user_id The id of the user.
|
|
242
|
+
*
|
|
243
|
+
* @returns promise
|
|
244
|
+
*/
|
|
245
|
+
public static removetUser<T>(team_id : string, user_id : string): AxiosPromise<Response<T>> {
|
|
246
|
+
return Requests.processRoute(TeamsRoutes.routes.removeTeamUser, {}, {team_id : team_id, user_id});
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export default Teams;
|
package/src/api/Users.ts
CHANGED
|
@@ -85,6 +85,80 @@ class Users {
|
|
|
85
85
|
return Requests.processRoute(UserRoutes.routes.oneTimeToken, {});
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
/**
|
|
89
|
+
* Updates the avatar image for the user using a File object.
|
|
90
|
+
*
|
|
91
|
+
* @see https://api.glitch.fun/api/documentation#/Users%20Route/userUploadAvatarImage
|
|
92
|
+
*
|
|
93
|
+
* @param file The file object to upload.
|
|
94
|
+
* @param data Any additional data to pass along to the upload.
|
|
95
|
+
*
|
|
96
|
+
* @returns promise
|
|
97
|
+
*/
|
|
98
|
+
public static uploadAvatarImageFile<T>(file : File, data? : object): AxiosPromise<Response<T>> {
|
|
99
|
+
|
|
100
|
+
return Requests.uploadFile(UserRoutes.routes.uploadAvatar.url, 'image', file, data);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Updates the avatar image for the user using a Blob.
|
|
105
|
+
*
|
|
106
|
+
* @see https://api.glitch.fun/api/documentation#/Users%20Route/userUploadAvatarImage
|
|
107
|
+
*
|
|
108
|
+
* @param blob The blob to upload.
|
|
109
|
+
* @param data Any additional data to pass along to the upload
|
|
110
|
+
*
|
|
111
|
+
* @returns promise
|
|
112
|
+
*/
|
|
113
|
+
public static uploadAvatarImageBlob<T>(blob : Blob, data? : object): AxiosPromise<Response<T>> {
|
|
114
|
+
|
|
115
|
+
return Requests.uploadBlob(UserRoutes.routes.uploadAvatar.url, 'image', blob, data);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Upload a banner image for the user, as a File object.
|
|
120
|
+
*
|
|
121
|
+
* @see https://api.glitch.fun/api/documentation#/Users%20Route/userUploadBannerImage
|
|
122
|
+
*
|
|
123
|
+
* @param file The file object to upload.
|
|
124
|
+
* @param data Any additional data to pass along to the upload.
|
|
125
|
+
*
|
|
126
|
+
* @returns promise
|
|
127
|
+
*/
|
|
128
|
+
public static uploadBannerImageFile<T>(file : File, data? : object): AxiosPromise<Response<T>> {
|
|
129
|
+
|
|
130
|
+
return Requests.uploadFile(UserRoutes.routes.uploadBanner.url, 'image', file, data);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Upload a banner image for the user, as a Blob.
|
|
135
|
+
*
|
|
136
|
+
* @see https://api.glitch.fun/api/documentation#/Users%20Route/userUploadBannerImage
|
|
137
|
+
*
|
|
138
|
+
* @param file The blob to upload.
|
|
139
|
+
* @param data Any additional data to pass along to the upload.
|
|
140
|
+
*
|
|
141
|
+
* @returns promise
|
|
142
|
+
*/
|
|
143
|
+
public static uploadBannerImageBlob<T>(blob : Blob, data? : object): AxiosPromise<Response<T>> {
|
|
144
|
+
|
|
145
|
+
return Requests.uploadBlob(UserRoutes.routes.uploadBanner.url, 'image', blob, data);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Creates a donation page for that user by syncing their information with various
|
|
150
|
+
* payment service.
|
|
151
|
+
*
|
|
152
|
+
* @see https://api.glitch.fun/api/documentation#/Users%20Route/userCreateDonationPage
|
|
153
|
+
*
|
|
154
|
+
* @returns promise
|
|
155
|
+
*/
|
|
156
|
+
public static createDonationPage<T>(): AxiosPromise<Response<T>> {
|
|
157
|
+
|
|
158
|
+
return Requests.processRoute(UserRoutes.routes.createDonationPage, {});
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
|
|
88
162
|
|
|
89
163
|
|
|
90
164
|
}
|
package/src/api/index.ts
CHANGED
|
@@ -2,8 +2,10 @@ import Auth from "./Auth";
|
|
|
2
2
|
import Competitions from "./Competitions";
|
|
3
3
|
import Users from "./Users";
|
|
4
4
|
import Events from "./Events";
|
|
5
|
+
import Teams from "./Teams";
|
|
5
6
|
|
|
6
7
|
export {Auth};
|
|
7
8
|
export {Competitions};
|
|
8
9
|
export {Users};
|
|
9
|
-
export {Events};
|
|
10
|
+
export {Events};
|
|
11
|
+
export {Teams};
|