Skip to content

Commit 0247582

Browse files
committed
Use 'MtUnit in Commands returning ()
1 parent df3cea1 commit 0247582

File tree

13 files changed

+37
-31
lines changed

13 files changed

+37
-31
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
[#363](https://github.com/phadej/github/pull/365)
1919
- Case insensitive enum parsing
2020
[#373](https://github.com/phadej/github/pull/373)
21+
- Don't try parse unitary responses
22+
[#377](https://github.com/phadej/github/issues/377)
2123
- Update dependencies
2224
[#364](https://github.com/phadej/github/pull/364)
2325
[#368](https://github.com/phadej/github/pull/368)

src/GitHub/Endpoints/Activity/Starring.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ unstarRepo auth user repo = executeRequest auth $ unstarRepoR user repo
9191

9292
-- | Unstar a repo by the authenticated user.
9393
-- See <https://developer.github.com/v3/activity/starring/#unstar-a-repository>
94-
unstarRepoR :: Name Owner -> Name Repo -> Request 'RW ()
95-
unstarRepoR user repo = command Delete paths mempty
94+
unstarRepoR :: Name Owner -> Name Repo -> GenRequest 'MtUnit 'RW ()
95+
unstarRepoR user repo = Command Delete paths mempty
9696
where
9797
paths = ["user", "starred", toPathPart user, toPathPart repo]

src/GitHub/Endpoints/Gists.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ unstarGist auth gid = executeRequest auth $ unstarGistR gid
8181

8282
-- | Unstar a gist by the authenticated user.
8383
-- See <https://developer.github.com/v3/gists/#unstar-a-gist>
84-
unstarGistR :: Name Gist -> Request 'RW ()
85-
unstarGistR gid = command Delete ["gists", toPathPart gid, "star"] mempty
84+
unstarGistR :: Name Gist -> GenRequest 'MtUnit 'RW ()
85+
unstarGistR gid = Command Delete ["gists", toPathPart gid, "star"] mempty
8686

8787
-- | Delete a gist by the authenticated user.
8888
--
@@ -92,5 +92,5 @@ deleteGist auth gid = executeRequest auth $ deleteGistR gid
9292

9393
-- | Delete a gist by the authenticated user.
9494
-- See <https://developer.github.com/v3/gists/#delete-a-gist>
95-
deleteGistR :: Name Gist -> Request 'RW ()
96-
deleteGistR gid = command Delete ["gists", toPathPart gid] mempty
95+
deleteGistR :: Name Gist -> GenRequest 'MtUnit 'RW ()
96+
deleteGistR gid = Command Delete ["gists", toPathPart gid] mempty

src/GitHub/Endpoints/Issues/Comments.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ deleteComment auth user repo commid =
101101

102102
-- | Delete a comment.
103103
-- See <https://developer.github.com/v3/issues/comments/#delete-a-comment>
104-
deleteCommentR :: Name Owner -> Name Repo -> Id Comment -> Request 'RW ()
104+
deleteCommentR :: Name Owner -> Name Repo -> Id Comment -> GenRequest 'MtUnit 'RW ()
105105
deleteCommentR user repo commid =
106-
command Delete parts mempty
106+
Command Delete parts mempty
107107
where
108108
parts = ["repos", toPathPart user, toPathPart repo, "issues", "comments", toPathPart commid]

src/GitHub/Endpoints/Issues/Labels.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,9 @@ deleteLabel auth user repo lbl =
130130

131131
-- | Delete a label.
132132
-- See <https://developer.github.com/v3/issues/labels/#delete-a-label>
133-
deleteLabelR :: Name Owner -> Name Repo -> Name IssueLabel -> Request 'RW ()
133+
deleteLabelR :: Name Owner -> Name Repo -> Name IssueLabel -> GenRequest 'MtUnit 'RW ()
134134
deleteLabelR user repo lbl =
135-
command Delete ["repos", toPathPart user, toPathPart repo, "labels", toPathPart lbl] mempty
135+
Command Delete ["repos", toPathPart user, toPathPart repo, "labels", toPathPart lbl] mempty
136136

137137
-- | The labels on an issue in a repo.
138138
--
@@ -188,9 +188,9 @@ removeLabelFromIssue auth user repo iid lbl =
188188

189189
-- | Remove a label from an issue.
190190
-- See <https://developer.github.com/v3/issues/labels/#remove-a-label-from-an-issue>
191-
removeLabelFromIssueR :: Name Owner -> Name Repo -> Id Issue -> Name IssueLabel -> Request 'RW ()
191+
removeLabelFromIssueR :: Name Owner -> Name Repo -> Id Issue -> Name IssueLabel -> GenRequest 'MtUnit 'RW ()
192192
removeLabelFromIssueR user repo iid lbl =
193-
command Delete ["repos", toPathPart user, toPathPart repo, "issues", toPathPart iid, "labels", toPathPart lbl] mempty
193+
Command Delete ["repos", toPathPart user, toPathPart repo, "issues", toPathPart iid, "labels", toPathPart lbl] mempty
194194

195195
-- | Replace all labels on an issue. Sending an empty list will remove all labels from the issue.
196196
--
@@ -229,9 +229,9 @@ removeAllLabelsFromIssue auth user repo iid =
229229

230230
-- | Remove all labels from an issue.
231231
-- See <https://developer.github.com/v3/issues/labels/#remove-all-labels-from-an-issue>
232-
removeAllLabelsFromIssueR :: Name Owner -> Name Repo -> Id Issue -> Request 'RW ()
232+
removeAllLabelsFromIssueR :: Name Owner -> Name Repo -> Id Issue -> GenRequest 'MtUnit 'RW ()
233233
removeAllLabelsFromIssueR user repo iid =
234-
command Delete ["repos", toPathPart user, toPathPart repo, "issues", toPathPart iid, "labels"] mempty
234+
Command Delete ["repos", toPathPart user, toPathPart repo, "issues", toPathPart iid, "labels"] mempty
235235

236236
-- | All the labels on a repo's milestone given the milestone ID.
237237
--

src/GitHub/Endpoints/Issues/Milestones.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ deleteMilestone auth user repo mid = executeRequest auth $ deleteMilestoneR user
8080

8181
-- | Delete a milestone.
8282
-- See <https://developer.github.com/v3/issues/milestones/#delete-a-milestone>
83-
deleteMilestoneR :: Name Owner -> Name Repo -> Id Milestone -> Request 'RW ()
83+
deleteMilestoneR :: Name Owner -> Name Repo -> Id Milestone -> GenRequest 'MtUnit 'RW ()
8484
deleteMilestoneR user repo mid =
85-
command Delete
85+
Command Delete
8686
["repos", toPathPart user, toPathPart repo, "milestones", toPathPart mid] mempty

src/GitHub/Endpoints/Organizations/Teams.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ deleteTeam' auth tid =
124124
-- | Delete team.
125125
--
126126
-- See <https://developer.github.com/v3/orgs/teams/#delete-team>
127-
deleteTeamR :: Id Team -> Request 'RW ()
127+
deleteTeamR :: Id Team -> GenRequest 'MtUnit 'RW ()
128128
deleteTeamR tid =
129-
command Delete ["teams", toPathPart tid] mempty
129+
Command Delete ["teams", toPathPart tid] mempty
130130

131131
-- | List team members.
132132
--
@@ -214,9 +214,9 @@ deleteTeamMembershipFor' auth tid user =
214214

215215
-- | Remove team membership.
216216
-- See <https://developer.github.com/v3/orgs/teams/#remove-team-membership>
217-
deleteTeamMembershipForR :: Id Team -> Name Owner -> Request 'RW ()
217+
deleteTeamMembershipForR :: Id Team -> Name Owner -> GenRequest 'MtUnit 'RW ()
218218
deleteTeamMembershipForR tid user =
219-
command Delete ["teams", toPathPart tid, "memberships", toPathPart user] mempty
219+
Command Delete ["teams", toPathPart tid, "memberships", toPathPart user] mempty
220220

221221
-- | List teams for current authenticated user
222222
--

src/GitHub/Endpoints/Repos.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,8 @@ deleteRepo :: Auth -> Name Owner -> Name Repo -> IO (Either Error ())
330330
deleteRepo auth user repo =
331331
executeRequest auth $ deleteRepoR user repo
332332

333-
deleteRepoR :: Name Owner -> Name Repo -> Request 'RW ()
333+
-- | Delete a repository,.
334+
-- See <https://developer.github.com/v3/repos/#delete-a-repository>
335+
deleteRepoR :: Name Owner -> Name Repo -> GenRequest 'MtUnit 'RW ()
334336
deleteRepoR user repo =
335-
command Delete ["repos", toPathPart user, toPathPart repo] mempty
337+
Command Delete ["repos", toPathPart user, toPathPart repo] mempty

src/GitHub/Endpoints/Repos/Contents.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,6 @@ deleteFileR
166166
:: Name Owner
167167
-> Name Repo
168168
-> DeleteFile
169-
-> Request 'RW ()
169+
-> GenRequest 'MtUnit 'RW ()
170170
deleteFileR user repo body =
171-
command Delete ["repos", toPathPart user, toPathPart repo, "contents", deleteFilePath body] (encode body)
171+
Command Delete ["repos", toPathPart user, toPathPart repo, "contents", deleteFilePath body] (encode body)

src/GitHub/Endpoints/Repos/DeployKeys.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,6 @@ deleteRepoDeployKey' auth user repo keyId =
6565

6666
-- | Delete a deploy key.
6767
-- See <https://developer.github.com/v3/repos/keys/#remove-a-deploy-key>
68-
deleteRepoDeployKeyR :: Name Owner -> Name Repo -> Id RepoDeployKey -> Request 'RW ()
68+
deleteRepoDeployKeyR :: Name Owner -> Name Repo -> Id RepoDeployKey -> GenRequest 'MtUnit 'RW ()
6969
deleteRepoDeployKeyR user repo keyId =
70-
command Delete ["repos", toPathPart user, toPathPart repo, "keys", toPathPart keyId] mempty
70+
Command Delete ["repos", toPathPart user, toPathPart repo, "keys", toPathPart keyId] mempty

src/GitHub/Endpoints/Repos/Webhooks.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ deleteRepoWebhook' auth user repo hookId =
103103

104104
-- | Delete a hook.
105105
-- See <https://developer.github.com/v3/repos/hooks/#delete-a-hook>
106-
deleteRepoWebhookR :: Name Owner -> Name Repo -> Id RepoWebhook -> Request 'RW ()
106+
deleteRepoWebhookR :: Name Owner -> Name Repo -> Id RepoWebhook -> GenRequest 'MtUnit 'RW ()
107107
deleteRepoWebhookR user repo hookId =
108-
command Delete (createWebhookOpPath user repo hookId Nothing) mempty
108+
Command Delete (createWebhookOpPath user repo hookId Nothing) mempty
109109

110110
createBaseWebhookPath :: Name Owner -> Name Repo -> Id RepoWebhook -> Paths
111111
createBaseWebhookPath user repo hookId =

src/GitHub/Endpoints/Users/PublicSSHKeys.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,6 @@ deleteUserPublicSSHKey' auth keyId =
7878

7979
-- | Delete a public SSH key.
8080
-- See <https://developer.github.com/v3/users/keys/#delete-a-public-key>
81-
deleteUserPublicSSHKeyR :: Id PublicSSHKey -> Request 'RW ()
81+
deleteUserPublicSSHKeyR :: Id PublicSSHKey -> GenRequest 'MtUnit 'RW ()
8282
deleteUserPublicSSHKeyR keyId =
83-
command Delete ["user", "keys", toPathPart keyId] mempty
83+
Command Delete ["user", "keys", toPathPart keyId] mempty

src/GitHub/Request.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,10 @@ parseStatus m (Status sci _) =
331331
-- Unit
332332
-------------------------------------------------------------------------------
333333

334+
-- | Note: we don't ignore response status.
335+
--
336+
-- We only accept any response body.
334337
instance Accept 'MtUnit where
335-
modifyRequest = Tagged setRequestIgnoreStatus
336338

337339
instance a ~ () => ParseResponse 'MtUnit a where
338340
parseResponse _ _ = Tagged (return ())

0 commit comments

Comments
 (0)