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.
@@ -0,0 +1,7 @@
1
+ import Route from "./interface";
2
+ declare class RecordingsRoute {
3
+ static routes: {
4
+ [key: string]: Route;
5
+ };
6
+ }
7
+ export default RecordingsRoute;
@@ -0,0 +1,7 @@
1
+ import Route from "./interface";
2
+ declare class WaitlistRoutes {
3
+ static routes: {
4
+ [key: string]: Route;
5
+ };
6
+ }
7
+ export default WaitlistRoutes;
@@ -7,12 +7,6 @@ declare class Requests {
7
7
  private static baseUrl;
8
8
  private static authToken;
9
9
  constructor(config: Config);
10
- /**
11
- * Sets the configuration of the system.
12
- *
13
- * @param config Config The config class.
14
- */
15
- static setConfig(config: Config): void;
16
10
  /**
17
11
  * Sets the base url of the API.
18
12
  *
@@ -46,6 +40,8 @@ declare class Requests {
46
40
  * @param data
47
41
  * @returns
48
42
  */
49
- static processRoute<T>(route: Route, data?: object, routeReplace?: object): AxiosPromise<Response<T>>;
43
+ static processRoute<T>(route: Route, data?: object, routeReplace?: {
44
+ [key: string]: any;
45
+ }): AxiosPromise<Response<T>>;
50
46
  }
51
47
  export default Requests;
package/dist/index.d.ts CHANGED
@@ -7,11 +7,37 @@ import { AxiosPromise } from 'axios';
7
7
  * API.
8
8
  */
9
9
  declare class Config {
10
- baseUrl: string;
11
- authToken: string;
12
- constructor(baseUrl: string, authToken: string);
13
- setBaseUrl(baseUrl: string): void;
14
- setAuthToken(authToken: string): void;
10
+ private static _baseUrl;
11
+ private static _authToken;
12
+ private static _baseUrlLocked;
13
+ /**
14
+ * Set the configuration
15
+ *
16
+ * @param baseUrl The url base endpoint of the api
17
+ * @param authToken The JSON Web Token
18
+ */
19
+ static setConfig(baseUrl: string, authToken: string, lock?: boolean): void;
20
+ /**
21
+ * Sets the endpoint for the API
22
+ *
23
+ * @param baseUrl The url that connects to the APIs base
24
+ * @param lock If set to true, will lock the baseUrl so it cannot be changed
25
+ */
26
+ static setBaseUrl(baseUrl: string, lock?: boolean): void;
27
+ /**
28
+ * Set the JSON Web Token (JWT) that will be passed to the API
29
+ *
30
+ * @param authToken The JWT
31
+ */
32
+ static setAuthToken(authToken: string): void;
33
+ /**
34
+ * Gets base url
35
+ */
36
+ static get baseUrl(): string;
37
+ /**
38
+ * Gets auth token
39
+ */
40
+ static get authToken(): string;
15
41
  }
16
42
 
