File tree Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 1+ {-# LANGUAGE OverloadedStrings #-}
2+ module DeleteGist where
3+
4+ import qualified GitHub.Data.Name as N
5+ import qualified GitHub.Endpoints.Gists as GH
6+
7+ import qualified Data.Text as T
8+ import qualified Data.Text.IO as T
9+
10+ main :: IO ()
11+ main = do
12+ let gid = " your-gist-id"
13+ result <- GH. deleteGist (GH. OAuth " your-token" ) gid
14+ case result of
15+ Left err -> putStrLn $ " Error: " ++ show err
16+ Right () -> T. putStrLn $ T. concat [" Deleted: " , N. untagName gid]
Original file line number Diff line number Diff line change @@ -57,9 +57,9 @@ module GitHub (
5757 -- * Check if a gist is starred
5858 -- * Fork a gist
5959 -- * List gist forks
60- -- * Delete a gist
6160 gistsR ,
6261 gistR ,
62+ deleteGistR ,
6363
6464 -- ** Comments
6565 -- | See <https://developer.github.com/v3/gists/comments/>
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ module GitHub.Endpoints.Gists (
1111 gist ,
1212 gist' ,
1313 gistR ,
14+ deleteGist ,
15+ deleteGistR ,
1416 module GitHub.Data ,
1517 ) where
1618
@@ -55,3 +57,14 @@ gist = gist' Nothing
5557gistR :: Name Gist -> Request k Gist
5658gistR gid =
5759 query [" gists" , toPathPart gid] []
60+
61+ -- | Delete a gist by the authenticated user.
62+ --
63+ -- > deleteGist ("github-username", "github-password") "225074"
64+ deleteGist :: Auth -> Name Gist -> IO (Either Error () )
65+ deleteGist auth gid = executeRequest auth $ deleteGistR gid
66+
67+ -- | Delete a gist by the authenticated user.
68+ -- See <https://developer.github.com/v3/gists/#delete-a-gist>
69+ deleteGistR :: Name Gist -> Request 'RW ()
70+ deleteGistR gid = command Delete [" gists" , toPathPart gid] mempty
You can’t perform that action at this time.
0 commit comments