-- |
-- The GitHub Enterprise orgs API as described on <https://developer.github.com/enterprise/v3/enterprise-admin/orgs/>.

module GitHub.Endpoints.Enterprise.Organizations (
    createOrganizationR,
    renameOrganizationR,
    module GitHub.Data,
    ) where

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

-- | Create an organization.
-- See <https://developer.github.com/enterprise/v3/enterprise-admin/orgs/#create-an-organization>
createOrganizationR :: CreateOrganization -> Request 'RW SimpleOrganization
createOrganizationR :: CreateOrganization -> Request 'RW SimpleOrganization
createOrganizationR =
    CommandMethod
-> Paths -> ByteString -> Request 'RW SimpleOrganization
forall a. CommandMethod -> Paths -> ByteString -> Request 'RW a
command CommandMethod
Post [Text
"admin", Text
"organizations"] (ByteString -> Request 'RW SimpleOrganization)
-> (CreateOrganization -> ByteString)
-> CreateOrganization
-> Request 'RW SimpleOrganization
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CreateOrganization -> ByteString
forall a. ToJSON a => a -> ByteString
encode

-- | Rename an organization.
-- See <https://developer.github.com/enterprise/v3/enterprise-admin/orgs/#rename-an-organization>
renameOrganizationR :: Name Organization -> RenameOrganization -> Request 'RW RenameOrganizationResponse
renameOrganizationR :: Name Organization
-> RenameOrganization -> Request 'RW RenameOrganizationResponse
renameOrganizationR Name Organization
org =
    CommandMethod
-> Paths -> ByteString -> Request 'RW RenameOrganizationResponse
forall a. CommandMethod -> Paths -> ByteString -> Request 'RW a
command CommandMethod
Patch [Text
"admin", Text
"organizations", Name Organization -> Text
forall a. IsPathPart a => a -> Text
toPathPart Name Organization
org] (ByteString -> Request 'RW RenameOrganizationResponse)
-> (RenameOrganization -> ByteString)
-> RenameOrganization
-> Request 'RW RenameOrganizationResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RenameOrganization -> ByteString
forall a. ToJSON a => a -> ByteString
encode