Repository navigation
Expand file tree
/
Copy pathUsers.hs
More file actions
56 lines (49 loc) · 1.81 KB
/
Copy pathUsers.hs
File metadata and controls
56 lines (49 loc) · 1.81 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
-----------------------------------------------------------------------------
-- |
-- License : BSD-3-Clause
-- Maintainer : Oleg Grenrus <oleg.grenrus@iki.fi>
--
-- The Github Users API, as described at
-- <http://developer.github.com/v3/users/>.
module GitHub.Endpoints.Users (
userInfoFor,
userInfoFor',
userInfoForR,
ownerInfoForR,
userInfoCurrent',
userInfoCurrentR,
module GitHub.Data,
) where
import GitHub.Data
import GitHub.Internal.Prelude
import GitHub.Request
import Prelude ()
-- | The information for a single user, by login name.
-- With authentification
--
-- > userInfoFor' (Just $ BasicAuth "github-username" "github-password") "mike-burns"
userInfoFor' :: Maybe Auth -> Name User -> IO (Either Error User)
userInfoFor' auth = executeRequestMaybe auth . userInfoForR
-- | The information for a single user, by login name.
--
-- > userInfoFor "mike-burns"
userInfoFor :: Name User -> IO (Either Error User)
userInfoFor = executeRequest' . userInfoForR
-- | Query a single user.
-- See <https://developer.github.com/v3/users/#get-a-single-user>
userInfoForR :: Name User -> Request k User
userInfoForR user = query ["users", toPathPart user] []
-- | Query a single user or an organization.
-- See <https://developer.github.com/v3/users/#get-a-single-user>
ownerInfoForR :: Name Owner -> Request k Owner
ownerInfoForR owner = query ["users", toPathPart owner] []
-- | Retrieve information about the user associated with the supplied authentication.
--
-- > userInfoCurrent' (OAuth "...")
userInfoCurrent' :: Auth -> IO (Either Error User)
userInfoCurrent' auth =
executeRequest auth $ userInfoCurrentR
-- | Query the authenticated user.
-- See <https://developer.github.com/v3/users/#get-the-authenticated-user>
userInfoCurrentR :: Request 'RA User
userInfoCurrentR = query ["user"] []