{-# LANGUAGE CPP #-}
module GitHub.Endpoints.Issues (
currentUserIssuesR,
organizationIssuesR,
issue,
issue',
issueR,
issuesForRepo,
issuesForRepo',
issuesForRepoR,
createIssue,
createIssueR,
newIssue,
editIssue,
editIssueR,
editOfIssue,
module GitHub.Data,
) where
import GitHub.Data
import GitHub.Internal.Prelude
import GitHub.Request
import Prelude ()
currentUserIssuesR :: IssueMod -> FetchCount -> Request 'RA (Vector Issue)
currentUserIssuesR opts =
pagedQuery ["user", "issues"] (issueModToQueryString opts)
organizationIssuesR :: Name Organization -> IssueMod -> FetchCount -> Request k (Vector Issue)
organizationIssuesR org opts =
pagedQuery ["orgs", toPathPart org, "issues"] (issueModToQueryString opts)
issue' :: Maybe Auth -> Name Owner -> Name Repo -> Id Issue -> IO (Either Error Issue)
issue' auth user reqRepoName reqIssueNumber =
executeRequestMaybe auth $ issueR user reqRepoName reqIssueNumber
issue :: Name Owner -> Name Repo -> Id Issue -> IO (Either Error Issue)
issue = issue' Nothing
issueR :: Name Owner -> Name Repo -> Id Issue -> Request k Issue
issueR user reqRepoName reqIssueNumber =
query ["repos", toPathPart user, toPathPart reqRepoName, "issues", toPathPart reqIssueNumber] []
issuesForRepo' :: Maybe Auth -> Name Owner -> Name Repo -> IssueRepoMod -> IO (Either Error (Vector Issue))
issuesForRepo' auth user reqRepoName opts =
executeRequestMaybe auth $ issuesForRepoR user reqRepoName opts FetchAll
issuesForRepo :: Name Owner -> Name Repo -> IssueRepoMod -> IO (Either Error (Vector Issue))
issuesForRepo = issuesForRepo' Nothing
issuesForRepoR :: Name Owner -> Name Repo -> IssueRepoMod -> FetchCount -> Request k (Vector Issue)
issuesForRepoR user reqRepoName opts =
pagedQuery ["repos", toPathPart user, toPathPart reqRepoName, "issues"] qs
where
qs = issueRepoModToQueryString opts
newIssue :: Text -> NewIssue
newIssue title = NewIssue title Nothing mempty Nothing Nothing
createIssue :: Auth -> Name Owner -> Name Repo -> NewIssue
-> IO (Either Error Issue)
createIssue auth user repo ni =
executeRequest auth $ createIssueR user repo ni
createIssueR :: Name Owner -> Name Repo -> NewIssue -> Request 'RW Issue
createIssueR user repo =
command Post ["repos", toPathPart user, toPathPart repo, "issues"] . encode
editOfIssue :: EditIssue
editOfIssue = EditIssue Nothing Nothing Nothing Nothing Nothing Nothing
editIssue :: Auth -> Name Owner -> Name Repo -> Id Issue -> EditIssue
-> IO (Either Error Issue)
editIssue auth user repo iss edit =
executeRequest auth $ editIssueR user repo iss edit
editIssueR :: Name Owner -> Name Repo -> Id Issue -> EditIssue -> Request 'RW Issue
editIssueR user repo iss =
command Patch ["repos", toPathPart user, toPathPart repo, "issues", toPathPart iss] . encode