-- |
-- The orgs API as described on <http://developer.github.com/v3/orgs/>.

module GitHub.Endpoints.Organizations (
    publicOrganizationsForR,
    publicOrganizationR,
    organizationsR,
    module GitHub.Data,
    ) where

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

-- | List all user organizations.
-- See <https://developer.github.com/v3/orgs/#list-your-organizations>
organizationsR :: FetchCount -> Request k (Vector SimpleOrganization)
organizationsR :: forall (k :: RW).
FetchCount -> Request k (Vector SimpleOrganization)
organizationsR = Paths
-> QueryString
-> FetchCount
-> Request k (Vector SimpleOrganization)
forall a (mt :: RW).
FromJSON a =>
Paths -> QueryString -> FetchCount -> Request mt (Vector a)
pagedQuery [Text
"user", Text
"orgs"] []

-- | List public user organizations.
-- See <https://developer.github.com/v3/orgs/#list-user-organizations>
publicOrganizationsForR :: Name User -> FetchCount -> Request k (Vector SimpleOrganization)
publicOrganizationsForR :: forall (k :: RW).
Name User -> FetchCount -> Request k (Vector SimpleOrganization)
publicOrganizationsForR Name User
user = Paths
-> QueryString
-> FetchCount
-> Request k (Vector SimpleOrganization)
forall a (mt :: RW).
FromJSON a =>
Paths -> QueryString -> FetchCount -> Request mt (Vector a)
pagedQuery [Text
"users", Name User -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name User
user, Text
"orgs"] []

-- | Query an organization.
-- See <https://developer.github.com/v3/orgs/#get-an-organization>
publicOrganizationR :: Name Organization -> Request k Organization
publicOrganizationR :: forall (k :: RW). Name Organization -> Request k Organization
publicOrganizationR Name Organization
reqOrganizationName = Paths -> QueryString -> Request k Organization
forall (mt :: RW) a. Paths -> QueryString -> Request mt a
query [Text
"orgs", Name Organization -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Organization
reqOrganizationName] []