File tree Expand file tree Collapse file tree 5 files changed +128
-0
lines changed
Expand file tree Collapse file tree 5 files changed +128
-0
lines changed Original file line number Diff line number Diff line change 1+ {-# LANGUAGE OverloadedStrings #-}
2+ module Main (main ) where
3+
4+ import qualified GitHub.Data.PublicSSHKeys as PK
5+ import qualified GitHub.Endpoints.Users.PublicSSHKeys as PK
6+ import qualified GitHub.Auth as Auth
7+ import Data.Text (Text )
8+
9+ main :: IO ()
10+ main = do
11+ let auth = Auth. OAuth " auth_token"
12+ ePublicSSHKey <- PK. createUserPublicSSHKey' auth newPublicSSHKey
13+ case ePublicSSHKey of
14+ (Left err) -> putStrLn $ " Error: " ++ (show err)
15+ (Right publicSSHKey) -> putStrLn $ show publicSSHKey
16+
17+ newPublicSSHKey :: PK. NewPublicSSHKey
18+ newPublicSSHKey =
19+ PK. NewPublicSSHKey
20+ { PK. newPublicSSHKeyKey = " test-key"
21+ , PK. newPublicSSHKeyTitle = " some-name-for-your-key"
22+ }
Original file line number Diff line number Diff line change 1+ {-# LANGUAGE OverloadedStrings #-}
2+ module Main (main ) where
3+
4+ import GitHub.Data.Id (Id (.. ))
5+ import qualified GitHub.Endpoints.Users.PublicSSHKeys as PK
6+ import qualified GitHub.Auth as Auth
7+
8+ main :: IO ()
9+ main = do
10+ let auth = Auth. OAuth " auth_token"
11+ ePublicSSHKey <- PK. deleteUserPublicSSHKey' auth (Id 18530161 )
12+ case ePublicSSHKey of
13+ (Left err) -> putStrLn $ " Error: " ++ (show err)
14+ (Right _) -> putStrLn $ " Deleted public SSH key!"
Original file line number Diff line number Diff line change 1+ {-# LANGUAGE OverloadedStrings #-}
2+ module Main (main ) where
3+
4+ import qualified GitHub.Data.PublicSSHKeys as PK
5+ import qualified GitHub.Endpoints.Users.PublicSSHKeys as PK
6+ import qualified GitHub.Auth as Auth
7+ import Data.List (intercalate )
8+ import Data.Vector (toList )
9+
10+ main :: IO ()
11+ main = do
12+ -- Fetch the SSH public keys of another user
13+ ePublicSSHKeys <- PK. publicSSHKeysFor' " github_name"
14+ case ePublicSSHKeys of
15+ (Left err) -> putStrLn $ " Error: " ++ (show err)
16+ (Right publicSSHKeys) -> putStrLn $ intercalate " \n " $ map show (toList publicSSHKeys)
17+
18+ -- Fetch my SSH public keys
19+ let auth = Auth. OAuth " auth_token"
20+ eMyPublicSSHKeys <- PK. publicSSHKeys' auth
21+ case eMyPublicSSHKeys of
22+ (Left err) -> putStrLn $ " Error: " ++ (show err)
23+ (Right publicSSHKeys) -> putStrLn $ intercalate " \n " $ map show (toList publicSSHKeys)
24+
Original file line number Diff line number Diff line change 1+ {-# LANGUAGE OverloadedStrings #-}
2+ module Main (main ) where
3+
4+ import GitHub.Data.Id (Id (.. ))
5+ import qualified GitHub.Data.PublicSSHKeys as PK
6+ import qualified GitHub.Endpoints.Users.PublicSSHKeys as PK
7+ import qualified GitHub.Auth as Auth
8+
9+ main :: IO ()
10+ main = do
11+ let auth = Auth. OAuth " auth_token"
12+ ePublicSSHKey <- PK. publicSSHKey' auth (Id 18528451 )
13+ case ePublicSSHKey of
14+ (Left err) -> putStrLn $ " Error: " ++ (show err)
15+ (Right publicSSHKey) -> putStrLn $ show publicSSHKey
Original file line number Diff line number Diff line change @@ -269,3 +269,56 @@ executable github-teaminfo-for
269269 , text
270270 , github-samples
271271 default-language : Haskell2010
272+
273+ executable github-create-public-ssh-key
274+ main-is : CreatePublicSSHKey.hs
275+ hs-source-dirs :
276+ Users/PublicSSHKeys
277+ ghc-options : -Wall
278+ build-depends :
279+ base
280+ , base-compat
281+ , github
282+ , text
283+ , github-samples
284+ default-language : Haskell2010
285+
286+ executable github-delete-public-ssh-key
287+ main-is : DeletePublicSSHKey.hs
288+ hs-source-dirs :
289+ Users/PublicSSHKeys
290+ ghc-options : -Wall
291+ build-depends :
292+ base
293+ , base-compat
294+ , github
295+ , text
296+ , github-samples
297+ default-language : Haskell2010
298+
299+ executable github-list-public-ssh-keys
300+ main-is : ListPublicSSHKeys.hs
301+ hs-source-dirs :
302+ Users/PublicSSHKeys
303+ ghc-options : -Wall
304+ build-depends :
305+ base
306+ , base-compat
307+ , github
308+ , text
309+ , github-samples
310+ , vector
311+ default-language : Haskell2010
312+
313+ executable github-get-public-ssh-key
314+ main-is : ShowPublicSSHKey.hs
315+ hs-source-dirs :
316+ Users/PublicSSHKeys
317+ ghc-options : -Wall
318+ build-depends :
319+ base
320+ , base-compat
321+ , github
322+ , text
323+ , github-samples
324+ default-language : Haskell2010
You can’t perform that action at this time.
0 commit comments