{-# LANGUAGE DeriveAnyClass #-}
module Hasura.RQL.Types.Webhook.Transform.Headers
( AddReplaceOrRemoveFields (..),
Headers (..),
HeadersTransformFn (..),
TransformCtx (..),
TransformFn (..),
)
where
import Autodocodec
import Autodocodec.Extended (caseInsensitiveHashMapCodec, caseInsensitiveTextCodec)
import Data.Aeson (FromJSON, ToJSON)
import Data.Aeson qualified as J
import Data.CaseInsensitive qualified as CI
import Data.HashMap.Strict qualified as HashMap
import Hasura.Prelude
import Hasura.RQL.Types.Webhook.Transform.Class (TransformCtx, TransformFn, UnescapedTemplate (..))
import Hasura.RQL.Types.Webhook.Transform.Request (RequestTransformCtx)
import Network.HTTP.Types qualified as HTTP.Types
newtype = [HTTP.Types.Header]
newtype
=
AddReplaceOrRemove AddReplaceOrRemoveFields
deriving stock (HeadersTransformFn -> HeadersTransformFn -> Bool
(HeadersTransformFn -> HeadersTransformFn -> Bool)
-> (HeadersTransformFn -> HeadersTransformFn -> Bool)
-> Eq HeadersTransformFn
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: HeadersTransformFn -> HeadersTransformFn -> Bool
== :: HeadersTransformFn -> HeadersTransformFn -> Bool
$c/= :: HeadersTransformFn -> HeadersTransformFn -> Bool
/= :: HeadersTransformFn -> HeadersTransformFn -> Bool
Eq, (forall x. HeadersTransformFn -> Rep HeadersTransformFn x)
-> (forall x. Rep HeadersTransformFn x -> HeadersTransformFn)
-> Generic HeadersTransformFn
forall x. Rep HeadersTransformFn x -> HeadersTransformFn
forall x. HeadersTransformFn -> Rep HeadersTransformFn x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. HeadersTransformFn -> Rep HeadersTransformFn x
from :: forall x. HeadersTransformFn -> Rep HeadersTransformFn x
$cto :: forall x. Rep HeadersTransformFn x -> HeadersTransformFn
to :: forall x. Rep HeadersTransformFn x -> HeadersTransformFn
Generic, Int -> HeadersTransformFn -> ShowS
[HeadersTransformFn] -> ShowS
HeadersTransformFn -> String
(Int -> HeadersTransformFn -> ShowS)
-> (HeadersTransformFn -> String)
-> ([HeadersTransformFn] -> ShowS)
-> Show HeadersTransformFn
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> HeadersTransformFn -> ShowS
showsPrec :: Int -> HeadersTransformFn -> ShowS
$cshow :: HeadersTransformFn -> String
show :: HeadersTransformFn -> String
$cshowList :: [HeadersTransformFn] -> ShowS
showList :: [HeadersTransformFn] -> ShowS
Show)
deriving newtype (HeadersTransformFn -> ()
(HeadersTransformFn -> ()) -> NFData HeadersTransformFn
forall a. (a -> ()) -> NFData a
$crnf :: HeadersTransformFn -> ()
rnf :: HeadersTransformFn -> ()
NFData, Value -> Parser [HeadersTransformFn]
Value -> Parser HeadersTransformFn
(Value -> Parser HeadersTransformFn)
-> (Value -> Parser [HeadersTransformFn])
-> FromJSON HeadersTransformFn
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
$cparseJSON :: Value -> Parser HeadersTransformFn
parseJSON :: Value -> Parser HeadersTransformFn
$cparseJSONList :: Value -> Parser [HeadersTransformFn]
parseJSONList :: Value -> Parser [HeadersTransformFn]
FromJSON, [HeadersTransformFn] -> Value
[HeadersTransformFn] -> Encoding
HeadersTransformFn -> Value
HeadersTransformFn -> Encoding
(HeadersTransformFn -> Value)
-> (HeadersTransformFn -> Encoding)
-> ([HeadersTransformFn] -> Value)
-> ([HeadersTransformFn] -> Encoding)
-> ToJSON HeadersTransformFn
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: HeadersTransformFn -> Value
toJSON :: HeadersTransformFn -> Value
$ctoEncoding :: HeadersTransformFn -> Encoding
toEncoding :: HeadersTransformFn -> Encoding
$ctoJSONList :: [HeadersTransformFn] -> Value
toJSONList :: [HeadersTransformFn] -> Value
$ctoEncodingList :: [HeadersTransformFn] -> Encoding
toEncodingList :: [HeadersTransformFn] -> Encoding
ToJSON)
instance HasCodec HeadersTransformFn where
codec :: JSONCodec HeadersTransformFn
codec = (AddReplaceOrRemoveFields -> HeadersTransformFn)
-> (HeadersTransformFn -> AddReplaceOrRemoveFields)
-> Codec Value AddReplaceOrRemoveFields AddReplaceOrRemoveFields
-> JSONCodec HeadersTransformFn
forall oldOutput newOutput newInput oldInput context.
(oldOutput -> newOutput)
-> (newInput -> oldInput)
-> Codec context oldInput oldOutput
-> Codec context newInput newOutput
dimapCodec AddReplaceOrRemoveFields -> HeadersTransformFn
AddReplaceOrRemove HeadersTransformFn -> AddReplaceOrRemoveFields
forall a b. Coercible a b => a -> b
coerce Codec Value AddReplaceOrRemoveFields AddReplaceOrRemoveFields
forall value. HasCodec value => JSONCodec value
codec
data AddReplaceOrRemoveFields = AddReplaceOrRemoveFields
{
:: [(CI.CI Text, UnescapedTemplate)],
:: [CI.CI Text]
}
deriving stock (Int -> AddReplaceOrRemoveFields -> ShowS
[AddReplaceOrRemoveFields] -> ShowS
AddReplaceOrRemoveFields -> String
(Int -> AddReplaceOrRemoveFields -> ShowS)
-> (AddReplaceOrRemoveFields -> String)
-> ([AddReplaceOrRemoveFields] -> ShowS)
-> Show AddReplaceOrRemoveFields
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> AddReplaceOrRemoveFields -> ShowS
showsPrec :: Int -> AddReplaceOrRemoveFields -> ShowS
$cshow :: AddReplaceOrRemoveFields -> String
show :: AddReplaceOrRemoveFields -> String
$cshowList :: [AddReplaceOrRemoveFields] -> ShowS
showList :: [AddReplaceOrRemoveFields] -> ShowS
Show, AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields -> Bool
(AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields -> Bool)
-> (AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields -> Bool)
-> Eq AddReplaceOrRemoveFields
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields -> Bool
== :: AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields -> Bool
$c/= :: AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields -> Bool
/= :: AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields -> Bool
Eq, Eq AddReplaceOrRemoveFields
Eq AddReplaceOrRemoveFields
-> (AddReplaceOrRemoveFields
-> AddReplaceOrRemoveFields -> Ordering)
-> (AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields -> Bool)
-> (AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields -> Bool)
-> (AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields -> Bool)
-> (AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields -> Bool)
-> (AddReplaceOrRemoveFields
-> AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields)
-> (AddReplaceOrRemoveFields
-> AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields)
-> Ord AddReplaceOrRemoveFields
AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields -> Bool
AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields -> Ordering
AddReplaceOrRemoveFields
-> AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields -> Ordering
compare :: AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields -> Ordering
$c< :: AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields -> Bool
< :: AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields -> Bool
$c<= :: AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields -> Bool
<= :: AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields -> Bool
$c> :: AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields -> Bool
> :: AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields -> Bool
$c>= :: AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields -> Bool
>= :: AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields -> Bool
$cmax :: AddReplaceOrRemoveFields
-> AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields
max :: AddReplaceOrRemoveFields
-> AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields
$cmin :: AddReplaceOrRemoveFields
-> AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields
min :: AddReplaceOrRemoveFields
-> AddReplaceOrRemoveFields -> AddReplaceOrRemoveFields
Ord, (forall x.
AddReplaceOrRemoveFields -> Rep AddReplaceOrRemoveFields x)
-> (forall x.
Rep AddReplaceOrRemoveFields x -> AddReplaceOrRemoveFields)
-> Generic AddReplaceOrRemoveFields
forall x.
Rep AddReplaceOrRemoveFields x -> AddReplaceOrRemoveFields
forall x.
AddReplaceOrRemoveFields -> Rep AddReplaceOrRemoveFields x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
AddReplaceOrRemoveFields -> Rep AddReplaceOrRemoveFields x
from :: forall x.
AddReplaceOrRemoveFields -> Rep AddReplaceOrRemoveFields x
$cto :: forall x.
Rep AddReplaceOrRemoveFields x -> AddReplaceOrRemoveFields
to :: forall x.
Rep AddReplaceOrRemoveFields x -> AddReplaceOrRemoveFields
Generic)
deriving anyclass (AddReplaceOrRemoveFields -> ()
(AddReplaceOrRemoveFields -> ()) -> NFData AddReplaceOrRemoveFields
forall a. (a -> ()) -> NFData a
$crnf :: AddReplaceOrRemoveFields -> ()
rnf :: AddReplaceOrRemoveFields -> ()
NFData)
instance HasCodec AddReplaceOrRemoveFields where
codec :: Codec Value AddReplaceOrRemoveFields AddReplaceOrRemoveFields
codec =
Text
-> ObjectCodec AddReplaceOrRemoveFields AddReplaceOrRemoveFields
-> Codec Value AddReplaceOrRemoveFields AddReplaceOrRemoveFields
forall input output.
Text -> ObjectCodec input output -> ValueCodec input output
object Text
"AddReplaceOrRemoveFields"
(ObjectCodec AddReplaceOrRemoveFields AddReplaceOrRemoveFields
-> Codec Value AddReplaceOrRemoveFields AddReplaceOrRemoveFields)
-> ObjectCodec AddReplaceOrRemoveFields AddReplaceOrRemoveFields
-> Codec Value AddReplaceOrRemoveFields AddReplaceOrRemoveFields
forall a b. (a -> b) -> a -> b
$ [(CI Text, UnescapedTemplate)]
-> [CI Text] -> AddReplaceOrRemoveFields
AddReplaceOrRemoveFields
([(CI Text, UnescapedTemplate)]
-> [CI Text] -> AddReplaceOrRemoveFields)
-> Codec
Object AddReplaceOrRemoveFields [(CI Text, UnescapedTemplate)]
-> Codec
Object
AddReplaceOrRemoveFields
([CI Text] -> AddReplaceOrRemoveFields)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Text
-> JSONCodec [(CI Text, UnescapedTemplate)]
-> [(CI Text, UnescapedTemplate)]
-> ObjectCodec
[(CI Text, UnescapedTemplate)] [(CI Text, UnescapedTemplate)]
forall output.
Text -> JSONCodec output -> output -> ObjectCodec output output
optionalFieldWithDefaultWith' Text
"add_headers" JSONCodec [(CI Text, UnescapedTemplate)]
addCodec [(CI Text, UnescapedTemplate)]
forall a. Monoid a => a
mempty
ObjectCodec
[(CI Text, UnescapedTemplate)] [(CI Text, UnescapedTemplate)]
-> (AddReplaceOrRemoveFields -> [(CI Text, UnescapedTemplate)])
-> Codec
Object AddReplaceOrRemoveFields [(CI Text, UnescapedTemplate)]
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= AddReplaceOrRemoveFields -> [(CI Text, UnescapedTemplate)]
addOrReplaceHeaders
Codec
Object
AddReplaceOrRemoveFields
([CI Text] -> AddReplaceOrRemoveFields)
-> Codec Object AddReplaceOrRemoveFields [CI Text]
-> ObjectCodec AddReplaceOrRemoveFields AddReplaceOrRemoveFields
forall a b.
Codec Object AddReplaceOrRemoveFields (a -> b)
-> Codec Object AddReplaceOrRemoveFields a
-> Codec Object AddReplaceOrRemoveFields b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> Text
-> JSONCodec [CI Text]
-> [CI Text]
-> ObjectCodec [CI Text] [CI Text]
forall output.
Text -> JSONCodec output -> output -> ObjectCodec output output
optionalFieldWithDefaultWith' Text
"remove_headers" JSONCodec [CI Text]
removeCodec [CI Text]
forall a. Monoid a => a
mempty
ObjectCodec [CI Text] [CI Text]
-> (AddReplaceOrRemoveFields -> [CI Text])
-> Codec Object AddReplaceOrRemoveFields [CI Text]
forall oldInput output newInput.
ObjectCodec oldInput output
-> (newInput -> oldInput) -> ObjectCodec newInput output
.= AddReplaceOrRemoveFields -> [CI Text]
removeHeaders
where
addCodec :: JSONCodec [(CI Text, UnescapedTemplate)]
addCodec = (HashMap (CI Text) UnescapedTemplate
-> [(CI Text, UnescapedTemplate)])
-> ([(CI Text, UnescapedTemplate)]
-> HashMap (CI Text) UnescapedTemplate)
-> Codec
Value
(HashMap (CI Text) UnescapedTemplate)
(HashMap (CI Text) UnescapedTemplate)
-> JSONCodec [(CI Text, UnescapedTemplate)]
forall oldOutput newOutput newInput oldInput context.
(oldOutput -> newOutput)
-> (newInput -> oldInput)
-> Codec context oldInput oldOutput
-> Codec context newInput newOutput
dimapCodec HashMap (CI Text) UnescapedTemplate
-> [(CI Text, UnescapedTemplate)]
forall k v. HashMap k v -> [(k, v)]
HashMap.toList [(CI Text, UnescapedTemplate)]
-> HashMap (CI Text) UnescapedTemplate
forall k v. (Eq k, Hashable k) => [(k, v)] -> HashMap k v
HashMap.fromList (Codec
Value
(HashMap (CI Text) UnescapedTemplate)
(HashMap (CI Text) UnescapedTemplate)
-> JSONCodec [(CI Text, UnescapedTemplate)])
-> Codec
Value
(HashMap (CI Text) UnescapedTemplate)
(HashMap (CI Text) UnescapedTemplate)
-> JSONCodec [(CI Text, UnescapedTemplate)]
forall a b. (a -> b) -> a -> b
$ JSONCodec UnescapedTemplate
-> Codec
Value
(HashMap (CI Text) UnescapedTemplate)
(HashMap (CI Text) UnescapedTemplate)
forall k a.
(FoldCase k, Hashable k, FromJSONKey k, ToJSONKey k) =>
JSONCodec a -> JSONCodec (HashMap (CI k) a)
caseInsensitiveHashMapCodec JSONCodec UnescapedTemplate
forall value. HasCodec value => JSONCodec value
codec
removeCodec :: JSONCodec [CI Text]
removeCodec = ValueCodec (CI Text) (CI Text) -> JSONCodec [CI Text]
forall input output.
ValueCodec input output -> ValueCodec [input] [output]
listCodec ValueCodec (CI Text) (CI Text)
forall a. (FoldCase a, HasCodec a) => JSONCodec (CI a)
caseInsensitiveTextCodec
instance FromJSON AddReplaceOrRemoveFields where
parseJSON :: Value -> Parser AddReplaceOrRemoveFields
parseJSON = String
-> (Object -> Parser AddReplaceOrRemoveFields)
-> Value
-> Parser AddReplaceOrRemoveFields
forall a. String -> (Object -> Parser a) -> Value -> Parser a
J.withObject String
"AddReplaceRemoveFields" ((Object -> Parser AddReplaceOrRemoveFields)
-> Value -> Parser AddReplaceOrRemoveFields)
-> (Object -> Parser AddReplaceOrRemoveFields)
-> Value
-> Parser AddReplaceOrRemoveFields
forall a b. (a -> b) -> a -> b
$ \Object
o -> do
HashMap Text UnescapedTemplate
addOrReplaceHeadersTxt <- Object
o Object -> Key -> Parser (Maybe (HashMap Text UnescapedTemplate))
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
J..:? Key
"add_headers" Parser (Maybe (HashMap Text UnescapedTemplate))
-> HashMap Text UnescapedTemplate
-> Parser (HashMap Text UnescapedTemplate)
forall a. Parser (Maybe a) -> a -> Parser a
J..!= HashMap Text UnescapedTemplate
forall a. Monoid a => a
mempty
let addOrReplaceHeaders :: [(CI Text, UnescapedTemplate)]
addOrReplaceHeaders = HashMap (CI Text) UnescapedTemplate
-> [(CI Text, UnescapedTemplate)]
forall k v. HashMap k v -> [(k, v)]
HashMap.toList (HashMap (CI Text) UnescapedTemplate
-> [(CI Text, UnescapedTemplate)])
-> HashMap (CI Text) UnescapedTemplate
-> [(CI Text, UnescapedTemplate)]
forall a b. (a -> b) -> a -> b
$ (Text -> CI Text)
-> HashMap Text UnescapedTemplate
-> HashMap (CI Text) UnescapedTemplate
forall k2 k1 v.
(Eq k2, Hashable k2) =>
(k1 -> k2) -> HashMap k1 v -> HashMap k2 v
mapKeys Text -> CI Text
forall s. FoldCase s => s -> CI s
CI.mk HashMap Text UnescapedTemplate
addOrReplaceHeadersTxt
[HeaderKey]
removeHeadersTxt <- Object
o Object -> Key -> Parser (Maybe [HeaderKey])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
J..:? Key
"remove_headers" Parser (Maybe [HeaderKey]) -> [HeaderKey] -> Parser [HeaderKey]
forall a. Parser (Maybe a) -> a -> Parser a
J..!= [HeaderKey]
forall a. Monoid a => a
mempty
let removeHeaders :: [CI Text]
removeHeaders = forall a b. Coercible a b => a -> b
forall a b. Coercible a b => a -> b
coerce @[HeaderKey] [HeaderKey]
removeHeadersTxt
AddReplaceOrRemoveFields -> Parser AddReplaceOrRemoveFields
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure AddReplaceOrRemoveFields {[(CI Text, UnescapedTemplate)]
addOrReplaceHeaders :: [(CI Text, UnescapedTemplate)]
addOrReplaceHeaders :: [(CI Text, UnescapedTemplate)]
addOrReplaceHeaders, [CI Text]
removeHeaders :: [CI Text]
removeHeaders :: [CI Text]
removeHeaders}
instance ToJSON AddReplaceOrRemoveFields where
toJSON :: AddReplaceOrRemoveFields -> Value
toJSON AddReplaceOrRemoveFields {[(CI Text, UnescapedTemplate)]
[CI Text]
addOrReplaceHeaders :: AddReplaceOrRemoveFields -> [(CI Text, UnescapedTemplate)]
removeHeaders :: AddReplaceOrRemoveFields -> [CI Text]
addOrReplaceHeaders :: [(CI Text, UnescapedTemplate)]
removeHeaders :: [CI Text]
..} =
[Pair] -> Value
J.object
[ Key
"add_headers" Key -> HashMap Text UnescapedTemplate -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
J..= [(Text, UnescapedTemplate)] -> HashMap Text UnescapedTemplate
forall k v. (Eq k, Hashable k) => [(k, v)] -> HashMap k v
HashMap.fromList (((CI Text, UnescapedTemplate) -> (Text, UnescapedTemplate))
-> [(CI Text, UnescapedTemplate)] -> [(Text, UnescapedTemplate)]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap ((CI Text -> Text)
-> (CI Text, UnescapedTemplate) -> (Text, UnescapedTemplate)
forall b c d. (b -> c) -> (b, d) -> (c, d)
forall (a :: * -> * -> *) b c d.
Arrow a =>
a b c -> a (b, d) (c, d)
first CI Text -> Text
forall s. CI s -> s
CI.original) [(CI Text, UnescapedTemplate)]
addOrReplaceHeaders),
Key
"remove_headers" Key -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
J..= (CI Text -> Text) -> [CI Text] -> [Text]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap CI Text -> Text
forall s. CI s -> s
CI.original [CI Text]
removeHeaders
]
newtype = { :: CI.CI Text}
deriving stock (Int -> HeaderKey -> ShowS
[HeaderKey] -> ShowS
HeaderKey -> String
(Int -> HeaderKey -> ShowS)
-> (HeaderKey -> String)
-> ([HeaderKey] -> ShowS)
-> Show HeaderKey
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> HeaderKey -> ShowS
showsPrec :: Int -> HeaderKey -> ShowS
$cshow :: HeaderKey -> String
show :: HeaderKey -> String
$cshowList :: [HeaderKey] -> ShowS
showList :: [HeaderKey] -> ShowS
Show, HeaderKey -> HeaderKey -> Bool
(HeaderKey -> HeaderKey -> Bool)
-> (HeaderKey -> HeaderKey -> Bool) -> Eq HeaderKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: HeaderKey -> HeaderKey -> Bool
== :: HeaderKey -> HeaderKey -> Bool
$c/= :: HeaderKey -> HeaderKey -> Bool
/= :: HeaderKey -> HeaderKey -> Bool
Eq, Eq HeaderKey
Eq HeaderKey
-> (HeaderKey -> HeaderKey -> Ordering)
-> (HeaderKey -> HeaderKey -> Bool)
-> (HeaderKey -> HeaderKey -> Bool)
-> (HeaderKey -> HeaderKey -> Bool)
-> (HeaderKey -> HeaderKey -> Bool)
-> (HeaderKey -> HeaderKey -> HeaderKey)
-> (HeaderKey -> HeaderKey -> HeaderKey)
-> Ord HeaderKey
HeaderKey -> HeaderKey -> Bool
HeaderKey -> HeaderKey -> Ordering
HeaderKey -> HeaderKey -> HeaderKey
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: HeaderKey -> HeaderKey -> Ordering
compare :: HeaderKey -> HeaderKey -> Ordering
$c< :: HeaderKey -> HeaderKey -> Bool
< :: HeaderKey -> HeaderKey -> Bool
$c<= :: HeaderKey -> HeaderKey -> Bool
<= :: HeaderKey -> HeaderKey -> Bool
$c> :: HeaderKey -> HeaderKey -> Bool
> :: HeaderKey -> HeaderKey -> Bool
$c>= :: HeaderKey -> HeaderKey -> Bool
>= :: HeaderKey -> HeaderKey -> Bool
$cmax :: HeaderKey -> HeaderKey -> HeaderKey
max :: HeaderKey -> HeaderKey -> HeaderKey
$cmin :: HeaderKey -> HeaderKey -> HeaderKey
min :: HeaderKey -> HeaderKey -> HeaderKey
Ord, (forall x. HeaderKey -> Rep HeaderKey x)
-> (forall x. Rep HeaderKey x -> HeaderKey) -> Generic HeaderKey
forall x. Rep HeaderKey x -> HeaderKey
forall x. HeaderKey -> Rep HeaderKey x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. HeaderKey -> Rep HeaderKey x
from :: forall x. HeaderKey -> Rep HeaderKey x
$cto :: forall x. Rep HeaderKey x -> HeaderKey
to :: forall x. Rep HeaderKey x -> HeaderKey
Generic)
deriving anyclass (HeaderKey -> ()
(HeaderKey -> ()) -> NFData HeaderKey
forall a. (a -> ()) -> NFData a
$crnf :: HeaderKey -> ()
rnf :: HeaderKey -> ()
NFData)
instance FromJSON HeaderKey where
parseJSON :: Value -> Parser HeaderKey
parseJSON = String -> (Text -> Parser HeaderKey) -> Value -> Parser HeaderKey
forall a. String -> (Text -> Parser a) -> Value -> Parser a
J.withText String
"HeaderKey" \Text
txt -> case Text -> CI Text
forall s. FoldCase s => s -> CI s
CI.mk Text
txt of
CI Text
key -> HeaderKey -> Parser HeaderKey
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (HeaderKey -> Parser HeaderKey) -> HeaderKey -> Parser HeaderKey
forall a b. (a -> b) -> a -> b
$ CI Text -> HeaderKey
HeaderKey CI Text
key
newtype instance TransformFn Headers = HeadersTransformFn
deriving stock (TransformFn Headers -> TransformFn Headers -> Bool
(TransformFn Headers -> TransformFn Headers -> Bool)
-> (TransformFn Headers -> TransformFn Headers -> Bool)
-> Eq (TransformFn Headers)
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TransformFn Headers -> TransformFn Headers -> Bool
== :: TransformFn Headers -> TransformFn Headers -> Bool
$c/= :: TransformFn Headers -> TransformFn Headers -> Bool
/= :: TransformFn Headers -> TransformFn Headers -> Bool
Eq, (forall x. TransformFn Headers -> Rep (TransformFn Headers) x)
-> (forall x. Rep (TransformFn Headers) x -> TransformFn Headers)
-> Generic (TransformFn Headers)
forall x. Rep (TransformFn Headers) x -> TransformFn Headers
forall x. TransformFn Headers -> Rep (TransformFn Headers) x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. TransformFn Headers -> Rep (TransformFn Headers) x
from :: forall x. TransformFn Headers -> Rep (TransformFn Headers) x
$cto :: forall x. Rep (TransformFn Headers) x -> TransformFn Headers
to :: forall x. Rep (TransformFn Headers) x -> TransformFn Headers
Generic, Int -> TransformFn Headers -> ShowS
[TransformFn Headers] -> ShowS
TransformFn Headers -> String
(Int -> TransformFn Headers -> ShowS)
-> (TransformFn Headers -> String)
-> ([TransformFn Headers] -> ShowS)
-> Show (TransformFn Headers)
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TransformFn Headers -> ShowS
showsPrec :: Int -> TransformFn Headers -> ShowS
$cshow :: TransformFn Headers -> String
show :: TransformFn Headers -> String
$cshowList :: [TransformFn Headers] -> ShowS
showList :: [TransformFn Headers] -> ShowS
Show)
deriving newtype (TransformFn Headers -> ()
(TransformFn Headers -> ()) -> NFData (TransformFn Headers)
forall a. (a -> ()) -> NFData a
$crnf :: TransformFn Headers -> ()
rnf :: TransformFn Headers -> ()
NFData, Value -> Parser [TransformFn Headers]
Value -> Parser (TransformFn Headers)
(Value -> Parser (TransformFn Headers))
-> (Value -> Parser [TransformFn Headers])
-> FromJSON (TransformFn Headers)
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
$cparseJSON :: Value -> Parser (TransformFn Headers)
parseJSON :: Value -> Parser (TransformFn Headers)
$cparseJSONList :: Value -> Parser [TransformFn Headers]
parseJSONList :: Value -> Parser [TransformFn Headers]
FromJSON, [TransformFn Headers] -> Value
[TransformFn Headers] -> Encoding
TransformFn Headers -> Value
TransformFn Headers -> Encoding
(TransformFn Headers -> Value)
-> (TransformFn Headers -> Encoding)
-> ([TransformFn Headers] -> Value)
-> ([TransformFn Headers] -> Encoding)
-> ToJSON (TransformFn Headers)
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: TransformFn Headers -> Value
toJSON :: TransformFn Headers -> Value
$ctoEncoding :: TransformFn Headers -> Encoding
toEncoding :: TransformFn Headers -> Encoding
$ctoJSONList :: [TransformFn Headers] -> Value
toJSONList :: [TransformFn Headers] -> Value
$ctoEncodingList :: [TransformFn Headers] -> Encoding
toEncodingList :: [TransformFn Headers] -> Encoding
ToJSON)
newtype instance TransformCtx Headers = TransformCtx RequestTransformCtx