github 0.1.2 → 0.2.0
raw patch · 41 files changed
+236/−183 lines, 41 filesdep +http-conduitdep −http-enumeratordep ~aeson
Dependencies added: http-conduit
Dependencies removed: http-enumerator
Dependency ranges changed: aeson
Files
- Github/Data.hs +54/−30
- Github/Data/Definitions.hs +69/−48
- Github/GitData/Blobs.hs +0/−16
- Github/Organizations/Members.hs +1/−1
- Github/Private.hs +12/−5
- Github/Repos/Collaborators.hs +4/−3
- Github/Repos/Watching.hs +1/−1
- Github/Users.hs +1/−1
- Github/Users/Followers.hs +2/−2
- README.md +2/−7
- github.cabal +5/−7
- samples/Gists/Comments/ShowComment.hs +1/−1
- samples/Gists/Comments/ShowComments.hs +1/−1
- samples/GitData/Blobs/GitHashObject.hs +0/−10
- samples/Issues/Comments/ShowComment.hs +1/−1
- samples/Issues/Comments/ShowComments.hs +1/−1
- samples/Issues/Events/ShowEvent.hs +1/−1
- samples/Issues/Events/ShowIssueEvents.hs +1/−1
- samples/Issues/Events/ShowRepoEvents.hs +1/−1
- samples/Issues/Milestones/ShowMilestone.hs +6/−4
- samples/Issues/Milestones/ShowMilestones.hs +6/−3
- samples/Issues/ShowIssue.hs +1/−1
- samples/Issues/ShowRepoIssues.hs +1/−1
- samples/Organizations/Members/ShowMembers.hs +1/−1
- samples/Pulls/ListPulls.hs +1/−1
- samples/Pulls/ReviewComments/ListComments.hs +2/−2
- samples/Pulls/ReviewComments/ShowComment.hs +2/−2
- samples/Pulls/ShowPull.hs +1/−1
- samples/Repos/Collaborators/ListCollaborators.hs +2/−2
- samples/Repos/Commits/CommitComment.hs +2/−2
- samples/Repos/Commits/CommitComments.hs +2/−2
- samples/Repos/Commits/RepoComments.hs +2/−2
- samples/Repos/Forks/ListForks.hs +1/−1
- samples/Repos/ListOrgRepos.hs +3/−1
- samples/Repos/ListUserRepos.hs +4/−1
- samples/Repos/ShowRepo.hs +4/−1
- samples/Repos/Watching/ListWatched.hs +4/−1
- samples/Repos/Watching/ListWatchers.hs +3/−3
- samples/Users/Followers/ListFollowers.hs +1/−1
- samples/Users/Followers/ListFollowing.hs +1/−1
- samples/Users/ShowUser.hs +28/−11
Github/Data.hs view
@@ -65,14 +65,20 @@ <*> o .:< "parents" parseJSON _ = fail "Could not build a GitCommit" -instance FromJSON GithubUser where- parseJSON (Object o) =- GithubUser <$> o .: "avatar_url"- <*> o .: "login"- <*> o .: "url"- <*> o .: "id"- <*> o .: "gravatar_id"- parseJSON v = fail $ "Could not build a GithubUser out of " ++ (show v)+instance FromJSON GithubOwner where+ parseJSON (Object o)+ | o `at` "gravatar_id" == Nothing =+ GithubOrganization <$> o .: "avatar_url"+ <*> o .: "login"+ <*> o .: "url"+ <*> o .: "id"+ | otherwise =+ GithubUser <$> o .: "avatar_url"+ <*> o .: "login"+ <*> o .: "url"+ <*> o .: "id"+ <*> o .: "gravatar_id"+ parseJSON v = fail $ "Could not build a GithubOwner out of " ++ (show v) instance FromJSON GitUser where parseJSON (Object o) =@@ -432,28 +438,46 @@ parseJSON (Object o) = BranchCommit <$> o .: "sha" <*> o .: "url" parseJSON _ = fail "Could not build a BranchCommit" -instance FromJSON DetailedUser where- parseJSON (Object o) =- DetailedUser <$> o .: "created_at"- <*> o .: "type"- <*> o .: "public_gists"- <*> o .: "avatar_url"- <*> o .: "followers"- <*> o .: "following"- <*> o .: "hireable"- <*> o .: "gravatar_id"- <*> o .:? "blog"- <*> o .:? "bio"- <*> o .: "public_repos"- <*> o .:? "name"- <*> o .:? "location"- <*> o .:? "company"- <*> o .: "email"- <*> o .: "url"- <*> o .: "id"- <*> o .: "html_url"- <*> o .: "login"- parseJSON _ = fail "Could not build a DetailedUser"+instance FromJSON DetailedOwner where+ parseJSON (Object o)+ | o `at` "gravatar_id" == Nothing =+ DetailedOrganization <$> o .: "created_at"+ <*> o .: "type"+ <*> o .: "public_gists"+ <*> o .: "avatar_url"+ <*> o .: "followers"+ <*> o .: "following"+ <*> o .:? "blog"+ <*> o .:? "bio"+ <*> o .: "public_repos"+ <*> o .:? "name"+ <*> o .:? "location"+ <*> o .:? "company"+ <*> o .: "url"+ <*> o .: "id"+ <*> o .: "html_url"+ <*> o .: "login"+ | otherwise =+ DetailedUser <$> o .: "created_at"+ <*> o .: "type"+ <*> o .: "public_gists"+ <*> o .: "avatar_url"+ <*> o .: "followers"+ <*> o .: "following"+ <*> o .: "hireable"+ <*> o .: "gravatar_id"+ <*> o .:? "blog"+ <*> o .:? "bio"+ <*> o .: "public_repos"+ <*> o .:? "name"+ <*> o .:? "location"+ <*> o .:? "company"+ <*> o .: "email"+ <*> o .: "url"+ <*> o .: "id"+ <*> o .: "html_url"+ <*> o .: "login"+ parseJSON _ = fail "Could not build a DetailedOwner" -- | A slightly more generic version of Aeson's @(.:?)@, using `mzero' instead
Github/Data/Definitions.hs view
@@ -4,19 +4,16 @@ import Data.Time import Data.Data-import Network.HTTP.Enumerator (HttpException(..)) import qualified Control.Exception as E -deriving instance Eq Network.HTTP.Enumerator.HttpException- -- | Errors have been tagged according to their source, so you can more easily -- dispatch and handle them. data Error =- HTTPConnectionError E.IOException -- ^ A HTTP error occurred. The actual caught error is included, if available.+ HTTPConnectionError E.SomeException -- ^ A HTTP error occurred. The actual caught error is included. | ParseError String -- ^ An error in the parser itself. | JsonError String -- ^ The JSON is malformed or unexpected. | UserError String -- ^ Incorrect input.- deriving (Show, Eq)+ deriving Show -- | A date in the Github format, which is a special case of ISO-8601. newtype GithubDate = GithubDate { fromGithubDate :: UTCTime }@@ -27,8 +24,8 @@ ,commitParents :: [Tree] ,commitUrl :: String ,commitGitCommit :: GitCommit- ,commitCommitter :: Maybe GithubUser- ,commitAuthor :: Maybe GithubUser+ ,commitCommitter :: Maybe GithubOwner+ ,commitAuthor :: Maybe GithubOwner ,commitFiles :: [File] ,commitStats :: Maybe Stats } deriving (Show, Data, Typeable, Eq, Ord)@@ -58,12 +55,18 @@ ,gitCommitParents :: [Tree] } deriving (Show, Data, Typeable, Eq, Ord) -data GithubUser = GithubUser {- githubUserAvatarUrl :: String- ,githubUserLogin :: String- ,githubUserUrl :: String- ,githubUserId :: Int- ,githubUserGravatarId :: String+data GithubOwner = GithubUser {+ githubOwnerAvatarUrl :: String+ ,githubOwnerLogin :: String+ ,githubOwnerUrl :: String+ ,githubOwnerId :: Int+ ,githubOwnerGravatarId :: String+ }+ | GithubOrganization {+ githubOwnerAvatarUrl :: String+ ,githubOwnerLogin :: String+ ,githubOwnerUrl :: String+ ,githubOwnerId :: Int } deriving (Show, Data, Typeable, Eq, Ord) data GitUser = GitUser {@@ -100,7 +103,7 @@ ,commentUrl :: String ,commentCreatedAt :: UTCTime ,commentPath :: Maybe String- ,commentUser :: GithubUser+ ,commentUser :: GithubOwner ,commentId :: Int } deriving (Show, Data, Typeable, Eq, Ord) @@ -120,7 +123,7 @@ } deriving (Show, Data, Typeable, Eq, Ord) data Gist = Gist {- gistUser :: GithubUser+ gistUser :: GithubOwner ,gistGitPushUrl :: String ,gistUrl :: String ,gistDescription :: Maybe String@@ -144,7 +147,7 @@ } deriving (Show, Data, Typeable, Eq, Ord) data GistComment = GistComment {- gistCommentUser :: GithubUser+ gistCommentUser :: GithubOwner ,gistCommentUrl :: String ,gistCommentCreatedAt :: GithubDate ,gistCommentBody :: String@@ -176,11 +179,11 @@ issueClosedAt :: Maybe GithubDate ,issueUpdatedAt :: GithubDate ,issueHtmlUrl :: String- ,issueClosedBy :: Maybe String+ ,issueClosedBy :: Maybe GithubOwner ,issueLabels :: [IssueLabel] ,issueNumber :: Int- ,issueAssignee :: Maybe GithubUser- ,issueUser :: GithubUser+ ,issueAssignee :: Maybe GithubOwner+ ,issueUser :: GithubOwner ,issueTitle :: String ,issuePullRequest :: PullRequestReference ,issueUrl :: String@@ -193,8 +196,8 @@ } deriving (Show, Data, Typeable, Eq, Ord) data Milestone = Milestone {- milestoneCreator :: GithubUser- ,milestoneDueOn :: GithubDate+ milestoneCreator :: GithubOwner+ ,milestoneDueOn :: Maybe GithubDate ,milestoneOpenIssues :: Int ,milestoneNumber :: Int ,milestoneClosedIssues :: Int@@ -219,7 +222,7 @@ data IssueComment = IssueComment { issueCommentUpdatedAt :: GithubDate- ,issueCommentUser :: GithubUser+ ,issueCommentUser :: GithubOwner ,issueCommentUrl :: String ,issueCommentCreatedAt :: GithubDate ,issueCommentBody :: String@@ -239,7 +242,7 @@ deriving (Show, Data, Typeable, Eq, Ord) data Event = Event {- eventActor :: GithubUser+ eventActor :: GithubOwner ,eventType :: EventType ,eventCommitId :: Maybe String ,eventUrl :: String@@ -277,7 +280,7 @@ data PullRequest = PullRequest { pullRequestClosedAt :: Maybe GithubDate ,pullRequestCreatedAt :: GithubDate- ,pullRequestUser :: GithubUser+ ,pullRequestUser :: GithubOwner ,pullRequestPatchUrl :: String ,pullRequestState :: String ,pullRequestNumber :: Int@@ -297,7 +300,7 @@ -- this is a duplication of a PullRequest detailedPullRequestClosedAt :: Maybe GithubDate ,detailedPullRequestCreatedAt :: GithubDate- ,detailedPullRequestUser :: GithubUser+ ,detailedPullRequestUser :: GithubOwner ,detailedPullRequestPatchUrl :: String ,detailedPullRequestState :: String ,detailedPullRequestNumber :: Int@@ -312,7 +315,7 @@ ,detailedPullRequestTitle :: String ,detailedPullRequestId :: Int - ,detailedPullRequestMergedBy :: Maybe GithubUser+ ,detailedPullRequestMergedBy :: Maybe GithubOwner ,detailedPullRequestChangedFiles :: Int ,detailedPullRequestHead :: PullRequestCommit ,detailedPullRequestComments :: Int@@ -350,9 +353,9 @@ ,repoSize :: Int ,repoUpdatedAt :: GithubDate ,repoWatchers :: Int- ,repoOwner :: GithubUser+ ,repoOwner :: GithubOwner ,repoName :: String- ,repoLanguage :: String+ ,repoLanguage :: Maybe String ,repoMasterBranch :: Maybe String ,repoPushedAt :: GithubDate ,repoId :: Int@@ -397,24 +400,42 @@ ,branchCommitUrl :: String } deriving (Show, Data, Typeable, Eq, Ord) -data DetailedUser = DetailedUser {- detailedUserCreatedAt :: GithubDate- ,detailedUserType :: String- ,detailedUserPublicGists :: Int- ,detailedUserAvatarUrl :: String- ,detailedUserFollowers :: Int- ,detailedUserFollowing :: Int- ,detailedUserHireable :: Bool- ,detailedUserGravatarId :: String- ,detailedUserBlog :: Maybe String- ,detailedUserBio :: Maybe String- ,detailedUserPublicRepos :: Int- ,detailedUserName :: Maybe String- ,detailedUserLocation :: Maybe String- ,detailedUserCompany :: Maybe String- ,detailedUserEmail :: String- ,detailedUserUrl :: String- ,detailedUserId :: Int- ,detailedUserHtmlUrl :: String- ,detailedUserLogin :: String+data DetailedOwner = DetailedUser {+ detailedOwnerCreatedAt :: GithubDate+ ,detailedOwnerType :: String+ ,detailedOwnerPublicGists :: Int+ ,detailedOwnerAvatarUrl :: String+ ,detailedOwnerFollowers :: Int+ ,detailedOwnerFollowing :: Int+ ,detailedOwnerHireable :: Bool+ ,detailedOwnerGravatarId :: String+ ,detailedOwnerBlog :: Maybe String+ ,detailedOwnerBio :: Maybe String+ ,detailedOwnerPublicRepos :: Int+ ,detailedOwnerName :: Maybe String+ ,detailedOwnerLocation :: Maybe String+ ,detailedOwnerCompany :: Maybe String+ ,detailedOwnerEmail :: String+ ,detailedOwnerUrl :: String+ ,detailedOwnerId :: Int+ ,detailedOwnerHtmlUrl :: String+ ,detailedOwnerLogin :: String+ }+ | DetailedOrganization {+ detailedOwnerCreatedAt :: GithubDate+ ,detailedOwnerType :: String+ ,detailedOwnerPublicGists :: Int+ ,detailedOwnerAvatarUrl :: String+ ,detailedOwnerFollowers :: Int+ ,detailedOwnerFollowing :: Int+ ,detailedOwnerBlog :: Maybe String+ ,detailedOwnerBio :: Maybe String+ ,detailedOwnerPublicRepos :: Int+ ,detailedOwnerName :: Maybe String+ ,detailedOwnerLocation :: Maybe String+ ,detailedOwnerCompany :: Maybe String+ ,detailedOwnerUrl :: String+ ,detailedOwnerId :: Int+ ,detailedOwnerHtmlUrl :: String+ ,detailedOwnerLogin :: String } deriving (Show, Data, Typeable, Eq, Ord)
− Github/GitData/Blobs.hs
@@ -1,16 +0,0 @@--- | The API for dealing with git blobs from Github repos, as described in--- <http://developer.github.com/v3/git/blobs/>.-module Github.GitData.Blobs (- blob-,module Github.Data-) where--import Github.Data-import Github.Private---- | Get a blob by SHA1.------ > blob "thoughtbot" "paperclip" "bc5c51d1ece1ee45f94b056a0f5a1674d7e8cba9"-blob :: String -> String -> String -> IO (Either Error Blob)-blob user repoName sha =- githubGet ["repos", user, repoName, "git", "blobs", sha]
Github/Organizations/Members.hs view
@@ -11,5 +11,5 @@ -- | All the users who are members of the specified organization. -- -- > membersOf "thoughtbot"-membersOf :: String -> IO (Either Error [GithubUser])+membersOf :: String -> IO (Either Error [GithubOwner]) membersOf organization = githubGet ["orgs", organization, "members"]
Github/Private.hs view
@@ -9,9 +9,8 @@ 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.Enumerator+import Network.HTTP.Conduit import Text.URI-import Control.Failure hiding (Error(..)) import qualified Control.Exception as E import Data.Maybe (fromMaybe) @@ -38,12 +37,12 @@ result where encodedBody = RequestBodyLBS $ encode $ toJSON body -doHttps :: BS.ByteString -> String -> Maybe (RequestBody IO) -> IO (Either E.IOException Response)+doHttps :: BS.ByteString -> String -> Maybe (RequestBody IO) -> IO (Either E.SomeException (Response LBS.ByteString)) doHttps method url body = do let (Just uri) = parseURI url (Just host) = uriRegName uri requestBody = fromMaybe (RequestBodyBS $ BS.pack "") body- queryString = Types.parseQuery $ BS.pack $ fromMaybe "" $ uriQuery uri+ queryString = BS.pack $ fromMaybe "" $ uriQuery uri request = def { method = method , secure = True , host = BS.pack host@@ -53,7 +52,15 @@ , queryString = queryString } - (getResponse request >>= return . Right) `catch` (return . Left)+ (getResponse request >>= 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+ -- should not occur during normal operation.+ E.Handler (\e -> E.throw (e :: E.AsyncException)),++ E.Handler (\e -> (return . Left) (e :: E.SomeException))+ ] where getResponse request = withManager $ \manager -> httpLbs request manager
Github/Repos/Collaborators.hs view
@@ -10,12 +10,13 @@ import Github.Private import Data.ByteString.Char8 (pack)-import Network.HTTP.Enumerator (statusCode)+import qualified Network.HTTP.Conduit as C (statusCode)+import qualified Network.HTTP.Types as T (statusCode) -- | All the users who have collaborated on a repo. -- -- > collaboratorsOn "thoughtbot" "paperclip"-collaboratorsOn :: String -> String -> IO (Either Error [GithubUser])+collaboratorsOn :: String -> String -> IO (Either Error [GithubOwner]) collaboratorsOn userName repoName = githubGet ["repos", userName, repoName, "collaborators"] @@ -30,5 +31,5 @@ (buildUrl ["repos", repoOwnerName, repoName, "collaborators", userName]) Nothing return $ either (Left . HTTPConnectionError)- (Right . (204 ==) . statusCode)+ (Right . (204 ==) . T.statusCode . C.statusCode) result
Github/Repos/Watching.hs view
@@ -12,7 +12,7 @@ -- | The list of users that are watching the specified Github repo. -- -- > watchersFor "thoughtbot" "paperclip"-watchersFor :: String -> String -> IO (Either Error [GithubUser])+watchersFor :: String -> String -> IO (Either Error [GithubOwner]) watchersFor userName repoName = githubGet ["repos", userName, repoName, "watchers"]
Github/Users.hs view
@@ -11,5 +11,5 @@ -- | The information for a single user, by login name. -- -- > userInfoFor "mike-burns"-userInfoFor :: String -> IO (Either Error DetailedUser)+userInfoFor :: String -> IO (Either Error DetailedOwner) userInfoFor userName = githubGet ["users", userName]
Github/Users/Followers.hs view
@@ -12,11 +12,11 @@ -- | All the users following the given user. -- -- > usersFollowing "mike-burns"-usersFollowing :: String -> IO (Either Error [GithubUser])+usersFollowing :: String -> IO (Either Error [GithubOwner]) usersFollowing userName = githubGet ["users", userName, "followers"] -- | All the users that the given user follows. -- -- > usersFollowedBy "mike-burns"-usersFollowedBy :: String -> IO (Either Error [GithubUser])+usersFollowedBy :: String -> IO (Either Error [GithubOwner]) usersFollowedBy userName = githubGet ["users", userName, "following"]
README.md view
@@ -3,12 +3,7 @@ The Github API v3 for Haskell. -**This is currently a read-only API.** There is a `read-write` branch with-ideas on how this can work for writing to Github, but I need ideas on how-authentication should work. *You can help* if you [let me-know](mailto:mike@mike-burns.com) how you are using this library or how you-would like to use it, and which authentication method is best for you (HTTP-basic, OAuth).+**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. @@ -52,6 +47,6 @@ Copyright ========= -Copyright 2011 Mike Burns.+Copyright 2011, 2012 Mike Burns. Available under the BSD 3-clause license.
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.1.2+Version: 0.2.0 -- A short (one-line) description of the package. Synopsis: Access to the Github API, v3.@@ -17,9 +17,9 @@ Github Web site, from Issues to Gists to repos down to the underlying git data 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.@@ -51,7 +51,6 @@ ,samples/Gists/Comments/ShowComments.hs ,samples/Gists/ListGists.hs ,samples/Gists/ShowGist.hs- ,samples/GitData/Blobs/GitHashObject.hs ,samples/GitData/Commits/GitShow.hs ,samples/GitData/References/GitLsRemote.hs ,samples/GitData/References/GitLsRemoteTags.hs@@ -120,7 +119,6 @@ Github.Gists, Github.Gists.Comments,- Github.GitData.Blobs, Github.GitData.Commits, Github.GitData.References, Github.GitData.Trees,@@ -144,7 +142,7 @@ -- Packages needed in order to build this package. Build-depends: base >= 4.0 && < 5.0, time,- aeson == 0.5.0.0,+ aeson == 0.6.0.0, attoparsec == 0.10.1.0, bytestring, containers,@@ -152,7 +150,7 @@ old-locale, HTTP, network,- http-enumerator == 0.7.2.1,+ http-conduit == 1.2.6, uri, failure, http-types,
samples/Gists/Comments/ShowComment.hs view
@@ -9,7 +9,7 @@ (Right comment) -> putStrLn $ formatComment comment formatComment comment =- (Github.githubUserLogin $ Github.gistCommentUser comment) ++ "\n" +++ (Github.githubOwnerLogin $ Github.gistCommentUser comment) ++ "\n" ++ (formatGithubDate $ Github.gistCommentUpdatedAt comment) ++ "\n\n" ++ (Github.gistCommentBody comment)
samples/Gists/Comments/ShowComments.hs view
@@ -10,7 +10,7 @@ (Right comments) -> putStrLn $ intercalate "\n\n" $ map formatComment comments formatComment comment =- (Github.githubUserLogin $ Github.gistCommentUser comment) ++ "\n" +++ (Github.githubOwnerLogin $ Github.gistCommentUser comment) ++ "\n" ++ (formatGithubDate $ Github.gistCommentUpdatedAt comment) ++ "\n\n" ++ (Github.gistCommentBody comment)
− samples/GitData/Blobs/GitHashObject.hs
@@ -1,10 +0,0 @@-module GitHashObject where--import qualified Github.GitData.Blobs as Github-import Data.List( intercalate)--main = do- possibleBlob <- Github.blob "thoughtbot" "paperclip" "bc5c51d1ece1ee45f94b056a0f5a1674d7e8cba9"- case possibleBlob of- (Left error) -> putStrLn $ "Error: " ++ (show error)- (Right blob) -> putStrLn $ Github.blobContent blob
samples/Issues/Comments/ShowComment.hs view
@@ -9,7 +9,7 @@ possibleComment formatComment comment =- (Github.githubUserLogin $ Github.issueCommentUser comment) +++ (Github.githubOwnerLogin $ Github.issueCommentUser comment) ++ " commented " ++ (show $ Github.fromGithubDate $ Github.issueCommentUpdatedAt comment) ++ "\n" ++ (Github.issueCommentBody comment)
samples/Issues/Comments/ShowComments.hs view
@@ -11,7 +11,7 @@ putStrLn $ intercalate "\n\n" $ map formatComment issues formatComment comment =- (Github.githubUserLogin $ Github.issueCommentUser comment) +++ (Github.githubOwnerLogin $ Github.issueCommentUser comment) ++ " commented " ++ (show $ Github.fromGithubDate $ Github.issueCommentUpdatedAt comment) ++ "\n" ++ (Github.issueCommentBody comment)
samples/Issues/Events/ShowEvent.hs view
@@ -33,6 +33,6 @@ formatEvent' event Github.Assigned = "Issue assigned to " ++ loginName event ++ " on " ++ createdAt event -loginName = Github.githubUserLogin . Github.eventActor+loginName = Github.githubOwnerLogin . Github.eventActor createdAt = show . Github.fromGithubDate . Github.eventCreatedAt withCommitId event f = maybe "" f (Github.eventCommitId event)
samples/Issues/Events/ShowIssueEvents.hs view
@@ -33,6 +33,6 @@ formatEvent' event Github.Assigned = "Issue assigned to " ++ loginName event ++ " on " ++ createdAt event -loginName = Github.githubUserLogin . Github.eventActor+loginName = Github.githubOwnerLogin . Github.eventActor createdAt = show . Github.fromGithubDate . Github.eventCreatedAt withCommitId event f = maybe "" f (Github.eventCommitId event)
samples/Issues/Events/ShowRepoEvents.hs view
@@ -35,7 +35,7 @@ formatEvent' event Github.Assigned = "assigned to " ++ loginName event ++ " on " ++ createdAt event -loginName = Github.githubUserLogin . Github.eventActor+loginName = Github.githubOwnerLogin . Github.eventActor createdAt = show . Github.fromGithubDate . Github.eventCreatedAt withCommitId event f = maybe "" f (Github.eventCommitId event) issueNumber = show . Github.issueNumber . fromJust . Github.eventIssue
samples/Issues/Milestones/ShowMilestone.hs view
@@ -13,10 +13,12 @@ formatMilestone milestone = (Github.milestoneTitle milestone) ++ ", as created by " ++ (loginName milestone) ++ " on " ++ (createdAt milestone) ++- ", is due on " ++ (dueOn milestone) ++ " and has the " +++ formatDueOn (Github.milestoneDueOn milestone) ++ " and has the " ++ (Github.milestoneState milestone) ++ " status" -loginName = Github.githubUserLogin . Github.milestoneCreator-createdAt = show . Github.fromGithubDate . Github.milestoneCreatedAt-dueOn = show . Github.fromGithubDate . Github.milestoneDueOn+formatDueOn Nothing = ""+formatDueOn (Just milestoneDate) = ", is due on " ++ dueOn milestoneDate +loginName = Github.githubOwnerLogin . Github.milestoneCreator+createdAt = show . Github.fromGithubDate . Github.milestoneCreatedAt+dueOn = show . Github.fromGithubDate
samples/Issues/Milestones/ShowMilestones.hs view
@@ -13,9 +13,12 @@ formatMilestone milestone = (Github.milestoneTitle milestone) ++ ", as created by " ++ (loginName milestone) ++ " on " ++ (createdAt milestone) ++- ", is due on " ++ (dueOn milestone) ++ " and has the " +++ formatDueOn (Github.milestoneDueOn milestone) ++ " and has the " ++ (Github.milestoneState milestone) ++ " status" -loginName = Github.githubUserLogin . Github.milestoneCreator+formatDueOn Nothing = ""+formatDueOn (Just milestoneDate) = ", is due on " ++ dueOn milestoneDate++loginName = Github.githubOwnerLogin . Github.milestoneCreator createdAt = show . Github.fromGithubDate . Github.milestoneCreatedAt-dueOn = show . Github.fromGithubDate . Github.milestoneDueOn+dueOn = show . Github.fromGithubDate
samples/Issues/ShowIssue.hs view
@@ -9,7 +9,7 @@ possibleIssue formatIssue issue =- (Github.githubUserLogin $ Github.issueUser issue) +++ (Github.githubOwnerLogin $ Github.issueUser issue) ++ " opened this issue " ++ (show $ Github.fromGithubDate $ Github.issueCreatedAt issue) ++ "\n" ++ (Github.issueState issue) ++ " with " ++
samples/Issues/ShowRepoIssues.hs view
@@ -12,7 +12,7 @@ putStrLn $ intercalate "\n\n" $ map formatIssue issues formatIssue issue =- (Github.githubUserLogin $ Github.issueUser issue) +++ (Github.githubOwnerLogin $ Github.issueUser issue) ++ " opened this issue " ++ (show $ Github.fromGithubDate $ Github.issueCreatedAt issue) ++ "\n" ++ (Github.issueState issue) ++ " with " ++
samples/Organizations/Members/ShowMembers.hs view
@@ -8,4 +8,4 @@ case possibleMembers of (Left error) -> putStrLn $ "Error: " ++ (show error) (Right members) ->- putStrLn $ intercalate "\n" $ map Github.githubUserLogin members+ putStrLn $ intercalate "\n" $ map Github.githubOwnerLogin members
samples/Pulls/ListPulls.hs view
@@ -13,7 +13,7 @@ formatPullRequest pullRequest = (Github.pullRequestTitle pullRequest) ++ "\n" ++ (take 80 $ Github.pullRequestBody pullRequest) ++ "\n" ++- (Github.githubUserLogin $ Github.pullRequestUser pullRequest) +++ (Github.githubOwnerLogin $ Github.pullRequestUser pullRequest) ++ " submitted to thoughtbot/paperclip " ++ (formatGithubDate $ Github.pullRequestCreatedAt pullRequest) ++ " updated " ++
samples/Pulls/ReviewComments/ListComments.hs view
@@ -16,6 +16,6 @@ (maybe "" ("\nURL: "++) $ Github.commentHtmlUrl comment) ++ "\n\n" ++ (Github.commentBody comment) -formatAuthor :: Github.GithubUser -> String+formatAuthor :: Github.GithubOwner -> String formatAuthor user =- (Github.githubUserLogin user) ++ " (" ++ (Github.githubUserUrl user) ++ ")"+ (Github.githubOwnerLogin user) ++ " (" ++ (Github.githubOwnerUrl user) ++ ")"
samples/Pulls/ReviewComments/ShowComment.hs view
@@ -16,7 +16,7 @@ (maybe "" ("\nURL: "++) $ Github.commentHtmlUrl comment) ++ "\n\n" ++ (Github.commentBody comment) -formatAuthor :: Github.GithubUser -> String+formatAuthor :: Github.GithubOwner -> String formatAuthor user =- (Github.githubUserLogin user) ++ " (" ++ (Github.githubUserUrl user) ++ ")"+ (Github.githubOwnerLogin user) ++ " (" ++ (Github.githubOwnerUrl user) ++ ")"
samples/Pulls/ShowPull.hs view
@@ -10,7 +10,7 @@ (Right pullRequest) -> putStrLn $ formatPullRequest pullRequest formatPullRequest p =- (Github.githubUserLogin $ Github.detailedPullRequestUser p) +++ (Github.githubOwnerLogin $ Github.detailedPullRequestUser p) ++ " opened this pull request " ++ (formatGithubDate $ Github.detailedPullRequestCreatedAt p) ++ "\n" ++ (Github.detailedPullRequestTitle p) ++ "\n" ++
samples/Repos/Collaborators/ListCollaborators.hs view
@@ -10,6 +10,6 @@ (Right collaborators) -> putStrLn $ intercalate "\n" $ map formatAuthor collaborators -formatAuthor :: Github.GithubUser -> String+formatAuthor :: Github.GithubOwner -> String formatAuthor user =- (Github.githubUserLogin user) ++ " (" ++ (Github.githubUserUrl user) ++ ")"+ (Github.githubOwnerLogin user) ++ " (" ++ (Github.githubOwnerUrl user) ++ ")"
samples/Repos/Commits/CommitComment.hs view
@@ -16,6 +16,6 @@ (maybe "" ("\nURL: "++) $ Github.commentHtmlUrl comment) ++ "\n\n" ++ (Github.commentBody comment) -formatAuthor :: Github.GithubUser -> String+formatAuthor :: Github.GithubOwner -> String formatAuthor user =- (Github.githubUserLogin user) ++ " (" ++ (Github.githubUserUrl user) ++ ")"+ (Github.githubOwnerLogin user) ++ " (" ++ (Github.githubOwnerUrl user) ++ ")"
samples/Repos/Commits/CommitComments.hs view
@@ -17,6 +17,6 @@ (maybe "" ("\nURL: "++) $ Github.commentHtmlUrl comment) ++ "\n\n" ++ (Github.commentBody comment) -formatAuthor :: Github.GithubUser -> String+formatAuthor :: Github.GithubOwner -> String formatAuthor user =- (Github.githubUserLogin user) ++ " (" ++ (Github.githubUserUrl user) ++ ")"+ (Github.githubOwnerLogin user) ++ " (" ++ (Github.githubOwnerUrl user) ++ ")"
samples/Repos/Commits/RepoComments.hs view
@@ -17,6 +17,6 @@ (maybe "" ("\nURL: "++) $ Github.commentHtmlUrl comment) ++ "\n\n" ++ (Github.commentBody comment) -formatAuthor :: Github.GithubUser -> String+formatAuthor :: Github.GithubOwner -> String formatAuthor user =- (Github.githubUserLogin user) ++ " (" ++ (Github.githubUserUrl user) ++ ")"+ (Github.githubOwnerLogin user) ++ " (" ++ (Github.githubOwnerUrl user) ++ ")"
samples/Repos/Forks/ListForks.hs view
@@ -10,6 +10,6 @@ possibleForks formatFork fork =- (Github.githubUserLogin $ Github.repoOwner fork) ++ "\t" +++ (Github.githubOwnerLogin $ Github.repoOwner fork) ++ "\t" ++ (show $ Github.fromGithubDate $ Github.repoPushedAt fork) ++ "\n" ++ (Github.repoCloneUrl fork)
samples/Repos/ListOrgRepos.hs view
@@ -15,9 +15,11 @@ (Github.repoHtmlUrl repo) ++ "\n" ++ (Github.repoCloneUrl repo) ++ "\t" ++ (formatDate $ Github.repoUpdatedAt repo) ++ "\n" ++- "language: " ++ (Github.repoLanguage repo) ++ "\t" +++ formatLanguage (Github.repoLanguage repo) ++ "watchers: " ++ (show $ Github.repoWatchers repo) ++ "\t" ++ "forks: " ++ (show $ Github.repoForks repo) formatDate = show . Github.fromGithubDate +formatLanguage (Just language) = "language: " ++ language ++ "\t"+formatLanguage Nothing = ""
samples/Repos/ListUserRepos.hs view
@@ -15,8 +15,11 @@ (Github.repoHtmlUrl repo) ++ "\n" ++ (Github.repoCloneUrl repo) ++ "\t" ++ (formatDate $ Github.repoUpdatedAt repo) ++ "\n" ++- "language: " ++ (Github.repoLanguage repo) ++ "\t" +++ formatLanguage (Github.repoLanguage repo) ++ "watchers: " ++ (show $ Github.repoWatchers repo) ++ "\t" ++ "forks: " ++ (show $ Github.repoForks repo) formatDate = show . Github.fromGithubDate++formatLanguage (Just language) = "language: " ++ language ++ "\t"+formatLanguage Nothing = ""
samples/Repos/ShowRepo.hs view
@@ -15,8 +15,11 @@ (Github.repoHtmlUrl repo) ++ "\n" ++ (Github.repoCloneUrl repo) ++ "\t" ++ (formatDate $ Github.repoUpdatedAt repo) ++ "\n" ++- "language: " ++ (Github.repoLanguage repo) ++ "\t" +++ formatLanguage (Github.repoLanguage repo) ++ "watchers: " ++ (show $ Github.repoWatchers repo) ++ "\t" ++ "forks: " ++ (show $ Github.repoForks repo) formatDate = show . Github.fromGithubDate++formatLanguage (Just language) = "language: " ++ language ++ "\t"+formatLanguage Nothing = ""
samples/Repos/Watching/ListWatched.hs view
@@ -15,8 +15,11 @@ (Github.repoHtmlUrl repo) ++ "\n" ++ (Github.repoCloneUrl repo) ++ "\t" ++ (formatDate $ Github.repoUpdatedAt repo) ++ "\n" ++- "language: " ++ (Github.repoLanguage repo) ++ "\t" +++ formatLanguage (Github.repoLanguage repo) ++ "watchers: " ++ (show $ Github.repoWatchers repo) ++ "\t" ++ "forks: " ++ (show $ Github.repoForks repo) formatDate = show . Github.fromGithubDate++formatLanguage (Just language) = "language: " ++ language ++ "\t"+formatLanguage Nothing = ""
samples/Repos/Watching/ListWatchers.hs view
@@ -4,11 +4,11 @@ import Data.List (intercalate) main = do- possibleWatchers <- Github.watchersFor "thoughtbot" "paperclip"+ possibleWatchers <- Github.watchersFor "doubledrones" "git-annex" putStrLn $ either (("Error: "++) . show) (intercalate "\n" . map formatWatcher) possibleWatchers -formatWatcher :: Github.GithubUser -> String+formatWatcher :: Github.GithubOwner -> String formatWatcher user =- (Github.githubUserLogin user) ++ " (" ++ (Github.githubUserUrl user) ++ ")"+ (Github.githubOwnerLogin user) ++ " (" ++ (Github.githubOwnerUrl user) ++ ")"
samples/Users/Followers/ListFollowers.hs view
@@ -9,4 +9,4 @@ (intercalate "\n" . map formatUser) possibleUsers -formatUser = Github.githubUserLogin+formatUser = Github.githubOwnerLogin
samples/Users/Followers/ListFollowing.hs view
@@ -9,5 +9,5 @@ (intercalate "\n" . map formatUser) possibleUsers -formatUser = Github.githubUserLogin+formatUser = Github.githubOwnerLogin
samples/Users/ShowUser.hs view
@@ -7,7 +7,24 @@ possibleUser <- Github.userInfoFor "mike-burns" putStrLn $ either (("Error: "++) . show) formatUser possibleUser -formatUser user =+formatUser user@(Github.DetailedOrganization {}) =+ "Organization: " ++ (formatName userName login) ++ "\t" +++ (fromMaybe "" company) ++ "\t" +++ (fromMaybe "" location) ++ "\n" +++ (fromMaybe "" blog) ++ "\t" ++ "\n" +++ htmlUrl ++ "\t" ++ (formatDate createdAt) ++ "\n\n" +++ (fromMaybe "" bio)+ where+ userName = Github.detailedOwnerName user+ login = Github.detailedOwnerLogin user+ company = Github.detailedOwnerCompany user+ location = Github.detailedOwnerLocation user+ blog = Github.detailedOwnerBlog user+ htmlUrl = Github.detailedOwnerHtmlUrl user+ createdAt = Github.detailedOwnerCreatedAt user+ bio = Github.detailedOwnerBio user++formatUser user@(Github.DetailedUser {}) = (formatName userName login) ++ "\t" ++ (fromMaybe "" company) ++ "\t" ++ (fromMaybe "" location) ++ "\n" ++ (fromMaybe "" blog) ++ "\t" ++ "<" ++ email ++ ">" ++ "\n" ++@@ -15,16 +32,16 @@ "hireable: " ++ (formatHireable isHireable) ++ "\n\n" ++ (fromMaybe "" bio) where- userName = Github.detailedUserName user- login = Github.detailedUserLogin user- company = Github.detailedUserCompany user- location = Github.detailedUserLocation user- blog = Github.detailedUserBlog user- email = Github.detailedUserEmail user - htmlUrl = Github.detailedUserHtmlUrl user- createdAt = Github.detailedUserCreatedAt user- isHireable = Github.detailedUserHireable user- bio = Github.detailedUserBio user+ userName = Github.detailedOwnerName user+ login = Github.detailedOwnerLogin user+ company = Github.detailedOwnerCompany user+ location = Github.detailedOwnerLocation user+ blog = Github.detailedOwnerBlog user+ email = Github.detailedOwnerEmail user + htmlUrl = Github.detailedOwnerHtmlUrl user+ createdAt = Github.detailedOwnerCreatedAt user+ isHireable = Github.detailedOwnerHireable user+ bio = Github.detailedOwnerBio user formatName Nothing login = login formatName (Just name) login = name ++ "(" ++ login ++ ")"