glitch-javascript-sdk 0.3.7 → 0.3.9

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.
@@ -19,6 +19,7 @@ declare class Session {
19
19
  first_name: string;
20
20
  last_name: string;
21
21
  email: string;
22
+ username: string;
22
23
  }): void;
23
24
  }
24
25
  export default Session;
package/dist/index.d.ts CHANGED
@@ -97,7 +97,7 @@ declare class Auth {
97
97
  *
98
98
  * @returns promise
99
99
  */
100
- static oneTimeLogin<T>(): AxiosPromise<Response<T>>;
100
+ static oneTimeLogin<T>(token: string): AxiosPromise<Response<T>>;
101
101
  /**
102
102
  * Execute the password reset process using a user's email address.
103
103
  *
@@ -577,6 +577,51 @@ declare class Competitions {
577
577
  * @returns promise
578
578
  */
579
579
  static uploadVenueMainImageBlob<T>(competition_id: string, blob: Blob, data?: object, params?: Record<string, any>): AxiosPromise<Response<T>>;
580
+ /**
581
+ * Get a leaderboard by a users points.
582
+ *
583
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/competitionUserList
584
+ *
585
+ * @param competition_id
586
+ * @returns promise
587
+ */
588
+ static userPointsLeaderboard<T>(competition_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
589
+ /**
590
+ * Get a leaderboard by a users wins.
591
+ *
592
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/competitionUserList
593
+ *
594
+ * @param competition_id
595
+ * @returns promise
596
+ */
597
+ static userWinsLeaderboard<T>(competition_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
598
+ /**
599
+ * Get a leaderboard by a teams points.
600
+ *
601
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/competitionUserList
602
+ *
603
+ * @param competition_id
604
+ * @returns promise
605
+ */
606
+ static teamPointsLeaderboard<T>(competition_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
607
+ /**
608
+ * Get a leaderboard by a teams wins.
609
+ *
610
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/competitionUserList
611
+ *
612
+ * @param competition_id
613
+ * @returns promise
614
+ */
615
+ static teamWinsLeaderboard<T>(competition_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
616
+ /**
617
+ * Get all leaderboards.
618
+ *
619
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/competitionUserList
620
+ *
621
+ * @param competition_id
622
+ * @returns promise
623
+ */
624
+ static allLeaderboards<T>(competition_id: string, params?: Record<string, any>): AxiosPromise<Response<T>>;
580
625
  }
581
626
 
582
627
  declare class Communities {
@@ -1692,6 +1737,7 @@ declare class Session {
1692
1737
  first_name: string;
1693
1738
  last_name: string;
1694
1739
  email: string;
1740
+ username: string;
1695
1741
  }): void;
1696
1742
  }
1697
1743
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "0.3.7",
3
+ "version": "0.3.9",
4
4
  "description": "Javascript SDK for Glitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
package/src/api/Auth.ts CHANGED
@@ -53,8 +53,8 @@ class Auth {
53
53
  *
54
54
  * @returns promise
55
55
  */
56
- public static oneTimeLogin<T>() : AxiosPromise<Response<T>> {
57
- return Requests.processRoute(AuthRoutes.routes.one_time_login, {});
56
+ public static oneTimeLogin<T>(token : string) : AxiosPromise<Response<T>> {
57
+ return Requests.processRoute(AuthRoutes.routes.one_time_login, {token : token});
58
58
  }
59
59
 
60
60
  /**
@@ -620,6 +620,66 @@ class Competitions {
620
620
 
621
621
  return Requests.uploadBlob(url, 'image', blob, data);
622
622
  }
623
+
624
+ /**
625
+ * Get a leaderboard by a users points.
626
+ *
627
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/competitionUserList
628
+ *
629
+ * @param competition_id
630
+ * @returns promise
631
+ */
632
+ public static userPointsLeaderboard<T>(competition_id : string, params?: Record<string, any>): AxiosPromise<Response<T>>{
633
+ return Requests.processRoute(CompetitionRoutes.routes.userPointsLeaderboard, {}, {competition_id : competition_id}, params);
634
+ }
635
+
636
+ /**
637
+ * Get a leaderboard by a users wins.
638
+ *
639
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/competitionUserList
640
+ *
641
+ * @param competition_id
642
+ * @returns promise
643
+ */
644
+ public static userWinsLeaderboard<T>(competition_id : string, params?: Record<string, any>): AxiosPromise<Response<T>>{
645
+ return Requests.processRoute(CompetitionRoutes.routes.userWinsLeaderboard, {}, {competition_id : competition_id}, params);
646
+ }
647
+
648
+ /**
649
+ * Get a leaderboard by a teams points.
650
+ *
651
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/competitionUserList
652
+ *
653
+ * @param competition_id
654
+ * @returns promise
655
+ */
656
+ public static teamPointsLeaderboard<T>(competition_id : string, params?: Record<string, any>): AxiosPromise<Response<T>>{
657
+ return Requests.processRoute(CompetitionRoutes.routes.teamPointsLeaderboard, {}, {competition_id : competition_id}, params);
658
+ }
659
+
660
+ /**
661
+ * Get a leaderboard by a teams wins.
662
+ *
663
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/competitionUserList
664
+ *
665
+ * @param competition_id
666
+ * @returns promise
667
+ */
668
+ public static teamWinsLeaderboard<T>(competition_id : string, params?: Record<string, any>): AxiosPromise<Response<T>>{
669
+ return Requests.processRoute(CompetitionRoutes.routes.teamWinsLeaderboard, {}, {competition_id : competition_id}, params);
670
+ }
671
+
672
+ /**
673
+ * Get all leaderboards.
674
+ *
675
+ * @see https://api.glitch.fun/api/documentation#/Competitions%20Route/competitionUserList
676
+ *
677
+ * @param competition_id
678
+ * @returns promise
679
+ */
680
+ public static allLeaderboards<T>(competition_id : string, params?: Record<string, any>): AxiosPromise<Response<T>>{
681
+ return Requests.processRoute(CompetitionRoutes.routes.allLeaderboards, {}, {competition_id : competition_id}, params);
682
+ }
623
683
  }
624
684
 
625
685
  export default Competitions;
@@ -47,6 +47,11 @@ class CompetitionRoutes {
47
47
  updateVenue : { url: '/competitions/{competition_id}/venues/{venue_id}', method: HTTP_METHODS.PUT },
48
48
  destroyVenue : { url: '/competitions/{competition_id}/venues/{venue_id}', method: HTTP_METHODS.DELETE },
49
49
  uploadVenueMainImage : { url: '/competitions/{competition_id}/venues/{venue_id}/uploadMainImage', method: HTTP_METHODS.POST },
50
+ userPointsLeaderboard : { url: '/competitions/{competition_id}/userPointsLeaderboard', method: HTTP_METHODS.GET },
51
+ teamPointsLeaderboard : { url: '/competitions/{competition_id}/teamPointsLeaderboard', method: HTTP_METHODS.GET },
52
+ userWinsLeaderboard : { url: '/competitions/{competition_id}/userWinsLeaderboard', method: HTTP_METHODS.GET },
53
+ teamWinsLeaderboard : { url: '/competitions/{competition_id}/teamWinsLeaderboard', method: HTTP_METHODS.GET },
54
+ allLeaderboards : { url: '/competitions/{competition_id}/allLeaderboards', method: HTTP_METHODS.GET },
50
55
  };
51
56
 
52
57
 
@@ -40,13 +40,15 @@ class Session {
40
40
  Storage.set(Session._first_name_key, null);
41
41
  Storage.set(Session._last_name_key, null);
42
42
  Storage.set(Session._email_key, null);
43
+ Storage.set(Session._username_key, null);
43
44
  }
44
45
 
45
- public static processAuthentication(data: { token: { access_token: string }, id: string, first_name: string, last_name: string, email: string }): void {
46
+ public static processAuthentication(data: { token: { access_token: string }, id: string, first_name: string, last_name: string, email: string, username: string }): void {
46
47
  Storage.setAuthToken(data.token.access_token);
47
48
  Storage.set(Session._id_key, data.id);
48
49
  Storage.set(Session._first_name_key, data.first_name);
49
50
  Storage.set(Session._last_name_key, data.last_name);
51
+ Storage.set(Session._username_key, data.username);
50
52
  Storage.set(Session._email_key, data.email);
51
53
 
52
54
  Config.setAuthToken(data.token.access_token);