-
Notifications
You must be signed in to change notification settings - Fork 196
Expand file tree
/
Copy pathCreateOrganization.hs
More file actions
30 lines (27 loc) · 1.05 KB
/
CreateOrganization.hs
File metadata and controls
30 lines (27 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
module Main (main) where
import Common
import qualified GitHub
import qualified GitHub.Enterprise as GitHub
main :: IO ()
main = do
args <- getArgs
result <- case args of
[api_endpoint, token, org_login, org_admin, org_profile_name] ->
GitHub.github
(GitHub.EnterpriseOAuth
(fromString api_endpoint)
(fromString token)
)
GitHub.createOrganizationR
(GitHub.CreateOrganization
(GitHub.mkOrganizationName $ fromString org_login)
(GitHub.mkUserName $ fromString org_admin)
(Just $ fromString org_profile_name)
)
_ ->
error "usage: CreateOrganization <api_endpoint> <token> <org_login> <org_admin> <org_profile_name>"
case result of
Left err -> putStrLn $ "Error: " <> tshow err
Right org -> putStrLn $ tshow org