17
43
  interface Response<T> {
@@ -104,6 +130,378 @@ declare class Competitions {
104
130
  * @returns promise
105
131
  */
106
132
  static delete<T>(competition_id: string): AxiosPromise<Response<T>>;
133
+ /**
134
+ * Add a team
135
+ *
136
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/addTeam
137
+ *
138
+ * @param competition_id
139
+ * @param team_id
140
+ * @returns promise
141
+ */
142
+ static addTeam<T>(competition_id: string, team_id: string): AxiosPromise<Response<T>>;
143
+ /**
144
+ * Adds participant
145
+ *
146
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/addParticipant
147
+ *
148
+ * @param competition_id
149
+ * @param user_id
150
+ * @returns promise
151
+ */
152
+ static addParticipant<T>(competition_id: string, user_id: string): AxiosPromise<Response<T>>;
153
+ /**
154
+ * Register a team
155
+ *
156
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/registerTeam
157
+ *
158
+ * @param competition_id
159
+ * @param team_id
160
+ * @returns promise
161
+ */
162
+ static registerTeam<T>(competition_id: string, team_id: string): AxiosPromise<Response<T>>;
163
+ /**
164
+ * Register a user
165
+ *
166
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/registerParticipant
167
+ *
168
+ * @param competition_id
169
+ * @returns promise
170
+ */
171
+ static registerUser<T>(competition_id: string): AxiosPromise<Response<T>>;
172
+ /**
173
+ * Sync rounds
174
+ *
175
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/syncRounds
176
+ *
177
+ * @param competition_id
178
+ * @param number_of_competitors
179
+ * @param competitors_per_bracket
180
+ * @returns promise
181
+ */
182
+ static syncRounds<T>(competition_id: string): AxiosPromise<Response<T>>;
183
+ /**
184
+ * auto generate team brackets
185
+ *
186
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/autoGenerateTeamBrackets
187
+ *
188
+ * @param competition_id
189
+ * @param round_id
190
+ * @returns promise
191
+ */
192
+ static autoGenerate<T>(competition_id: string, round_id: number): AxiosPromise<Response<T>>;
193
+ /**
194
+ * auto generate user brackets
195
+ *
196
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/autoGenerateUserBrackets
197
+ *
198
+ * @param competition_id
199
+ * @returns promise
200
+ */
201
+ static autoGenerateUserBrackets<T>(competition_id: string): AxiosPromise<Response<T>>;
202
+ /**
203
+ * Upload main image
204
+ *
205
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/uploadMainImage
206
+ *
207
+ * @param competition_id
208
+ * @param image
209
+ * @returns promise
210
+ */
211
+ static uploadMainImage<T>(competition_id: string, image: string): AxiosPromise<Response<T>>;
212
+ /**
213
+ * Upload banner image
214
+ *
215
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/uploadBannerImage
216
+ *
217
+ * @param competition_id
218
+ * @param image
219
+ * @returns promise
220
+ */
221
+ static uploadBannerImage<T>(competition_id: string, image: string): AxiosPromise<Response<T>>;
222
+ /**
223
+ * Invites
224
+ *
225
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/competitionUserInviteList
226
+ *
227
+ * @param competition_id
228
+ * @returns promise
229
+ */
230
+ static invites<T>(competition_id: string): AxiosPromise<Response<T>>;
231
+ /**
232
+ * Sends invite
233
+ *
234
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/competitionSendInvite
235
+ *
236
+ * @param competition_id
237
+ * @returns promise
238
+ */
239
+ static sendInvite<T>(competition_id: string): AxiosPromise<Response<T>>;
240
+ /**
241
+ * Accept invite
242
+ *
243
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/competitionAcceptInvite
244
+ *
245
+ * @param competition_id
246
+ * @param token
247
+ * @returns promise
248
+ */
249
+ static acceptInvite<T>(competition_id: string, token: string): AxiosPromise<Response<T>>;
250
+ /**
251
+ * Round brackets
252
+ *
253
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/resourceRoundBracketList1
254
+ *
255
+ * @param competition_id
256
+ * @param round_id
257
+ * @returns promise
258
+ */
259
+ static brackets<T>(competition_id: string, round_id: number): AxiosPromise<Response<T>>;
260
+ /**
261
+ * Store round brackets
262
+ *
263
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/resourceRoundBracketStorage
264
+ *
265
+ * @param competition_id
266
+ * @param round_id
267
+ * @returns promise
268
+ */
269
+ static bracketStore<T>(competition_id: string, round_id: number): AxiosPromise<Response<T>>;
270
+ /**
271
+ * Show round bracket
272
+ *
273
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/resourceRoundBracketShow
274
+ *
275
+ * @param competition_id
276
+ * @param round_id
277
+ * @param bracket_id
278
+ * @returns promise
279
+ */
280
+ static showBracket<T>(competition_id: string, round_id: number, bracket_id: number): AxiosPromise<Response<T>>;
281
+ /**
282
+ * Update bracket
283
+ *
284
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/updateRoundBracket
285
+ *
286
+ * @param competition_id
287
+ * @param round_id
288
+ * @param bracket_id
289
+ * @returns promise
290
+ */
291
+ static updateBracket<T>(competition_id: string, round_id: number, bracket_id: number): AxiosPromise<Response<T>>;
292
+ /**
293
+ * Delete bracket
294
+ *
295
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/destoryRoundBracket
296
+ *
297
+ * @param competition_id
298
+ * @param round_id
299
+ * @param bracket_id
300
+ * @returns promise
301
+ */
302
+ static destroyBracket<T>(competition_id: string, round_id: number, bracket_id: number): AxiosPromise<Response<T>>;
303
+ /**
304
+ * List round
305
+ *
306
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/resourceRoundList
307
+ *
308
+ * @param competition_id
309
+ * @returns promise
310
+ */
311
+ static rounds<T>(competition_id: string): AxiosPromise<Response<T>>;
312
+ /**
313
+ * Create a new round for competition
314
+ *
315
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/resourceRoundStorage
316
+ *
317
+ * @param competition_id
318
+ * @returns promise
319
+ */
320
+ static roundStore<T>(competition_id: string): AxiosPromise<Response<T>>;
321
+ /**
322
+ * Retrieve the information for a single round.
323
+ *
324
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/resourceRoundShow
325
+ *
326
+ * @param competition_id
327
+ * @param round_id
328
+ * @returns promise
329
+ */
330
+ static showRound<T>(competition_id: string, round_id: number): AxiosPromise<Response<T>>;
331
+ /**
332
+ * Updating resource in storage with new information.
333
+ *
334
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/updateRound
335
+ *
336
+ * @param competition_id
337
+ * @param round_id
338
+ * @returns promise
339
+ */
340
+ static updateRound<T>(competition_id: string, round_id: number): AxiosPromise<Response<T>>;
341
+ /**
342
+ * Deletes the round for the competition.
343
+ *
344
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/destoryRound
345
+ *
346
+ * @param competition_id
347
+ * @param round_id
348
+ * @returns promise
349
+ */
350
+ static destroyRound<T>(competition_id: string, round_id: number): AxiosPromise<Response<T>>;
351
+ /**
352
+ * Retrieve a list of teams associated with the competition.
353
+ *
354
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/resourceCompetitionTeamList
355
+ *
356
+ * @param competition_id
357
+ * @returns promise
358
+ */
359
+ static team<T>(competition_id: string): AxiosPromise<Response<T>>;
360
+ /**
361
+ * Associate a new team with the competition.
362
+ *
363
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/resourceCompetitionTeamStorage
364
+ *
365
+ * @param competition_id
366
+ * @returns promise
367
+ */
368
+ static teamStore<T>(competition_id: string): AxiosPromise<Response<T>>;
369
+ /**
370
+ * Display the contents of a single team associated with the competition.
371
+ *
372
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/resourceTeamShow
373
+ *
374
+ * @param competition_id
375
+ * @param team
376
+ * @returns promise
377
+ */
378
+ static showTeam<T>(competition_id: string, team: string): AxiosPromise<Response<T>>;
379
+ /**
380
+ * Update the team information associated with the competition.
381
+ *
382
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/updateTeam
383
+ *
384
+ * @param competition_id
385
+ * @param team_id
386
+ * @returns promise
387
+ */
388
+ static updateTeam<T>(competition_id: string, team_id: string): AxiosPromise<Response<T>>;
389
+ /**
390
+ * Removes the team from the competition.
391
+ *
392
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/destoryTeam
393
+ *
394
+ * @param competition_id
395
+ * @param team_id
396
+ * @returns promise
397
+ */
398
+ static destroyTeam<T>(competition_id: string, team_id: string): AxiosPromise<Response<T>>;
399
+ /**
400
+ * List all the users associated with a competition.
401
+ *
402
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/competitionUserList
403
+ *
404
+ * @param competition_id
405
+ * @returns promise
406
+ */
407
+ static users<T>(competition_id: string): AxiosPromise<Response<T>>;
408
+ /**
409
+ * Associate a new users with the competition.
410
+ *
411
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/createCompetitionUser
412
+ *
413
+ * @param competition_id
414
+ * @returns promise
415
+ */
416
+ static competitionUser<T>(competition_id: string): AxiosPromise<Response<T>>;
417
+ /**
418
+ * Show a single user by its ID.
419
+ *
420
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/showCompetitionUser
421
+ *
422
+ * @param competition_id
423
+ * @param user_id
424
+ * @returns promise
425
+ */
426
+ static showCompetitionUser<T>(competition_id: string, user_id: string): AxiosPromise<Response<T>>;
427
+ /**
428
+ * Update the user associated with competition.
429
+ *
430
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/updateCompetitionUser
431
+ *
432
+ * @param competition_id
433
+ * @param user_id
434
+ * @returns promise
435
+ */
436
+ static updateCompetitionUser<T>(competition_id: string, user_id: string): AxiosPromise<Response<T>>;
437
+ /**
438
+ * Remove the associated user from the competition.
439
+ *
440
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/removeCompetitionUser
441
+ *
442
+ * @param competition_id
443
+ * @param user_id
444
+ * @returns promise
445
+ */
446
+ static destroyCompetitionUser<T>(competition_id: string, user_id: string): AxiosPromise<Response<T>>;
447
+ /**
448
+ * List all the venues associated with a competition.
449
+ *
450
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/venueList
451
+ *
452
+ * @param competition_id
453
+ * @returns promise
454
+ */
455
+ static venues<T>(competition_id: string): AxiosPromise<Response<T>>;
456
+ /**
457
+ * Creating a new venue.
458
+ *
459
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/createVenue
460
+ *
461
+ * @param competition_id
462
+ * @returns promise
463
+ */
464
+ static newVenue<T>(competition_id: string): AxiosPromise<Response<T>>;
465
+ /**
466
+ * Show a single venue by its ID.
467
+ *
468
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/showVenue
469
+ *
470
+ * @param competition_id
471
+ * @param venue_id
472
+ * @returns promise
473
+ */
474
+ static showVenue<T>(competition_id: string, venue_id: string): AxiosPromise<Response<T>>;
475
+ /**
476
+ * Update the venue.
477
+ *
478
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/updateVenue
479
+ *
480
+ * @param competition_id
481
+ * @param venue_id
482
+ * @returns promise
483
+ */
484
+ static updateVenue<T>(competition_id: string, venue_id: string): AxiosPromise<Response<T>>;
485
+ /**
486
+ * Deletes the venue from the competition.
487
+ *
488
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/removeCompetitionVenue
489
+ *
490
+ * @param competition_id
491
+ * @param venue_id
492
+ * @returns promise
493
+ */
494
+ static destroyVenue<T>(competition_id: string, venue_id: string): AxiosPromise<Response<T>>;
495
+ /**
496
+ * Upload venue main image to storage.
497
+ *
498
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/uploadVenueMainImage
499
+ *
500
+ * @param competition_id
501
+ * @param venue_id
502
+ * @returns promise
503
+ */
504
+ static uploadVenueMainImage<T>(competition_id: string, venue_id: string): AxiosPromise<Response<T>>;
107
505
  }
108
506
 
109
507
  declare class Users {
@@ -653,13 +1051,13 @@ declare class Teams {
653
1051
  }
654
1052
 
655
1053
  declare class Glitch {
656
- static config: typeof Config;
1054
+ static config: Config;
657
1055
  static api: {
658
- Auth: typeof Auth;
659
- Competitions: typeof Competitions;
660
- Users: typeof Users;
661
- Events: typeof Events;
662
- Teams: typeof Teams;
1056
+ Auth: Auth;
1057
+ Competitions: Competitions;
1058
+ Users: Users;
1059
+ Events: Events;
1060
+ Teams: Teams;
663
1061
  };
664
1062
  }
665
1063
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "0.0.4",
3
+ "version": "0.0.7",
4
4
  "description": "Javascrip SDK for GLitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -14,10 +14,6 @@
14
14
  "build": "rm -Rf dist && rollup -c --bundleConfigAsCjs",
15
15
  "build-docs": "rm -rf docs && typedoc --tsconfig tsconfig.json src/"
16
16
  },
17
- "files": [
18
- "dist",
19
- "src"
20
- ],
21
17
  "author": "",
22
18
  "license": "ISC",
23
19
  "devDependencies": {
@@ -31,7 +27,7 @@
31
27
  "rollup": "^3.2.5",
32
28
  "rollup-plugin-dts": "^5.0.0",
33
29
  "rollup-plugin-polyfill-node": "^0.11.0",
34
- "typedoc": "^0.23.15",
30
+ "typedoc": "^0.23.27",
35
31
  "typescript": "^4.8.4"
36
32
  },
37
33
  "dependencies": {