github 0.10.0 → 0.11.0
raw patch · 10 files changed
+93/−37 lines, 10 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Github.Data: instance FromJSON Code
+ Github.Data: instance FromJSON SearchCodeResult
+ Github.Data.Definitions: Code :: String -> String -> String -> String -> String -> String -> Repo -> Code
+ Github.Data.Definitions: SearchCodeResult :: Int -> [Code] -> SearchCodeResult
+ Github.Data.Definitions: codeGitUrl :: Code -> String
+ Github.Data.Definitions: codeHtmlUrl :: Code -> String
+ Github.Data.Definitions: codeName :: Code -> String
+ Github.Data.Definitions: codePath :: Code -> String
+ Github.Data.Definitions: codeRepo :: Code -> Repo
+ Github.Data.Definitions: codeSha :: Code -> String
+ Github.Data.Definitions: codeUrl :: Code -> String
+ Github.Data.Definitions: data Code
+ Github.Data.Definitions: data SearchCodeResult
+ Github.Data.Definitions: instance Data Code
+ Github.Data.Definitions: instance Data SearchCodeResult
+ Github.Data.Definitions: instance Eq Code
+ Github.Data.Definitions: instance Eq SearchCodeResult
+ Github.Data.Definitions: instance Ord Code
+ Github.Data.Definitions: instance Ord SearchCodeResult
+ Github.Data.Definitions: instance Show Code
+ Github.Data.Definitions: instance Show SearchCodeResult
+ Github.Data.Definitions: instance Typeable Code
+ Github.Data.Definitions: instance Typeable SearchCodeResult
+ Github.Data.Definitions: searchCodeCodes :: SearchCodeResult -> [Code]
+ Github.Data.Definitions: searchCodeTotalCount :: SearchCodeResult -> Int
+ Github.Search: searchCode :: String -> IO (Either Error SearchCodeResult)
+ Github.Search: searchCode' :: Maybe GithubAuth -> String -> IO (Either Error SearchCodeResult)
- Github.Data.Definitions: Comment :: Maybe Int -> Maybe Int -> String -> Maybe String -> UTCTime -> Maybe String -> String -> UTCTime -> Maybe String -> GithubOwner -> Int -> Comment
+ Github.Data.Definitions: Comment :: Maybe Int -> Maybe Int -> String -> Maybe String -> UTCTime -> Maybe String -> String -> Maybe UTCTime -> Maybe String -> GithubOwner -> Int -> Comment
- Github.Data.Definitions: Repo :: String -> Maybe String -> GithubDate -> String -> String -> Int -> Maybe String -> Bool -> String -> Bool -> String -> Int -> GithubDate -> Int -> GithubOwner -> String -> Maybe String -> Maybe String -> Maybe GithubDate -> Int -> String -> Int -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe RepoRef -> Maybe RepoRef -> String -> Repo
+ Github.Data.Definitions: Repo :: Maybe String -> Maybe String -> Maybe GithubDate -> String -> Maybe String -> Maybe Int -> Maybe String -> Maybe Bool -> Maybe String -> Bool -> Maybe String -> Maybe Int -> Maybe GithubDate -> Maybe Int -> GithubOwner -> String -> Maybe String -> Maybe String -> Maybe GithubDate -> Int -> String -> Maybe Int -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe RepoRef -> Maybe RepoRef -> String -> Repo
- Github.Data.Definitions: commentCreatedAt :: Comment -> UTCTime
+ Github.Data.Definitions: commentCreatedAt :: Comment -> Maybe UTCTime
- Github.Data.Definitions: repoCloneUrl :: Repo -> String
+ Github.Data.Definitions: repoCloneUrl :: Repo -> Maybe String
- Github.Data.Definitions: repoCreatedAt :: Repo -> GithubDate
+ Github.Data.Definitions: repoCreatedAt :: Repo -> Maybe GithubDate
- Github.Data.Definitions: repoFork :: Repo -> Bool
+ Github.Data.Definitions: repoFork :: Repo -> Maybe Bool
- Github.Data.Definitions: repoForks :: Repo -> Int
+ Github.Data.Definitions: repoForks :: Repo -> Maybe Int
- Github.Data.Definitions: repoGitUrl :: Repo -> String
+ Github.Data.Definitions: repoGitUrl :: Repo -> Maybe String
- Github.Data.Definitions: repoOpenIssues :: Repo -> Int
+ Github.Data.Definitions: repoOpenIssues :: Repo -> Maybe Int
- Github.Data.Definitions: repoSize :: Repo -> Int
+ Github.Data.Definitions: repoSize :: Repo -> Maybe Int
- Github.Data.Definitions: repoSshUrl :: Repo -> String
+ Github.Data.Definitions: repoSshUrl :: Repo -> Maybe String
- Github.Data.Definitions: repoSvnUrl :: Repo -> String
+ Github.Data.Definitions: repoSvnUrl :: Repo -> Maybe String
- Github.Data.Definitions: repoUpdatedAt :: Repo -> GithubDate
+ Github.Data.Definitions: repoUpdatedAt :: Repo -> Maybe GithubDate
- Github.Data.Definitions: repoWatchers :: Repo -> Int
+ Github.Data.Definitions: repoWatchers :: Repo -> Maybe Int
Files
- Github/Data.hs +29/−12
- Github/Data/Definitions.hs +28/−13
- Github/Search.hs +18/−1
- github.cabal +1/−1
- samples/Repos/Forks/ListForks.hs +4/−1
- samples/Repos/ListOrgRepos.hs +3/−2
- samples/Repos/ListUserRepos.hs +3/−2
- samples/Repos/Starring/ListStarred.hs +3/−2
- samples/Repos/Watching/ListWatched.hs +3/−2
- samples/Search/SearchRepos.hs +1/−1
Github/Data.hs view
@@ -503,28 +503,28 @@ instance FromJSON Repo where parseJSON (Object o) =- Repo <$> o .: "ssh_url"+ Repo <$> o .:? "ssh_url" <*> o .: "description"- <*> o .: "created_at"+ <*> o .:? "created_at" <*> o .: "html_url"- <*> o .: "svn_url"- <*> o .: "forks"+ <*> o .:? "svn_url"+ <*> o .:? "forks" <*> o .:? "homepage" <*> o .: "fork"- <*> o .: "git_url"+ <*> o .:? "git_url" <*> o .: "private"- <*> o .: "clone_url"- <*> o .: "size"- <*> o .: "updated_at"- <*> o .: "watchers"+ <*> o .:? "clone_url"+ <*> o .:? "size"+ <*> o .:? "updated_at"+ <*> o .:? "watchers" <*> o .: "owner" <*> o .: "name"- <*> o .: "language"+ <*> o .:? "language" <*> o .:? "master_branch"- <*> o .: "pushed_at"+ <*> o .:? "pushed_at" <*> o .: "id" <*> o .: "url"- <*> o .: "open_issues"+ <*> o .:? "open_issues" <*> o .:? "has_wiki" <*> o .:? "has_issues" <*> o .:? "has_downloads"@@ -532,6 +532,23 @@ <*> o .:? "source" <*> o .: "hooks_url" parseJSON _ = fail "Could not build a Repo"++instance FromJSON SearchCodeResult where+ parseJSON (Object o) =+ SearchCodeResult <$> o .: "total_count"+ <*> o .:< "items"+ parseJSON _ = fail "Could not build a SearchCodeResult"++instance FromJSON Code where+ parseJSON (Object o ) =+ Code <$> o .: "name"+ <*> o .: "path"+ <*> o .: "sha"+ <*> o .: "url"+ <*> o .: "git_url"+ <*> o .: "html_url"+ <*> o .: "repository"+ parseJSON _ = fail "Could not build a Code" instance FromJSON RepoRef where parseJSON (Object o) =
Github/Data/Definitions.hs view
@@ -103,7 +103,7 @@ ,commentUpdatedAt :: UTCTime ,commentHtmlUrl :: Maybe String ,commentUrl :: String- ,commentCreatedAt :: UTCTime+ ,commentCreatedAt :: Maybe UTCTime ,commentPath :: Maybe String ,commentUser :: GithubOwner ,commentId :: Int@@ -390,24 +390,24 @@ data SearchReposResult = SearchReposResult { searchReposTotalCount :: Int- ,searchReposRepos :: [ Repo ]+ ,searchReposRepos :: [Repo] } deriving (Show, Data, Typeable, Eq, Ord) data Repo = Repo {- repoSshUrl :: String+ repoSshUrl :: Maybe String ,repoDescription :: Maybe String- ,repoCreatedAt :: GithubDate+ ,repoCreatedAt :: Maybe GithubDate ,repoHtmlUrl :: String- ,repoSvnUrl :: String- ,repoForks :: Int+ ,repoSvnUrl :: Maybe String+ ,repoForks :: Maybe Int ,repoHomepage :: Maybe String- ,repoFork :: Bool- ,repoGitUrl :: String+ ,repoFork :: Maybe Bool+ ,repoGitUrl :: Maybe String ,repoPrivate :: Bool- ,repoCloneUrl :: String- ,repoSize :: Int- ,repoUpdatedAt :: GithubDate- ,repoWatchers :: Int+ ,repoCloneUrl :: Maybe String+ ,repoSize :: Maybe Int+ ,repoUpdatedAt :: Maybe GithubDate+ ,repoWatchers :: Maybe Int ,repoOwner :: GithubOwner ,repoName :: String ,repoLanguage :: Maybe String@@ -415,7 +415,7 @@ ,repoPushedAt :: Maybe GithubDate -- ^ this is Nothing for new repositories ,repoId :: Int ,repoUrl :: String- ,repoOpenIssues :: Int+ ,repoOpenIssues :: Maybe Int ,repoHasWiki :: Maybe Bool ,repoHasIssues :: Maybe Bool ,repoHasDownloads :: Maybe Bool@@ -426,6 +426,21 @@ data RepoRef = RepoRef GithubOwner String -- Repo owner and name deriving (Show, Data, Typeable, Eq, Ord)++data SearchCodeResult = SearchCodeResult {+ searchCodeTotalCount :: Int+ ,searchCodeCodes :: [Code]+} deriving (Show, Data, Typeable, Eq, Ord)++data Code = Code {+ codeName :: String+ ,codePath :: String+ ,codeSha :: String+ ,codeUrl :: String+ ,codeGitUrl :: String+ ,codeHtmlUrl :: String+ ,codeRepo :: Repo+} deriving (Show, Data, Typeable, Eq, Ord) data Content = ContentFile ContentData | ContentDirectory [ContentData] deriving (Show, Data, Typeable, Eq, Ord)
Github/Search.hs view
@@ -3,6 +3,8 @@ module Github.Search( searchRepos' ,searchRepos+,searchCode'+,searchCode ,module Github.Data ) where @@ -14,7 +16,7 @@ -- -- > 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+searchRepos' auth queryString = githubGetWithQueryString' auth ["search", "repositories"] queryString -- | Perform a repository search. -- | Without authentication.@@ -22,4 +24,19 @@ -- > 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 +
github.cabal view
@@ -7,7 +7,7 @@ -- The package version. See the Haskell package versioning policy -- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for -- standards guiding when and how versions should be incremented.-Version: 0.10.0+Version: 0.11.0 -- A short (one-line) description of the package. Synopsis: Access to the Github API, v3.
samples/Repos/Forks/ListForks.hs view
@@ -12,7 +12,10 @@ formatFork fork = (Github.githubOwnerLogin $ Github.repoOwner fork) ++ "\t" ++ (formatPushedAt $ Github.repoPushedAt fork) ++ "\n" ++- (Github.repoCloneUrl fork)+ (formatCloneUrl $ Github.repoCloneUrl fork) formatPushedAt Nothing = "" formatPushedAt (Just pushedAt) = show $ Github.fromGithubDate pushedAt++formatCloneUrl Nothing = ""+formatCloneUrl (Just cloneUrl) = cloneUrl
samples/Repos/ListOrgRepos.hs view
@@ -14,13 +14,14 @@ (Github.repoName repo) ++ "\t" ++ (fromMaybe "" $ Github.repoDescription repo) ++ "\n" ++ (Github.repoHtmlUrl repo) ++ "\n" ++- (Github.repoCloneUrl repo) ++ "\t" +++ (fromMaybe "" $ Github.repoCloneUrl repo) ++ "\t" ++ (formatDate $ Github.repoUpdatedAt repo) ++ "\n" ++ formatLanguage (Github.repoLanguage repo) ++ "watchers: " ++ (show $ Github.repoWatchers repo) ++ "\t" ++ "forks: " ++ (show $ Github.repoForks repo) -formatDate = show . Github.fromGithubDate+formatDate (Just date) = show . Github.fromGithubDate $ date+formatDate Nothing = "????" formatLanguage (Just language) = "language: " ++ language ++ "\t" formatLanguage Nothing = ""
samples/Repos/ListUserRepos.hs view
@@ -14,13 +14,14 @@ (Github.repoName repo) ++ "\t" ++ (fromMaybe "" $ Github.repoDescription repo) ++ "\n" ++ (Github.repoHtmlUrl repo) ++ "\n" ++- (Github.repoCloneUrl repo) ++ "\t" +++ (fromMaybe "" $ Github.repoCloneUrl repo) ++ "\t" ++ (formatDate $ Github.repoUpdatedAt repo) ++ "\n" ++ formatLanguage (Github.repoLanguage repo) ++ "watchers: " ++ (show $ Github.repoWatchers repo) ++ "\t" ++ "forks: " ++ (show $ Github.repoForks repo) -formatDate = show . Github.fromGithubDate+formatDate (Just date) = show . Github.fromGithubDate $ date+formatDate Nothing = "" formatLanguage (Just language) = "language: " ++ language ++ "\t" formatLanguage Nothing = ""
samples/Repos/Starring/ListStarred.hs view
@@ -14,11 +14,12 @@ (Github.repoName repo) ++ "\t" ++ (fromMaybe "" $ Github.repoDescription repo) ++ "\n" ++ (Github.repoHtmlUrl repo) ++ "\n" ++- (Github.repoCloneUrl repo) ++ "\t" +++ (fromMaybe "" $ Github.repoCloneUrl repo) ++ "\t" ++ (formatDate $ Github.repoUpdatedAt repo) ++ "\n" ++ formatLanguage (Github.repoLanguage repo) -formatDate = show . Github.fromGithubDate+formatDate (Just date) = show . Github.fromGithubDate $ date+formatDate Nothing = "" formatLanguage (Just language) = "language: " ++ language ++ "\t" formatLanguage Nothing = ""
samples/Repos/Watching/ListWatched.hs view
@@ -14,13 +14,14 @@ (Github.repoName repo) ++ "\t" ++ (fromMaybe "" $ Github.repoDescription repo) ++ "\n" ++ (Github.repoHtmlUrl repo) ++ "\n" ++- (Github.repoCloneUrl repo) ++ "\t" +++ (fromMaybe "" $ Github.repoCloneUrl repo) ++ "\t" ++ (formatDate $ Github.repoUpdatedAt repo) ++ "\n" ++ formatLanguage (Github.repoLanguage repo) ++ "watchers: " ++ (show $ Github.repoWatchers repo) ++ "\t" ++ "forks: " ++ (show $ Github.repoForks repo) -formatDate = show . Github.fromGithubDate+formatDate (Just date) = show . Github.fromGithubDate $ date+formatDate Nothing = "" formatLanguage (Just language) = "language: " ++ language ++ "\t" formatLanguage Nothing = ""
samples/Search/SearchRepos.hs view
@@ -42,7 +42,7 @@ let fields = [ ("Name", Github.repoName) ,("URL", Github.repoHtmlUrl) ,("Description", orEmpty . Github.repoDescription)- ,("Created-At", formatDate . Github.repoCreatedAt)+ ,("Created-At", formatMaybeDate . Github.repoCreatedAt) ,("Pushed-At", formatMaybeDate . Github.repoPushedAt) ] in intercalate "\n" $ map fmt fields