glitch-javascript-sdk 0.0.4 → 0.0.7
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 +0 -15736
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Competitions.d.ts +372 -0
- package/dist/esm/api/Waitlist.d.ts +53 -0
- package/dist/esm/config/Config.d.ts +31 -5
- package/dist/esm/index.d.ts +6 -6
- package/dist/esm/index.js +0 -29960
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/RecordingRoute.d.ts +7 -0
- package/dist/esm/routes/WaitlistRoutes.d.ts +7 -0
- package/dist/esm/util/Requests.d.ts +3 -7
- package/dist/index.d.ts +409 -11
- package/package.json +2 -6
- package/src/api/Competitions.ts +483 -0
- package/src/api/Events.ts +1 -1
- package/src/api/Waitlist.ts +78 -0
- package/src/config/Config.ts +57 -17
- package/src/index.ts +6 -6
- package/src/routes/CompetitionRoute.ts +39 -0
- package/src/routes/RecordingRoute.ts +16 -0
- package/src/routes/WaitlistRoutes.ts +16 -0
- package/src/util/Requests.ts +2 -14
package/src/api/Competitions.ts
CHANGED
|
@@ -72,8 +72,491 @@ class Competitions {
|
|
|
72
72
|
return Requests.processRoute(CompetitionRoutes.routes.delete, {}, {competition_id : competition_id});
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Add a team
|
|
77
|
+
*
|
|
78
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/addTeam
|
|
79
|
+
*
|
|
80
|
+
* @param competition_id
|
|
81
|
+
* @param team_id
|
|
82
|
+
* @returns promise
|
|
83
|
+
*/
|
|
84
|
+
public static addTeam<T>(competition_id : string, team_id : string) : AxiosPromise<Response<T>>{
|
|
85
|
+
return Requests.processRoute(CompetitionRoutes.routes.addTeam, {team_id : team_id}, {competition_id : competition_id});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Adds participant
|
|
90
|
+
*
|
|
91
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/addParticipant
|
|
92
|
+
*
|
|
93
|
+
* @param competition_id
|
|
94
|
+
* @param user_id
|
|
95
|
+
* @returns promise
|
|
96
|
+
*/
|
|
97
|
+
public static addParticipant<T>(competition_id : string, user_id : string) : AxiosPromise<Response<T>>{
|
|
98
|
+
return Requests.processRoute(CompetitionRoutes.routes.addParticipant, {user_id : user_id}, {competition_id : competition_id});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Register a team
|
|
103
|
+
*
|
|
104
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/registerTeam
|
|
105
|
+
*
|
|
106
|
+
* @param competition_id
|
|
107
|
+
* @param team_id
|
|
108
|
+
* @returns promise
|
|
109
|
+
*/
|
|
110
|
+
public static registerTeam<T>(competition_id : string, team_id : string) : AxiosPromise<Response<T>>{
|
|
111
|
+
return Requests.processRoute(CompetitionRoutes.routes.registerTeam, {team_id : team_id}, {competition_id : competition_id});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Register a user
|
|
116
|
+
*
|
|
117
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/registerParticipant
|
|
118
|
+
*
|
|
119
|
+
* @param competition_id
|
|
120
|
+
* @returns promise
|
|
121
|
+
*/
|
|
122
|
+
public static registerUser<T>(competition_id : string) : AxiosPromise<Response<T>>{
|
|
123
|
+
return Requests.processRoute(CompetitionRoutes.routes.registerUser, {competition_id : competition_id});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Sync rounds
|
|
128
|
+
*
|
|
129
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/syncRounds
|
|
130
|
+
*
|
|
131
|
+
* @param competition_id
|
|
132
|
+
* @param number_of_competitors
|
|
133
|
+
* @param competitors_per_bracket
|
|
134
|
+
* @returns promise
|
|
135
|
+
*/
|
|
136
|
+
public static syncRounds<T>(competition_id : string) : AxiosPromise<Response<T>>{
|
|
137
|
+
return Requests.processRoute(CompetitionRoutes.routes.syncRounds, {competition_id : competition_id});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* auto generate team brackets
|
|
142
|
+
*
|
|
143
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/autoGenerateTeamBrackets
|
|
144
|
+
*
|
|
145
|
+
* @param competition_id
|
|
146
|
+
* @param round_id
|
|
147
|
+
* @returns promise
|
|
148
|
+
*/
|
|
149
|
+
public static autoGenerate<T>(competition_id : string, round_id : number) : AxiosPromise<Response<T>>{
|
|
150
|
+
return Requests.processRoute(CompetitionRoutes.routes.autoGenerate, {round_id : round_id}, {competition_id : competition_id});
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* auto generate user brackets
|
|
155
|
+
*
|
|
156
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/autoGenerateUserBrackets
|
|
157
|
+
*
|
|
158
|
+
* @param competition_id
|
|
159
|
+
* @returns promise
|
|
160
|
+
*/
|
|
161
|
+
public static autoGenerateUserBrackets<T>(competition_id : string) : AxiosPromise<Response<T>>{
|
|
162
|
+
return Requests.processRoute(CompetitionRoutes.routes.autoGenerateUserBrackets, {competition_id : competition_id});
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Upload main image
|
|
167
|
+
*
|
|
168
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/uploadMainImage
|
|
169
|
+
*
|
|
170
|
+
* @param competition_id
|
|
171
|
+
* @param image
|
|
172
|
+
* @returns promise
|
|
173
|
+
*/
|
|
174
|
+
public static uploadMainImage<T>(competition_id : string, image : string) : AxiosPromise<Response<T>>{
|
|
175
|
+
return Requests.processRoute(CompetitionRoutes.routes.uploadMainImage, {competition_id : competition_id}, {image : image});
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Upload banner image
|
|
180
|
+
*
|
|
181
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/uploadBannerImage
|
|
182
|
+
*
|
|
183
|
+
* @param competition_id
|
|
184
|
+
* @param image
|
|
185
|
+
* @returns promise
|
|
186
|
+
*/
|
|
187
|
+
public static uploadBannerImage<T>(competition_id : string, image : string) : AxiosPromise<Response<T>>{
|
|
188
|
+
return Requests.processRoute(CompetitionRoutes.routes.uploadBannerImage, {competition_id : competition_id}, {image : image});
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Invites
|
|
193
|
+
*
|
|
194
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/competitionUserInviteList
|
|
195
|
+
*
|
|
196
|
+
* @param competition_id
|
|
197
|
+
* @returns promise
|
|
198
|
+
*/
|
|
199
|
+
public static invites<T>(competition_id : string) : AxiosPromise<Response<T>>{
|
|
200
|
+
return Requests.processRoute(CompetitionRoutes.routes.invites, {competition_id : competition_id});
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Sends invite
|
|
205
|
+
*
|
|
206
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/competitionSendInvite
|
|
207
|
+
*
|
|
208
|
+
* @param competition_id
|
|
209
|
+
* @returns promise
|
|
210
|
+
*/
|
|
211
|
+
public static sendInvite<T>(competition_id : string) : AxiosPromise<Response<T>>{
|
|
212
|
+
return Requests.processRoute(CompetitionRoutes.routes.sendInvite, {competition_id : competition_id});
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Accept invite
|
|
217
|
+
*
|
|
218
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/competitionAcceptInvite
|
|
219
|
+
*
|
|
220
|
+
* @param competition_id
|
|
221
|
+
* @param token
|
|
222
|
+
* @returns promise
|
|
223
|
+
*/
|
|
224
|
+
public static acceptInvite<T>(competition_id : string, token : string): AxiosPromise<Response<T>>{
|
|
225
|
+
return Requests.processRoute(CompetitionRoutes.routes.acceptInvite, {competition_id : competition_id}, {token : token});
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Round brackets
|
|
230
|
+
*
|
|
231
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/resourceRoundBracketList1
|
|
232
|
+
*
|
|
233
|
+
* @param competition_id
|
|
234
|
+
* @param round_id
|
|
235
|
+
* @returns promise
|
|
236
|
+
*/
|
|
237
|
+
public static brackets<T>(competition_id : string, round_id : number): AxiosPromise<Response<T>>{
|
|
238
|
+
return Requests.processRoute(CompetitionRoutes.routes.brackets, {competition_id : competition_id}, {round_id : round_id});
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Store round brackets
|
|
243
|
+
*
|
|
244
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/resourceRoundBracketStorage
|
|
245
|
+
*
|
|
246
|
+
* @param competition_id
|
|
247
|
+
* @param round_id
|
|
248
|
+
* @returns promise
|
|
249
|
+
*/
|
|
250
|
+
public static bracketStore<T>(competition_id : string, round_id : number): AxiosPromise<Response<T>>{
|
|
251
|
+
return Requests.processRoute(CompetitionRoutes.routes.bracketStore, {competition_id : competition_id}, {round_id : round_id});
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Show round bracket
|
|
256
|
+
*
|
|
257
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/resourceRoundBracketShow
|
|
258
|
+
*
|
|
259
|
+
* @param competition_id
|
|
260
|
+
* @param round_id
|
|
261
|
+
* @param bracket_id
|
|
262
|
+
* @returns promise
|
|
263
|
+
*/
|
|
264
|
+
public static showBracket<T>(competition_id : string, round_id : number, bracket_id : number): AxiosPromise<Response<T>>{
|
|
265
|
+
return Requests.processRoute(CompetitionRoutes.routes.showBracket, {competition_id : competition_id}, {round_id : round_id, bracket_id : bracket_id});
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Update bracket
|
|
270
|
+
*
|
|
271
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/updateRoundBracket
|
|
272
|
+
*
|
|
273
|
+
* @param competition_id
|
|
274
|
+
* @param round_id
|
|
275
|
+
* @param bracket_id
|
|
276
|
+
* @returns promise
|
|
277
|
+
*/
|
|
278
|
+
public static updateBracket<T>(competition_id : string, round_id : number, bracket_id : number): AxiosPromise<Response<T>>{
|
|
279
|
+
return Requests.processRoute(CompetitionRoutes.routes.updateBracket, {competition_id : competition_id}, {round_id : round_id, bracket_id : bracket_id});
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Delete bracket
|
|
284
|
+
*
|
|
285
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/destoryRoundBracket
|
|
286
|
+
*
|
|
287
|
+
* @param competition_id
|
|
288
|
+
* @param round_id
|
|
289
|
+
* @param bracket_id
|
|
290
|
+
* @returns promise
|
|
291
|
+
*/
|
|
292
|
+
public static destroyBracket<T>(competition_id : string, round_id : number, bracket_id : number): AxiosPromise<Response<T>>{
|
|
293
|
+
return Requests.processRoute(CompetitionRoutes.routes.destroyBracket, {competition_id : competition_id}, {round_id : round_id, bracket_id : bracket_id});
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* List round
|
|
298
|
+
*
|
|
299
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/resourceRoundList
|
|
300
|
+
*
|
|
301
|
+
* @param competition_id
|
|
302
|
+
* @returns promise
|
|
303
|
+
*/
|
|
304
|
+
public static rounds<T>(competition_id : string): AxiosPromise<Response<T>>{
|
|
305
|
+
return Requests.processRoute(CompetitionRoutes.routes.rounds, {competition_id : competition_id});
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Create a new round for competition
|
|
310
|
+
*
|
|
311
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/resourceRoundStorage
|
|
312
|
+
*
|
|
313
|
+
* @param competition_id
|
|
314
|
+
* @returns promise
|
|
315
|
+
*/
|
|
316
|
+
public static roundStore<T>(competition_id : string): AxiosPromise<Response<T>>{
|
|
317
|
+
return Requests.processRoute(CompetitionRoutes.routes.roundStore, {competition_id : competition_id});
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Retrieve the information for a single round.
|
|
322
|
+
*
|
|
323
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/resourceRoundShow
|
|
324
|
+
*
|
|
325
|
+
* @param competition_id
|
|
326
|
+
* @param round_id
|
|
327
|
+
* @returns promise
|
|
328
|
+
*/
|
|
329
|
+
public static showRound<T>(competition_id : string, round_id : number): AxiosPromise<Response<T>>{
|
|
330
|
+
return Requests.processRoute(CompetitionRoutes.routes.showRound, {competition_id : competition_id}, {round_id : round_id});
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Updating resource in storage with new information.
|
|
335
|
+
*
|
|
336
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/updateRound
|
|
337
|
+
*
|
|
338
|
+
* @param competition_id
|
|
339
|
+
* @param round_id
|
|
340
|
+
* @returns promise
|
|
341
|
+
*/
|
|
342
|
+
public static updateRound<T>(competition_id : string, round_id : number): AxiosPromise<Response<T>>{
|
|
343
|
+
return Requests.processRoute(CompetitionRoutes.routes.updateBracket, {competition_id : competition_id}, {round_id : round_id});
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Deletes the round for the competition.
|
|
348
|
+
*
|
|
349
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/destoryRound
|
|
350
|
+
*
|
|
351
|
+
* @param competition_id
|
|
352
|
+
* @param round_id
|
|
353
|
+
* @returns promise
|
|
354
|
+
*/
|
|
355
|
+
public static destroyRound<T>(competition_id : string, round_id : number): AxiosPromise<Response<T>>{
|
|
356
|
+
return Requests.processRoute(CompetitionRoutes.routes.destroyRound, {competition_id : competition_id}, {round_id : round_id});
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Retrieve a list of teams associated with the competition.
|
|
361
|
+
*
|
|
362
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/resourceCompetitionTeamList
|
|
363
|
+
*
|
|
364
|
+
* @param competition_id
|
|
365
|
+
* @returns promise
|
|
366
|
+
*/
|
|
367
|
+
public static team<T>(competition_id : string): AxiosPromise<Response<T>>{
|
|
368
|
+
return Requests.processRoute(CompetitionRoutes.routes.team, {competition_id : competition_id});
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Associate a new team with the competition.
|
|
373
|
+
*
|
|
374
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/resourceCompetitionTeamStorage
|
|
375
|
+
*
|
|
376
|
+
* @param competition_id
|
|
377
|
+
* @returns promise
|
|
378
|
+
*/
|
|
379
|
+
public static teamStore<T>(competition_id : string): AxiosPromise<Response<T>>{
|
|
380
|
+
return Requests.processRoute(CompetitionRoutes.routes.teamStore, {competition_id : competition_id});
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Display the contents of a single team associated with the competition.
|
|
385
|
+
*
|
|
386
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/resourceTeamShow
|
|
387
|
+
*
|
|
388
|
+
* @param competition_id
|
|
389
|
+
* @param team
|
|
390
|
+
* @returns promise
|
|
391
|
+
*/
|
|
392
|
+
public static showTeam<T>(competition_id : string, team : string): AxiosPromise<Response<T>>{
|
|
393
|
+
return Requests.processRoute(CompetitionRoutes.routes.showTeam, {competition_id : competition_id}, {team : team});
|
|
394
|
+
}
|
|
75
395
|
|
|
396
|
+
/**
|
|
397
|
+
* Update the team information associated with the competition.
|
|
398
|
+
*
|
|
399
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/updateTeam
|
|
400
|
+
*
|
|
401
|
+
* @param competition_id
|
|
402
|
+
* @param team_id
|
|
403
|
+
* @returns promise
|
|
404
|
+
*/
|
|
405
|
+
public static updateTeam<T>(competition_id : string, team_id : string): AxiosPromise<Response<T>>{
|
|
406
|
+
return Requests.processRoute(CompetitionRoutes.routes.updateTeam, {competition_id : competition_id}, {team_id : team_id});
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Removes the team from the competition.
|
|
411
|
+
*
|
|
412
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/destoryTeam
|
|
413
|
+
*
|
|
414
|
+
* @param competition_id
|
|
415
|
+
* @param team_id
|
|
416
|
+
* @returns promise
|
|
417
|
+
*/
|
|
418
|
+
public static destroyTeam<T>(competition_id : string, team_id : string): AxiosPromise<Response<T>>{
|
|
419
|
+
return Requests.processRoute(CompetitionRoutes.routes.destroyTeam, {competition_id : competition_id}, {team_id : team_id});
|
|
420
|
+
}
|
|
76
421
|
|
|
422
|
+
/**
|
|
423
|
+
* List all the users associated with a competition.
|
|
424
|
+
*
|
|
425
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/competitionUserList
|
|
426
|
+
*
|
|
427
|
+
* @param competition_id
|
|
428
|
+
* @returns promise
|
|
429
|
+
*/
|
|
430
|
+
public static users<T>(competition_id : string): AxiosPromise<Response<T>>{
|
|
431
|
+
return Requests.processRoute(CompetitionRoutes.routes.users, {competition_id : competition_id});
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Associate a new users with the competition.
|
|
436
|
+
*
|
|
437
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/createCompetitionUser
|
|
438
|
+
*
|
|
439
|
+
* @param competition_id
|
|
440
|
+
* @returns promise
|
|
441
|
+
*/
|
|
442
|
+
public static competitionUser<T>(competition_id : string): AxiosPromise<Response<T>>{
|
|
443
|
+
return Requests.processRoute(CompetitionRoutes.routes.competitionUser, {competition_id : competition_id});
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/**
|
|
447
|
+
* Show a single user by its ID.
|
|
448
|
+
*
|
|
449
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/showCompetitionUser
|
|
450
|
+
*
|
|
451
|
+
* @param competition_id
|
|
452
|
+
* @param user_id
|
|
453
|
+
* @returns promise
|
|
454
|
+
*/
|
|
455
|
+
public static showCompetitionUser<T>(competition_id : string, user_id : string): AxiosPromise<Response<T>>{
|
|
456
|
+
return Requests.processRoute(CompetitionRoutes.routes.showCompetitionUser, {competition_id : competition_id}, {user_id : user_id});
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* Update the user associated with competition.
|
|
461
|
+
*
|
|
462
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/updateCompetitionUser
|
|
463
|
+
*
|
|
464
|
+
* @param competition_id
|
|
465
|
+
* @param user_id
|
|
466
|
+
* @returns promise
|
|
467
|
+
*/
|
|
468
|
+
public static updateCompetitionUser<T>(competition_id : string, user_id : string): AxiosPromise<Response<T>>{
|
|
469
|
+
return Requests.processRoute(CompetitionRoutes.routes.updateCompetitionUser, {competition_id : competition_id}, {user_id : user_id});
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* Remove the associated user from the competition.
|
|
474
|
+
*
|
|
475
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/removeCompetitionUser
|
|
476
|
+
*
|
|
477
|
+
* @param competition_id
|
|
478
|
+
* @param user_id
|
|
479
|
+
* @returns promise
|
|
480
|
+
*/
|
|
481
|
+
public static destroyCompetitionUser<T>(competition_id : string, user_id : string): AxiosPromise<Response<T>>{
|
|
482
|
+
return Requests.processRoute(CompetitionRoutes.routes.destroyCompetitionUser, {competition_id : competition_id}, {user_id : user_id});
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* List all the venues associated with a competition.
|
|
487
|
+
*
|
|
488
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/venueList
|
|
489
|
+
*
|
|
490
|
+
* @param competition_id
|
|
491
|
+
* @returns promise
|
|
492
|
+
*/
|
|
493
|
+
public static venues<T>(competition_id : string): AxiosPromise<Response<T>>{
|
|
494
|
+
return Requests.processRoute(CompetitionRoutes.routes.venues, {competition_id : competition_id});
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Creating a new venue.
|
|
499
|
+
*
|
|
500
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/createVenue
|
|
501
|
+
*
|
|
502
|
+
* @param competition_id
|
|
503
|
+
* @returns promise
|
|
504
|
+
*/
|
|
505
|
+
public static newVenue<T>(competition_id : string): AxiosPromise<Response<T>>{
|
|
506
|
+
return Requests.processRoute(CompetitionRoutes.routes.newVenue, {competition_id : competition_id});
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Show a single venue by its ID.
|
|
511
|
+
*
|
|
512
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/showVenue
|
|
513
|
+
*
|
|
514
|
+
* @param competition_id
|
|
515
|
+
* @param venue_id
|
|
516
|
+
* @returns promise
|
|
517
|
+
*/
|
|
518
|
+
public static showVenue<T>(competition_id : string, venue_id : string): AxiosPromise<Response<T>>{
|
|
519
|
+
return Requests.processRoute(CompetitionRoutes.routes.showVenue, {competition_id : competition_id}, {venue_id : venue_id});
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* Update the venue.
|
|
524
|
+
*
|
|
525
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/updateVenue
|
|
526
|
+
*
|
|
527
|
+
* @param competition_id
|
|
528
|
+
* @param venue_id
|
|
529
|
+
* @returns promise
|
|
530
|
+
*/
|
|
531
|
+
public static updateVenue<T>(competition_id : string, venue_id : string): AxiosPromise<Response<T>>{
|
|
532
|
+
return Requests.processRoute(CompetitionRoutes.routes.updateVenue, {competition_id : competition_id}, {venue_id : venue_id});
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* Deletes the venue from the competition.
|
|
537
|
+
*
|
|
538
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/removeCompetitionVenue
|
|
539
|
+
*
|
|
540
|
+
* @param competition_id
|
|
541
|
+
* @param venue_id
|
|
542
|
+
* @returns promise
|
|
543
|
+
*/
|
|
544
|
+
public static destroyVenue<T>(competition_id : string, venue_id : string): AxiosPromise<Response<T>>{
|
|
545
|
+
return Requests.processRoute(CompetitionRoutes.routes.destroyVenue, {competition_id : competition_id}, {venue_id : venue_id});
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
/**
|
|
549
|
+
* Upload venue main image to storage.
|
|
550
|
+
*
|
|
551
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/uploadVenueMainImage
|
|
552
|
+
*
|
|
553
|
+
* @param competition_id
|
|
554
|
+
* @param venue_id
|
|
555
|
+
* @returns promise
|
|
556
|
+
*/
|
|
557
|
+
public static uploadVenueMainImage<T>(competition_id : string, venue_id : string): AxiosPromise<Response<T>>{
|
|
558
|
+
return Requests.processRoute(CompetitionRoutes.routes.uploadVenueMainImage, {competition_id : competition_id}, {venue_id : venue_id});
|
|
559
|
+
}
|
|
77
560
|
}
|
|
78
561
|
|
|
79
562
|
export default Competitions;
|
package/src/api/Events.ts
CHANGED
|
@@ -42,7 +42,7 @@ class Events {
|
|
|
42
42
|
*/
|
|
43
43
|
public static update<T>(event_id: string, data: object): AxiosPromise<Response<T>> {
|
|
44
44
|
|
|
45
|
-
return Requests.processRoute(EventsRoutes.routes.
|
|
45
|
+
return Requests.processRoute(EventsRoutes.routes.update, data, { event_id: event_id });
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
/**
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import WaitlistRoutes 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 waitlist sign-ups.
|
|
10
|
+
*
|
|
11
|
+
* @see https://api.glitch.fun/api/documentation#/Waitlist%20Route/waitlistList
|
|
12
|
+
*
|
|
13
|
+
* @returns promise
|
|
14
|
+
*/
|
|
15
|
+
public static list<T>() : AxiosPromise<Response<T>> {
|
|
16
|
+
return Requests.processRoute(WaitlistRoutes.routes.list);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Sign-up to the waitlist.
|
|
21
|
+
*
|
|
22
|
+
* @see https://api.glitch.fun/api/documentation#/Waitlist%20Route/waitlistCreate
|
|
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(WaitlistRoutes.routes.create, data);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Update a waitlist.
|
|
35
|
+
*
|
|
36
|
+
* @see https://api.glitch.fun/api/documentation#/Waitlist%20Route/waitlistUpdate
|
|
37
|
+
*
|
|
38
|
+
* @param waitlist_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>(waitlist_id : string, data : object) : AxiosPromise<Response<T>>{
|
|
44
|
+
|
|
45
|
+
return Requests.processRoute(WaitlistRoutes.routes.update, data, {waitlist_id : waitlist_id});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Retrieve the information for a single user who signed-up to the waitlist.
|
|
50
|
+
*
|
|
51
|
+
* @see https://api.glitch.fun/api/documentation#/Waitlist%20Route/waitlistUpdate
|
|
52
|
+
*
|
|
53
|
+
* @param waitlist_id The id fo the team to retrieve.
|
|
54
|
+
*
|
|
55
|
+
* @returns promise
|
|
56
|
+
*/
|
|
57
|
+
public static view<T>(waitlist_id : string) : AxiosPromise<Response<T>> {
|
|
58
|
+
|
|
59
|
+
return Requests.processRoute(WaitlistRoutes.routes.view, {}, {waitlist_id : waitlist_id});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Deletes an entry from the waitlist.
|
|
64
|
+
*
|
|
65
|
+
* @see https://api.glitch.fun/api/documentation#/Waitlist%20Route/waitlistDelete
|
|
66
|
+
*
|
|
67
|
+
* @param waitlist_id The id of the team to delete.
|
|
68
|
+
* @returns promise
|
|
69
|
+
*/
|
|
70
|
+
public static delete<T>(waitlist_id : string) : AxiosPromise<Response<T>> {
|
|
71
|
+
|
|
72
|
+
return Requests.processRoute(WaitlistRoutes.routes.delete, {}, {waitlist_id : waitlist_id});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export default Teams;
|
package/src/config/Config.ts
CHANGED
|
@@ -7,31 +7,71 @@ import Requests from "../util/Requests";
|
|
|
7
7
|
* API.
|
|
8
8
|
*/
|
|
9
9
|
class Config {
|
|
10
|
-
//The base url of the API, ie: http://api.example.com/v1/
|
|
11
|
-
baseUrl: string;
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
constructor(baseUrl: string, authToken: string) {
|
|
17
|
-
this.baseUrl = baseUrl;
|
|
18
|
-
this.authToken = authToken;
|
|
11
|
+
private static _baseUrl: string;
|
|
12
|
+
private static _authToken: string;
|
|
19
13
|
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
private static _baseUrlLocked: boolean = false;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Set the configuration
|
|
18
|
+
*
|
|
19
|
+
* @param baseUrl The url base endpoint of the api
|
|
20
|
+
* @param authToken The JSON Web Token
|
|
21
|
+
*/
|
|
22
|
+
static setConfig(baseUrl: string, authToken: string, lock? : boolean) {
|
|
23
|
+
|
|
24
|
+
this.setBaseUrl(baseUrl, lock);
|
|
25
|
+
|
|
26
|
+
this.setAuthToken(authToken);
|
|
27
|
+
|
|
28
|
+
Requests.setBaseUrl(baseUrl);
|
|
29
|
+
Requests.setAuthToken(authToken);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Sets the endpoint for the API
|
|
34
|
+
*
|
|
35
|
+
* @param baseUrl The url that connects to the APIs base
|
|
36
|
+
* @param lock If set to true, will lock the baseUrl so it cannot be changed
|
|
37
|
+
*/
|
|
38
|
+
static setBaseUrl(baseUrl: string, lock? : boolean) {
|
|
22
39
|
|
|
23
|
-
|
|
24
|
-
|
|
40
|
+
if(!this._baseUrlLocked) {
|
|
41
|
+
Config._baseUrl = baseUrl;
|
|
25
42
|
|
|
26
43
|
Requests.setBaseUrl(baseUrl);
|
|
27
44
|
}
|
|
28
45
|
|
|
29
|
-
|
|
30
|
-
this.
|
|
31
|
-
|
|
32
|
-
Requests.setAuthToken(authToken);
|
|
46
|
+
if(lock) {
|
|
47
|
+
this._baseUrlLocked = true;
|
|
33
48
|
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Set the JSON Web Token (JWT) that will be passed to the API
|
|
53
|
+
*
|
|
54
|
+
* @param authToken The JWT
|
|
55
|
+
*/
|
|
56
|
+
static setAuthToken(authToken: string) {
|
|
57
|
+
Config._authToken = authToken;
|
|
58
|
+
|
|
59
|
+
Requests.setAuthToken(authToken);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Gets base url
|
|
64
|
+
*/
|
|
65
|
+
static get baseUrl(): string {
|
|
66
|
+
return Config._baseUrl;
|
|
67
|
+
}
|
|
34
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Gets auth token
|
|
71
|
+
*/
|
|
72
|
+
static get authToken(): string {
|
|
73
|
+
return Config._authToken;
|
|
35
74
|
}
|
|
75
|
+
}
|
|
36
76
|
|
|
37
|
-
|
|
77
|
+
export default Config;
|
package/src/index.ts
CHANGED
|
@@ -11,14 +11,14 @@ import {Teams} from "./api";
|
|
|
11
11
|
|
|
12
12
|
class Glitch {
|
|
13
13
|
|
|
14
|
-
public static config:
|
|
14
|
+
public static config: Config;
|
|
15
15
|
|
|
16
16
|
public static api : {
|
|
17
|
-
Auth :
|
|
18
|
-
Competitions:
|
|
19
|
-
Users:
|
|
20
|
-
Events :
|
|
21
|
-
Teams :
|
|
17
|
+
Auth : Auth,
|
|
18
|
+
Competitions: Competitions,
|
|
19
|
+
Users: Users,
|
|
20
|
+
Events : Events,
|
|
21
|
+
Teams : Teams
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
|