module GitHub.Endpoints.Activity.Starring (
stargazersFor,
stargazersForR,
reposStarredBy,
reposStarredByR,
myStarred,
myStarredR,
myStarredAcceptStar,
myStarredAcceptStarR,
starRepo,
starRepoR,
unstarRepo,
unstarRepoR,
module GitHub.Data,
) where
import GitHub.Auth
import GitHub.Data
import GitHub.Internal.Prelude
import GitHub.Request
import Prelude ()
stargazersFor :: Maybe Auth -> Name Owner -> Name Repo -> IO (Either Error (Vector SimpleUser))
stargazersFor :: Maybe Auth
-> Name Owner -> Name Repo -> IO (Either Error (Vector SimpleUser))
stargazersFor auth :: Maybe Auth
auth user :: Name Owner
user repo :: Name Repo
repo =
Maybe Auth
-> GenRequest 'MtJSON 'RO (Vector SimpleUser)
-> IO (Either Error (Vector SimpleUser))
forall am (mt :: MediaType *) a.
(AuthMethod am, ParseResponse mt a) =>
Maybe am -> GenRequest mt 'RO a -> IO (Either Error a)
executeRequestMaybe Maybe Auth
auth (GenRequest 'MtJSON 'RO (Vector SimpleUser)
-> IO (Either Error (Vector SimpleUser)))
-> GenRequest 'MtJSON 'RO (Vector SimpleUser)
-> IO (Either Error (Vector SimpleUser))
forall a b. (a -> b) -> a -> b
$ Name Owner
-> Name Repo
-> FetchCount
-> GenRequest 'MtJSON 'RO (Vector SimpleUser)
forall (k :: RW).
Name Owner
-> Name Repo -> FetchCount -> Request k (Vector SimpleUser)
stargazersForR Name Owner
user Name Repo
repo FetchCount
FetchAll
stargazersForR :: Name Owner -> Name Repo -> FetchCount -> Request k (Vector SimpleUser)
stargazersForR :: Name Owner
-> Name Repo -> FetchCount -> Request k (Vector SimpleUser)
stargazersForR user :: Name Owner
user repo :: Name Repo
repo =
Paths -> QueryString -> FetchCount -> Request k (Vector SimpleUser)
forall a (mt :: RW).
FromJSON a =>
Paths -> QueryString -> FetchCount -> Request mt (Vector a)
pagedQuery ["repos", Name Owner -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Owner
user, Name Repo -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Repo
repo, "stargazers"] []
reposStarredBy :: Maybe Auth -> Name Owner -> IO (Either Error (Vector Repo))
reposStarredBy :: Maybe Auth -> Name Owner -> IO (Either Error (Vector Repo))
reposStarredBy auth :: Maybe Auth
auth user :: Name Owner
user =
Maybe Auth
-> GenRequest 'MtJSON 'RO (Vector Repo)
-> IO (Either Error (Vector Repo))
forall am (mt :: MediaType *) a.
(AuthMethod am, ParseResponse mt a) =>
Maybe am -> GenRequest mt 'RO a -> IO (Either Error a)
executeRequestMaybe Maybe Auth
auth (GenRequest 'MtJSON 'RO (Vector Repo)
-> IO (Either Error (Vector Repo)))
-> GenRequest 'MtJSON 'RO (Vector Repo)
-> IO (Either Error (Vector Repo))
forall a b. (a -> b) -> a -> b
$ Name Owner -> FetchCount -> GenRequest 'MtJSON 'RO (Vector Repo)
forall (k :: RW).
Name Owner -> FetchCount -> Request k (Vector Repo)
reposStarredByR Name Owner
user FetchCount
FetchAll
reposStarredByR :: Name Owner -> FetchCount -> Request k (Vector Repo)
reposStarredByR :: Name Owner -> FetchCount -> Request k (Vector Repo)
reposStarredByR user :: Name Owner
user =
Paths -> QueryString -> FetchCount -> Request k (Vector Repo)
forall a (mt :: RW).
FromJSON a =>
Paths -> QueryString -> FetchCount -> Request mt (Vector a)
pagedQuery ["users", Name Owner -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Owner
user, "starred"] []
myStarred :: Auth -> IO (Either Error (Vector Repo))
myStarred :: Auth -> IO (Either Error (Vector Repo))
myStarred auth :: Auth
auth =
Auth
-> GenRequest 'MtJSON 'RA (Vector Repo)
-> IO (Either Error (Vector Repo))
forall am (mt :: MediaType *) a (rw :: RW).
(AuthMethod am, ParseResponse mt a) =>
am -> GenRequest mt rw a -> IO (Either Error a)
executeRequest Auth
auth (GenRequest 'MtJSON 'RA (Vector Repo)
-> IO (Either Error (Vector Repo)))
-> GenRequest 'MtJSON 'RA (Vector Repo)
-> IO (Either Error (Vector Repo))
forall a b. (a -> b) -> a -> b
$ FetchCount -> GenRequest 'MtJSON 'RA (Vector Repo)
myStarredR FetchCount
FetchAll
myStarredR :: FetchCount -> Request 'RA (Vector Repo)
myStarredR :: FetchCount -> GenRequest 'MtJSON 'RA (Vector Repo)
myStarredR = Paths
-> QueryString
-> FetchCount
-> GenRequest 'MtJSON 'RA (Vector Repo)
forall a (mt :: RW).
FromJSON a =>
Paths -> QueryString -> FetchCount -> Request mt (Vector a)
pagedQuery ["user", "starred"] []
myStarredAcceptStar :: Auth -> IO (Either Error (Vector RepoStarred))
myStarredAcceptStar :: Auth -> IO (Either Error (Vector RepoStarred))
myStarredAcceptStar auth :: Auth
auth =
Auth
-> GenRequest 'MtStar 'RA (Vector RepoStarred)
-> IO (Either Error (Vector RepoStarred))
forall am (mt :: MediaType *) a (rw :: RW).
(AuthMethod am, ParseResponse mt a) =>
am -> GenRequest mt rw a -> IO (Either Error a)
executeRequest Auth
auth (GenRequest 'MtStar 'RA (Vector RepoStarred)
-> IO (Either Error (Vector RepoStarred)))
-> GenRequest 'MtStar 'RA (Vector RepoStarred)
-> IO (Either Error (Vector RepoStarred))
forall a b. (a -> b) -> a -> b
$ FetchCount -> GenRequest 'MtStar 'RA (Vector RepoStarred)
myStarredAcceptStarR FetchCount
FetchAll
myStarredAcceptStarR :: FetchCount -> GenRequest 'MtStar 'RA (Vector RepoStarred)
myStarredAcceptStarR :: FetchCount -> GenRequest 'MtStar 'RA (Vector RepoStarred)
myStarredAcceptStarR = Paths
-> QueryString
-> FetchCount
-> GenRequest 'MtStar 'RA (Vector RepoStarred)
forall (mt :: MediaType *) (rw :: RW) a.
Paths -> QueryString -> FetchCount -> GenRequest mt rw (Vector a)
PagedQuery ["user", "starred"] []
starRepo :: Auth -> Name Owner -> Name Repo -> IO (Either Error ())
starRepo :: Auth -> Name Owner -> Name Repo -> IO (Either Error ())
starRepo auth :: Auth
auth user :: Name Owner
user repo :: Name Repo
repo = Auth -> GenRequest 'MtUnit 'RW () -> IO (Either Error ())
forall am (mt :: MediaType *) a (rw :: RW).
(AuthMethod am, ParseResponse mt a) =>
am -> GenRequest mt rw a -> IO (Either Error a)
executeRequest Auth
auth (GenRequest 'MtUnit 'RW () -> IO (Either Error ()))
-> GenRequest 'MtUnit 'RW () -> IO (Either Error ())
forall a b. (a -> b) -> a -> b
$ Name Owner -> Name Repo -> GenRequest 'MtUnit 'RW ()
starRepoR Name Owner
user Name Repo
repo
starRepoR :: Name Owner -> Name Repo -> GenRequest 'MtUnit 'RW ()
starRepoR :: Name Owner -> Name Repo -> GenRequest 'MtUnit 'RW ()
starRepoR user :: Name Owner
user repo :: Name Repo
repo = CommandMethod -> Paths -> ByteString -> GenRequest 'MtUnit 'RW ()
forall (mt :: MediaType *) a.
CommandMethod -> Paths -> ByteString -> GenRequest mt 'RW a
Command CommandMethod
Put Paths
paths ByteString
forall a. Monoid a => a
mempty
where
paths :: Paths
paths = ["user", "starred", Name Owner -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Owner
user, Name Repo -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Repo
repo]
unstarRepo :: Auth -> Name Owner -> Name Repo -> IO (Either Error ())
unstarRepo :: Auth -> Name Owner -> Name Repo -> IO (Either Error ())
unstarRepo auth :: Auth
auth user :: Name Owner
user repo :: Name Repo
repo = Auth -> GenRequest 'MtUnit 'RW () -> IO (Either Error ())
forall am (mt :: MediaType *) a (rw :: RW).
(AuthMethod am, ParseResponse mt a) =>
am -> GenRequest mt rw a -> IO (Either Error a)
executeRequest Auth
auth (GenRequest 'MtUnit 'RW () -> IO (Either Error ()))
-> GenRequest 'MtUnit 'RW () -> IO (Either Error ())
forall a b. (a -> b) -> a -> b
$ Name Owner -> Name Repo -> GenRequest 'MtUnit 'RW ()
unstarRepoR Name Owner
user Name Repo
repo
unstarRepoR :: Name Owner -> Name Repo -> GenRequest 'MtUnit 'RW ()
unstarRepoR :: Name Owner -> Name Repo -> GenRequest 'MtUnit 'RW ()
unstarRepoR user :: Name Owner
user repo :: Name Repo
repo = CommandMethod -> Paths -> ByteString -> GenRequest 'MtUnit 'RW ()
forall (mt :: MediaType *) a.
CommandMethod -> Paths -> ByteString -> GenRequest mt 'RW a
Command CommandMethod
Delete Paths
paths ByteString
forall a. Monoid a => a
mempty
where
paths :: Paths
paths = ["user", "starred", Name Owner -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Owner
user, Name Repo -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Repo
repo]