Skip to content
Browse files

[api] Added start/stop/restart to Apps API client

  • Loading branch information...
1 parent d51860b commit d20f3bcee69b4fce7347c6a17a86623e80dae1b8 @indexzero indexzero committed Mar 6, 2011
Showing with 36 additions and 0 deletions.
  1. +36 −0 lib/jitsu/api/apps.js
View
36 lib/jitsu/api/apps.js
@@ -81,4 +81,40 @@ Apps.prototype.destroy = function (name, callback) {
this._request('DELETE', ['apps', jitsu.config.username, name], callback, function (res, result) {
callback();
});
+};
+
+//
+// ### function start (name, callback)
+// #### @name {string} Name of the application to start
+// #### @callback {function} Continuation to pass control to when complete
+// Starts the application with `name` for the authenticated user.
+//
+Apps.prototype.start = function (name, callback) {
+ this._request('POST', ['apps', jitsu.config.username, name, 'start'], { start: name }, callback, function (res, result) {
+ callback();
+ });
+};
+
+//
+// ### function restart (name, callback)
+// #### @name {string} Name of the application to start
+// #### @callback {function} Continuation to pass control to when complete
+// Starts the application with `name` for the authenticated user.
+//
+Apps.prototype.restart = function (name, callback) {
+ this._request('POST', ['apps', jitsu.config.username, name, 'restart'], { restart: name }, callback, function (res, result) {
+ callback();
+ });
+};
+
+//
+// ### function stop (name, callback)
+// #### @name {string} Name of the application to stop.
+// #### @callback {function} Continuation to pass control to when complete
+// Stops the application with `name` for the authenticated user.
+//
+Apps.prototype.stop = function (name, callback) {
+ this._request('POST', ['apps', jitsu.config.username, name, 'stop'], { stop: name }, callback, function (res, result) {
+ callback();
+ });
};

0 comments on commit d20f3bc

Please sign in to comment.
Something went wrong with that request. Please try again.