Skip to content

Add pagination support to history calls #95

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 31, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions lib/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -1704,22 +1704,29 @@
* @example
*
* var savedSearch = service.savedSearches().item("MySavedSearch");
* savedSearch.history(function(err, jobs, search) {
* savedSearch.history({count: 10}, function(err, jobs, search) {
* for(var i = 0; i < jobs.length; i++) {
* console.log("Job", i, ":", jobs[i].sid);
* }
* });
*
* @param {Object} options Options for retrieving history. For a full list, see the <a href="https://docs.splunk.com/Documentation/Splunk/8.0.2/RESTREF/RESTprolog#Pagination_and_filtering_parameters" target="_blank">Pagination and Filtering options</a> in the REST API documentation.
* @param {Function} callback A function to call when the history is retrieved: `(err, job, savedSearch)`.
*
* @endpoint saved/searches/{name}/history
* @method splunkjs.Service.SavedSearch
*/
history: function(callback) {
history: function(options, callback) {
if (!callback && utils.isFunction(options)) {
callback = options;
options = {};
}

callback = callback || function() {};
options = options || {};

var that = this;
return this.get("history", {}, function(err, response) {
return this.get("history", options, function(err, response) {
if (err) {
callback(err);
return;
Expand Down