-- |
-- The events API as described on <https://developer.github.com/v3/activity/events/>.

module GitHub.Endpoints.Activity.Events (
    -- * Events
    repositoryEventsR,
    userEventsR,
    module GitHub.Data,
    ) where

import GitHub.Data
import GitHub.Internal.Prelude
import Prelude ()

-- | List repository events.
-- See <https://developer.github.com/v3/activity/events/#list-repository-events>
repositoryEventsR :: Name Owner -> Name Repo -> FetchCount -> Request 'RO (Vector Event)
repositoryEventsR :: Name Owner -> Name Repo -> FetchCount -> Request 'RO (Vector Event)
repositoryEventsR Name Owner
user Name Repo
repo =
    forall a (mt :: RW).
FromJSON a =>
Paths -> QueryString -> FetchCount -> Request mt (Vector a)
pagedQuery  [Text
"repos", forall a. IsPathPart a => a -> Text
toPathPart Name Owner
user, forall a. IsPathPart a => a -> Text
toPathPart Name Repo
repo, Text
"events"] []

-- | List user public events.
-- See <https://developer.github.com/v3/activity/events/#list-public-events-performed-by-a-user>
userEventsR :: Name User -> FetchCount -> Request 'RO (Vector Event)
userEventsR :: Name User -> FetchCount -> Request 'RO (Vector Event)
userEventsR Name User
user =
    forall a (mt :: RW).
FromJSON a =>
Paths -> QueryString -> FetchCount -> Request mt (Vector a)
pagedQuery [Text
"users", forall a. IsPathPart a => a -> Text
toPathPart Name User
user, Text
"events", Text
"public"] []