Skip to content

Commit 41a2314

Browse files
committed
added getTestBalance function
1 parent f40dfa2 commit 41a2314

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

lib/mapping.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,11 @@ var commands = {
782782
options: [options.request,options.apikey],
783783
info: 'list locations and the number of pending tests'
784784
},
785+
'testBalance': {
786+
name: 'getTestBalance',
787+
options: [options.request,options.apikey],
788+
info: 'get remaining tests for the account'
789+
},
785790
'testers': {
786791
name: 'getTesters',
787792
options: [options.request],

lib/webpagetest.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ var paths = {
2424
testResults: 'jsonResult.php',
2525
locations: 'getLocations.php',
2626
testers: 'getTesters.php',
27+
testBalance: 'testBalance.php',
2728
test: 'runtest.php',
2829
gzip: 'getgzip.php',
2930
har: 'export.php',
@@ -315,6 +316,17 @@ function getTesters(options, callback) {
315316
return api.call(this, paths.testers, callback, query, options);
316317
}
317318

319+
function getTestBalance(options, callback) {
320+
callback = callback || options;
321+
options = options === callback ? undefined : options;
322+
323+
var query = helper.setQuery(mapping.commands.testBalance, options);
324+
if (!query.k && this.config.key) {
325+
query.k = this.config.key;
326+
}
327+
return api.call(this, paths.testBalance, callback, query, options);
328+
}
329+
318330
function runTest(what, options, callback) {
319331
var query = {};
320332

@@ -778,6 +790,7 @@ WebPageTest.prototype = {
778790
restartTest: restartTest,
779791
cancelTest: cancelTest,
780792
getPageSpeedData: getPageSpeedData,
793+
getTestBalance : getTestBalance,
781794
getHARData: getHARData,
782795
getUtilizationData: getUtilizationData,
783796
getRequestData: getRequestData,

0 commit comments

Comments
 (0)