glitch-javascript-sdk 0.0.2 → 0.0.4

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,258 @@
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
+ * The event is synced with Invirtu for the lie streams. This will allow you to update
54
+ *
55
+ *
56
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/updateEventStorage
57
+ *
58
+ * @param event_id The id of the event to update.
59
+ * @param data The data to update.
60
+ *
61
+ * @returns promise
62
+ */
63
+ static updateInvirtuEvent<T>(event_id: string, data: object): AxiosPromise<Response<T>>;
64
+ /**
65
+ * Add an RTMP source to multicast a stream too.
66
+ *
67
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/addRTMPSource
68
+ *
69
+ * @param event_id The id of the event.
70
+ * @param data The data to be passed when adding an RTMP source.
71
+ *
72
+ * @returns promise
73
+ */
74
+ static addRTMPSource<T>(event_id: string, data?: object): AxiosPromise<Response<T>>;
75
+ /**
76
+ * Update an RTMP Source for multicasing.
77
+ *
78
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/addRTMPSource
79
+ *
80
+ * @param event_id The id of the event.
81
+ * @param data The data to be passed when adding an RTMP source.
82
+ *
83
+ * @returns promise
84
+ */
85
+ static updateRTMPSource<T>(event_id: string, stream_id: string, data?: object): AxiosPromise<Response<T>>;
86
+ /**
87
+ * Remove a RTMP source for multicasing.
88
+ *
89
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/addRTMPSource
90
+ *
91
+ * @param event_id The id of the event.
92
+ * @param data The data to be passed when adding an RTMP source.
93
+ *
94
+ * @returns promise
95
+ */
96
+ static removeRTMPSource<T>(event_id: string, stream_id: string): AxiosPromise<Response<T>>;
97
+ /**
98
+ * A function that should be run on an interval to set the event as live when the live stream is active.
99
+ *
100
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/syncLive
101
+ *
102
+ * @param event_id The id of the event.
103
+ *
104
+ * @returns promise
105
+ */
106
+ static syncAsLive<T>(event_id: string): AxiosPromise<Response<T>>;
107
+ /**
108
+ * Updates the main image for the event using a File object.
109
+ *
110
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/uploadMainEventImage
111
+ *
112
+ * @param file The file object to upload.
113
+ * @param data Any additional data to pass along to the upload.
114
+ *
115
+ * @returns promise
116
+ */
117
+ static uploadMainImageFile<T>(event_id: string, file: File, data?: object): AxiosPromise<Response<T>>;
118
+ /**
119
+ * Updates the main image for the event using a Blob.
120
+ *
121
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/uploadMainEventImage
122
+ *
123
+ * @param blob The blob to upload.
124
+ * @param data Any additional data to pass along to the upload
125
+ *
126
+ * @returns promise
127
+ */
128
+ static uploadMainImageBlob<T>(event_id: string, blob: Blob, data?: object): AxiosPromise<Response<T>>;
129
+ /**
130
+ * Updates the banner image for the team using a File object.
131
+ *
132
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/uploadBannerEventImage
133
+ *
134
+ * @param file The file object to upload.
135
+ * @param data Any additional data to pass along to the upload.
136
+ *
137
+ * @returns promise
138
+ */
139
+ static uploadBannerImageFile<T>(event_id: string, file: File, data?: object): AxiosPromise<Response<T>>;
140
+ /**
141
+ * Updates the banner image for the team using a Blob.
142
+ *
143
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/uploadBannerEventImage
144
+ *
145
+ * @param blob The blob to upload.
146
+ * @param data Any additional data to pass along to the upload
147
+ *
148
+ * @returns promise
149
+ */
150
+ static uploadBannerImageBlob<T>(event_id: string, blob: Blob, data?: object): AxiosPromise<Response<T>>;
151
+ /**
152
+ * Enable Broadcast Mode. Broadcast mode is when the live stream is broadcasted from the game play through a protocol
153
+ * such as screen sharing.
154
+ *
155
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/enableBroadcastMode
156
+ *
157
+ * @param event_id The id of the event.
158
+ *
159
+ * @returns promise
160
+ */
161
+ static enableBroadcastMode<T>(event_id: string): AxiosPromise<Response<T>>;
162
+ /**
163
+ * Enable livestream mode, in which the stream will be delivered to the invirtu RTMP endpoint for
164
+ * streaming.
165
+ *
166
+ * @param event_id The id of the event.
167
+ *
168
+ * @returns promise
169
+ */
170
+ static enableLivestreamMode<T>(event_id: string): AxiosPromise<Response<T>>;
171
+ /**
172
+ * Sends content that will appear on-screen to the user.
173
+ *
174
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/sendOnScreenContent
175
+ *
176
+ * @param event_id The id of the event.
177
+ * @param data The information to send on-screen.
178
+ *
179
+ * @returns promise
180
+ */
181
+ static sendOnScreenContent<T>(event_id: string, data: object): AxiosPromise<Response<T>>;
182
+ /**
183
+ * Uploads an image that can be used and overlay later. A File object is used.
184
+ *
185
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/uploadOverlayImage
186
+ *
187
+ * @param event_id The id of the event.
188
+ * @param file The image as a file.
189
+ * @param data Any additional data to be sent in the request.
190
+ *
191
+ * @returns promise
192
+ */
193
+ static addOverlayAsFile<T>(event_id: string, file: File, data?: object): AxiosPromise<Response<T>>;
194
+ /**
195
+ * Uploads an image that can be used and overlay later. A blob is used.
196
+ *
197
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/uploadOverlayImage
198
+ *
199
+ * @param event_id The id of the event.
200
+ * @param blob Image data as a blob
201
+ * @param data Any additional data to be sent in the request.
202
+ *
203
+ * @returns promise
204
+ */
205
+ static addOverlayAsBlob<T>(event_id: string, blob: Blob, data?: object): AxiosPromise<Response<T>>;
206
+ /**
207
+ * Deletes an overlay image.
208
+ *
209
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/destoryOverlayStorage
210
+ *
211
+ * @param event_id The id of the event.
212
+ * @param overlay_id The id of the overlay.
213
+ *
214
+ * @returns promise
215
+ */
216
+ static removeOverlay<T>(event_id: string, overlay_id: string): AxiosPromise<Response<T>>;
217
+ /**
218
+ * Enables an overlay so that it will appear on screen.
219
+ *
220
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/enableOverlayImage
221
+ *
222
+ * @param event_id The id of the event.
223
+ * @param overlay_id The id of the overlay.
224
+ *
225
+ * @returns promise
226
+ */
227
+ static enableOverlay<T>(event_id: string, overlay_id: string): AxiosPromise<Response<T>>;
228
+ /**
229
+ * Disables the overlay so it no longer appears on-screen.
230
+ *
231
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/disableOverlay
232
+ *
233
+ * @param event_id The id of the event.
234
+ *
235
+ * @returns promise
236
+ */
237
+ static disableOverlay<T>(event_id: string): AxiosPromise<Response<T>>;
238
+ /**
239
+ * Enable the donations to appear on-screen
240
+ *
241
+ * @see https://api.glitch.fun/api/documentation#/Event%20Route/enableDonations
242
+ *
243
+ * @param event_id The id of the event.
244
+ *
245
+ * @returns promise
246
+ */
247
+ static enableDonations<T>(event_id: string): AxiosPromise<Response<T>>;
248
+ /**
249
+ * Disable the donations and remove from the screen.
250
+ *
251
+ * @param event_id
252
+ * @returns
253
+ */
254
+ static disableDonations<T>(event_id: string): AxiosPromise<Response<T>>;
255
+ static sendInvite<T>(event_id: string, data: object): AxiosPromise<Response<T>>;
256
+ static acceptInvite<T>(event_id: string, token: string): AxiosPromise<Response<T>>;
257
+ }
258
+ export default Events;
@@ -0,0 +1,179 @@
1
+ import Response from "../util/Response";
2
+ import { AxiosPromise } from "axios";
3
+ declare class Teams {
4
+ /**
5
+ * List all the teams
6
+ *
7
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamsList
8
+ *
9
+ * @returns promise
10
+ */
11
+ static list<T>(): AxiosPromise<Response<T>>;
12
+ /**
13
+ * Create a new team.
14
+ *
15
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamCreate
16
+ *
17
+ * @param data The data to be passed when creating a team.
18
+ *
19
+ * @returns Promise
20
+ */
21
+ static create<T>(data: object): AxiosPromise<Response<T>>;
22
+ /**
23
+ * Update a team.
24
+ *
25
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamUpdate
26
+ *
27
+ * @param team_id The id of the team to update.
28
+ * @param data The data to update.
29
+ *
30
+ * @returns promise
31
+ */
32
+ static update<T>(team_id: string, data: object): AxiosPromise<Response<T>>;
33
+ /**
34
+ * Retrieve the information for a single team.
35
+ *
36
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamShow
37
+ *
38
+ * @param team_id The id fo the team to retrieve.
39
+ *
40
+ * @returns promise
41
+ */
42
+ static view<T>(team_id: string): AxiosPromise<Response<T>>;
43
+ /**
44
+ * Deletes a team.
45
+ *
46
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamDelete
47
+ *
48
+ * @param team_id The id of the team to delete.
49
+ * @returns promise
50
+ */
51
+ static delete<T>(team_id: string): AxiosPromise<Response<T>>;
52
+ /**
53
+ * Updates the main image for the team using a File object.
54
+ *
55
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamUploadMainImage
56
+ *
57
+ * @param file The file object to upload.
58
+ * @param data Any additional data to pass along to the upload.
59
+ *
60
+ * @returns promise
61
+ */
62
+ static uploadMainImageFile<T>(team_id: string, file: File, data?: object): AxiosPromise<Response<T>>;
63
+ /**
64
+ * Updates the main image for the team using a Blob.
65
+ *
66
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamUploadMainImage
67
+ *
68
+ * @param blob The blob to upload.
69
+ * @param data Any additional data to pass along to the upload
70
+ *
71
+ * @returns promise
72
+ */
73
+ static uploadMainImageBlob<T>(team_id: string, blob: Blob, data?: object): AxiosPromise<Response<T>>;
74
+ /**
75
+ * Updates the banner image for the team using a File object.
76
+ *
77
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamUploadMainImage
78
+ *
79
+ * @param file The file object to upload.
80
+ * @param data Any additional data to pass along to the upload.
81
+ *
82
+ * @returns promise
83
+ */
84
+ static uploadBannerImageFile<T>(team_id: string, file: File, data?: object): AxiosPromise<Response<T>>;
85
+ /**
86
+ * Updates the banner image for the team using a Blob.
87
+ *
88
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamUploadMainImage
89
+ *
90
+ * @param blob The blob to upload.
91
+ * @param data Any additional data to pass along to the upload
92
+ *
93
+ * @returns promise
94
+ */
95
+ static uploadBannerImageBlob<T>(team_id: string, blob: Blob, data?: object): AxiosPromise<Response<T>>;
96
+ /**
97
+ * List the invites that have been sent for the team to users.
98
+ *
99
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamsUserInviteList
100
+ *
101
+ * @param team_id The id of the team
102
+ *
103
+ * @returns promise
104
+ */
105
+ static listInvites<T>(team_id: string): AxiosPromise<Response<T>>;
106
+ /**
107
+ * Send an invitation to a user to join the team.
108
+ *
109
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamSendInvite
110
+ *
111
+ * @param team_id The id of the team.
112
+ * @param data The data that will be passed into sending an invite.
113
+ *
114
+ * @returns promise
115
+ */
116
+ static sendInvite<T>(team_id: string, data?: object): AxiosPromise<Response<T>>;
117
+ /**
118
+ * Accept an invite to a team. The JSON Web Token (JWT) must be related to the token.
119
+ *
120
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamAcceptInvite
121
+ *
122
+ * @param team_id The id of the team
123
+ * @param token The token required to accept the user.
124
+ *
125
+ * @returns promise
126
+ */
127
+ static acceptInvite<T>(team_id: string, token: string): AxiosPromise<Response<T>>;
128
+ /**
129
+ * List the users who are currently associated with the team.
130
+ *
131
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/teamUserList
132
+ *
133
+ * @param team_id The id of the team.
134
+ *
135
+ * @returns promise
136
+ */
137
+ static listUsers<T>(team_id: string): AxiosPromise<Response<T>>;
138
+ /**
139
+ * Add a user to a team.
140
+ *
141
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/createTeamUser
142
+ *
143
+ * @param team_id The id of the team.
144
+ * @param data The data to be passed when adding a user.
145
+ *
146
+ * @returns promise
147
+ */
148
+ static addUser<T>(team_id: string, data?: object): AxiosPromise<Response<T>>;
149
+ /**
150
+ * Retrieves a single user and their information that is associated with a team.
151
+ *
152
+ * @see https://api.glitch.fun/api/documentation#/Teams%20Route/showTeamUser
153
+ *
154
+ * @param team_id The id of the team.
155
+ * @param user_id The id of the user.
156
+ *
157
+ * @returns promise
158
+ */
159
+ static getUser<T>(team_id: string, user_id: string): AxiosPromise<Response<T>>;
160
+ /**
161
+ * Updates the users information associated with the team.
162
+ *
163
+ * @param team_id The id of the team.
164
+ * @param user_id The id of the user.
165
+ *
166
+ * @returns promise
167
+ */
168
+ static updatetUser<T>(team_id: string, user_id: string, data?: object): AxiosPromise<Response<T>>;
169
+ /**
170
+ * Removes a user from a team.
171
+ *
172
+ * @param team_id The id of team.
173
+ * @param user_id The id of the user.
174
+ *
175
+ * @returns promise
176
+ */
177
+ static removetUser<T>(team_id: string, user_id: string): AxiosPromise<Response<T>>;
178
+ }
179
+ export default Teams;
@@ -0,0 +1,115 @@
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
+ * Updates the avatar image for the user using a File object.
63
+ *
64
+ * @see https://api.glitch.fun/api/documentation#/Users%20Route/userUploadAvatarImage
65
+ *
66
+ * @param file The file object to upload.
67
+ * @param data Any additional data to pass along to the upload.
68
+ *
69
+ * @returns promise
70
+ */
71
+ static uploadAvatarImageFile<T>(file: File, data?: object): AxiosPromise<Response<T>>;
72
+ /**
73
+ * Updates the avatar image for the user using a Blob.
74
+ *
75
+ * @see https://api.glitch.fun/api/documentation#/Users%20Route/userUploadAvatarImage
76
+ *
77
+ * @param blob The blob to upload.
78
+ * @param data Any additional data to pass along to the upload
79
+ *
80
+ * @returns promise
81
+ */
82
+ static uploadAvatarImageBlob<T>(blob: Blob, data?: object): AxiosPromise<Response<T>>;
83
+ /**
84
+ * Upload a banner image for the user, as a File object.
85
+ *
86
+ * @see https://api.glitch.fun/api/documentation#/Users%20Route/userUploadBannerImage
87
+ *
88
+ * @param file The file object to upload.
89
+ * @param data Any additional data to pass along to the upload.
90
+ *
91
+ * @returns promise
92
+ */
93
+ static uploadBannerImageFile<T>(file: File, data?: object): AxiosPromise<Response<T>>;
94
+ /**
95
+ * Upload a banner image for the user, as a Blob.
96
+ *
97
+ * @see https://api.glitch.fun/api/documentation#/Users%20Route/userUploadBannerImage
98
+ *
99
+ * @param file The blob to upload.
100
+ * @param data Any additional data to pass along to the upload.
101
+ *
102
+ * @returns promise
103
+ */
104
+ static uploadBannerImageBlob<T>(blob: Blob, data?: object): AxiosPromise<Response<T>>;
105
+ /**
106
+ * Creates a donation page for that user by syncing their information with various
107
+ * payment service.
108
+ *
109
+ * @see https://api.glitch.fun/api/documentation#/Users%20Route/userCreateDonationPage
110
+ *
111
+ * @returns promise
112
+ */
113
+ static createDonationPage<T>(): AxiosPromise<Response<T>>;
114
+ }
115
+ export default Users;
@@ -1,4 +1,10 @@
1
1
  import Auth from "./Auth";
2
2
  import Competitions from "./Competitions";
3
+ import Users from "./Users";
4
+ import Events from "./Events";
5
+ import Teams from "./Teams";
3
6
  export { Auth };
4
7
  export { Competitions };
8
+ export { Users };
9
+ export { Events };
10
+ export { Teams };
@@ -1,9 +1,17 @@
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";
6
+ import { Teams } from "./api";
4
7
  declare class Glitch {
5
8
  static config: typeof Config;
6
- static auth: typeof Auth;
7
- static competitions: typeof Competitions;
9
+ static api: {
10
+ Auth: typeof Auth;
11
+ Competitions: typeof Competitions;
12
+ Users: typeof Users;
13
+ Events: typeof Events;
14
+ Teams: typeof Teams;
15
+ };
8
16
  }
9
17
  export { Glitch };