-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
612 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
{-# LANGUAGE RecordWildCards #-} | ||
module GitHub.Types.Base.CheckApp where | ||
|
||
import Control.Applicative ((<$>), (<*>)) | ||
import Data.Aeson (FromJSON (..), ToJSON (..), | ||
object) | ||
import Data.Aeson.Types (Value (..), (.:), (.=)) | ||
import Data.Text (Text) | ||
import Test.QuickCheck.Arbitrary (Arbitrary (..)) | ||
|
||
import GitHub.Types.Base.Permissions | ||
import GitHub.Types.Base.User | ||
|
||
------------------------------------------------------------------------------ | ||
-- CheckApp | ||
|
||
data CheckApp = CheckApp | ||
{ checkAppCreatedAt :: Text | ||
, checkAppDescription :: Text | ||
, checkAppEvents :: [Text] | ||
, checkAppExternalUrl :: Text | ||
, checkAppHtmlUrl :: Text | ||
, checkAppId :: Int | ||
, checkAppName :: Text | ||
, checkAppNodeId :: Text | ||
, checkAppOwner :: User | ||
, checkAppPermissions :: Permissions | ||
, checkAppSlug :: Text | ||
, checkAppUpdatedAt :: Text | ||
} deriving (Eq, Show, Read) | ||
|
||
|
||
instance FromJSON CheckApp where | ||
parseJSON (Object x) = CheckApp | ||
<$> x .: "created_at" | ||
<*> x .: "description" | ||
<*> x .: "events" | ||
<*> x .: "external_url" | ||
<*> x .: "html_url" | ||
<*> x .: "id" | ||
<*> x .: "name" | ||
<*> x .: "node_id" | ||
<*> x .: "owner" | ||
<*> x .: "permissions" | ||
<*> x .: "slug" | ||
<*> x .: "updated_at" | ||
|
||
parseJSON _ = fail "CheckApp" | ||
|
||
|
||
instance ToJSON CheckApp where | ||
toJSON CheckApp{..} = object | ||
[ "created_at" .= checkAppCreatedAt | ||
, "description" .= checkAppDescription | ||
, "events" .= checkAppEvents | ||
, "external_url" .= checkAppExternalUrl | ||
, "html_url" .= checkAppHtmlUrl | ||
, "id" .= checkAppId | ||
, "name" .= checkAppName | ||
, "node_id" .= checkAppNodeId | ||
, "owner" .= checkAppOwner | ||
, "permissions" .= checkAppPermissions | ||
, "slug" .= checkAppSlug | ||
, "updated_at" .= checkAppUpdatedAt | ||
] | ||
|
||
|
||
instance Arbitrary CheckApp where | ||
arbitrary = CheckApp | ||
<$> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
{-# LANGUAGE RecordWildCards #-} | ||
module GitHub.Types.Base.CheckCommit where | ||
|
||
import Control.Applicative ((<$>), (<*>)) | ||
import Data.Aeson (FromJSON (..), ToJSON (..), object) | ||
import Data.Aeson.Types (Value (..), (.:), (.=)) | ||
import Data.Text (Text) | ||
import Test.QuickCheck.Arbitrary (Arbitrary (..)) | ||
|
||
import GitHub.Types.Base.Author | ||
|
||
------------------------------------------------------------------------------ | ||
-- CheckCommit | ||
|
||
data CheckCommit = CheckCommit | ||
{ checkCommitAuthor :: Author | ||
, checkCommitCommitter :: Author | ||
, checkCommitId :: Text | ||
, checkCommitMessage :: Text | ||
, checkCommitTimestamp :: Text | ||
, checkCommitTreeId :: Text | ||
} deriving (Eq, Show, Read) | ||
|
||
|
||
instance FromJSON CheckCommit where | ||
parseJSON (Object x) = CheckCommit | ||
<$> x .: "author" | ||
<*> x .: "committer" | ||
<*> x .: "id" | ||
<*> x .: "message" | ||
<*> x .: "timestamp" | ||
<*> x .: "tree_id" | ||
|
||
parseJSON _ = fail "CheckCommit" | ||
|
||
|
||
instance ToJSON CheckCommit where | ||
toJSON CheckCommit{..} = object | ||
[ "author" .= checkCommitAuthor | ||
, "committer" .= checkCommitCommitter | ||
, "id" .= checkCommitId | ||
, "message" .= checkCommitMessage | ||
, "timestamp" .= checkCommitTimestamp | ||
, "tree_id" .= checkCommitTreeId | ||
] | ||
|
||
|
||
instance Arbitrary CheckCommit where | ||
arbitrary = CheckCommit | ||
<$> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
{-# LANGUAGE RecordWildCards #-} | ||
module GitHub.Types.Base.CheckOutput where | ||
|
||
import Control.Applicative ((<$>), (<*>)) | ||
import Data.Aeson (FromJSON (..), ToJSON (..), object) | ||
import Data.Aeson.Types (Value (..), (.:), (.=)) | ||
import Data.Text (Text) | ||
import Data.Text.Arbitrary () | ||
import Test.QuickCheck.Arbitrary (Arbitrary (..)) | ||
|
||
------------------------------------------------------------------------------ | ||
-- CheckOutput | ||
|
||
data CheckOutput = CheckOutput | ||
{ checkOutputAnnotationsCount :: Int | ||
, checkOutputAnnotationsUrl :: Text | ||
, checkOutputSummary :: Text | ||
, checkOutputText :: Maybe Text | ||
, checkOutputTitle :: Text | ||
} deriving (Eq, Show, Read) | ||
|
||
|
||
instance FromJSON CheckOutput where | ||
parseJSON (Object x) = CheckOutput | ||
<$> x .: "annotations_count" | ||
<*> x .: "annotations_url" | ||
<*> x .: "summary" | ||
<*> x .: "text" | ||
<*> x .: "title" | ||
|
||
parseJSON _ = fail "CheckOutput" | ||
|
||
|
||
instance ToJSON CheckOutput where | ||
toJSON CheckOutput{..} = object | ||
[ "annotations_count" .= checkOutputAnnotationsCount | ||
, "annotations_url" .= checkOutputAnnotationsUrl | ||
, "summary" .= checkOutputSummary | ||
, "text" .= checkOutputText | ||
, "title" .= checkOutputTitle | ||
] | ||
|
||
|
||
instance Arbitrary CheckOutput where | ||
arbitrary = CheckOutput | ||
<$> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
{-# LANGUAGE OverloadedStrings #-} | ||
{-# LANGUAGE RecordWildCards #-} | ||
module GitHub.Types.Base.CheckRun where | ||
|
||
import Control.Applicative ((<$>), (<*>)) | ||
import Data.Aeson (FromJSON (..), ToJSON (..), | ||
object) | ||
import Data.Aeson.Types (Value (..), (.:), (.=)) | ||
import Data.Text (Text) | ||
import Test.QuickCheck.Arbitrary (Arbitrary (..)) | ||
|
||
import GitHub.Types.Base.CheckApp | ||
import GitHub.Types.Base.CheckOutput | ||
import GitHub.Types.Base.CheckSuite | ||
|
||
------------------------------------------------------------------------------ | ||
-- CheckRun | ||
|
||
data CheckRun = CheckRun | ||
{ checkRunApp :: CheckApp | ||
, checkRunCheckSuite :: CheckSuite | ||
, checkRunCompletedAt :: Text | ||
, checkRunConclusion :: Text | ||
, checkRunDetailsUrl :: Text | ||
, checkRunExternalId :: Text | ||
, checkRunHeadSha :: Text | ||
, checkRunHtmlUrl :: Text | ||
, checkRunId :: Int | ||
, checkRunName :: Text | ||
, checkRunNodeId :: Text | ||
, checkRunOutput :: CheckOutput | ||
, checkRunStartedAt :: Text | ||
, checkRunStatus :: Text | ||
, checkRunUrl :: Text | ||
} deriving (Eq, Show, Read) | ||
|
||
|
||
instance FromJSON CheckRun where | ||
parseJSON (Object x) = CheckRun | ||
<$> x .: "app" | ||
<*> x .: "check_suite" | ||
<*> x .: "completed_at" | ||
<*> x .: "conclusion" | ||
<*> x .: "details_url" | ||
<*> x .: "external_id" | ||
<*> x .: "head_sha" | ||
<*> x .: "html_url" | ||
<*> x .: "id" | ||
<*> x .: "name" | ||
<*> x .: "node_id" | ||
<*> x .: "output" | ||
<*> x .: "started_at" | ||
<*> x .: "status" | ||
<*> x .: "url" | ||
|
||
parseJSON _ = fail "CheckRun" | ||
|
||
|
||
instance ToJSON CheckRun where | ||
toJSON CheckRun{..} = object | ||
[ "app" .= checkRunApp | ||
, "check_suite" .= checkRunCheckSuite | ||
, "completed_at" .= checkRunCompletedAt | ||
, "conclusion" .= checkRunConclusion | ||
, "details_url" .= checkRunDetailsUrl | ||
, "external_id" .= checkRunExternalId | ||
, "head_sha" .= checkRunHeadSha | ||
, "html_url" .= checkRunHtmlUrl | ||
, "id" .= checkRunId | ||
, "name" .= checkRunName | ||
, "node_id" .= checkRunNodeId | ||
, "output" .= checkRunOutput | ||
, "started_at" .= checkRunStartedAt | ||
, "status" .= checkRunStatus | ||
, "url" .= checkRunUrl | ||
] | ||
|
||
|
||
instance Arbitrary CheckRun where | ||
arbitrary = CheckRun | ||
<$> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary | ||
<*> arbitrary |
Oops, something went wrong.