module GitHub.Endpoints.Issues.Labels (
labelsOnRepo,
labelsOnRepo',
labelsOnRepoR,
label,
label',
labelR,
createLabel,
createLabelR,
updateLabel,
updateLabelR,
deleteLabel,
deleteLabelR,
labelsOnIssue,
labelsOnIssue',
labelsOnIssueR,
addLabelsToIssue,
addLabelsToIssueR,
removeLabelFromIssue,
removeLabelFromIssueR,
replaceAllLabelsForIssue,
replaceAllLabelsForIssueR,
removeAllLabelsFromIssue,
removeAllLabelsFromIssueR,
labelsOnMilestone,
labelsOnMilestone',
labelsOnMilestoneR,
module GitHub.Data,
) where
import GitHub.Data
import GitHub.Internal.Prelude
import GitHub.Request
import Prelude ()
labelsOnRepo :: Name Owner -> Name Repo -> IO (Either Error (Vector IssueLabel))
labelsOnRepo = labelsOnRepo' Nothing
labelsOnRepo' :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector IssueLabel))
labelsOnRepo' auth user repo =
executeRequestMaybe auth $ labelsOnRepoR user repo FetchAll
labelsOnRepoR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector IssueLabel)
labelsOnRepoR user repo =
pagedQuery ["repos", toPathPart user, toPathPart repo, "labels"] []
label :: Name Owner -> Name Repo -> Name IssueLabel -> IO (Either Error IssueLabel)
label = label' Nothing
label' :: Maybe Auth -> Name Owner -> Name Repo -> Name IssueLabel -> IO (Either Error IssueLabel)
label' auth user repo lbl =
executeRequestMaybe auth $ labelR user repo lbl
labelR :: Name Owner -> Name Repo -> Name IssueLabel -> Request k IssueLabel
labelR user repo lbl =
query ["repos", toPathPart user, toPathPart repo, "labels", toPathPart lbl] []
createLabel :: Auth -> Name Owner -> Name Repo -> Name IssueLabel -> String -> IO (Either Error IssueLabel)
createLabel auth user repo lbl color =
executeRequest auth $ createLabelR user repo lbl color
createLabelR :: Name Owner -> Name Repo -> Name IssueLabel -> String -> Request 'RW IssueLabel
createLabelR user repo lbl color =
command Post paths $ encode body
where
paths = ["repos", toPathPart user, toPathPart repo, "labels"]
body = object ["name" .= untagName lbl, "color" .= color]
updateLabel :: Auth
-> Name Owner
-> Name Repo
-> Name IssueLabel
-> Name IssueLabel
-> String
-> IO (Either Error IssueLabel)
updateLabel auth user repo oldLbl newLbl color =
executeRequest auth $ updateLabelR user repo oldLbl newLbl color
updateLabelR :: Name Owner
-> Name Repo
-> Name IssueLabel
-> Name IssueLabel
-> String
-> Request 'RW IssueLabel
updateLabelR user repo oldLbl newLbl color =
command Patch paths (encode body)
where
paths = ["repos", toPathPart user, toPathPart repo, "labels", toPathPart oldLbl]
body = object ["name" .= untagName newLbl, "color" .= color]
deleteLabel :: Auth -> Name Owner -> Name Repo -> Name IssueLabel -> IO (Either Error ())
deleteLabel auth user repo lbl =
executeRequest auth $ deleteLabelR user repo lbl
deleteLabelR :: Name Owner -> Name Repo -> Name IssueLabel -> GenRequest 'MtUnit 'RW ()
deleteLabelR user repo lbl =
Command Delete ["repos", toPathPart user, toPathPart repo, "labels", toPathPart lbl] mempty
labelsOnIssue :: Name Owner -> Name Repo -> Id Issue -> IO (Either Error (Vector IssueLabel))
labelsOnIssue = labelsOnIssue' Nothing
labelsOnIssue' :: Maybe Auth -> Name Owner -> Name Repo -> Id Issue -> IO (Either Error (Vector IssueLabel))
labelsOnIssue' auth user repo iid =
executeRequestMaybe auth $ labelsOnIssueR user repo iid FetchAll
labelsOnIssueR :: Name Owner -> Name Repo -> Id Issue -> FetchCount -> Request k (Vector IssueLabel)
labelsOnIssueR user repo iid =
pagedQuery ["repos", toPathPart user, toPathPart repo, "issues", toPathPart iid, "labels"] []
addLabelsToIssue :: Foldable f
=> Auth
-> Name Owner
-> Name Repo
-> Id Issue
-> f (Name IssueLabel)
-> IO (Either Error (Vector IssueLabel))
addLabelsToIssue auth user repo iid lbls =
executeRequest auth $ addLabelsToIssueR user repo iid lbls
addLabelsToIssueR :: Foldable f
=> Name Owner
-> Name Repo
-> Id Issue
-> f (Name IssueLabel)
-> Request 'RW (Vector IssueLabel)
addLabelsToIssueR user repo iid lbls =
command Post paths (encode $ toList lbls)
where
paths = ["repos", toPathPart user, toPathPart repo, "issues", toPathPart iid, "labels"]
removeLabelFromIssue :: Auth -> Name Owner -> Name Repo -> Id Issue -> Name IssueLabel -> IO (Either Error ())
removeLabelFromIssue auth user repo iid lbl =
executeRequest auth $ removeLabelFromIssueR user repo iid lbl
removeLabelFromIssueR :: Name Owner -> Name Repo -> Id Issue -> Name IssueLabel -> GenRequest 'MtUnit 'RW ()
removeLabelFromIssueR user repo iid lbl =
Command Delete ["repos", toPathPart user, toPathPart repo, "issues", toPathPart iid, "labels", toPathPart lbl] mempty
replaceAllLabelsForIssue :: Foldable f
=> Auth
-> Name Owner
-> Name Repo
-> Id Issue
-> f (Name IssueLabel)
-> IO (Either Error (Vector IssueLabel))
replaceAllLabelsForIssue auth user repo iid lbls =
executeRequest auth $ replaceAllLabelsForIssueR user repo iid lbls
replaceAllLabelsForIssueR :: Foldable f
=> Name Owner
-> Name Repo
-> Id Issue
-> f (Name IssueLabel)
-> Request 'RW (Vector IssueLabel)
replaceAllLabelsForIssueR user repo iid lbls =
command Put paths (encode $ toList lbls)
where
paths = ["repos", toPathPart user, toPathPart repo, "issues", toPathPart iid, "labels"]
removeAllLabelsFromIssue :: Auth -> Name Owner -> Name Repo -> Id Issue -> IO (Either Error ())
removeAllLabelsFromIssue auth user repo iid =
executeRequest auth $ removeAllLabelsFromIssueR user repo iid
removeAllLabelsFromIssueR :: Name Owner -> Name Repo -> Id Issue -> GenRequest 'MtUnit 'RW ()
removeAllLabelsFromIssueR user repo iid =
Command Delete ["repos", toPathPart user, toPathPart repo, "issues", toPathPart iid, "labels"] mempty
labelsOnMilestone :: Name Owner -> Name Repo -> Id Milestone -> IO (Either Error (Vector IssueLabel))
labelsOnMilestone = labelsOnMilestone' Nothing
labelsOnMilestone' :: Maybe Auth -> Name Owner -> Name Repo -> Id Milestone -> IO (Either Error (Vector IssueLabel))
labelsOnMilestone' auth user repo mid =
executeRequestMaybe auth $ labelsOnMilestoneR user repo mid FetchAll
labelsOnMilestoneR :: Name Owner -> Name Repo -> Id Milestone -> FetchCount -> Request k (Vector IssueLabel)
labelsOnMilestoneR user repo mid =
pagedQuery ["repos", toPathPart user, toPathPart repo, "milestones", toPathPart mid, "labels"] []