Skip to content

Commit 31e84ed

Browse files
committed
Adds support for v4 API and updates challenge service to use it.
1 parent a9440e3 commit 31e84ed

File tree

3 files changed

+103
-241
lines changed

3 files changed

+103
-241
lines changed

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v8.11.1
1+
8.11.2

src/services/api.js

+17
Original file line numberDiff line numberDiff line change
@@ -265,3 +265,20 @@ export function getApiV3(token) {
265265
}
266266
return lastApiV3;
267267
}
268+
269+
/*
270+
* Topcoder API v4.
271+
*/
272+
273+
let lastApiV4 = null;
274+
/**
275+
* Returns a new or existing Api object for Topcoder API v4
276+
* @param {String} token Optional. Auth token for Topcoder API v4. (Uses same Token as v3)
277+
* @return {Api} API v3 service object.
278+
*/
279+
export function getApiV4(token) {
280+
if (!lastApiV4 || lastApiV4.private.token !== token) {
281+
lastApiV4 = new Api(config.API.V4, token);
282+
}
283+
return lastApiV4;
284+
}

0 commit comments

Comments
 (0)