glitch-javascript-sdk 0.0.3 → 0.0.6
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 +0 -15714
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/api/Competitions.d.ts +372 -0
- package/dist/esm/api/Events.d.ts +205 -0
- package/dist/esm/api/Teams.d.ts +179 -0
- package/dist/esm/api/Users.d.ts +53 -0
- package/dist/esm/api/Waitlist.d.ts +53 -0
- package/dist/esm/api/index.d.ts +2 -0
- package/dist/esm/index.d.ts +7 -5
- package/dist/esm/index.js +0 -29938
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routes/RecordingRoute.d.ts +7 -0
- package/dist/esm/routes/TeamsRoute.d.ts +7 -0
- package/dist/esm/routes/WaitlistRoutes.d.ts +7 -0
- package/dist/esm/util/Requests.d.ts +5 -1
- package/dist/index.d.ts +813 -5
- package/package.json +2 -6
- package/src/api/Competitions.ts +483 -0
- package/src/api/Events.ts +306 -8
- package/src/api/Teams.ts +256 -0
- package/src/api/Users.ts +74 -0
- package/src/api/Waitlist.ts +78 -0
- package/src/api/index.ts +3 -1
- package/src/index.ts +7 -5
- package/src/routes/CompetitionRoute.ts +39 -0
- package/src/routes/EventsRoute.ts +18 -16
- package/src/routes/RecordingRoute.ts +16 -0
- package/src/routes/TeamsRoute.ts +26 -0
- package/src/routes/UserRoutes.ts +1 -1
- package/src/routes/WaitlistRoutes.ts +16 -0
- package/src/util/Requests.ts +54 -7
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import WaitlistRoutes from "../routes/TeamsRoute";
|
|
2
|
+
import Requests from "../util/Requests";
|
|
3
|
+
import Response from "../util/Response";
|
|
4
|
+
import { AxiosPromise } from "axios";
|
|
5
|
+
|
|
6
|
+
class Teams {
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* List all the waitlist sign-ups.
|
|
10
|
+
*
|
|
11
|
+
* @see https://api.glitch.fun/api/documentation#/Waitlist%20Route/waitlistList
|
|
12
|
+
*
|
|
13
|
+
* @returns promise
|
|
14
|
+
*/
|
|
15
|
+
public static list<T>() : AxiosPromise<Response<T>> {
|
|
16
|
+
return Requests.processRoute(WaitlistRoutes.routes.list);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Sign-up to the waitlist.
|
|
21
|
+
*
|
|
22
|
+
* @see https://api.glitch.fun/api/documentation#/Waitlist%20Route/waitlistCreate
|
|
23
|
+
*
|
|
24
|
+
* @param data The data to be passed when creating a team.
|
|
25
|
+
*
|
|
26
|
+
* @returns Promise
|
|
27
|
+
*/
|
|
28
|
+
public static create<T>(data : object) : AxiosPromise<Response<T>> {
|
|
29
|
+
|
|
30
|
+
return Requests.processRoute(WaitlistRoutes.routes.create, data);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Update a waitlist.
|
|
35
|
+
*
|
|
36
|
+
* @see https://api.glitch.fun/api/documentation#/Waitlist%20Route/waitlistUpdate
|
|
37
|
+
*
|
|
38
|
+
* @param waitlist_id The id of the team to update.
|
|
39
|
+
* @param data The data to update.
|
|
40
|
+
*
|
|
41
|
+
* @returns promise
|
|
42
|
+
*/
|
|
43
|
+
public static update<T>(waitlist_id : string, data : object) : AxiosPromise<Response<T>>{
|
|
44
|
+
|
|
45
|
+
return Requests.processRoute(WaitlistRoutes.routes.update, data, {waitlist_id : waitlist_id});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Retrieve the information for a single user who signed-up to the waitlist.
|
|
50
|
+
*
|
|
51
|
+
* @see https://api.glitch.fun/api/documentation#/Waitlist%20Route/waitlistUpdate
|
|
52
|
+
*
|
|
53
|
+
* @param waitlist_id The id fo the team to retrieve.
|
|
54
|
+
*
|
|
55
|
+
* @returns promise
|
|
56
|
+
*/
|
|
57
|
+
public static view<T>(waitlist_id : string) : AxiosPromise<Response<T>> {
|
|
58
|
+
|
|
59
|
+
return Requests.processRoute(WaitlistRoutes.routes.view, {}, {waitlist_id : waitlist_id});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Deletes an entry from the waitlist.
|
|
64
|
+
*
|
|
65
|
+
* @see https://api.glitch.fun/api/documentation#/Waitlist%20Route/waitlistDelete
|
|
66
|
+
*
|
|
67
|
+
* @param waitlist_id The id of the team to delete.
|
|
68
|
+
* @returns promise
|
|
69
|
+
*/
|
|
70
|
+
public static delete<T>(waitlist_id : string) : AxiosPromise<Response<T>> {
|
|
71
|
+
|
|
72
|
+
return Requests.processRoute(WaitlistRoutes.routes.delete, {}, {waitlist_id : waitlist_id});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export default Teams;
|
package/src/api/index.ts
CHANGED
|
@@ -2,8 +2,10 @@ import Auth from "./Auth";
|
|
|
2
2
|
import Competitions from "./Competitions";
|
|
3
3
|
import Users from "./Users";
|
|
4
4
|
import Events from "./Events";
|
|
5
|
+
import Teams from "./Teams";
|
|
5
6
|
|
|
6
7
|
export {Auth};
|
|
7
8
|
export {Competitions};
|
|
8
9
|
export {Users};
|
|
9
|
-
export {Events};
|
|
10
|
+
export {Events};
|
|
11
|
+
export {Teams};
|
package/src/index.ts
CHANGED
|
@@ -7,16 +7,18 @@ import { Auth } from "./api";
|
|
|
7
7
|
import { Competitions } from "./api";
|
|
8
8
|
import { Users } from "./api";
|
|
9
9
|
import {Events} from "./api";
|
|
10
|
+
import {Teams} from "./api";
|
|
10
11
|
|
|
11
12
|
class Glitch {
|
|
12
13
|
|
|
13
|
-
public static config:
|
|
14
|
+
public static config: Config;
|
|
14
15
|
|
|
15
16
|
public static api : {
|
|
16
|
-
Auth :
|
|
17
|
-
Competitions:
|
|
18
|
-
Users:
|
|
19
|
-
Events :
|
|
17
|
+
Auth : Auth,
|
|
18
|
+
Competitions: Competitions,
|
|
19
|
+
Users: Users,
|
|
20
|
+
Events : Events,
|
|
21
|
+
Teams : Teams
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
|
|
@@ -9,8 +9,47 @@ class CompetitionRoutes {
|
|
|
9
9
|
view : { url: '/competitions/{competition_id}', method: HTTP_METHODS.GET },
|
|
10
10
|
update :{ url: '/competitions/{competition_id}', method: HTTP_METHODS.PUT },
|
|
11
11
|
delete : { url: '/competitions/{competition_id}', method: HTTP_METHODS.DELETE },
|
|
12
|
+
addTeam : { url: '/competitions/{competition_id}/addTeam', method: HTTP_METHODS.POST },
|
|
13
|
+
addParticipant : { url: '/competitions/{competition_id}/addParticipant', method: HTTP_METHODS.POST },
|
|
14
|
+
registerTeam : { url: '/competitions/{competition_id}/registerTeam', method: HTTP_METHODS.POST },
|
|
15
|
+
registerUser : { url: '/competitions/{competition_id}/registerUser', method: HTTP_METHODS.POST },
|
|
16
|
+
syncRounds : { url: '/competitions/{competition_id}/syncRounds', method: HTTP_METHODS.GET },
|
|
17
|
+
autoGenerate : { url: '/competitions/{competition_id}/rounds/{round_id}/brackets/autoGenerate', method: HTTP_METHODS.GET },
|
|
18
|
+
autoGenerateUserBrackets : { url: '/competitions/{competition_id}/autoGenerateUserBrackets', method: HTTP_METHODS.GET },
|
|
19
|
+
uploadMainImage : { url: '/competitions/{competition_id}/uploadMainImage', method: HTTP_METHODS.POST },
|
|
20
|
+
uploadBannerImage : { url: '/competitions/{competition_id}/uploadBannerImage', method: HTTP_METHODS.POST },
|
|
21
|
+
invites : { url: '/competitions/{competition_id}/invites', method: HTTP_METHODS.GET },
|
|
22
|
+
sendInvite : { url: '/competitions/{competition_id}/sendInvite', method: HTTP_METHODS.POST },
|
|
23
|
+
acceptInvite : { url: '/competitions/{competition_id}/acceptInvite', method: HTTP_METHODS.POST },
|
|
24
|
+
brackets : { url: '/competitions/{competition_id}/rounds/{round_id}/brackets', method: HTTP_METHODS.GET },
|
|
25
|
+
bracketStore : { url: '/competitions/{competition_id}/rounds/{round_id}/brackets', method: HTTP_METHODS.POST },
|
|
26
|
+
showBracket : { url: '/competitions/{competition_id}/rounds/{round_id}/brackets/{bracket_id}', method: HTTP_METHODS.GET },
|
|
27
|
+
updateBracket : { url: '/competitions/{competition_id}/rounds/{round_id}/brackets/{bracket_id}', method: HTTP_METHODS.PUT },
|
|
28
|
+
destroyBracket : { url: '/competitions/{competition_id}/rounds/{round_id}/brackets/{bracket_id}', method: HTTP_METHODS.DELETE },
|
|
29
|
+
rounds : { url: '/competitions/{competition_id}/rounds', method: HTTP_METHODS.GET },
|
|
30
|
+
roundStore : { url: '/competitions/{competition_id}/rounds', method: HTTP_METHODS.POST },
|
|
31
|
+
showRound : { url: '/competitions/{competition_id}/rounds/{round_id}', method: HTTP_METHODS.GET },
|
|
32
|
+
updateRound : { url: '/competitions/{competition_id}/rounds/{round_id}', method: HTTP_METHODS.PUT },
|
|
33
|
+
destroyRound : { url: '/competitions/{competition_id}/rounds/{round_id}', method: HTTP_METHODS.DELETE },
|
|
34
|
+
team : { url: '/competitions/{competition_id}/teams', method: HTTP_METHODS.GET },
|
|
35
|
+
teamStore : { url: '/competitions/{competition_id}/teams', method: HTTP_METHODS.POST },
|
|
36
|
+
showTeam : { url: '/competitions/{competition_id}/teams/{team_id}', method: HTTP_METHODS.GET },
|
|
37
|
+
updateTeam : { url: '/competitions/{competition_id}/teams/{team_id}', method: HTTP_METHODS.PUT },
|
|
38
|
+
destroyTeam : { url: '/competitions/{competition_id}/teams/{team_id}', method: HTTP_METHODS.DELETE },
|
|
39
|
+
users : { url: '/competitions/{competition_id}/users', method: HTTP_METHODS.GET },
|
|
40
|
+
competitionUser : { url: '/competitions/{competition_id}/users', method: HTTP_METHODS.POST },
|
|
41
|
+
showCompetitionUser : { url: '/competitions/{competition_id}/users/{user_id}', method: HTTP_METHODS.GET },
|
|
42
|
+
updateCompetitionUser : { url: '/competitions/{competition_id}/users/{user_id}', method: HTTP_METHODS.PUT },
|
|
43
|
+
destroyCompetitionUser : { url: '/competitions/{competition_id}/users/{user_id}', method: HTTP_METHODS.DELETE },
|
|
44
|
+
venues : { url: '/competitions/{competition_id}/venues', method: HTTP_METHODS.GET },
|
|
45
|
+
newVenue : { url: '/competitions/{competition_id}/venues', method: HTTP_METHODS.POST },
|
|
46
|
+
showVenue : { url: '/competitions/{competition_id}/venues/{venue_id}', method: HTTP_METHODS.GET },
|
|
47
|
+
updateVenue : { url: '/competitions/{competition_id}/venues/{venue_id}', method: HTTP_METHODS.PUT },
|
|
48
|
+
destroyVenue : { url: '/competitions/{competition_id}/venues/{venue_id}', method: HTTP_METHODS.DELETE },
|
|
49
|
+
uploadVenueMainImage : { url: '/competitions/{competition_id}/venues/{venue_id}/uploadMainImage', method: HTTP_METHODS.POST },
|
|
12
50
|
};
|
|
13
51
|
|
|
52
|
+
|
|
14
53
|
}
|
|
15
54
|
|
|
16
55
|
export default CompetitionRoutes;
|
|
@@ -9,22 +9,24 @@ class EventsRoutes {
|
|
|
9
9
|
view : { url: '/events/{event_id}', method: HTTP_METHODS.GET },
|
|
10
10
|
update :{ url: '/events/{event_id}', method: HTTP_METHODS.PUT },
|
|
11
11
|
delete : { url: '/events/{event_id}', method: HTTP_METHODS.DELETE },
|
|
12
|
-
updateInvirtu : {url : '/events/{
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
12
|
+
updateInvirtu : {url : '/events/{event_id}/invirtu', method: HTTP_METHODS.PUT },
|
|
13
|
+
syncAsLive : {url : '/events/{event_id}/syncAsLive', method: HTTP_METHODS.POST },
|
|
14
|
+
addRTMPSource : {url : '/events/{event_id}/addRTMPSource', method: HTTP_METHODS.POST },
|
|
15
|
+
updateRTMPSource : {url : '/events/{event_id}/updateRTMPSource/{subid}', method: HTTP_METHODS.PUT },
|
|
16
|
+
removeRTMPSource : {url : '/events/{event_id}/removeRTMPSource/{subid}', method: HTTP_METHODS.DELETE},
|
|
17
|
+
uploadMainImage : {url : '/events/{event_id}/removeRTMPSource/{subid}', method: HTTP_METHODS.POST},
|
|
18
|
+
uploadBannerImage : {url : '/events/{event_id}/uploadBannerImage', method: HTTP_METHODS.POST},
|
|
19
|
+
enableBroadcastMode : {url : '/events/{event_id}/uploadBannerImage', method: HTTP_METHODS.POST},
|
|
20
|
+
enableLivestreamMode : {url : '/events/{event_id}/enableLivestreamMode', method: HTTP_METHODS.POST},
|
|
21
|
+
sendOnScreenContent : {url : '/events/{event_id}/sendOnScreenContent', method: HTTP_METHODS.POST},
|
|
22
|
+
addOverlay : {url : '/events/{event_id}/addOverlay', method : HTTP_METHODS.POST},
|
|
23
|
+
removeOverlay : {url : '/events/{event_id}/removeOverlay/{subid}', method : HTTP_METHODS.DELETE},
|
|
24
|
+
enableOverlay : {url : '/events/{event_id}/enableOverlay/{subid}', method : HTTP_METHODS.POST},
|
|
25
|
+
disableOverlay : {url : '/events/{event_id}/disableOverlay', method: HTTP_METHODS.POST},
|
|
26
|
+
enableDonations : {url : '/events/{event_id}/enableDonations', method: HTTP_METHODS.POST},
|
|
27
|
+
disableDonations : {url : '/events/{event_id}/disableDonations', method : HTTP_METHODS.POST},
|
|
28
|
+
sendInvite : {url : '/events/{event_id}/sendInvite', method : HTTP_METHODS.POST},
|
|
29
|
+
acceptInvite : {url : '/events/{event_id}/sendInvite', method : HTTP_METHODS.POST}
|
|
28
30
|
|
|
29
31
|
};
|
|
30
32
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Route from "./interface";
|
|
2
|
+
import HTTP_METHODS from "../constants/HttpMethods";
|
|
3
|
+
|
|
4
|
+
class RecordingsRoute {
|
|
5
|
+
|
|
6
|
+
public static routes: { [key: string]: Route } = {
|
|
7
|
+
login: { url: '/auth/login', method: HTTP_METHODS.POST },
|
|
8
|
+
register: { url: '/auth/register', method: HTTP_METHODS.POST },
|
|
9
|
+
one_time_login : { url: '/auth/oneTimeLoginWithToken', method: HTTP_METHODS.POST },
|
|
10
|
+
forgot_password :{ url: '/auth/forgotpassword', method: HTTP_METHODS.POST },
|
|
11
|
+
reset_password : { url: '/auth/resetpassword', method: HTTP_METHODS.POST },
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default RecordingsRoute;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Route from "./interface";
|
|
2
|
+
import HTTP_METHODS from "../constants/HttpMethods";
|
|
3
|
+
|
|
4
|
+
class TeamsRoute {
|
|
5
|
+
|
|
6
|
+
public static routes: { [key: string]: Route } = {
|
|
7
|
+
list: { url: '/teams', method: HTTP_METHODS.GET },
|
|
8
|
+
create: { url: '/teams', method: HTTP_METHODS.POST },
|
|
9
|
+
view : { url: '/teams/{team_id}', method: HTTP_METHODS.GET },
|
|
10
|
+
update :{ url: '/teams/{team_id}', method: HTTP_METHODS.PUT },
|
|
11
|
+
delete : { url: '/teams/{team_id}', method: HTTP_METHODS.DELETE },
|
|
12
|
+
uploadMainImage : {url: '/teams/{team_id}/uploadMainImage', method : HTTP_METHODS.POST },
|
|
13
|
+
uploadBannerImage : {url : '/teams/{team_id}/uploadBannerImage', method : HTTP_METHODS.POST },
|
|
14
|
+
listInvites : {url : '/teams/{team_id}/invites', method : HTTP_METHODS.GET },
|
|
15
|
+
sendInvite : {url: '/teams/{team_id}/sendInvite', method : HTTP_METHODS.POST},
|
|
16
|
+
acceptInvite : {url : '/teams/{team_id}/acceptInvite', method: HTTP_METHODS.POST},
|
|
17
|
+
listTeamUsers : {url : '/teams/{team_id}/users', method : HTTP_METHODS.GET},
|
|
18
|
+
addTeamUser : {url : '/teams/{team_id}/users', method : HTTP_METHODS.POST},
|
|
19
|
+
showTeamUser : {url : '/teams/{team_id}/users/{user_id}', method : HTTP_METHODS.GET},
|
|
20
|
+
updateTeamUser : {url : '/teams/{team_id}/users/{user_id}', method : HTTP_METHODS.PUT},
|
|
21
|
+
removeTeamUser : {url : '/teams/{team_id}/users/{user_id}', method : HTTP_METHODS.DELETE}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default TeamsRoute;
|
package/src/routes/UserRoutes.ts
CHANGED
|
@@ -7,7 +7,7 @@ class UserRoutes {
|
|
|
7
7
|
list: { url: '/users', method: HTTP_METHODS.GET },
|
|
8
8
|
update: { url: '/users', method: HTTP_METHODS.PUT },
|
|
9
9
|
follow : { url: '/users/{user_id}/follow', method: HTTP_METHODS.POST },
|
|
10
|
-
profile :{ url: '/users/{
|
|
10
|
+
profile :{ url: '/users/{user_id}/profile', method: HTTP_METHODS.GET },
|
|
11
11
|
me : { url: '/users/me', method: HTTP_METHODS.GET },
|
|
12
12
|
oneTimeToken : { url: '/users/oneTimeToken', method: HTTP_METHODS.GET },
|
|
13
13
|
uploadAvatar : { url: '/users/uploadAvatarImage', method: HTTP_METHODS.POST },
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Route from "./interface";
|
|
2
|
+
import HTTP_METHODS from "../constants/HttpMethods";
|
|
3
|
+
|
|
4
|
+
class WaitlistRoutes {
|
|
5
|
+
|
|
6
|
+
public static routes: { [key: string]: Route } = {
|
|
7
|
+
list: { url: '/waitlists', method: HTTP_METHODS.GET },
|
|
8
|
+
create: { url: '/waitlists', method: HTTP_METHODS.POST },
|
|
9
|
+
show : { url: '/waitlists/{waitlist_id}', method: HTTP_METHODS.GET},
|
|
10
|
+
update : { url: '/waitlists/{waitlist_id}', method: HTTP_METHODS.PUT},
|
|
11
|
+
delete : { url: '/waitlists/{waitlist_id}', method: HTTP_METHODS.DELETE},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default WaitlistRoutes;
|
package/src/util/Requests.ts
CHANGED
|
@@ -53,16 +53,27 @@ class Requests {
|
|
|
53
53
|
private static request<T>(
|
|
54
54
|
method: 'GET' | 'POST' | 'PUT' | 'DELETE',
|
|
55
55
|
url: string,
|
|
56
|
-
data?: any
|
|
56
|
+
data?: any,
|
|
57
|
+
fileData?: any
|
|
57
58
|
): AxiosPromise<Response<T>> {
|
|
59
|
+
|
|
60
|
+
let headers : { [key: string]: string } = {
|
|
61
|
+
'Content-Type': 'application/json',
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
if(this.authToken) {
|
|
65
|
+
headers['Authorization'] = `Bearer ${this.authToken}`;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (fileData) {
|
|
69
|
+
headers['Content-Type'] = 'multipart/form-data';
|
|
70
|
+
}
|
|
71
|
+
|
|
58
72
|
const axiosPromise = axios({
|
|
59
73
|
method,
|
|
60
74
|
url: `${this.baseUrl}${url}`,
|
|
61
|
-
data,
|
|
62
|
-
headers
|
|
63
|
-
Authorization: `Bearer ${this.authToken}`,
|
|
64
|
-
'Content-Type': 'application/json',
|
|
65
|
-
},
|
|
75
|
+
data: fileData || data,
|
|
76
|
+
headers,
|
|
66
77
|
});
|
|
67
78
|
|
|
68
79
|
return axiosPromise;
|
|
@@ -90,6 +101,42 @@ class Requests {
|
|
|
90
101
|
return this.request<T>('DELETE', url);
|
|
91
102
|
}
|
|
92
103
|
|
|
104
|
+
public static uploadFile<T>(
|
|
105
|
+
url: string,
|
|
106
|
+
filename : string,
|
|
107
|
+
file: File,
|
|
108
|
+
data?: any
|
|
109
|
+
): AxiosPromise<Response<T>> {
|
|
110
|
+
|
|
111
|
+
const formData = new FormData();
|
|
112
|
+
|
|
113
|
+
formData.append(filename, file);
|
|
114
|
+
|
|
115
|
+
for (let key in data) {
|
|
116
|
+
formData.append(key, data[key]);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return this.request<T>('POST', url, data, formData);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
public static uploadBlob<T>(
|
|
123
|
+
url: string,
|
|
124
|
+
filename : string,
|
|
125
|
+
blob: Blob,
|
|
126
|
+
data?: any
|
|
127
|
+
): AxiosPromise<Response<T>> {
|
|
128
|
+
|
|
129
|
+
const formData = new FormData();
|
|
130
|
+
|
|
131
|
+
formData.append(filename, blob);
|
|
132
|
+
|
|
133
|
+
for (let key in data) {
|
|
134
|
+
formData.append(key, data[key]);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return this.request<T>('POST', url, data, formData);
|
|
138
|
+
}
|
|
139
|
+
|
|
93
140
|
/**
|
|
94
141
|
* The Route class contains the method and url, thereforce items can be
|
|
95
142
|
* automatically routed depending on the configuration.
|
|
@@ -98,7 +145,7 @@ class Requests {
|
|
|
98
145
|
* @param data
|
|
99
146
|
* @returns
|
|
100
147
|
*/
|
|
101
|
-
public static processRoute<T>(route : Route, data? : object, routeReplace? :
|
|
148
|
+
public static processRoute<T>(route : Route, data? : object, routeReplace? : {[key: string]: any}) : AxiosPromise<Response<T>> {
|
|
102
149
|
|
|
103
150
|
let url = route.url;
|
|
104
151
|
|