{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.Pinpoint.Types.MessageResult where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types.DeliveryStatus
import qualified Amazonka.Prelude as Prelude
data MessageResult = MessageResult'
{
MessageResult -> Maybe Text
statusMessage :: Prelude.Maybe Prelude.Text,
MessageResult -> Maybe Text
updatedToken :: Prelude.Maybe Prelude.Text,
MessageResult -> Maybe Text
messageId :: Prelude.Maybe Prelude.Text,
MessageResult -> DeliveryStatus
deliveryStatus :: DeliveryStatus,
MessageResult -> Int
statusCode :: Prelude.Int
}
deriving (MessageResult -> MessageResult -> Bool
(MessageResult -> MessageResult -> Bool)
-> (MessageResult -> MessageResult -> Bool) -> Eq MessageResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MessageResult -> MessageResult -> Bool
$c/= :: MessageResult -> MessageResult -> Bool
== :: MessageResult -> MessageResult -> Bool
$c== :: MessageResult -> MessageResult -> Bool
Prelude.Eq, ReadPrec [MessageResult]
ReadPrec MessageResult
Int -> ReadS MessageResult
ReadS [MessageResult]
(Int -> ReadS MessageResult)
-> ReadS [MessageResult]
-> ReadPrec MessageResult
-> ReadPrec [MessageResult]
-> Read MessageResult
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MessageResult]
$creadListPrec :: ReadPrec [MessageResult]
readPrec :: ReadPrec MessageResult
$creadPrec :: ReadPrec MessageResult
readList :: ReadS [MessageResult]
$creadList :: ReadS [MessageResult]
readsPrec :: Int -> ReadS MessageResult
$creadsPrec :: Int -> ReadS MessageResult
Prelude.Read, Int -> MessageResult -> ShowS
[MessageResult] -> ShowS
MessageResult -> String
(Int -> MessageResult -> ShowS)
-> (MessageResult -> String)
-> ([MessageResult] -> ShowS)
-> Show MessageResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MessageResult] -> ShowS
$cshowList :: [MessageResult] -> ShowS
show :: MessageResult -> String
$cshow :: MessageResult -> String
showsPrec :: Int -> MessageResult -> ShowS
$cshowsPrec :: Int -> MessageResult -> ShowS
Prelude.Show, (forall x. MessageResult -> Rep MessageResult x)
-> (forall x. Rep MessageResult x -> MessageResult)
-> Generic MessageResult
forall x. Rep MessageResult x -> MessageResult
forall x. MessageResult -> Rep MessageResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MessageResult x -> MessageResult
$cfrom :: forall x. MessageResult -> Rep MessageResult x
Prelude.Generic)
newMessageResult ::
DeliveryStatus ->
Prelude.Int ->
MessageResult
newMessageResult :: DeliveryStatus -> Int -> MessageResult
newMessageResult DeliveryStatus
pDeliveryStatus_ Int
pStatusCode_ =
MessageResult' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> DeliveryStatus
-> Int
-> MessageResult
MessageResult'
{ $sel:statusMessage:MessageResult' :: Maybe Text
statusMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:updatedToken:MessageResult' :: Maybe Text
updatedToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:messageId:MessageResult' :: Maybe Text
messageId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:deliveryStatus:MessageResult' :: DeliveryStatus
deliveryStatus = DeliveryStatus
pDeliveryStatus_,
$sel:statusCode:MessageResult' :: Int
statusCode = Int
pStatusCode_
}
messageResult_statusMessage :: Lens.Lens' MessageResult (Prelude.Maybe Prelude.Text)
messageResult_statusMessage :: (Maybe Text -> f (Maybe Text)) -> MessageResult -> f MessageResult
messageResult_statusMessage = (MessageResult -> Maybe Text)
-> (MessageResult -> Maybe Text -> MessageResult)
-> Lens MessageResult MessageResult (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MessageResult' {Maybe Text
statusMessage :: Maybe Text
$sel:statusMessage:MessageResult' :: MessageResult -> Maybe Text
statusMessage} -> Maybe Text
statusMessage) (\s :: MessageResult
s@MessageResult' {} Maybe Text
a -> MessageResult
s {$sel:statusMessage:MessageResult' :: Maybe Text
statusMessage = Maybe Text
a} :: MessageResult)
messageResult_updatedToken :: Lens.Lens' MessageResult (Prelude.Maybe Prelude.Text)
messageResult_updatedToken :: (Maybe Text -> f (Maybe Text)) -> MessageResult -> f MessageResult
messageResult_updatedToken = (MessageResult -> Maybe Text)
-> (MessageResult -> Maybe Text -> MessageResult)
-> Lens MessageResult MessageResult (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MessageResult' {Maybe Text
updatedToken :: Maybe Text
$sel:updatedToken:MessageResult' :: MessageResult -> Maybe Text
updatedToken} -> Maybe Text
updatedToken) (\s :: MessageResult
s@MessageResult' {} Maybe Text
a -> MessageResult
s {$sel:updatedToken:MessageResult' :: Maybe Text
updatedToken = Maybe Text
a} :: MessageResult)
messageResult_messageId :: Lens.Lens' MessageResult (Prelude.Maybe Prelude.Text)
messageResult_messageId :: (Maybe Text -> f (Maybe Text)) -> MessageResult -> f MessageResult
messageResult_messageId = (MessageResult -> Maybe Text)
-> (MessageResult -> Maybe Text -> MessageResult)
-> Lens MessageResult MessageResult (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MessageResult' {Maybe Text
messageId :: Maybe Text
$sel:messageId:MessageResult' :: MessageResult -> Maybe Text
messageId} -> Maybe Text
messageId) (\s :: MessageResult
s@MessageResult' {} Maybe Text
a -> MessageResult
s {$sel:messageId:MessageResult' :: Maybe Text
messageId = Maybe Text
a} :: MessageResult)
messageResult_deliveryStatus :: Lens.Lens' MessageResult DeliveryStatus
messageResult_deliveryStatus :: (DeliveryStatus -> f DeliveryStatus)
-> MessageResult -> f MessageResult
messageResult_deliveryStatus = (MessageResult -> DeliveryStatus)
-> (MessageResult -> DeliveryStatus -> MessageResult)
-> Lens MessageResult MessageResult DeliveryStatus DeliveryStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MessageResult' {DeliveryStatus
deliveryStatus :: DeliveryStatus
$sel:deliveryStatus:MessageResult' :: MessageResult -> DeliveryStatus
deliveryStatus} -> DeliveryStatus
deliveryStatus) (\s :: MessageResult
s@MessageResult' {} DeliveryStatus
a -> MessageResult
s {$sel:deliveryStatus:MessageResult' :: DeliveryStatus
deliveryStatus = DeliveryStatus
a} :: MessageResult)
messageResult_statusCode :: Lens.Lens' MessageResult Prelude.Int
messageResult_statusCode :: (Int -> f Int) -> MessageResult -> f MessageResult
messageResult_statusCode = (MessageResult -> Int)
-> (MessageResult -> Int -> MessageResult)
-> Lens MessageResult MessageResult Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MessageResult' {Int
statusCode :: Int
$sel:statusCode:MessageResult' :: MessageResult -> Int
statusCode} -> Int
statusCode) (\s :: MessageResult
s@MessageResult' {} Int
a -> MessageResult
s {$sel:statusCode:MessageResult' :: Int
statusCode = Int
a} :: MessageResult)
instance Core.FromJSON MessageResult where
parseJSON :: Value -> Parser MessageResult
parseJSON =
String
-> (Object -> Parser MessageResult)
-> Value
-> Parser MessageResult
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"MessageResult"
( \Object
x ->
Maybe Text
-> Maybe Text
-> Maybe Text
-> DeliveryStatus
-> Int
-> MessageResult
MessageResult'
(Maybe Text
-> Maybe Text
-> Maybe Text
-> DeliveryStatus
-> Int
-> MessageResult)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text -> DeliveryStatus -> Int -> MessageResult)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"StatusMessage")
Parser
(Maybe Text
-> Maybe Text -> DeliveryStatus -> Int -> MessageResult)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> DeliveryStatus -> Int -> MessageResult)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"UpdatedToken")
Parser (Maybe Text -> DeliveryStatus -> Int -> MessageResult)
-> Parser (Maybe Text)
-> Parser (DeliveryStatus -> Int -> MessageResult)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"MessageId")
Parser (DeliveryStatus -> Int -> MessageResult)
-> Parser DeliveryStatus -> Parser (Int -> MessageResult)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser DeliveryStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"DeliveryStatus")
Parser (Int -> MessageResult) -> Parser Int -> Parser MessageResult
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Int
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"StatusCode")
)
instance Prelude.Hashable MessageResult
instance Prelude.NFData MessageResult