glitch-javascript-sdk 0.0.1 → 0.0.3
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 +55 -186
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Auth.d.ts +34 -2
- package/dist/esm/api/Competitions.d.ts +50 -5
- package/dist/esm/api/Events.d.ts +53 -0
- package/dist/esm/api/Users.d.ts +62 -0
- package/dist/esm/api/index.d.ts +4 -0
- package/dist/esm/index.d.ts +8 -2
- package/dist/esm/index.js +211 -342
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/EventsRoute.d.ts +7 -0
- package/dist/esm/routes/UserRoutes.d.ts +7 -0
- package/dist/esm/util/Requests.d.ts +27 -5
- package/dist/index.d.ts +199 -9
- package/package.json +1 -1
- package/src/api/Auth.ts +38 -3
- package/src/api/Competitions.ts +50 -5
- package/src/api/Events.ts +81 -0
- package/src/api/Users.ts +92 -0
- package/src/api/index.ts +5 -1
- package/src/index.ts +8 -2
- package/src/routes/EventsRoute.ts +33 -0
- package/src/routes/UserRoutes.ts +20 -0
- package/src/util/Requests.ts +46 -31
package/dist/esm/api/Auth.d.ts
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
|
+
import Response from "../util/Response";
|
|
2
|
+
import { AxiosPromise } from "axios";
|
|
1
3
|
declare class Auth {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Attempts to authenticate a user using their email address.
|
|
6
|
+
*
|
|
7
|
+
* @see https://api.glitch.fun/api/documentation#/Authentication%20Route/authLogin
|
|
8
|
+
*
|
|
9
|
+
* @param email The email address of the user
|
|
10
|
+
* @param password The password of the user
|
|
11
|
+
*
|
|
12
|
+
* @returns A promise
|
|
13
|
+
*/
|
|
14
|
+
static loginWithEmail<T>(email: string, password: string): AxiosPromise<Response<T>>;
|
|
15
|
+
/**
|
|
16
|
+
* Attempts to authenticate a user using their username.
|
|
17
|
+
*
|
|
18
|
+
* @see https://api.glitch.fun/api/documentation#/Authentication%20Route/authLogin
|
|
19
|
+
*
|
|
20
|
+
* @param username The username of the user
|
|
21
|
+
* @param password The password of the user
|
|
22
|
+
*
|
|
23
|
+
* @returns A promise
|
|
24
|
+
*/
|
|
25
|
+
static loginWithUsername<T>(username: string, password: string): AxiosPromise<Response<T>>;
|
|
26
|
+
/**
|
|
27
|
+
* Attempts to register a user.
|
|
28
|
+
*
|
|
29
|
+
* @see https://api.glitch.fun/api/documentation#/Authentication%20Route/authRegister
|
|
30
|
+
*
|
|
31
|
+
* @param data The data the user can register with.
|
|
32
|
+
*
|
|
33
|
+
* @returns A promise
|
|
34
|
+
*/
|
|
35
|
+
static register<T>(data: object): AxiosPromise<Response<T>>;
|
|
4
36
|
}
|
|
5
37
|
export default Auth;
|
|
@@ -1,8 +1,53 @@
|
|
|
1
|
+
import Response from "../util/Response";
|
|
2
|
+
import { AxiosPromise } from "axios";
|
|
1
3
|
declare class Competitions {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
/**
|
|
5
|
+
* List all the competitions
|
|
6
|
+
*
|
|
7
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/resourceList
|
|
8
|
+
*
|
|
9
|
+
* @returns promise
|
|
10
|
+
*/
|
|
11
|
+
static list<T>(): AxiosPromise<Response<T>>;
|
|
12
|
+
/**
|
|
13
|
+
* Create a new competition
|
|
14
|
+
*
|
|
15
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/newResourceStorage
|
|
16
|
+
*
|
|
17
|
+
* @param data The date to be passed when creating a competiton.
|
|
18
|
+
*
|
|
19
|
+
* @returns Promise
|
|
20
|
+
*/
|
|
21
|
+
static create<T>(data: object): AxiosPromise<Response<T>>;
|
|
22
|
+
/**
|
|
23
|
+
* Update a competition
|
|
24
|
+
*
|
|
25
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/updateStorage
|
|
26
|
+
*
|
|
27
|
+
* @param competition_id The id of the competition to update.
|
|
28
|
+
* @param data The data to update.
|
|
29
|
+
*
|
|
30
|
+
* @returns promise
|
|
31
|
+
*/
|
|
32
|
+
static update<T>(competition_id: string, data: object): AxiosPromise<Response<T>>;
|
|
33
|
+
/**
|
|
34
|
+
* Retrieve the information for a single competition.
|
|
35
|
+
*
|
|
36
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/showStorage
|
|
37
|
+
*
|
|
38
|
+
* @param competition_id The id fo the competition to retrieve.
|
|
39
|
+
*
|
|
40
|
+
* @returns promise
|
|
41
|
+
*/
|
|
42
|
+
static view<T>(competition_id: string): AxiosPromise<Response<T>>;
|
|
43
|
+
/**
|
|
44
|
+
* Deletes a competition.
|
|
45
|
+
*
|
|
46
|
+
* @see https://api.glitch.fun/api/documentation#/Competitions%20Route/destoryStorage
|
|
47
|
+
*
|
|
48
|
+
* @param competition_id The id of the competition to delete.
|
|
49
|
+
* @returns promise
|
|
50
|
+
*/
|
|
51
|
+
static delete<T>(competition_id: string): AxiosPromise<Response<T>>;
|
|
7
52
|
}
|
|
8
53
|
export default Competitions;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import Response from "../util/Response";
|
|
2
|
+
import { AxiosPromise } from "axios";
|
|
3
|
+
declare class Events {
|
|
4
|
+
/**
|
|
5
|
+
* List all the events
|
|
6
|
+
*
|
|
7
|
+
* @see https://api.glitch.fun/api/documentation#/Event%20Route/resourceEventList
|
|
8
|
+
*
|
|
9
|
+
* @returns promise
|
|
10
|
+
*/
|
|
11
|
+
static list<T>(): AxiosPromise<Response<T>>;
|
|
12
|
+
/**
|
|
13
|
+
* Create a new event.
|
|
14
|
+
*
|
|
15
|
+
* @see https://api.glitch.fun/api/documentation#/Event%20Route/newEventResourceStorage
|
|
16
|
+
*
|
|
17
|
+
* @param data The data to be passed when creating an event.
|
|
18
|
+
*
|
|
19
|
+
* @returns Promise
|
|
20
|
+
*/
|
|
21
|
+
static create<T>(data: object): AxiosPromise<Response<T>>;
|
|
22
|
+
/**
|
|
23
|
+
* Update a event
|
|
24
|
+
*
|
|
25
|
+
* @see https://api.glitch.fun/api/documentation#/Event%20Route/updateEventStorage
|
|
26
|
+
*
|
|
27
|
+
* @param event_id The id of the event to update.
|
|
28
|
+
* @param data The data to update.
|
|
29
|
+
*
|
|
30
|
+
* @returns promise
|
|
31
|
+
*/
|
|
32
|
+
static update<T>(event_id: string, data: object): AxiosPromise<Response<T>>;
|
|
33
|
+
/**
|
|
34
|
+
* Retrieve the information for a single event.
|
|
35
|
+
*
|
|
36
|
+
* @see https://api.glitch.fun/api/documentation#/Event%20Route/showEventStorage
|
|
37
|
+
*
|
|
38
|
+
* @param event_id The id fo the event to retrieve.
|
|
39
|
+
*
|
|
40
|
+
* @returns promise
|
|
41
|
+
*/
|
|
42
|
+
static view<T>(event_id: string): AxiosPromise<Response<T>>;
|
|
43
|
+
/**
|
|
44
|
+
* Deletes a event.
|
|
45
|
+
*
|
|
46
|
+
* @see https://api.glitch.fun/api/documentation#/Event%20Route/destoryEventStorage
|
|
47
|
+
*
|
|
48
|
+
* @param event_id The id of the event to delete.
|
|
49
|
+
* @returns promise
|
|
50
|
+
*/
|
|
51
|
+
static delete<T>(event_id: string): AxiosPromise<Response<T>>;
|
|
52
|
+
}
|
|
53
|
+
export default Events;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import Response from "../util/Response";
|
|
2
|
+
import { AxiosPromise } from "axios";
|
|
3
|
+
declare class Users {
|
|
4
|
+
/**
|
|
5
|
+
* List all the users.
|
|
6
|
+
*
|
|
7
|
+
* @see https://api.glitch.fun/api/documentation#/Users%20Route/userList
|
|
8
|
+
*
|
|
9
|
+
* @returns promise
|
|
10
|
+
*/
|
|
11
|
+
static list<T>(): AxiosPromise<Response<T>>;
|
|
12
|
+
/**
|
|
13
|
+
* Updates a users information. Requires the users JSON Web Token (JWT) for them to update their profile.
|
|
14
|
+
*
|
|
15
|
+
* @see https://api.glitch.fun/api/documentation#/Users%20Route/updateUser
|
|
16
|
+
*
|
|
17
|
+
* @param data The date to be passed when creating a competiton.
|
|
18
|
+
*
|
|
19
|
+
* @returns Promise
|
|
20
|
+
*/
|
|
21
|
+
static update<T>(data: object): AxiosPromise<Response<T>>;
|
|
22
|
+
/**
|
|
23
|
+
* Gets the current users information based on the current Json Web Token (JWT).
|
|
24
|
+
*
|
|
25
|
+
* @see https://api.glitch.fun/api/documentation#/Users%20Route/showMe
|
|
26
|
+
*
|
|
27
|
+
* @param user_id The id of the user to update.
|
|
28
|
+
* @param data The data to update.
|
|
29
|
+
*
|
|
30
|
+
* @returns promise
|
|
31
|
+
*/
|
|
32
|
+
static me<T>(): AxiosPromise<Response<T>>;
|
|
33
|
+
/**
|
|
34
|
+
* Will follow and unfollow a user. If the user is not being following, it will follow the user. If they are following, it will unfollow the user. The current JWT is used for the follower.
|
|
35
|
+
*
|
|
36
|
+
* @see https://api.glitch.fun/api/documentation#/Users%20Route/userToggleFollow
|
|
37
|
+
*
|
|
38
|
+
* @param user_id The id fo the user to retrieve.
|
|
39
|
+
*
|
|
40
|
+
* @returns promise
|
|
41
|
+
*/
|
|
42
|
+
static followToggle<T>(user_id: string): AxiosPromise<Response<T>>;
|
|
43
|
+
/**
|
|
44
|
+
* Show a users profile.
|
|
45
|
+
*
|
|
46
|
+
* @see https://api.glitch.fun/api/documentation#/Users%20Route/showUser
|
|
47
|
+
*
|
|
48
|
+
* @param user_id The id of the user to delete.
|
|
49
|
+
* @returns promise
|
|
50
|
+
*/
|
|
51
|
+
static profile<T>(user_id: string): AxiosPromise<Response<T>>;
|
|
52
|
+
/**
|
|
53
|
+
* Retrieves a user's one time login token based on a users JWT.
|
|
54
|
+
*
|
|
55
|
+
* @see https://api.glitch.fun/api/documentation#/Users%20Route/userOneTimeLoginToken
|
|
56
|
+
*
|
|
57
|
+
*
|
|
58
|
+
* @returns promise
|
|
59
|
+
*/
|
|
60
|
+
static oneTimeLoginToken<T>(): AxiosPromise<Response<T>>;
|
|
61
|
+
}
|
|
62
|
+
export default Users;
|
package/dist/esm/api/index.d.ts
CHANGED
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import Config from "./config/Config";
|
|
2
2
|
import { Auth } from "./api";
|
|
3
3
|
import { Competitions } from "./api";
|
|
4
|
+
import { Users } from "./api";
|
|
5
|
+
import { Events } from "./api";
|
|
4
6
|
declare class Glitch {
|
|
5
7
|
static config: typeof Config;
|
|
6
|
-
static
|
|
7
|
-
|
|
8
|
+
static api: {
|
|
9
|
+
Auth: typeof Auth;
|
|
10
|
+
Competitions: typeof Competitions;
|
|
11
|
+
Users: typeof Users;
|
|
12
|
+
Events: typeof Events;
|
|
13
|
+
};
|
|
8
14
|
}
|
|
9
15
|
export { Glitch };
|