stuff
This commit is contained in:
		
							
								
								
									
										8
									
								
								doapi.js
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								doapi.js
									
									
									
									
									
								
							| @ -7,12 +7,14 @@ api = function(key){ | |||||||
| 		'Content-Type': 'application/json', | 		'Content-Type': 'application/json', | ||||||
| 		'Authorization': 'Bearer '+key | 		'Authorization': 'Bearer '+key | ||||||
| 	} | 	} | ||||||
|  | 	this.calls = 0; | ||||||
|  |  | ||||||
| 	this.account = function(callback){ | 	this.account = function(callback){ | ||||||
| 		var options = { | 		var options = { | ||||||
| 			url: this.BASEURL+'account', | 			url: this.BASEURL+'account', | ||||||
| 			headers: this.headers | 			headers: this.headers | ||||||
| 		}; | 		}; | ||||||
|  | 		this.calls++; | ||||||
|  |  | ||||||
| 		return request.get(options, function(error, response, body){ | 		return request.get(options, function(error, response, body){ | ||||||
| 			return callback(body, response, error); | 			return callback(body, response, error); | ||||||
| @ -24,6 +26,7 @@ api = function(key){ | |||||||
| 			url: this.BASEURL+'droplets?tag_name='+tag, | 			url: this.BASEURL+'droplets?tag_name='+tag, | ||||||
| 			headers: this.headers | 			headers: this.headers | ||||||
| 		}; | 		}; | ||||||
|  | 		this.calls++; | ||||||
| 		 | 		 | ||||||
| 		return request.get(options, function(error, response, body){ | 		return request.get(options, function(error, response, body){ | ||||||
| 			return callback(body, response, error); | 			return callback(body, response, error); | ||||||
| @ -44,6 +47,7 @@ api = function(key){ | |||||||
| 			headers: this.headers, | 			headers: this.headers, | ||||||
| 			body: JSON.stringify(data) | 			body: JSON.stringify(data) | ||||||
| 		}; | 		}; | ||||||
|  | 		this.calls++; | ||||||
|  |  | ||||||
| 		return request.post(options, function(error, response, body){ | 		return request.post(options, function(error, response, body){ | ||||||
| 			return callback(body, response, error); | 			return callback(body, response, error); | ||||||
| @ -66,6 +70,7 @@ api = function(key){ | |||||||
| 			headers: this.headers, | 			headers: this.headers, | ||||||
| 			body: JSON.stringify(data) | 			body: JSON.stringify(data) | ||||||
| 		}; | 		}; | ||||||
|  | 		this.calls++; | ||||||
|  |  | ||||||
| 		return request.post(options, function(error, response, body){ | 		return request.post(options, function(error, response, body){ | ||||||
| 			return callback(body, response, error); | 			return callback(body, response, error); | ||||||
| @ -77,6 +82,7 @@ api = function(key){ | |||||||
| 			url: this.BASEURL+'droplets/'+dropletID, | 			url: this.BASEURL+'droplets/'+dropletID, | ||||||
| 			headers: this.headers | 			headers: this.headers | ||||||
| 		}; | 		}; | ||||||
|  | 		this.calls++; | ||||||
|  |  | ||||||
| 		return request.del(options, function(error, response, body){ | 		return request.del(options, function(error, response, body){ | ||||||
| 			callback(body, response, error); | 			callback(body, response, error); | ||||||
| @ -88,6 +94,7 @@ api = function(key){ | |||||||
| 			url: this.BASEURL+'droplets/'+dropletID, | 			url: this.BASEURL+'droplets/'+dropletID, | ||||||
| 			headers: this.headers | 			headers: this.headers | ||||||
| 		}; | 		}; | ||||||
|  | 		this.calls++; | ||||||
|  |  | ||||||
| 		return request.get(options, function(error, response, body){ | 		return request.get(options, function(error, response, body){ | ||||||
| 			callback(body, response, error); | 			callback(body, response, error); | ||||||
| @ -99,6 +106,7 @@ api = function(key){ | |||||||
| 			url: this.BASEURL+'tags', | 			url: this.BASEURL+'tags', | ||||||
| 			headers: this.headers | 			headers: this.headers | ||||||
| 		}; | 		}; | ||||||
|  | 		this.calls++; | ||||||
|  |  | ||||||
| 		return request.get(options, function(e,r,b){ | 		return request.get(options, function(e,r,b){ | ||||||
| 			callback(b,r,e); | 			callback(b,r,e); | ||||||
|  | |||||||
| @ -296,7 +296,7 @@ router.get('/stop/:name', function(req, res, next){ | |||||||
|  |  | ||||||
| router.get('/liststuff', function(req, res, next){ | router.get('/liststuff', function(req, res, next){ | ||||||
| 	var obj = util.inspect(workers, {depth: 4}); | 	var obj = util.inspect(workers, {depth: 4}); | ||||||
| 	res.send("<pre>"+obj+"</pre>"); | 	res.send("<h1>Workers</h1><pre>"+obj+"</pre><h1>label2runner</h1><pre>"util.inspect(label2runner)+'</pre><h1>DO calls</h1>'+doapi.calls); | ||||||
| }); | }); | ||||||
|  |  | ||||||
| router.post('/run/:ip?', function doRun(req, res, next){ | router.post('/run/:ip?', function doRun(req, res, next){ | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user