proto3-suite-0.5.0: gen/TestProtoNestedMessage.hs
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-name-shadowing #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
{-# OPTIONS_GHC -fno-warn-missing-export-lists #-}
-- | Generated by Haskell protocol buffer compiler. DO NOT EDIT!
module TestProtoNestedMessage where
import qualified Prelude as Hs
import qualified Proto3.Suite.Class as HsProtobuf
import qualified Proto3.Suite.DotProto as HsProtobuf
import qualified Proto3.Suite.JSONPB as HsJSONPB
import Proto3.Suite.JSONPB ((.=), (.:))
import qualified Proto3.Suite.Types as HsProtobuf
import qualified Proto3.Wire as HsProtobuf
import qualified Control.Applicative as Hs
import Control.Applicative ((<*>), (<|>), (<$>))
import qualified Control.DeepSeq as Hs
import qualified Control.Monad as Hs
import qualified Data.ByteString as Hs
import qualified Data.Coerce as Hs
import qualified Data.Int as Hs (Int16, Int32, Int64)
import qualified Data.List.NonEmpty as Hs (NonEmpty(..))
import qualified Data.Map as Hs (Map, mapKeysMonotonic)
import qualified Data.Proxy as Proxy
import qualified Data.String as Hs (fromString)
import qualified Data.Text.Lazy as Hs (Text)
import qualified Data.Vector as Hs (Vector)
import qualified Data.Word as Hs (Word16, Word32, Word64)
import qualified GHC.Enum as Hs
import qualified GHC.Generics as Hs
import qualified Unsafe.Coerce as Hs
newtype Request = Request{requestFoo ::
Hs.Maybe TestProtoNestedMessage.Request_Foo}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named Request where
nameOf _ = (Hs.fromString "Request")
instance HsProtobuf.HasDefault Request
instance HsProtobuf.Message Request where
encodeMessage _ Request{requestFoo = requestFoo}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
(Hs.coerce @(Hs.Maybe TestProtoNestedMessage.Request_Foo)
@(HsProtobuf.Nested TestProtoNestedMessage.Request_Foo)
requestFoo))])
decodeMessage _
= (Hs.pure Request) <*>
(Hs.coerce
@(_ (HsProtobuf.Nested TestProtoNestedMessage.Request_Foo))
@(_ (Hs.Maybe TestProtoNestedMessage.Request_Foo))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim (HsProtobuf.Named (HsProtobuf.Single "Foo")))
(HsProtobuf.Single "foo")
[]
"")]
instance HsJSONPB.ToJSONPB Request where
toJSONPB (Request f1) = (HsJSONPB.object ["foo" .= f1])
toEncodingPB (Request f1) = (HsJSONPB.pairs ["foo" .= f1])
instance HsJSONPB.FromJSONPB Request where
parseJSONPB
= (HsJSONPB.withObject "Request"
(\ obj -> (Hs.pure Request) <*> obj .: "foo"))
instance HsJSONPB.ToJSON Request where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON Request where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema Request where
declareNamedSchema _
= do let declare_foo = HsJSONPB.declareSchemaRef
requestFoo <- declare_foo Proxy.Proxy
let _ = Hs.pure Request <*> HsJSONPB.asProxy declare_foo
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "Request",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("foo", requestFoo)]}})
newtype Request_Foo = Request_Foo{request_FooBar ::
Hs.Maybe TestProtoNestedMessage.Request_Foo_Bar}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named Request_Foo where
nameOf _ = (Hs.fromString "Request_Foo")
instance HsProtobuf.HasDefault Request_Foo
instance HsProtobuf.Message Request_Foo where
encodeMessage _ Request_Foo{request_FooBar = request_FooBar}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
(Hs.coerce @(Hs.Maybe TestProtoNestedMessage.Request_Foo_Bar)
@(HsProtobuf.Nested TestProtoNestedMessage.Request_Foo_Bar)
request_FooBar))])
decodeMessage _
= (Hs.pure Request_Foo) <*>
(Hs.coerce
@(_ (HsProtobuf.Nested TestProtoNestedMessage.Request_Foo_Bar))
@(_ (Hs.Maybe TestProtoNestedMessage.Request_Foo_Bar))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim (HsProtobuf.Named (HsProtobuf.Single "Bar")))
(HsProtobuf.Single "bar")
[]
"")]
instance HsJSONPB.ToJSONPB Request_Foo where
toJSONPB (Request_Foo f1) = (HsJSONPB.object ["bar" .= f1])
toEncodingPB (Request_Foo f1) = (HsJSONPB.pairs ["bar" .= f1])
instance HsJSONPB.FromJSONPB Request_Foo where
parseJSONPB
= (HsJSONPB.withObject "Request_Foo"
(\ obj -> (Hs.pure Request_Foo) <*> obj .: "bar"))
instance HsJSONPB.ToJSON Request_Foo where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON Request_Foo where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema Request_Foo where
declareNamedSchema _
= do let declare_bar = HsJSONPB.declareSchemaRef
request_FooBar <- declare_bar Proxy.Proxy
let _ = Hs.pure Request_Foo <*> HsJSONPB.asProxy declare_bar
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "Request_Foo",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("bar", request_FooBar)]}})
newtype Request_Foo_Bar = Request_Foo_Bar{request_Foo_BarBuz ::
Hs.Maybe TestProtoNestedMessage.Request_Foo_Bar_Buz}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named Request_Foo_Bar where
nameOf _ = (Hs.fromString "Request_Foo_Bar")
instance HsProtobuf.HasDefault Request_Foo_Bar
instance HsProtobuf.Message Request_Foo_Bar where
encodeMessage _
Request_Foo_Bar{request_Foo_BarBuz = request_Foo_BarBuz}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
(Hs.coerce @(Hs.Maybe TestProtoNestedMessage.Request_Foo_Bar_Buz)
@(HsProtobuf.Nested TestProtoNestedMessage.Request_Foo_Bar_Buz)
request_Foo_BarBuz))])
decodeMessage _
= (Hs.pure Request_Foo_Bar) <*>
(Hs.coerce
@(_ (HsProtobuf.Nested TestProtoNestedMessage.Request_Foo_Bar_Buz))
@(_ (Hs.Maybe TestProtoNestedMessage.Request_Foo_Bar_Buz))
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1)))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim (HsProtobuf.Named (HsProtobuf.Single "Buz")))
(HsProtobuf.Single "buz")
[]
"")]
instance HsJSONPB.ToJSONPB Request_Foo_Bar where
toJSONPB (Request_Foo_Bar f1) = (HsJSONPB.object ["buz" .= f1])
toEncodingPB (Request_Foo_Bar f1) = (HsJSONPB.pairs ["buz" .= f1])
instance HsJSONPB.FromJSONPB Request_Foo_Bar where
parseJSONPB
= (HsJSONPB.withObject "Request_Foo_Bar"
(\ obj -> (Hs.pure Request_Foo_Bar) <*> obj .: "buz"))
instance HsJSONPB.ToJSON Request_Foo_Bar where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON Request_Foo_Bar where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema Request_Foo_Bar where
declareNamedSchema _
= do let declare_buz = HsJSONPB.declareSchemaRef
request_Foo_BarBuz <- declare_buz Proxy.Proxy
let _ = Hs.pure Request_Foo_Bar <*> HsJSONPB.asProxy declare_buz
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "Request_Foo_Bar",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("buz", request_Foo_BarBuz)]}})
newtype Request_Foo_Bar_Buz = Request_Foo_Bar_Buz{request_Foo_Bar_BuzX
:: Hs.Word32}
deriving (Hs.Show, Hs.Eq, Hs.Ord, Hs.Generic, Hs.NFData)
instance HsProtobuf.Named Request_Foo_Bar_Buz where
nameOf _ = (Hs.fromString "Request_Foo_Bar_Buz")
instance HsProtobuf.HasDefault Request_Foo_Bar_Buz
instance HsProtobuf.Message Request_Foo_Bar_Buz where
encodeMessage _
Request_Foo_Bar_Buz{request_Foo_Bar_BuzX = request_Foo_Bar_BuzX}
= (Hs.mconcat
[(HsProtobuf.encodeMessageField (HsProtobuf.FieldNumber 1)
request_Foo_Bar_BuzX)])
decodeMessage _
= (Hs.pure Request_Foo_Bar_Buz) <*>
(HsProtobuf.at HsProtobuf.decodeMessageField
(HsProtobuf.FieldNumber 1))
dotProto _
= [(HsProtobuf.DotProtoField (HsProtobuf.FieldNumber 1)
(HsProtobuf.Prim HsProtobuf.UInt32)
(HsProtobuf.Single "x")
[]
"")]
instance HsJSONPB.ToJSONPB Request_Foo_Bar_Buz where
toJSONPB (Request_Foo_Bar_Buz f1) = (HsJSONPB.object ["x" .= f1])
toEncodingPB (Request_Foo_Bar_Buz f1)
= (HsJSONPB.pairs ["x" .= f1])
instance HsJSONPB.FromJSONPB Request_Foo_Bar_Buz where
parseJSONPB
= (HsJSONPB.withObject "Request_Foo_Bar_Buz"
(\ obj -> (Hs.pure Request_Foo_Bar_Buz) <*> obj .: "x"))
instance HsJSONPB.ToJSON Request_Foo_Bar_Buz where
toJSON = HsJSONPB.toAesonValue
toEncoding = HsJSONPB.toAesonEncoding
instance HsJSONPB.FromJSON Request_Foo_Bar_Buz where
parseJSON = HsJSONPB.parseJSONPB
instance HsJSONPB.ToSchema Request_Foo_Bar_Buz where
declareNamedSchema _
= do let declare_x = HsJSONPB.declareSchemaRef
request_Foo_Bar_BuzX <- declare_x Proxy.Proxy
let _ = Hs.pure Request_Foo_Bar_Buz <*> HsJSONPB.asProxy declare_x
Hs.return
(HsJSONPB.NamedSchema{HsJSONPB._namedSchemaName =
Hs.Just "Request_Foo_Bar_Buz",
HsJSONPB._namedSchemaSchema =
Hs.mempty{HsJSONPB._schemaParamSchema =
Hs.mempty{HsJSONPB._paramSchemaType =
Hs.Just HsJSONPB.SwaggerObject},
HsJSONPB._schemaProperties =
HsJSONPB.insOrdFromList
[("x", request_Foo_Bar_BuzX)]}})