forked from haskell-github/github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeployKeys.hs
More file actions
52 lines (46 loc) · 1.55 KB
/
DeployKeys.hs
File metadata and controls
52 lines (46 loc) · 1.55 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
-----------------------------------------------------------------------------
-- |
-- License : BSD-3-Clause
-- Maintainer : Todd Mohney <toddmohney@gmail.com>
--
module GitHub.Data.DeployKeys where
import GitHub.Data.Id (Id)
import GitHub.Data.URL (URL)
import GitHub.Internal.Prelude
import Prelude ()
data RepoDeployKey = RepoDeployKey
{ repoDeployKeyId :: !(Id RepoDeployKey)
, repoDeployKeyKey :: !Text
, repoDeployKeyUrl :: !URL
, repoDeployKeyTitle :: !Text
, repoDeployKeyVerified :: !Bool
, repoDeployKeyCreatedAt :: !UTCTime
, repoDeployKeyReadOnly :: !Bool
}
deriving (Show, Data, Typeable, Eq, Ord, Generic)
instance FromJSON RepoDeployKey where
parseJSON = withObject "RepoDeployKey" $ \o -> RepoDeployKey
<$> o .: "id"
<*> o .: "key"
<*> o .: "url"
<*> o .: "title"
<*> o .: "verified"
<*> o .: "created_at"
<*> o .: "read_only"
data NewRepoDeployKey = NewRepoDeployKey
{ newRepoDeployKeyKey :: !Text
, newRepoDeployKeyTitle :: !Text
, newRepoDeployKeyReadOnly :: !Bool
}
deriving (Show, Data, Typeable, Eq, Ord, Generic)
instance ToJSON NewRepoDeployKey where
toJSON (NewRepoDeployKey key title readOnly) = object
[ "key" .= key
, "title" .= title
, "read_only" .= readOnly
]
instance FromJSON NewRepoDeployKey where
parseJSON = withObject "RepoDeployKey" $ \o -> NewRepoDeployKey
<$> o .: "key"
<*> o .: "title"
<*> o .: "read_only"