{-# LANGUAGE ExplicitForAll #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
module StripeAPI.Operations.PostPlansPlan where
import qualified Control.Monad.Fail
import qualified Control.Monad.Trans.Reader
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.Char8
import qualified Data.ByteString.Char8 as Data.ByteString.Internal
import qualified Data.Either
import qualified Data.Functor
import qualified Data.Scientific
import qualified Data.Text
import qualified 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 Data.Vector
import qualified GHC.Base
import qualified GHC.Classes
import qualified GHC.Int
import qualified GHC.Show
import qualified GHC.Types
import qualified Network.HTTP.Client
import qualified Network.HTTP.Client as Network.HTTP.Client.Request
import qualified Network.HTTP.Client as Network.HTTP.Client.Types
import qualified Network.HTTP.Simple
import qualified Network.HTTP.Types
import qualified Network.HTTP.Types as Network.HTTP.Types.Status
import qualified Network.HTTP.Types as Network.HTTP.Types.URI
import qualified StripeAPI.Common
import StripeAPI.Types
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe
postPlansPlan ::
forall m.
StripeAPI.Common.MonadHTTP m =>
Data.Text.Internal.Text ->
GHC.Maybe.Maybe PostPlansPlanRequestBody ->
StripeAPI.Common.ClientT m (Network.HTTP.Client.Types.Response PostPlansPlanResponse)
postPlansPlan :: Text
-> Maybe PostPlansPlanRequestBody
-> ClientT m (Response PostPlansPlanResponse)
postPlansPlan
Text
plan
Maybe PostPlansPlanRequestBody
body =
(Response ByteString -> Response PostPlansPlanResponse)
-> ClientT m (Response ByteString)
-> ClientT m (Response PostPlansPlanResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
( \Response ByteString
response_0 ->
(ByteString -> PostPlansPlanResponse)
-> Response ByteString -> Response PostPlansPlanResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
GHC.Base.fmap
( (String -> PostPlansPlanResponse)
-> (PostPlansPlanResponse -> PostPlansPlanResponse)
-> Either String PostPlansPlanResponse
-> PostPlansPlanResponse
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
Data.Either.either String -> PostPlansPlanResponse
PostPlansPlanResponseError PostPlansPlanResponse -> PostPlansPlanResponse
forall a. a -> a
GHC.Base.id
(Either String PostPlansPlanResponse -> PostPlansPlanResponse)
-> (ByteString -> Either String PostPlansPlanResponse)
-> ByteString
-> PostPlansPlanResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. ( \Response ByteString
response ByteString
body ->
if
| (\Status
status_1 -> Status -> Int
Network.HTTP.Types.Status.statusCode Status
status_1 Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Int
200) (Response ByteString -> Status
forall body. Response body -> Status
Network.HTTP.Client.Types.responseStatus Response ByteString
response) ->
Plan -> PostPlansPlanResponse
PostPlansPlanResponse200
(Plan -> PostPlansPlanResponse)
-> Either String Plan -> Either String PostPlansPlanResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String Plan
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
Data.Either.Either
GHC.Base.String
Plan
)
| Bool -> Status -> Bool
forall a b. a -> b -> a
GHC.Base.const Bool
GHC.Types.True (Response ByteString -> Status
forall body. Response body -> Status
Network.HTTP.Client.Types.responseStatus Response ByteString
response) ->
Error -> PostPlansPlanResponse
PostPlansPlanResponseDefault
(Error -> PostPlansPlanResponse)
-> Either String Error -> Either String PostPlansPlanResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> ( ByteString -> Either String Error
forall a. FromJSON a => ByteString -> Either String a
Data.Aeson.eitherDecodeStrict ByteString
body ::
Data.Either.Either
GHC.Base.String
Error
)
| Bool
GHC.Base.otherwise -> String -> Either String PostPlansPlanResponse
forall a b. a -> Either a b
Data.Either.Left String
"Missing default response type"
)
Response ByteString
response_0
)
Response ByteString
response_0
)
(Text
-> Text
-> [QueryParameter]
-> Maybe PostPlansPlanRequestBody
-> RequestBodyEncoding
-> ClientT m (Response ByteString)
forall (m :: * -> *) body.
(MonadHTTP m, ToJSON body) =>
Text
-> Text
-> [QueryParameter]
-> Maybe body
-> RequestBodyEncoding
-> ClientT m (Response ByteString)
StripeAPI.Common.doBodyCallWithConfigurationM (Text -> Text
Data.Text.toUpper (Text -> Text) -> Text -> Text
forall a b. (a -> b) -> a -> b
GHC.Base.$ String -> Text
Data.Text.pack String
"POST") (String -> Text
Data.Text.pack (String
"/v1/plans/" String -> String -> String
forall a. [a] -> [a] -> [a]
GHC.Base.++ (ByteString -> String
Data.ByteString.Char8.unpack (Bool -> ByteString -> ByteString
Network.HTTP.Types.URI.urlEncode Bool
GHC.Types.True (ByteString -> ByteString) -> ByteString -> ByteString
forall a b. (a -> b) -> a -> b
GHC.Base.$ (String -> ByteString
Data.ByteString.Char8.pack (String -> ByteString) -> String -> ByteString
forall a b. (a -> b) -> a -> b
GHC.Base.$ Text -> String
forall a. StringifyModel a => a -> String
StripeAPI.Common.stringifyModel Text
plan)) String -> String -> String
forall a. [a] -> [a] -> [a]
GHC.Base.++ String
""))) [QueryParameter]
forall a. Monoid a => a
GHC.Base.mempty Maybe PostPlansPlanRequestBody
body RequestBodyEncoding
StripeAPI.Common.RequestBodyEncodingFormData)
data PostPlansPlanRequestBody = PostPlansPlanRequestBody
{
PostPlansPlanRequestBody -> Maybe Bool
postPlansPlanRequestBodyActive :: (GHC.Maybe.Maybe GHC.Types.Bool),
PostPlansPlanRequestBody -> Maybe [Text]
postPlansPlanRequestBodyExpand :: (GHC.Maybe.Maybe ([Data.Text.Internal.Text])),
PostPlansPlanRequestBody
-> Maybe PostPlansPlanRequestBodyMetadata'Variants
postPlansPlanRequestBodyMetadata :: (GHC.Maybe.Maybe PostPlansPlanRequestBodyMetadata'Variants),
PostPlansPlanRequestBody -> Maybe Text
postPlansPlanRequestBodyNickname :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
PostPlansPlanRequestBody -> Maybe Text
postPlansPlanRequestBodyProduct :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
PostPlansPlanRequestBody -> Maybe Int
postPlansPlanRequestBodyTrialPeriodDays :: (GHC.Maybe.Maybe GHC.Types.Int)
}
deriving
( Int -> PostPlansPlanRequestBody -> String -> String
[PostPlansPlanRequestBody] -> String -> String
PostPlansPlanRequestBody -> String
(Int -> PostPlansPlanRequestBody -> String -> String)
-> (PostPlansPlanRequestBody -> String)
-> ([PostPlansPlanRequestBody] -> String -> String)
-> Show PostPlansPlanRequestBody
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [PostPlansPlanRequestBody] -> String -> String
$cshowList :: [PostPlansPlanRequestBody] -> String -> String
show :: PostPlansPlanRequestBody -> String
$cshow :: PostPlansPlanRequestBody -> String
showsPrec :: Int -> PostPlansPlanRequestBody -> String -> String
$cshowsPrec :: Int -> PostPlansPlanRequestBody -> String -> String
GHC.Show.Show,
PostPlansPlanRequestBody -> PostPlansPlanRequestBody -> Bool
(PostPlansPlanRequestBody -> PostPlansPlanRequestBody -> Bool)
-> (PostPlansPlanRequestBody -> PostPlansPlanRequestBody -> Bool)
-> Eq PostPlansPlanRequestBody
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostPlansPlanRequestBody -> PostPlansPlanRequestBody -> Bool
$c/= :: PostPlansPlanRequestBody -> PostPlansPlanRequestBody -> Bool
== :: PostPlansPlanRequestBody -> PostPlansPlanRequestBody -> Bool
$c== :: PostPlansPlanRequestBody -> PostPlansPlanRequestBody -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON PostPlansPlanRequestBody where
toJSON :: PostPlansPlanRequestBody -> Value
toJSON PostPlansPlanRequestBody
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"active" Text -> Maybe Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostPlansPlanRequestBody -> Maybe Bool
postPlansPlanRequestBodyActive PostPlansPlanRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"expand" Text -> Maybe [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostPlansPlanRequestBody -> Maybe [Text]
postPlansPlanRequestBodyExpand PostPlansPlanRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"metadata" Text -> Maybe PostPlansPlanRequestBodyMetadata'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostPlansPlanRequestBody
-> Maybe PostPlansPlanRequestBodyMetadata'Variants
postPlansPlanRequestBodyMetadata PostPlansPlanRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"nickname" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostPlansPlanRequestBody -> Maybe Text
postPlansPlanRequestBodyNickname PostPlansPlanRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"product" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostPlansPlanRequestBody -> Maybe Text
postPlansPlanRequestBodyProduct PostPlansPlanRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"trial_period_days" Text -> Maybe Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostPlansPlanRequestBody -> Maybe Int
postPlansPlanRequestBodyTrialPeriodDays PostPlansPlanRequestBody
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
toEncoding :: PostPlansPlanRequestBody -> Encoding
toEncoding PostPlansPlanRequestBody
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"active" Text -> Maybe Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostPlansPlanRequestBody -> Maybe Bool
postPlansPlanRequestBodyActive PostPlansPlanRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"expand" Text -> Maybe [Text] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostPlansPlanRequestBody -> Maybe [Text]
postPlansPlanRequestBodyExpand PostPlansPlanRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"metadata" Text -> Maybe PostPlansPlanRequestBodyMetadata'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostPlansPlanRequestBody
-> Maybe PostPlansPlanRequestBodyMetadata'Variants
postPlansPlanRequestBodyMetadata PostPlansPlanRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"nickname" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostPlansPlanRequestBody -> Maybe Text
postPlansPlanRequestBodyNickname PostPlansPlanRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"product" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostPlansPlanRequestBody -> Maybe Text
postPlansPlanRequestBodyProduct PostPlansPlanRequestBody
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"trial_period_days" Text -> Maybe Int -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= PostPlansPlanRequestBody -> Maybe Int
postPlansPlanRequestBodyTrialPeriodDays PostPlansPlanRequestBody
obj))))))
instance Data.Aeson.Types.FromJSON.FromJSON PostPlansPlanRequestBody where
parseJSON :: Value -> Parser PostPlansPlanRequestBody
parseJSON = String
-> (Object -> Parser PostPlansPlanRequestBody)
-> Value
-> Parser PostPlansPlanRequestBody
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"PostPlansPlanRequestBody" (\Object
obj -> ((((((Maybe Bool
-> Maybe [Text]
-> Maybe PostPlansPlanRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> PostPlansPlanRequestBody)
-> Parser
(Maybe Bool
-> Maybe [Text]
-> Maybe PostPlansPlanRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> PostPlansPlanRequestBody)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Bool
-> Maybe [Text]
-> Maybe PostPlansPlanRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> PostPlansPlanRequestBody
PostPlansPlanRequestBody Parser
(Maybe Bool
-> Maybe [Text]
-> Maybe PostPlansPlanRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> PostPlansPlanRequestBody)
-> Parser (Maybe Bool)
-> Parser
(Maybe [Text]
-> Maybe PostPlansPlanRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> PostPlansPlanRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"active")) Parser
(Maybe [Text]
-> Maybe PostPlansPlanRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> PostPlansPlanRequestBody)
-> Parser (Maybe [Text])
-> Parser
(Maybe PostPlansPlanRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> PostPlansPlanRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe [Text])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"expand")) Parser
(Maybe PostPlansPlanRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> PostPlansPlanRequestBody)
-> Parser (Maybe PostPlansPlanRequestBodyMetadata'Variants)
-> Parser
(Maybe Text -> Maybe Text -> Maybe Int -> PostPlansPlanRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object
-> Text -> Parser (Maybe PostPlansPlanRequestBodyMetadata'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"metadata")) Parser
(Maybe Text -> Maybe Text -> Maybe Int -> PostPlansPlanRequestBody)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Int -> PostPlansPlanRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"nickname")) Parser (Maybe Text -> Maybe Int -> PostPlansPlanRequestBody)
-> Parser (Maybe Text)
-> Parser (Maybe Int -> PostPlansPlanRequestBody)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"product")) Parser (Maybe Int -> PostPlansPlanRequestBody)
-> Parser (Maybe Int) -> Parser PostPlansPlanRequestBody
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"trial_period_days"))
mkPostPlansPlanRequestBody :: PostPlansPlanRequestBody
mkPostPlansPlanRequestBody :: PostPlansPlanRequestBody
mkPostPlansPlanRequestBody =
PostPlansPlanRequestBody :: Maybe Bool
-> Maybe [Text]
-> Maybe PostPlansPlanRequestBodyMetadata'Variants
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> PostPlansPlanRequestBody
PostPlansPlanRequestBody
{ postPlansPlanRequestBodyActive :: Maybe Bool
postPlansPlanRequestBodyActive = Maybe Bool
forall a. Maybe a
GHC.Maybe.Nothing,
postPlansPlanRequestBodyExpand :: Maybe [Text]
postPlansPlanRequestBodyExpand = Maybe [Text]
forall a. Maybe a
GHC.Maybe.Nothing,
postPlansPlanRequestBodyMetadata :: Maybe PostPlansPlanRequestBodyMetadata'Variants
postPlansPlanRequestBodyMetadata = Maybe PostPlansPlanRequestBodyMetadata'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
postPlansPlanRequestBodyNickname :: Maybe Text
postPlansPlanRequestBodyNickname = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
postPlansPlanRequestBodyProduct :: Maybe Text
postPlansPlanRequestBodyProduct = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
postPlansPlanRequestBodyTrialPeriodDays :: Maybe Int
postPlansPlanRequestBodyTrialPeriodDays = Maybe Int
forall a. Maybe a
GHC.Maybe.Nothing
}
data PostPlansPlanRequestBodyMetadata'Variants
=
PostPlansPlanRequestBodyMetadata'EmptyString
| PostPlansPlanRequestBodyMetadata'Object Data.Aeson.Types.Internal.Object
deriving (Int
-> PostPlansPlanRequestBodyMetadata'Variants -> String -> String
[PostPlansPlanRequestBodyMetadata'Variants] -> String -> String
PostPlansPlanRequestBodyMetadata'Variants -> String
(Int
-> PostPlansPlanRequestBodyMetadata'Variants -> String -> String)
-> (PostPlansPlanRequestBodyMetadata'Variants -> String)
-> ([PostPlansPlanRequestBodyMetadata'Variants]
-> String -> String)
-> Show PostPlansPlanRequestBodyMetadata'Variants
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [PostPlansPlanRequestBodyMetadata'Variants] -> String -> String
$cshowList :: [PostPlansPlanRequestBodyMetadata'Variants] -> String -> String
show :: PostPlansPlanRequestBodyMetadata'Variants -> String
$cshow :: PostPlansPlanRequestBodyMetadata'Variants -> String
showsPrec :: Int
-> PostPlansPlanRequestBodyMetadata'Variants -> String -> String
$cshowsPrec :: Int
-> PostPlansPlanRequestBodyMetadata'Variants -> String -> String
GHC.Show.Show, PostPlansPlanRequestBodyMetadata'Variants
-> PostPlansPlanRequestBodyMetadata'Variants -> Bool
(PostPlansPlanRequestBodyMetadata'Variants
-> PostPlansPlanRequestBodyMetadata'Variants -> Bool)
-> (PostPlansPlanRequestBodyMetadata'Variants
-> PostPlansPlanRequestBodyMetadata'Variants -> Bool)
-> Eq PostPlansPlanRequestBodyMetadata'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostPlansPlanRequestBodyMetadata'Variants
-> PostPlansPlanRequestBodyMetadata'Variants -> Bool
$c/= :: PostPlansPlanRequestBodyMetadata'Variants
-> PostPlansPlanRequestBodyMetadata'Variants -> Bool
== :: PostPlansPlanRequestBodyMetadata'Variants
-> PostPlansPlanRequestBodyMetadata'Variants -> Bool
$c== :: PostPlansPlanRequestBodyMetadata'Variants
-> PostPlansPlanRequestBodyMetadata'Variants -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON PostPlansPlanRequestBodyMetadata'Variants where
toJSON :: PostPlansPlanRequestBodyMetadata'Variants -> Value
toJSON (PostPlansPlanRequestBodyMetadata'Object Object
a) = Object -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Object
a
toJSON (PostPlansPlanRequestBodyMetadata'Variants
PostPlansPlanRequestBodyMetadata'EmptyString) = Value
""
instance Data.Aeson.Types.FromJSON.FromJSON PostPlansPlanRequestBodyMetadata'Variants where
parseJSON :: Value -> Parser PostPlansPlanRequestBodyMetadata'Variants
parseJSON Value
val =
if
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"" -> PostPlansPlanRequestBodyMetadata'Variants
-> Parser PostPlansPlanRequestBodyMetadata'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure PostPlansPlanRequestBodyMetadata'Variants
PostPlansPlanRequestBodyMetadata'EmptyString
| Bool
GHC.Base.otherwise -> case (Object -> PostPlansPlanRequestBodyMetadata'Variants
PostPlansPlanRequestBodyMetadata'Object (Object -> PostPlansPlanRequestBodyMetadata'Variants)
-> Result Object
-> Result PostPlansPlanRequestBodyMetadata'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Object
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result PostPlansPlanRequestBodyMetadata'Variants
-> Result PostPlansPlanRequestBodyMetadata'Variants
-> Result PostPlansPlanRequestBodyMetadata'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String -> Result PostPlansPlanRequestBodyMetadata'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched" of
Data.Aeson.Types.Internal.Success PostPlansPlanRequestBodyMetadata'Variants
a -> PostPlansPlanRequestBodyMetadata'Variants
-> Parser PostPlansPlanRequestBodyMetadata'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure PostPlansPlanRequestBodyMetadata'Variants
a
Data.Aeson.Types.Internal.Error String
a -> String -> Parser PostPlansPlanRequestBodyMetadata'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
a
data PostPlansPlanResponse
=
PostPlansPlanResponseError GHC.Base.String
|
PostPlansPlanResponse200 Plan
|
PostPlansPlanResponseDefault Error
deriving (Int -> PostPlansPlanResponse -> String -> String
[PostPlansPlanResponse] -> String -> String
PostPlansPlanResponse -> String
(Int -> PostPlansPlanResponse -> String -> String)
-> (PostPlansPlanResponse -> String)
-> ([PostPlansPlanResponse] -> String -> String)
-> Show PostPlansPlanResponse
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
showList :: [PostPlansPlanResponse] -> String -> String
$cshowList :: [PostPlansPlanResponse] -> String -> String
show :: PostPlansPlanResponse -> String
$cshow :: PostPlansPlanResponse -> String
showsPrec :: Int -> PostPlansPlanResponse -> String -> String
$cshowsPrec :: Int -> PostPlansPlanResponse -> String -> String
GHC.Show.Show, PostPlansPlanResponse -> PostPlansPlanResponse -> Bool
(PostPlansPlanResponse -> PostPlansPlanResponse -> Bool)
-> (PostPlansPlanResponse -> PostPlansPlanResponse -> Bool)
-> Eq PostPlansPlanResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PostPlansPlanResponse -> PostPlansPlanResponse -> Bool
$c/= :: PostPlansPlanResponse -> PostPlansPlanResponse -> Bool
== :: PostPlansPlanResponse -> PostPlansPlanResponse -> Bool
$c== :: PostPlansPlanResponse -> PostPlansPlanResponse -> Bool
GHC.Classes.Eq)