forked from haskell-github/github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSearch.hs
More file actions
42 lines (35 loc) · 1.45 KB
/
Copy pathSearch.hs
File metadata and controls
42 lines (35 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
-- | The Github Search API, as described at
-- <http://developer.github.com/v3/search/>.
module Github.Search(
searchRepos'
,searchRepos
,searchCode'
,searchCode
,module Github.Data
) where
import Github.Data
import Github.Private
-- | Perform a repository search.
-- | With authentication.
--
-- > searchRepos' (Just $ GithubBasicAuth "github-username" "github-password') "q=a in%3Aname language%3Ahaskell created%3A>2013-10-01&per_page=100"
searchRepos' :: Maybe GithubAuth -> String -> IO (Either Error SearchReposResult)
searchRepos' auth queryString = githubGetWithQueryString' auth ["search", "repositories"] queryString
-- | Perform a repository search.
-- | Without authentication.
--
-- > searchRepos "q=a in%3Aname language%3Ahaskell created%3A>2013-10-01&per_page=100"
searchRepos :: String -> IO (Either Error SearchReposResult)
searchRepos = searchRepos' Nothing
-- | Perform a code search.
-- | With authentication.
--
-- > searchCode' (Just $ GithubBasicAuth "github-username" "github-password') "q=a in%3Aname language%3Ahaskell created%3A>2013-10-01&per_page=100"
searchCode' :: Maybe GithubAuth -> String -> IO (Either Error SearchCodeResult)
searchCode' auth queryString = githubGetWithQueryString' auth ["search", "code"] queryString
-- | Perform a code search.
-- | Without authentication.
--
-- > searchCode "q=addClass+in:file+language:js+repo:jquery/jquery"
searchCode :: String -> IO (Either Error SearchCodeResult)
searchCode = searchCode' Nothing