Skip to content

Commit

Permalink
Automate API : updateSession and deleteSession methods
Browse files Browse the repository at this point in the history
Fixes #41
Closes #43
  • Loading branch information
Simon Tarchichi authored and scottgonzalez committed Apr 21, 2016
1 parent 83e2166 commit fa57979
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/automate.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,21 @@ extend(AutomateClient.prototype, {
this.request({
path: this.path("/sessions/" + id + ".json")
}, this.handleResponse(fn, this.stripKey("automation_session")));
},

updateSession: function(id, options, fn) {
var data = JSON.stringify(options);
this.request({
method: "PUT",
path: this.path("/sessions/" + id + ".json")
}, data, this.handleResponse(fn, this.stripKey("automation_session")));
},

deleteSession: function(id, fn) {
this.request({
method: "DELETE",
path: this.path("/sessions/" + id + ".json")
}, fn);
}
});

Expand Down
18 changes: 18 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,24 @@ Gets the details for a session.
* `callback` (`function(error, session)`): A callback to invoke when the API call is complete.
* `session`: A [session object](#session-objects).

#### automateClient.updateSession(id, options, callback)

Updates the status of a session.

* `id`: The hashed ID of the session.
* `options`: An object containing the parameters.
* `status`: New status value. [May be one of](https://www.browserstack.com/automate/rest-api#rest-api-sessions) `"completed"` or `"error"`.
* `callback` (`function(error, session)`): A callback to invoke when the API call is complete.
* `session`: The updated [session object](#session-objects).

#### automateClient.deleteSession(id, callback)

Deletes a session.

* `id`: The hashed ID of the session.
* `callback` (`function(error, data)`): A callback to invoke when the API call is complete.
* `data`: An object with a `message`, confirming the deletion.

### Screenshots API

#### BrowserStack.createScreenshotClient(settings)
Expand Down

0 comments on commit fa57979

Please sign in to comment.