{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
module RecurlyClient.Types.ShippingMethodMini where
import qualified Control.Monad.Fail
import qualified Data.Aeson
import qualified Data.Aeson as Data.Aeson.Encoding.Internal
import qualified Data.Aeson as Data.Aeson.Types
import qualified Data.Aeson as Data.Aeson.Types.FromJSON
import qualified Data.Aeson as Data.Aeson.Types.Internal
import qualified Data.Aeson as Data.Aeson.Types.ToJSON
import qualified Data.ByteString
import qualified Data.ByteString as Data.ByteString.Internal
import qualified Data.Foldable
import qualified Data.Functor
import qualified Data.Maybe
import qualified Data.Scientific
import qualified Data.Text
import qualified Data.Text as Data.Text.Internal
import qualified Data.Time.Calendar as Data.Time.Calendar.Days
import qualified Data.Time.LocalTime as Data.Time.LocalTime.Internal.ZonedTime
import qualified GHC.Base
import qualified GHC.Classes
import qualified GHC.Int
import qualified GHC.Show
import qualified GHC.Types
import qualified RecurlyClient.Common
import RecurlyClient.TypeAlias
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe
data ShippingMethodMini = ShippingMethodMini
{ ShippingMethodMini -> Maybe Text
shippingMethodMiniCode :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
, ShippingMethodMini -> Maybe Text
shippingMethodMiniId :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
, ShippingMethodMini -> Maybe Text
shippingMethodMiniName :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
, ShippingMethodMini -> Maybe Text
shippingMethodMiniObject :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
}
deriving
( Int -> ShippingMethodMini -> ShowS
[ShippingMethodMini] -> ShowS
ShippingMethodMini -> String
(Int -> ShippingMethodMini -> ShowS)
-> (ShippingMethodMini -> String)
-> ([ShippingMethodMini] -> ShowS)
-> Show ShippingMethodMini
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ShippingMethodMini -> ShowS
showsPrec :: Int -> ShippingMethodMini -> ShowS
$cshow :: ShippingMethodMini -> String
show :: ShippingMethodMini -> String
$cshowList :: [ShippingMethodMini] -> ShowS
showList :: [ShippingMethodMini] -> ShowS
GHC.Show.Show
, ShippingMethodMini -> ShippingMethodMini -> Bool
(ShippingMethodMini -> ShippingMethodMini -> Bool)
-> (ShippingMethodMini -> ShippingMethodMini -> Bool)
-> Eq ShippingMethodMini
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ShippingMethodMini -> ShippingMethodMini -> Bool
== :: ShippingMethodMini -> ShippingMethodMini -> Bool
$c/= :: ShippingMethodMini -> ShippingMethodMini -> Bool
/= :: ShippingMethodMini -> ShippingMethodMini -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON ShippingMethodMini where
toJSON :: ShippingMethodMini -> Value
toJSON ShippingMethodMini
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object ([[Pair]] -> [Pair]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"code" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ShippingMethodMini -> Maybe Text
shippingMethodMiniCode ShippingMethodMini
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"id" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ShippingMethodMini -> Maybe Text
shippingMethodMiniId ShippingMethodMini
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"name" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ShippingMethodMini -> Maybe Text
shippingMethodMiniName ShippingMethodMini
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"object" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (ShippingMethodMini -> Maybe Text
shippingMethodMiniObject ShippingMethodMini
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [[Pair]]
forall a. Monoid a => a
GHC.Base.mempty))
toEncoding :: ShippingMethodMini -> Encoding
toEncoding ShippingMethodMini
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ([Series] -> Series
forall a. Monoid a => [a] -> a
GHC.Base.mconcat ([[Series]] -> [Series]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"code" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ShippingMethodMini -> Maybe Text
shippingMethodMiniCode ShippingMethodMini
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"id" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ShippingMethodMini -> Maybe Text
shippingMethodMiniId ShippingMethodMini
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"name" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ShippingMethodMini -> Maybe Text
shippingMethodMiniName ShippingMethodMini
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"object" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (ShippingMethodMini -> Maybe Text
shippingMethodMiniObject ShippingMethodMini
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [[Series]]
forall a. Monoid a => a
GHC.Base.mempty)))
instance Data.Aeson.Types.FromJSON.FromJSON ShippingMethodMini where
parseJSON :: Value -> Parser ShippingMethodMini
parseJSON = String
-> (Object -> Parser ShippingMethodMini)
-> Value
-> Parser ShippingMethodMini
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"ShippingMethodMini" (\Object
obj -> ((((Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> ShippingMethodMini)
-> Parser
(Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> ShippingMethodMini)
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> ShippingMethodMini
ShippingMethodMini Parser
(Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> ShippingMethodMini)
-> Parser (Maybe Text)
-> Parser
(Maybe Text -> Maybe Text -> Maybe Text -> ShippingMethodMini)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"code")) Parser
(Maybe Text -> Maybe Text -> Maybe Text -> ShippingMethodMini)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> ShippingMethodMini)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"id")) Parser (Maybe Text -> Maybe Text -> ShippingMethodMini)
-> Parser (Maybe Text) -> Parser (Maybe Text -> ShippingMethodMini)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"name")) Parser (Maybe Text -> ShippingMethodMini)
-> Parser (Maybe Text) -> Parser ShippingMethodMini
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"object"))
mkShippingMethodMini :: ShippingMethodMini
mkShippingMethodMini :: ShippingMethodMini
mkShippingMethodMini =
ShippingMethodMini
{ shippingMethodMiniCode :: Maybe Text
shippingMethodMiniCode = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
, shippingMethodMiniId :: Maybe Text
shippingMethodMiniId = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
, shippingMethodMiniName :: Maybe Text
shippingMethodMiniName = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
, shippingMethodMiniObject :: Maybe Text
shippingMethodMiniObject = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
}