Skip to content

Commit 135199f

Browse files
authored
Merge pull request #343 from sajidanower23/add-collab-endpoint
Add collab endpoint
2 parents 792665d + e76e7a3 commit 135199f

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/GitHub.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ module GitHub (
253253
-- | See <https://developer.github.com/v3/repos/collaborators/>
254254
collaboratorsOnR,
255255
isCollaboratorOnR,
256+
addCollaboratorR,
256257

257258
-- ** Comments
258259
-- | See <https://developer.github.com/v3/repos/comments/>

src/GitHub/Endpoints/Repos/Collaborators.hs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ module GitHub.Endpoints.Repos.Collaborators (
1111
collaboratorsOnR,
1212
isCollaboratorOn,
1313
isCollaboratorOnR,
14+
addCollaborator,
15+
addCollaboratorR,
1416
module GitHub.Data,
1517
) where
1618

@@ -60,3 +62,22 @@ isCollaboratorOnR
6062
-> Request k Bool
6163
isCollaboratorOnR user repo coll = StatusQuery statusOnlyOk $
6264
Query ["repos", toPathPart user, toPathPart repo, "collaborators", toPathPart coll] []
65+
66+
addCollaborator
67+
:: Auth
68+
-> Name Owner -- ^ Repository owner
69+
-> Name Repo -- ^ Repository name
70+
-> Name User -- ^ Collaborator to add
71+
-> IO (Either Error ())
72+
addCollaborator auth owner repo coll =
73+
executeRequest auth $ addCollaboratorR owner repo coll
74+
75+
-- | Invite a user as a collaborator.
76+
-- See <https://developer.github.com/v3/repos/collaborators/#add-user-as-a-collaborator>
77+
addCollaboratorR
78+
:: Name Owner -- ^ Repository owner
79+
-> Name Repo -- ^ Repository name
80+
-> Name User -- ^ Collaborator to add
81+
-> Request 'RW ()
82+
addCollaboratorR owner repo coll =
83+
command Put' ["repos", toPathPart owner, toPathPart repo, "collaborators", toPathPart coll] mempty

0 commit comments

Comments
 (0)