From ffdc18c557e7f95e7f6b04674feb5bbe29e20246 Mon Sep 17 00:00:00 2001 From: Alistair Burrowes Date: Sun, 3 Oct 2021 08:43:42 +1100 Subject: [PATCH 1/2] Add marketplace purchase event --- src/Servant/GitHub/Webhook.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Servant/GitHub/Webhook.hs b/src/Servant/GitHub/Webhook.hs index d3c862a..4afd312 100644 --- a/src/Servant/GitHub/Webhook.hs +++ b/src/Servant/GitHub/Webhook.hs @@ -444,6 +444,9 @@ instance Reflect 'WebhookIssueCommentEvent where instance Reflect 'WebhookIssuesEvent where reflect _ = WebhookIssuesEvent +instance Reflect 'WebhookMarketplacePurchaseEvent where + reflect _ = WebhookMarketplacePurchaseEvent + instance Reflect 'WebhookMemberEvent where reflect _ = WebhookMemberEvent From f8cb8bc10d3e9d275fa995b0d01ba2d1eeaa700b Mon Sep 17 00:00:00 2001 From: Alistair Burrowes Date: Mon, 4 Apr 2022 18:31:50 +1000 Subject: [PATCH 2/2] Aeson 2.0 compatibility --- src/Servant/GitHub/Webhook.hs | 6 +++--- stack.yaml | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Servant/GitHub/Webhook.hs b/src/Servant/GitHub/Webhook.hs index 4afd312..3302712 100644 --- a/src/Servant/GitHub/Webhook.hs +++ b/src/Servant/GitHub/Webhook.hs @@ -92,13 +92,13 @@ import Crypto.Hash.Algorithms ( SHA1 ) import Crypto.MAC.HMAC ( hmac, HMAC(..) ) import Data.Aeson ( decode', encode, Value(String, Object) ) import qualified Data.Aeson as Aeson +import qualified Data.Aeson.KeyMap as KeyMap import qualified Data.Aeson.Types as AesonType import Data.ByteArray ( convert, constEq ) import qualified Data.Text as T import qualified Data.ByteString as BS import Data.ByteString.Lazy ( fromStrict, toStrict ) import qualified Data.ByteString.Base16 as B16 -import qualified Data.HashMap.Strict as HashMap import Data.List ( intercalate ) import Data.Maybe ( catMaybes, fromMaybe ) import Data.Monoid ( (<>) ) @@ -225,8 +225,8 @@ instance HasRepository Value where instance HasRepository AesonType.Object where getFullName o = - do Object r <- HashMap.lookup "repository" o - String n <- HashMap.lookup "full_name" r + do Object r <- KeyMap.lookup "repository" o + String n <- KeyMap.lookup "full_name" r pure n -- |For use with 'github-webhooks' package types. Routes would look like: diff --git a/stack.yaml b/stack.yaml index 939efea..fea3547 100644 --- a/stack.yaml +++ b/stack.yaml @@ -1,6 +1,4 @@ -resolver: lts-14.1 +resolver: lts-19.2 extra-deps: - - github-0.22 - - binary-instances-1 - - github-webhooks-0.12.0 + - github-webhooks-0.16.0