@@ -14,6 +14,10 @@ module GitHub.Endpoints.Activity.Starring (
1414 myStarredR ,
1515 myStarredAcceptStar ,
1616 myStarredAcceptStarR ,
17+ starRepo ,
18+ starRepoR ,
19+ unstarRepo ,
20+ unstarRepoR ,
1721 module GitHub.Data ,
1822 ) where
1923
@@ -69,3 +73,25 @@ myStarredAcceptStar auth =
6973-- See <https://developer.github.com/v3/activity/starring/#alternative-response-with-star-creation-timestamps-1>
7074myStarredAcceptStarR :: FetchCount -> Request 'RA (Vector RepoStarred )
7175myStarredAcceptStarR = HeaderQuery [(" Accept" , " application/vnd.github.v3.star+json" )] . PagedQuery [" user" , " starred" ] []
76+
77+ -- | Star a repo by the authenticated user.
78+ starRepo :: Auth -> Name Owner -> Name Repo -> IO (Either Error () )
79+ starRepo auth user repo = executeRequest auth $ starRepoR user repo
80+
81+ -- | Star a repo by the authenticated user.
82+ -- See <https://developer.github.com/v3/activity/starring/#star-a-repository>
83+ starRepoR :: Name Owner -> Name Repo -> Request 'RW ()
84+ starRepoR user repo = command Put' paths mempty
85+ where
86+ paths = [" user" , " starred" , toPathPart user, toPathPart repo]
87+
88+ -- | Unstar a repo by the authenticated user.
89+ unstarRepo :: Auth -> Name Owner -> Name Repo -> IO (Either Error () )
90+ unstarRepo auth user repo = executeRequest auth $ unstarRepoR user repo
91+
92+ -- | Unstar a repo by the authenticated user.
93+ -- 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
96+ where
97+ paths = [" user" , " starred" , toPathPart user, toPathPart repo]
0 commit comments