glitch-javascript-sdk 0.0.7 → 0.0.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/src/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAWA,IAAA,MAAA,kBAAA,YAAA;AAAA,IAAA,SAAA,MAAA,GAAA;KAaG;IAAD,OAAC,MAAA,CAAA;AAAD,CAAC,EAAA;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/src/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAYA,IAAA,MAAA,kBAAA,YAAA;AAAA,IAAA,SAAA,MAAA,GAAA;KAgBC;IAAD,OAAC,MAAA,CAAA;AAAD,CAAC,EAAA;;;;"}
@@ -26,12 +26,40 @@ declare class Auth {
26
26
  /**
27
27
  * Attempts to register a user.
28
28
  *
29
- * @see https://api.glitch.fun/api/documentation#/Authentication%20Route/authRegister
29
+ * @see https://api.glitch.fun/api/documentation#/Authentication%20Route/oneTimeLoginToken
30
30
  *
31
31
  * @param data The data the user can register with.
32
32
  *
33
33
  * @returns A promise
34
34
  */
35
35
  static register<T>(data: object): AxiosPromise<Response<T>>;
36
+ /**
37
+ * Request an authentication token to faciliate a one time login of an user.
38
+ *
39
+ * @see https://api.glitch.fun/api/documentation#/Authentication%20Route/oneTimeLoginToken
40
+ *
41
+ * @returns promise
42
+ */
43
+ static oneTimeLogin<T>(): AxiosPromise<Response<T>>;
44
+ /**
45
+ * Execute the password reset process using a user's email address.
46
+ *
47
+ * @see https://api.glitch.fun/api/documentation#/Authentication%20Route/authForgotPassword
48
+ *
49
+ * @param email The email address
50
+ *
51
+ * @returns promise
52
+ */
53
+ static forgotPasswordWithEmail<T>(email: string): AxiosPromise<Response<T>>;
54
+ /**
55
+ * Resets the users password after the forgot password has been executed.
56
+ *
57
+ * @see https://api.glitch.fun/api/documentation#/Authentication%20Route/authResetPassword
58
+ *
59
+ * @param data The parameters required to reset the password.
60
+ *
61
+ * @returns promise
62
+ */
63
+ static resetPassword<T>(data: object): AxiosPromise<Response<T>>;
36
64
  }
37
65
  export default Auth;
@@ -1,6 +1,6 @@
1
1
  import Response from "../util/Response";
2
2
  import { AxiosPromise } from "axios";
