File: Gists.hs

package info (click to toggle)
haskell-github 0.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 452 kB
  • sloc: haskell: 2,286; makefile: 2
file content (35 lines) | stat: -rw-r--r-- 976 bytes parent folder | download
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
31
32
33
34
35
-- | The gists API as described at <http://developer.github.com/v3/gists/>.
module Github.Gists (
 gists
,gists'
,gist
,gist'
,module Github.Data
) where

import Github.Data
import Github.Private

-- | The list of all gists created by the user 
-- 
-- > gists' (Just ("github-username", "github-password")) "mike-burns"
gists' :: Maybe BasicAuth -> String -> IO (Either Error [Gist])
gists' auth userName = githubGet' auth ["users", userName, "gists"]

-- | The list of all public gists created by the user.
--
-- > gists "mike-burns"
gists :: String -> IO (Either Error [Gist])
gists = gists' Nothing

-- | A specific gist, given its id, with authentication credentials
--
-- > gist' (Just ("github-username", "github-password")) "225074"
gist' :: Maybe BasicAuth -> String -> IO (Either Error Gist)
gist' auth gistId = githubGet' auth ["gists", gistId]

-- | A specific gist, given its id.
--
-- > gist "225074"
gist :: String -> IO (Either Error Gist)
gist = gist' Nothing