github 0.2.1 → 0.3.0
raw patch · 16 files changed
+321/−43 lines, 16 filesdep +data-defaultdep +tlsdep +tls-extraPVP ok
version bump matches the API change (PVP)
Dependencies added: data-default, tls, tls-extra
API changes (from Hackage documentation)
+ Github.Gists: gist' :: Maybe BasicAuth -> String -> IO (Either Error Gist)
+ Github.Gists: gists' :: Maybe BasicAuth -> String -> IO (Either Error [Gist])
+ Github.Issues: issue' :: Maybe BasicAuth -> String -> String -> Int -> IO (Either Error Issue)
+ Github.Issues: issuesForRepo' :: Maybe BasicAuth -> String -> String -> [IssueLimitation] -> IO (Either Error [Issue])
+ Github.Organizations: publicOrganization' :: Maybe BasicAuth -> String -> IO (Either Error Organization)
+ Github.Organizations: publicOrganizationsFor' :: Maybe BasicAuth -> String -> IO (Either Error [SimpleOrganization])
+ Github.PullRequests: pullRequest' :: Maybe BasicAuth -> String -> String -> Int -> IO (Either Error DetailedPullRequest)
+ Github.PullRequests: pullRequestCommits' :: Maybe BasicAuth -> String -> String -> Int -> IO (Either Error [Commit])
+ Github.PullRequests: pullRequestFiles' :: Maybe BasicAuth -> String -> String -> Int -> IO (Either Error [File])
+ Github.PullRequests: pullRequestsFor' :: Maybe BasicAuth -> String -> String -> IO (Either Error [PullRequest])
+ Github.Repos: Edit :: Maybe String -> Maybe String -> Maybe String -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Edit
+ Github.Repos: NewRepo :: String -> (Maybe String) -> (Maybe String) -> (Maybe Bool) -> (Maybe Bool) -> (Maybe Bool) -> (Maybe Bool) -> NewRepo
+ Github.Repos: createOrganizationRepo :: BasicAuth -> String -> NewRepo -> IO (Either Error Repo)
+ Github.Repos: createRepo :: BasicAuth -> NewRepo -> IO (Either Error Repo)
+ Github.Repos: data Edit
+ Github.Repos: data NewRepo
+ Github.Repos: def :: Default a => a
+ Github.Repos: deleteRepo :: BasicAuth -> String -> String -> IO (Either Error ())
+ Github.Repos: editDescription :: Edit -> Maybe String
+ Github.Repos: editHasDownloads :: Edit -> Maybe Bool
+ Github.Repos: editHasIssues :: Edit -> Maybe Bool
+ Github.Repos: editHasWiki :: Edit -> Maybe Bool
+ Github.Repos: editHomepage :: Edit -> Maybe String
+ Github.Repos: editName :: Edit -> Maybe String
+ Github.Repos: editPublic :: Edit -> Maybe Bool
+ Github.Repos: editRepo :: BasicAuth -> String -> String -> Edit -> IO (Either Error Repo)
+ Github.Repos: instance Default Edit
+ Github.Repos: instance FromJSON DeleteToken
+ Github.Repos: instance Show DeleteToken
+ Github.Repos: instance Show Edit
+ Github.Repos: instance Show NewRepo
+ Github.Repos: instance ToJSON Edit
+ Github.Repos: instance ToJSON NewRepo
+ Github.Repos: newRepo :: String -> NewRepo
+ Github.Repos: newRepoDescription :: NewRepo -> (Maybe String)
+ Github.Repos: newRepoHasDownloads :: NewRepo -> (Maybe Bool)
+ Github.Repos: newRepoHasIssues :: NewRepo -> (Maybe Bool)
+ Github.Repos: newRepoHasWiki :: NewRepo -> (Maybe Bool)
+ Github.Repos: newRepoHomepage :: NewRepo -> (Maybe String)
+ Github.Repos: newRepoName :: NewRepo -> String
+ Github.Repos: newRepoPrivate :: NewRepo -> (Maybe Bool)
+ Github.Repos: type BasicAuth = (ByteString, ByteString)
+ Github.Users: userInfoFor' :: Maybe BasicAuth -> String -> IO (Either Error DetailedOwner)
- Github.Data.Definitions: Repo :: String -> String -> GithubDate -> String -> String -> Int -> Maybe String -> Bool -> String -> Bool -> String -> Int -> GithubDate -> Int -> GithubOwner -> String -> Maybe String -> Maybe String -> GithubDate -> Int -> String -> Int -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Repo
+ 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 -> Repo
- Github.Data.Definitions: repoDescription :: Repo -> String
+ Github.Data.Definitions: repoDescription :: Repo -> Maybe String
- Github.Data.Definitions: repoPushedAt :: Repo -> GithubDate
+ Github.Data.Definitions: repoPushedAt :: Repo -> Maybe GithubDate
Files
- Github/Data/Definitions.hs +2/−2
- Github/Gists.hs +16/−2
- Github/Issues.hs +24/−6
- Github/Organizations.hs +16/−2
- Github/Private.hs +35/−9
- Github/PullRequests.hs +43/−9
- Github/Repos.hs +151/−0
- Github/Repos/Collaborators.hs +1/−0
- Github/Users.hs +9/−1
- README.md +7/−3
- github.cabal +5/−4
- samples/Repos/Forks/ListForks.hs +4/−1
- samples/Repos/ListOrgRepos.hs +2/−1
- samples/Repos/ListUserRepos.hs +2/−1
- samples/Repos/ShowRepo.hs +2/−1
- samples/Repos/Watching/ListWatched.hs +2/−1
Github/Data/Definitions.hs view
@@ -340,7 +340,7 @@ data Repo = Repo { repoSshUrl :: String- ,repoDescription :: String+ ,repoDescription :: Maybe String ,repoCreatedAt :: GithubDate ,repoHtmlUrl :: String ,repoSvnUrl :: String@@ -357,7 +357,7 @@ ,repoName :: String ,repoLanguage :: Maybe String ,repoMasterBranch :: Maybe String- ,repoPushedAt :: GithubDate+ ,repoPushedAt :: Maybe GithubDate -- ^ this is Nothing for new repositories ,repoId :: Int ,repoUrl :: String ,repoOpenIssues :: Int
Github/Gists.hs view
@@ -1,21 +1,35 @@ -- | The gists API as described at <http://developer.github.com/v3/gists/>. module Github.Gists ( gists+,gists' ,gist+,gist' ,module Github.Data ) where import Github.Data import Github.Private +-- | The list of all gists created by the user +-- +-- > gists' (Just ("github-username", "github-password")) "mike-burns"+gists' :: Maybe BasicAuth -> String -> IO (Either Error [Gist])+gists' auth userName = githubGet' auth ["users", userName, "gists"]+ -- | The list of all public gists created by the user. -- -- > gists "mike-burns" gists :: String -> IO (Either Error [Gist])-gists userName = githubGet ["users", userName, "gists"]+gists = gists' Nothing +-- | A specific gist, given its id, with authentication credentials+--+-- > gist' (Just ("github-username", "github-password")) "225074"+gist' :: Maybe BasicAuth -> String -> IO (Either Error Gist)+gist' auth gistId = githubGet' auth ["gists", gistId]+ -- | A specific gist, given its id. -- -- > gist "225074" gist :: String -> IO (Either Error Gist)-gist gistId = githubGet ["gists", gistId]+gist = gist' Nothing
Github/Issues.hs view
@@ -1,7 +1,9 @@ -- | The issues API as described on <http://developer.github.com/v3/issues/>. module Github.Issues ( issue+,issue' ,issuesForRepo+,issuesForRepo' ,IssueLimitation(..) ,module Github.Data ) where@@ -30,21 +32,30 @@ | Descending -- ^ Sort descending. [default] | Since UTCTime -- ^ Only issues created since the specified date and time. + -- | Details on a specific issue, given the repo owner and name, and the issue+-- number.'+--+-- > issue' (Just ("github-username", "github-password")) "thoughtbot" "paperclip" "462"+issue' :: Maybe BasicAuth -> String -> String -> Int -> IO (Either Error Issue)+issue' auth user repoName issueNumber =+ githubGet' auth ["repos", user, repoName, "issues", show issueNumber]++-- | Details on a specific issue, given the repo owner and name, and the issue -- number. -- -- > issue "thoughtbot" "paperclip" "462" issue :: String -> String -> Int -> IO (Either Error Issue)-issue user repoName issueNumber =- githubGet ["repos", user, repoName, "issues", show issueNumber]+issue = issue' Nothing -- | All issues for a repo (given the repo owner and name), with optional -- restrictions as described in the @IssueLimitation@ data type. ----- > issuesForRepo "thoughtbot" "paperclip" [NoMilestone, OnlyClosed, Mentions "jyurek", Ascending]-issuesForRepo :: String -> String -> [IssueLimitation] -> IO (Either Error [Issue])-issuesForRepo user repoName issueLimitations =- githubGetWithQueryString+-- > issuesForRepo' (Just ("github-username", "github-password")) "thoughtbot" "paperclip" [NoMilestone, OnlyClosed, Mentions "jyurek", Ascending]+issuesForRepo' :: Maybe BasicAuth -> String -> String -> [IssueLimitation] -> IO (Either Error [Issue])+issuesForRepo' auth user repoName issueLimitations =+ githubGetWithQueryString' + auth ["repos", user, repoName, "issues"] (queryStringFromLimitations issueLimitations) where@@ -64,3 +75,10 @@ convert Descending = "direction=desc" convert (Since t) = "since=" ++ formatTime defaultTimeLocale "%FT%TZ" t++-- | All issues for a repo (given the repo owner and name), with optional+-- restrictions as described in the @IssueLimitation@ data type.+--+-- > issuesForRepo "thoughtbot" "paperclip" [NoMilestone, OnlyClosed, Mentions "jyurek", Ascending]+issuesForRepo :: String -> String -> [IssueLimitation] -> IO (Either Error [Issue])+issuesForRepo = issuesForRepo' Nothing
Github/Organizations.hs view
@@ -1,21 +1,35 @@ -- | The orgs API as described on <http://developer.github.com/v3/orgs/>. module Github.Organizations ( publicOrganizationsFor+,publicOrganizationsFor' ,publicOrganization+,publicOrganization' ,module Github.Data ) where import Github.Data import Github.Private +-- | The public organizations for a user, given the user's login, with authorization+--+-- > publicOrganizationsFor' (Just ("github-username", "github-password")) "mike-burns"+publicOrganizationsFor' :: Maybe BasicAuth -> String -> IO (Either Error [SimpleOrganization])+publicOrganizationsFor' auth userName = githubGet' auth ["users", userName, "orgs"]+ -- | The public organizations for a user, given the user's login. -- -- > publicOrganizationsFor "mike-burns" publicOrganizationsFor :: String -> IO (Either Error [SimpleOrganization])-publicOrganizationsFor userName = githubGet ["users", userName, "orgs"]+publicOrganizationsFor = publicOrganizationsFor' Nothing -- | Details on a public organization. Takes the organization's login. --+-- > publicOrganization' (Just ("github-username", "github-password")) "thoughtbot"+publicOrganization' :: Maybe BasicAuth -> String -> IO (Either Error Organization)+publicOrganization' auth organizationName = githubGet' auth ["orgs", organizationName]++-- | Details on a public organization. Takes the organization's login.+-- -- > publicOrganization "thoughtbot" publicOrganization :: String -> IO (Either Error Organization)-publicOrganization organizationName = githubGet ["orgs", organizationName]+publicOrganization = publicOrganization' Nothing
Github/Private.hs view
@@ -8,37 +8,62 @@ import Data.List import qualified Data.ByteString.Char8 as BS import qualified Data.ByteString.Lazy.Char8 as LBS-import qualified Network.HTTP.Types as Types+import Network.HTTP.Types (Method) import Network.HTTP.Conduit import Text.URI import qualified Control.Exception as E import Data.Maybe (fromMaybe) githubGet :: (FromJSON b, Show b) => [String] -> IO (Either Error b)-githubGet paths =+githubGet = githubGet' Nothing++githubGet' :: (FromJSON b, Show b) => Maybe BasicAuth -> [String] -> IO (Either Error b)+githubGet' auth paths = githubAPI (BS.pack "GET") (buildUrl paths)+ auth (Nothing :: Maybe Value) githubGetWithQueryString :: (FromJSON b, Show b) => [String] -> String -> IO (Either Error b)-githubGetWithQueryString paths queryString =+githubGetWithQueryString = githubGetWithQueryString' Nothing++githubGetWithQueryString' :: (FromJSON b, Show b) => Maybe BasicAuth -> [String] -> String -> IO (Either Error b)+githubGetWithQueryString' auth paths queryString = githubAPI (BS.pack "GET") (buildUrl paths ++ "?" ++ queryString)+ auth (Nothing :: Maybe Value) +githubPost :: (ToJSON a, Show a, FromJSON b, Show b) => BasicAuth -> [String] -> a -> IO (Either Error b)+githubPost auth paths body =+ githubAPI (BS.pack "POST")+ (buildUrl paths)+ (Just auth)+ (Just body)++githubPatch :: (ToJSON a, Show a, FromJSON b, Show b) => BasicAuth -> [String] -> a -> IO (Either Error b)+githubPatch auth paths body =+ githubAPI (BS.pack "PATCH")+ (buildUrl paths)+ (Just auth)+ (Just body)+ buildUrl :: [String] -> String buildUrl paths = "https://api.github.com/" ++ intercalate "/" paths -githubAPI :: (ToJSON a, Show a, FromJSON b, Show b) => BS.ByteString -> String -> Maybe a -> IO (Either Error b)-githubAPI method url body = do- result <- doHttps method url (Just encodedBody)+githubAPI :: (ToJSON a, Show a, FromJSON b, Show b) => BS.ByteString -> String -> Maybe BasicAuth -> Maybe a -> IO (Either Error b)+githubAPI method url auth body = do+ result <- doHttps method url auth (Just encodedBody) return $ either (Left . HTTPConnectionError) (parseJson . responseBody) result where encodedBody = RequestBodyLBS $ encode $ toJSON body -doHttps :: BS.ByteString -> String -> Maybe (RequestBody IO) -> IO (Either E.SomeException (Response LBS.ByteString))-doHttps method url body = do+-- | user/password for HTTP basic access authentication+type BasicAuth = (BS.ByteString, BS.ByteString)++doHttps :: Method -> String -> Maybe BasicAuth -> Maybe (RequestBody IO) -> IO (Either E.SomeException (Response LBS.ByteString))+doHttps method url auth body = do let (Just uri) = parseURI url (Just host) = uriRegName uri requestBody = fromMaybe (RequestBodyBS $ BS.pack "") body@@ -51,8 +76,9 @@ , requestBody = requestBody , queryString = queryString }+ authRequest = maybe id (uncurry applyBasicAuth) auth request - (getResponse request >>= return . Right) `E.catches` [+ (getResponse authRequest >>= return . Right) `E.catches` [ -- Re-throw AsyncException, otherwise execution will not terminate on -- SIGINT (ctrl-c). All AsyncExceptions are re-thrown (not just -- UserInterrupt) because all of them indicate severe conditions and
Github/PullRequests.hs view
@@ -1,7 +1,11 @@ -- | The pull requests API as documented at -- <http://developer.github.com/v3/pulls/>. module Github.PullRequests (- pullRequestsFor+ pullRequestsFor'+,pullRequest'+,pullRequestCommits'+,pullRequestFiles'+,pullRequestsFor ,pullRequest ,pullRequestCommits ,pullRequestFiles@@ -12,32 +16,62 @@ import Github.Private -- | All pull requests for the repo, by owner and repo name.+-- | With authentification --+-- > pullRequestsFor' (Just ("github-username", "github-password")) "rails" "rails"+pullRequestsFor' :: Maybe BasicAuth -> String -> String -> IO (Either Error [PullRequest])+pullRequestsFor' auth userName repoName =+ githubGet' auth ["repos", userName, repoName, "pulls"]++-- | All pull requests for the repo, by owner and repo name.+-- -- > pullRequestsFor "rails" "rails" pullRequestsFor :: String -> String -> IO (Either Error [PullRequest])-pullRequestsFor userName repoName =- githubGet ["repos", userName, repoName, "pulls"]+pullRequestsFor = pullRequestsFor' Nothing -- | A detailed pull request, which has much more information. This takes the -- repo owner and name along with the number assigned to the pull request.+-- | With authentification --+-- > pullRequest' (Just ("github-username", "github-password")) "thoughtbot" "paperclip" 562+pullRequest' :: Maybe BasicAuth -> String -> String -> Int -> IO (Either Error DetailedPullRequest)+pullRequest' auth userName repoName number =+ githubGet' auth ["repos", userName, repoName, "pulls", show number]++-- | A detailed pull request, which has much more information. This takes the+-- repo owner and name along with the number assigned to the pull request.+-- -- > pullRequest "thoughtbot" "paperclip" 562 pullRequest :: String -> String -> Int -> IO (Either Error DetailedPullRequest)-pullRequest userName repoName number =- githubGet ["repos", userName, repoName, "pulls", show number]+pullRequest = pullRequest' Nothing -- | All the commits on a pull request, given the repo owner, repo name, and -- the number of the pull request.+-- | With authentification --+-- > pullRequestCommits' (Just ("github-username", "github-password")) "thoughtbot" "paperclip" 688+pullRequestCommits' :: Maybe BasicAuth -> String -> String -> Int -> IO (Either Error [Commit])+pullRequestCommits' auth userName repoName number =+ githubGet' auth ["repos", userName, repoName, "pulls", show number, "commits"]++-- | All the commits on a pull request, given the repo owner, repo name, and+-- the number of the pull request.+-- -- > pullRequestCommits "thoughtbot" "paperclip" 688 pullRequestCommits :: String -> String -> Int -> IO (Either Error [Commit])-pullRequestCommits userName repoName number =- githubGet ["repos", userName, repoName, "pulls", show number, "commits"]+pullRequestCommits = pullRequestCommits' Nothing -- | The individual files that a pull request patches. Takes the repo owner and -- name, plus the number assigned to the pull request.+-- | With authentification --+-- > pullRequestFiles' (Just ("github-username", "github-password")) "thoughtbot" "paperclip" 688+pullRequestFiles' :: Maybe BasicAuth -> String -> String -> Int -> IO (Either Error [File])+pullRequestFiles' auth userName repoName number =+ githubGet' auth ["repos", userName, repoName, "pulls", show number, "files"]+-- | The individual files that a pull request patches. Takes the repo owner and+-- name, plus the number assigned to the pull request.+-- -- > pullRequestFiles "thoughtbot" "paperclip" 688 pullRequestFiles :: String -> String -> Int -> IO (Either Error [File])-pullRequestFiles userName repoName number =- githubGet ["repos", userName, repoName, "pulls", show number, "files"]+pullRequestFiles = pullRequestFiles' Nothing
Github/Repos.hs view
@@ -1,6 +1,9 @@+{-# LANGUAGE OverloadedStrings #-} -- | The Github Repos API, as documented at -- <http://developer.github.com/v3/repos/> module Github.Repos (++-- * Querying repositories userRepos ,organizationRepos ,userRepo@@ -11,10 +14,36 @@ ,branchesFor ,module Github.Data ,RepoPublicity(..)++-- * Modifying repositories+-- |+-- Only authenticated users may modify repositories. Currently only+-- /HTTP basic access authentication/ is implemented.+,BasicAuth++-- ** Create+,createRepo+,createOrganizationRepo+,newRepo+,NewRepo(..)++-- ** Edit+,editRepo+,def+,Edit(..)++-- ** Delete+,deleteRepo ) where +import Data.Default+import Data.Aeson.Types import Github.Data import Github.Private+import Network.HTTP.Conduit+import qualified Data.ByteString.Char8 as BS+import Control.Applicative+import Network.HTTP.Types -- | Filter the list of the user's repos using any of these constructors. data RepoPublicity =@@ -94,3 +123,125 @@ branchesFor :: String -> String -> IO (Either Error [Branch]) branchesFor userName repoName = githubGet ["repos", userName, repoName, "branches"]+++data NewRepo = NewRepo {+ newRepoName :: String+, newRepoDescription :: (Maybe String)+, newRepoHomepage :: (Maybe String)+, newRepoPrivate :: (Maybe Bool)+, newRepoHasIssues :: (Maybe Bool)+, newRepoHasWiki :: (Maybe Bool)+, newRepoHasDownloads :: (Maybe Bool)+} deriving Show++instance ToJSON NewRepo where+ toJSON (NewRepo { newRepoName = name+ , newRepoDescription = description+ , newRepoHomepage = homepage+ , newRepoPrivate = private+ , newRepoHasIssues = hasIssues+ , newRepoHasWiki = hasWiki+ , newRepoHasDownloads = hasDownloads+ }) = object+ [ "name" .= name+ , "description" .= description+ , "homepage" .= homepage+ , "private" .= private+ , "has_issues" .= hasIssues+ , "has_wiki" .= hasWiki+ , "has_downloads" .= hasDownloads+ ]++newRepo :: String -> NewRepo+newRepo name = NewRepo name Nothing Nothing Nothing Nothing Nothing Nothing++-- |+-- Create a new repository.+--+-- > createRepo (user, password) (newRepo "some_repo") {newRepoHasIssues = Just False}+createRepo :: BasicAuth -> NewRepo -> IO (Either Error Repo)+createRepo auth = githubPost auth ["user", "repos"]++-- |+-- Create a new repository for an organization.+--+-- > createOrganizationRepo (user, password) "thoughtbot" (newRepo "some_repo") {newRepoHasIssues = Just False}+createOrganizationRepo :: BasicAuth -> String -> NewRepo -> IO (Either Error Repo)+createOrganizationRepo auth org = githubPost auth ["orgs", org, "repos"]++data Edit = Edit {+ editName :: Maybe String+, editDescription :: Maybe String+, editHomepage :: Maybe String+, editPublic :: Maybe Bool+, editHasIssues :: Maybe Bool+, editHasWiki :: Maybe Bool+, editHasDownloads :: Maybe Bool+} deriving Show++instance Default Edit where+ def = Edit def def def def def def def++instance ToJSON Edit where+ toJSON (Edit { editName = name+ , editDescription = description+ , editHomepage = homepage+ , editPublic = public+ , editHasIssues = hasIssues+ , editHasWiki = hasWiki+ , editHasDownloads = hasDownloads+ }) = object+ [ "name" .= name+ , "description" .= description+ , "homepage" .= homepage+ , "public" .= public+ , "has_issues" .= hasIssues+ , "has_wiki" .= hasWiki+ , "has_downloads" .= hasDownloads+ ]++-- |+-- Edit an existing repository.+--+-- > editRepo (user, password) "some_user" "some_repo" def {editDescription = Just "some description"}+editRepo :: BasicAuth+ -> String -- ^ owner+ -> String -- ^ repository name+ -> Edit+ -> IO (Either Error Repo)+editRepo auth user repo body = githubPatch auth ["repos", user, repo] b+ where+ -- if no name is given, use curent name+ b = body {editName = editName body <|> Just repo}++-- |+-- Delete an existing repository.+--+-- > deleteRepo (user, password) "thoughtbot" "some_repo"+deleteRepo :: BasicAuth+ -> String -- ^ owner+ -> String -- ^ repository name+ -> IO (Either Error ())+deleteRepo auth owner repo = do+ requestToken >>= either (return . Left) (sendToken)+ where+ -- APIv3 does not support deletion, so we use APIv2 for that+ url = "https://github.com/api/v2/json/repos/delete/" ++ owner ++ "/" ++ repo++ requestToken :: IO (Either Error DeleteToken)+ requestToken = githubAPI "POST" url (Just auth) (Nothing :: Maybe Value)++ sendToken (DeleteToken t) = do+ let body = RequestBodyBS $ renderSimpleQuery False [("delete_token", t)]+ result <- doHttps "POST" url (Just auth) (Just body)+ return $ either (Left . HTTPConnectionError)+ (const $ Right ())+ result++newtype DeleteToken = DeleteToken BS.ByteString+ deriving Show++instance FromJSON DeleteToken where+ parseJSON (Object o) = DeleteToken <$> o .: "delete_token"+ parseJSON _ = fail "Could not build a DeleteToken"
Github/Repos/Collaborators.hs view
@@ -30,6 +30,7 @@ result <- doHttps (pack "GET") (buildUrl ["repos", repoOwnerName, repoName, "collaborators", userName]) Nothing+ Nothing return $ either (Left . HTTPConnectionError) (Right . (204 ==) . T.statusCode . C.statusCode) result
Github/Users.hs view
@@ -2,6 +2,7 @@ -- <http://developer.github.com/v3/users/>. module Github.Users ( userInfoFor+,userInfoFor' ,module Github.Data ) where @@ -9,7 +10,14 @@ import Github.Private -- | The information for a single user, by login name.+-- | With authentification --+-- > userInfoFor' (Just ("github-username", "github-password")) "mike-burns"+userInfoFor' :: Maybe BasicAuth -> String -> IO (Either Error DetailedOwner)+userInfoFor' auth userName = githubGet' auth ["users", userName]++-- | The information for a single user, by login name.+-- -- > userInfoFor "mike-burns" userInfoFor :: String -> IO (Either Error DetailedOwner)-userInfoFor userName = githubGet ["users", userName]+userInfoFor = userInfoFor' Nothing
README.md view
@@ -3,9 +3,9 @@ The Github API v3 for Haskell. -**This is currently a read-only API.**--Some functions which do not require authentication are also missing; these are functions where the Github API did not work as expected. The full Github API is in beta and constantly improving.+Some functions are missing; these are functions where the Github API did+not work as expected. The full Github API is in beta and constantly+improving. Installation ============@@ -43,6 +43,10 @@ (intercalate "\n" . map githubUserLogin) possibleUsers +Contributions+=============++Please see [CONTRIBUTING.md](https://github.com/mike-burns/github/tree/master/CONTRIBUTING.md) for details on how you can help. Copyright =========
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.2.1+Version: 0.3.0 -- A short (one-line) description of the package. Synopsis: Access to the Github API, v3.@@ -18,8 +18,6 @@ like references and trees. This library wraps all of that, exposing a basic but Haskell-friendly set of functions and data structures. .- /Currently this only supports read-only access/.- . For more of an overview please see the README: <https://github.com/mike-burns/github/blob/master/README.md> -- The license under which the package is released.@@ -38,7 +36,7 @@ Homepage: https://github.com/mike-burns/github -- A copyright notice.-Copyright: Copyright 2011 Mike Burns+Copyright: Copyright 2012 Mike Burns Category: Network APIs @@ -150,10 +148,13 @@ old-locale, HTTP, network,+ tls == 0.9.2,+ tls-extra == 0.4.4, http-conduit == 1.2.6, uri, failure, http-types,+ data-default, vector, unordered-containers >= 0.1 && < 0.2
samples/Repos/Forks/ListForks.hs view
@@ -11,5 +11,8 @@ formatFork fork = (Github.githubOwnerLogin $ Github.repoOwner fork) ++ "\t" ++- (show $ Github.fromGithubDate $ Github.repoPushedAt fork) ++ "\n" +++ (formatPushedAt $ Github.repoPushedAt fork) ++ "\n" ++ (Github.repoCloneUrl fork)++formatPushedAt Nothing = ""+formatPushedAt (Just pushedAt) = show $ Github.fromGithubDate pushedAt
samples/Repos/ListOrgRepos.hs view
@@ -2,6 +2,7 @@ import qualified Github.Repos as Github import Data.List+import Data.Maybe main = do possibleRepos <- Github.organizationRepos "thoughtbot"@@ -11,7 +12,7 @@ formatRepo repo = (Github.repoName repo) ++ "\t" ++- (Github.repoDescription repo) ++ "\n" +++ (fromMaybe "" $ Github.repoDescription repo) ++ "\n" ++ (Github.repoHtmlUrl repo) ++ "\n" ++ (Github.repoCloneUrl repo) ++ "\t" ++ (formatDate $ Github.repoUpdatedAt repo) ++ "\n" ++
samples/Repos/ListUserRepos.hs view
@@ -2,6 +2,7 @@ import qualified Github.Repos as Github import Data.List+import Data.Maybe main = do possibleRepos <- Github.userRepos "mike-burns" Github.Owner@@ -11,7 +12,7 @@ formatRepo repo = (Github.repoName repo) ++ "\t" ++- (Github.repoDescription repo) ++ "\n" +++ (fromMaybe "" $ Github.repoDescription repo) ++ "\n" ++ (Github.repoHtmlUrl repo) ++ "\n" ++ (Github.repoCloneUrl repo) ++ "\t" ++ (formatDate $ Github.repoUpdatedAt repo) ++ "\n" ++
samples/Repos/ShowRepo.hs view
@@ -2,6 +2,7 @@ import qualified Github.Repos as Github import Data.List+import Data.Maybe main = do possibleRepo <- Github.userRepo "mike-burns" "trylambda"@@ -11,7 +12,7 @@ formatRepo repo = (Github.repoName repo) ++ "\t" ++- (Github.repoDescription repo) ++ "\n" +++ (fromMaybe "" $ Github.repoDescription repo) ++ "\n" ++ (Github.repoHtmlUrl repo) ++ "\n" ++ (Github.repoCloneUrl repo) ++ "\t" ++ (formatDate $ Github.repoUpdatedAt repo) ++ "\n" ++
samples/Repos/Watching/ListWatched.hs view
@@ -2,6 +2,7 @@ import qualified Github.Repos.Watching as Github import Data.List (intercalate)+import Data.Maybe (fromMaybe) main = do possibleRepos <- Github.reposWatchedBy "mike-burns"@@ -11,7 +12,7 @@ formatRepo repo = (Github.repoName repo) ++ "\t" ++- (Github.repoDescription repo) ++ "\n" +++ (fromMaybe "" $ Github.repoDescription repo) ++ "\n" ++ (Github.repoHtmlUrl repo) ++ "\n" ++ (Github.repoCloneUrl repo) ++ "\t" ++ (formatDate $ Github.repoUpdatedAt repo) ++ "\n" ++