3
- declare class Teams {
3
+ declare class Waitlists {
4
4
  /**
5
5
  * List all the waitlist sign-ups.
6
6
  *
@@ -50,4 +50,4 @@ declare class Teams {
50
50
  */
51
51
  static delete<T>(waitlist_id: string): AxiosPromise<Response<T>>;
52
52
  }
53
- export default Teams;
53
+ export default Waitlists;
@@ -3,8 +3,10 @@ import Competitions from "./Competitions";
3
3
  import Users from "./Users";
4
4
  import Events from "./Events";
5
5
  import Teams from "./Teams";
6
+ import Waitlists from "./Waitlist";
6
7
  export { Auth };
7
8
  export { Competitions };
8
9
  export { Users };
9
10
  export { Events };
10
11
  export { Teams };
12
+ export { Waitlists };
@@ -0,0 +1,2 @@
1
+ import Config from "./Config";
2
+ export { Config };
@@ -1,17 +1,21 @@
1
- import Config from "./config/Config";
1
+ import { Config } from "./config";
2
2
  import { Auth } from "./api";
3
3
  import { Competitions } from "./api";
4
4
  import { Users } from "./api";
5
5
  import { Events } from "./api";
6
6
  import { Teams } from "./api";
7
+ import { Waitlists } from "./api";
7
8
  declare class Glitch {
8
- static config: Config;
9
+ static config: {
10
+ Config: Config;
11
+ };
9
12
  static api: {
10
13
  Auth: Auth;
11
14
  Competitions: Competitions;
12
15
  Users: Users;
13
16
  Events: Events;
14
17
  Teams: Teams;
18
+ Waitlists: Waitlists;
15
19
  };
16
20
  }
17
21
  export { Glitch };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":[null],"names":[],"mappings":"AAWA,IAAA,MAAA,kBAAA,YAAA;AAAA,IAAA,SAAA,MAAA,GAAA;KAaG;IAAD,OAAC,MAAA,CAAA;AAAD,CAAC,EAAA;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":[null],"names":[],"mappings":"AAYA,IAAA,MAAA,kBAAA,YAAA;AAAA,IAAA,SAAA,MAAA,GAAA;KAgBC;IAAD,OAAC,MAAA,CAAA;AAAD,CAAC,EAAA;;;;"}
package/dist/index.d.ts CHANGED
@@ -72,13 +72,41 @@ declare class Auth {
72
72
  /**
73
73
  * Attempts to register a user.
74
74
  *
75
- * @see https://api.glitch.fun/api/documentation#/Authentication%20Route/authRegister
75
+ * @see https://api.glitch.fun/api/documentation#/Authentication%20Route/oneTimeLoginToken
76
76
  *
77
77
  * @param data The data the user can register with.
78
78
  *
79
79
  * @returns A promise
80
80
  */
81
81
  static register<T>(data: object): AxiosPromise<Response<T>>;
82
+ /**
83
+ * Request an authentication token to faciliate a one time login of an user.
84
+ *
85
+ * @see https://api.glitch.fun/api/documentation#/Authentication%20Route/oneTimeLoginToken
86
+ *
87
+ * @returns promise
88
+ */
89
+ static oneTimeLogin<T>(): AxiosPromise<Response<T>>;
90
+ /**
91
+ * Execute the password reset process using a user's email address.
92
+ *
93
+ * @see https://api.glitch.fun/api/documentation#/Authentication%20Route/authForgotPassword
94
+ *
95
+ * @param email The email address
96
+ *
97
+ * @returns promise
98
+ */
99
+ static forgotPasswordWithEmail<T>(email: string): AxiosPromise<Response<T>>;
100
+ /**
101
+ * Resets the users password after the forgot password has been executed.
102
+ *
103
+ * @see https://api.glitch.fun/api/documentation#/Authentication%20Route/authResetPassword
104
+ *
105
+ * @param data The parameters required to reset the password.
106
+ *
107
+ * @returns promise
108
+ */
109
+ static resetPassword<T>(data: object): AxiosPromise<Response<T>>;
82
110
  }
83
111
 
84
112
  declare class Competitions {
@@ -1050,14 +1078,68 @@ declare class Teams {
1050
1078
  static removetUser<T>(team_id: string, user_id: string): AxiosPromise<Response<T>>;
1051
1079
  }
1052
1080
 
1081
+ declare class Waitlists {
1082
+ /**
1083
+ * List all the waitlist sign-ups.
1084
+ *
1085
+ * @see https://api.glitch.fun/api/documentation#/Waitlist%20Route/waitlistList
1086
+ *
1087
+ * @returns promise
1088
+ */
1089
+ static list<T>(): AxiosPromise<Response<T>>;
1090
+ /**
1091
+ * Sign-up to the waitlist.
1092
+ *
1093
+ * @see https://api.glitch.fun/api/documentation#/Waitlist%20Route/waitlistCreate
1094
+ *
1095
+ * @param data The data to be passed when creating a team.
1096
+ *
1097
+ * @returns Promise
1098
+ */
1099
+ static create<T>(data: object): AxiosPromise<Response<T>>;
1100
+ /**
1101
+ * Update a waitlist.
1102
+ *
1103
+ * @see https://api.glitch.fun/api/documentation#/Waitlist%20Route/waitlistUpdate
1104
+ *
1105
+ * @param waitlist_id The id of the team to update.
1106
+ * @param data The data to update.
1107
+ *
1108
+ * @returns promise
1109
+ */
1110
+ static update<T>(waitlist_id: string, data: object): AxiosPromise<Response<T>>;
1111
+ /**
1112
+ * Retrieve the information for a single user who signed-up to the waitlist.
1113
+ *
1114
+ * @see https://api.glitch.fun/api/documentation#/Waitlist%20Route/waitlistUpdate
1115
+ *
1116
+ * @param waitlist_id The id fo the team to retrieve.
1117
+ *
1118
+ * @returns promise
1119
+ */
1120
+ static view<T>(waitlist_id: string): AxiosPromise<Response<T>>;
1121
+ /**
1122
+ * Deletes an entry from the waitlist.
1123
+ *
1124
+ * @see https://api.glitch.fun/api/documentation#/Waitlist%20Route/waitlistDelete
1125
+ *
1126
+ * @param waitlist_id The id of the team to delete.
1127
+ * @returns promise
1128
+ */
1129
+ static delete<T>(waitlist_id: string): AxiosPromise<Response<T>>;
1130
+ }
1131
+
1053
1132
  declare class Glitch {
1054
- static config: Config;
1133
+ static config: {
1134
+ Config: Config;
1135
+ };
1055
1136
  static api: {
1056
1137
  Auth: Auth;
1057
1138
  Competitions: Competitions;
1058
1139
  Users: Users;
1059
1140
  Events: Events;
1060
1141
  Teams: Teams;
1142
+ Waitlists: Waitlists;
1061
1143
  };
1062
1144
  }
1063
1145
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glitch-javascript-sdk",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "Javascrip SDK for GLitch",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
package/src/api/Auth.ts CHANGED
@@ -36,7 +36,7 @@ class Auth {
36
36
  /**
37
37
  * Attempts to register a user.
38
38
  *
39
- * @see https://api.glitch.fun/api/documentation#/Authentication%20Route/authRegister
39
+ * @see https://api.glitch.fun/api/documentation#/Authentication%20Route/oneTimeLoginToken
40
40
  *
41
41
  * @param data The data the user can register with.
42
42
  *
@@ -45,6 +45,44 @@ class Auth {
45
45
  public static register<T>(data : object) : AxiosPromise<Response<T>> {
46
46
  return Requests.processRoute(AuthRoutes.routes.register, data);
47
47
  }
48
+
49
+ /**
50
+ * Request an authentication token to faciliate a one time login of an user.
51
+ *
52
+ * @see https://api.glitch.fun/api/documentation#/Authentication%20Route/oneTimeLoginToken
53
+ *
54
+ * @returns promise
55
+ */
56
+ public static oneTimeLogin<T>() : AxiosPromise<Response<T>> {
57
+ return Requests.processRoute(AuthRoutes.routes.one_time_login, {});
58
+ }
59
+
60
+ /**
61
+ * Execute the password reset process using a user's email address.
62
+ *
63
+ * @see https://api.glitch.fun/api/documentation#/Authentication%20Route/authForgotPassword
64
+ *
65
+ * @param email The email address
66
+ *
67
+ * @returns promise
68
+ */
69
+ public static forgotPasswordWithEmail<T>(email: string) : AxiosPromise<Response<T>> {
70
+ return Requests.processRoute(AuthRoutes.routes.forgot_password, {email: email});
71
+ }
72
+
73
+ /**
74
+ * Resets the users password after the forgot password has been executed.
75
+ *
76
+ * @see https://api.glitch.fun/api/documentation#/Authentication%20Route/authResetPassword
77
+ *
78
+ * @param data The parameters required to reset the password.
79
+ *
80
+ * @returns promise
81
+ */
82
+ public static resetPassword<T>(data : object) : AxiosPromise<Response<T>> {
83
+ return Requests.processRoute(AuthRoutes.routes.forgot_password, data);
84
+ }
85
+
48
86
  }
49
87
 
50
88
  export default Auth;
@@ -1,9 +1,9 @@
1
- import WaitlistRoutes from "../routes/TeamsRoute";
1
+ import WaitlistRoutes from "../routes/WaitlistRoutes";
2
2
  import Requests from "../util/Requests";
3
3
  import Response from "../util/Response";
4
4
  import { AxiosPromise } from "axios";
5
5
 
6
- class Teams {
6
+ class Waitlists {
7
7
 
8
8
  /**
9
9
  * List all the waitlist sign-ups.
@@ -75,4 +75,4 @@ class Teams {
75
75
 
76
76
  }
77
77
 
78
- export default Teams;
78
+ export default Waitlists;
package/src/api/index.ts CHANGED
@@ -3,9 +3,12 @@ import Competitions from "./Competitions";
3
3
  import Users from "./Users";
4
4
  import Events from "./Events";
5
5
  import Teams from "./Teams";
6
+ import Waitlists from "./Waitlist";
7
+
6
8
 
7
9
  export {Auth};
8
10
  export {Competitions};
9
11
  export {Users};
10
12
  export {Events};
11
- export {Teams};
13
+ export {Teams};
14
+ export {Waitlists}
@@ -19,7 +19,7 @@ class Config {
19
19
  * @param baseUrl The url base endpoint of the api
20
20
  * @param authToken The JSON Web Token
21
21
  */
22
- static setConfig(baseUrl: string, authToken: string, lock? : boolean) {
22
+ public static setConfig(baseUrl: string, authToken: string, lock? : boolean) {
23
23
 
24
24
  this.setBaseUrl(baseUrl, lock);
25
25
 
@@ -35,7 +35,7 @@ class Config {
35
35
  * @param baseUrl The url that connects to the APIs base
36
36
  * @param lock If set to true, will lock the baseUrl so it cannot be changed
37
37
  */
38
- static setBaseUrl(baseUrl: string, lock? : boolean) {
38
+ public static setBaseUrl(baseUrl: string, lock? : boolean) {
39
39
 
40
40
  if(!this._baseUrlLocked) {
41
41
  Config._baseUrl = baseUrl;
@@ -53,7 +53,7 @@ class Config {
53
53
  *
54
54
  * @param authToken The JWT
55
55
  */
56
- static setAuthToken(authToken: string) {
56
+ public static setAuthToken(authToken: string) {
57
57
  Config._authToken = authToken;
58
58
 
59
59
  Requests.setAuthToken(authToken);
@@ -62,14 +62,14 @@ class Config {
62
62
  /**
63
63
  * Gets base url
64
64
  */
65
- static get baseUrl(): string {
65
+ public static get baseUrl(): string {
66
66
  return Config._baseUrl;
67
67
  }
68
68
 
69
69
  /**
70
70
  * Gets auth token
71
71
  */
72
- static get authToken(): string {
72
+ public static get authToken(): string {
73
73
  return Config._authToken;
74
74
  }
75
75
  }
@@ -0,0 +1,3 @@
1
+ import Config from "./Config";
2
+
3
+ export {Config};
package/src/index.ts CHANGED
@@ -1,27 +1,31 @@
1
1
 
2
2
  //Configuration
3
- import Config from "./config/Config";
3
+ import { Config } from "./config";
4
4
 
5
5
  //API
6
6
  import { Auth } from "./api";
7
7
  import { Competitions } from "./api";
8
8
  import { Users } from "./api";
9
- import {Events} from "./api";
10
- import {Teams} from "./api";
9
+ import { Events } from "./api";
10
+ import { Teams } from "./api";
11
+ import { Waitlists } from "./api";
11
12
 
12
13
  class Glitch {
13
14
 
14
- public static config: Config;
15
+ public static config: {
16
+ Config: Config
17
+ };
15
18
 
16
- public static api : {
17
- Auth : Auth,
19
+ public static api: {
20
+ Auth: Auth,
18
21
  Competitions: Competitions,
19
- Users: Users,
20
- Events : Events,
21
- Teams : Teams
22
+ Users: Users,
23
+ Events: Events,
24
+ Teams: Teams,
25
+ Waitlists: Waitlists
22
26
  }
23
27
 
24
28
 
25
- }
29
+ }
26
30
 
27
- export {Glitch};
31
+ export { Glitch };