From 25a943318aae8cb8cfaa7921f063880688300c62 Mon Sep 17 00:00:00 2001 From: Aziz Shamim Date: Thu, 2 Nov 2017 17:51:44 -0500 Subject: [PATCH] Add the functionality for commit search. Ensure that the preview accept header is set properly --- lib/octokit/client/search.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/octokit/client/search.rb b/lib/octokit/client/search.rb index 3826005a5..a6e1fb7cb 100644 --- a/lib/octokit/client/search.rb +++ b/lib/octokit/client/search.rb @@ -20,6 +20,21 @@ def search_code(query, options = {}) search "search/code", query, options end + # Search commits + # + # @param query [String] Search terms and qualifiers + # @param options [Hash] Sort and pagination options + # @option options [String] :sort Sort field + # @option options [String] :order Sort order (asc or desc) + # @option options [Integer] :page Page of paginated results + # @option options [Integer] :per_page Number of items per page + # @return [Sawyer::Resource] Search results object + # @see https://developer.github.com/v3/search/#search-commits + def search_commits(query, options = {}) + options = ensure_api_media_type(:commit_search, options) + search "search/commits", query, options + end + # Search issues # # @param query [String] Search term and qualifiers