Skip to content

Commit bf73c80

Browse files
Fix repo content endpoint result types.
1 parent 1cae1e2 commit bf73c80

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

src/GitHub/Data/Content.hs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,17 @@ data ContentInfo = ContentInfo {
5656
instance NFData ContentInfo where rnf = genericRnf
5757
instance Binary ContentInfo
5858

59+
data ContentResultInfo = ContentResultInfo
60+
{ contentResultInfo :: !ContentInfo
61+
, contentResultSize :: !Int
62+
} deriving (Show, Data, Typeable, Eq, Ord, Generic)
63+
64+
instance NFData ContentResultInfo where rnf = genericRnf
65+
instance Binary ContentResultInfo
66+
5967
data ContentResult = ContentResult
60-
{ contentResultInfo :: !ContentInfo
61-
, contentResultSize :: !Int
62-
, contentResultCommit :: !Commit
68+
{ contentResultContent :: !ContentResultInfo
69+
, contentResultCommit :: !GitCommit
6370
} deriving (Show, Data, Typeable, Eq, Ord, Generic)
6471

6572
instance NFData ContentResult where rnf = genericRnf
@@ -147,10 +154,14 @@ instance FromJSON ContentInfo where
147154
<*> o .: "git_url"
148155
<*> o .: "html_url"
149156

157+
instance FromJSON ContentResultInfo where
158+
parseJSON = withObject "ContentResultInfo" $ \o ->
159+
ContentResultInfo <$> parseJSON (Object o)
160+
<*> o .: "size"
161+
150162
instance FromJSON ContentResult where
151163
parseJSON = withObject "ContentResult" $ \o ->
152-
ContentResult <$> parseJSON (Object o)
153-
<*> o .: "size"
164+
ContentResult <$> o .: "content"
154165
<*> o .: "commit"
155166

156167
instance ToJSON Author where

0 commit comments

Comments
 (0)