Skip to content

Commit

Permalink
feat: Support the latest github api updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
iphydf committed Nov 4, 2024
1 parent 63c31f9 commit d5723c5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/GitHub/Types/Base/CheckApp.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import GitHub.Types.Base.User
-- CheckApp

data CheckApp = CheckApp
{ checkAppCreatedAt :: Text
{ checkAppClientId :: Text
, checkAppCreatedAt :: Text
, checkAppDescription :: Text
, checkAppEvents :: [Text]
, checkAppExternalUrl :: Text
Expand All @@ -33,7 +34,8 @@ data CheckApp = CheckApp

instance FromJSON CheckApp where
parseJSON (Object x) = CheckApp
<$> x .: "created_at"
<$> x .: "client_id"
<*> x .: "created_at"
<*> x .: "description"
<*> x .: "events"
<*> x .: "external_url"
Expand All @@ -51,7 +53,8 @@ instance FromJSON CheckApp where

instance ToJSON CheckApp where
toJSON CheckApp{..} = object
[ "created_at" .= checkAppCreatedAt
[ "client_id" .= checkAppClientId
, "created_at" .= checkAppCreatedAt
, "description" .= checkAppDescription
, "events" .= checkAppEvents
, "external_url" .= checkAppExternalUrl
Expand Down Expand Up @@ -80,3 +83,4 @@ instance Arbitrary CheckApp where
<*> arbitrary
<*> arbitrary
<*> arbitrary
<*> arbitrary
4 changes: 4 additions & 0 deletions src/GitHub/Types/Base/Permissions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Test.QuickCheck.Arbitrary (Arbitrary (..))
data Permissions = Permissions
{ permissionsActions :: Maybe Text
, permissionsAdministration :: Maybe Text
, permissionsAttestations :: Maybe Text
, permissionsChecks :: Maybe Text
, permissionsContents :: Maybe Text
, permissionsContentReferences :: Maybe Text
Expand Down Expand Up @@ -45,6 +46,7 @@ instance FromJSON Permissions where
parseJSON (Object x) = Permissions
<$> x .:? "actions"
<*> x .:? "administration"
<*> x .:? "attestations"
<*> x .:? "checks"
<*> x .:? "contents"
<*> x .:? "content_references"
Expand Down Expand Up @@ -76,6 +78,7 @@ instance ToJSON Permissions where
toJSON Permissions{..} = object
[ "actions" .= permissionsActions
, "administration" .= permissionsAdministration
, "attestations" .= permissionsAttestations
, "checks" .= permissionsChecks
, "contents" .= permissionsContents
, "content_references" .= permissionsContentReferences
Expand Down Expand Up @@ -129,3 +132,4 @@ instance Arbitrary Permissions where
<*> arbitrary
<*> arbitrary
<*> arbitrary
<*> arbitrary
4 changes: 4 additions & 0 deletions src/GitHub/Types/Base/User.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ data User = User
, userStarredUrl :: Text
, userSubscriptionsUrl :: Text
, userType :: Text
, userUserViewType :: Text
, userUrl :: Text
} deriving (Eq, Show, Read)

Expand All @@ -57,6 +58,7 @@ instance FromJSON User where
<*> x .: "starred_url"
<*> x .: "subscriptions_url"
<*> x .: "type"
<*> x .: "user_view_type"
<*> x .: "url"

parseJSON _ = fail "User"
Expand All @@ -83,6 +85,7 @@ instance ToJSON User where
, "starred_url" .= userStarredUrl
, "subscriptions_url" .= userSubscriptionsUrl
, "type" .= userType
, "user_view_type" .= userUserViewType
, "url" .= userUrl
]

Expand All @@ -109,3 +112,4 @@ instance Arbitrary User where
<*> arbitrary
<*> arbitrary
<*> arbitrary
<*> arbitrary

0 comments on commit d5723c5

Please sign in to comment.