{-# language BangPatterns #-} {-# language DuplicateRecordFields #-} {-# language NamedFieldPuns #-} module Kafka.JoinGroup.Response.V9 ( Response(..) , Member(..) , parser , decode , decodeHeaded ) where import Control.Applicative (liftA2) import Data.Bytes (Bytes) import Data.Bytes.Parser (Parser) import Data.Int (Int16) import Data.Int (Int32) import Data.Primitive (SmallArray) import Kafka.ErrorCode (ErrorCode) import Kafka.TaggedField (TaggedField) import Kafka.Parser.Context (Context) import Data.Text (Text) import qualified Data.Bytes.Parser as Parser import qualified Kafka.Parser.Context as Ctx import qualified Kafka.Header.Response.V0 as Header import qualified Kafka.TaggedField as TaggedField import qualified Kafka.Parser data Response = Response { Response -> Int32 throttleTimeMilliseconds :: !Int32 , Response -> ErrorCode errorCode :: !ErrorCode , Response -> Int32 generationId :: !Int32 , Response -> Text protocolType :: !Text , Response -> Text protocolName :: !Text , Response -> Text leader :: !Text , Response -> Bool skipAssignment :: !Bool , Response -> Text memberId :: !Text , Response -> SmallArray Member members :: !(SmallArray Member) , Response -> SmallArray TaggedField taggedFields :: !(SmallArray TaggedField) } deriving (Int -> Response -> ShowS [Response] -> ShowS Response -> String (Int -> Response -> ShowS) -> (Response -> String) -> ([Response] -> ShowS) -> Show Response forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a $cshowsPrec :: Int -> Response -> ShowS showsPrec :: Int -> Response -> ShowS $cshow :: Response -> String show :: Response -> String $cshowList :: [Response] -> ShowS showList :: [Response] -> ShowS Show) data Member = Member { Member -> Text memberId :: !Text , Member -> Text groupInstanceId :: !Text , Member -> Bytes metadata :: !Bytes , Member -> SmallArray TaggedField taggedFields :: !(SmallArray TaggedField) } deriving (Int -> Member -> ShowS [Member] -> ShowS Member -> String (Int -> Member -> ShowS) -> (Member -> String) -> ([Member] -> ShowS) -> Show Member forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a $cshowsPrec :: Int -> Member -> ShowS showsPrec :: Int -> Member -> ShowS $cshow :: Member -> String show :: Member -> String $cshowList :: [Member] -> ShowS showList :: [Member] -> ShowS Show) decodeHeaded :: Bytes -> Either Context (Header.Headed Response) decodeHeaded :: Bytes -> Either Context (Headed Response) decodeHeaded !Bytes b = (forall s. Parser Context s (Headed Response)) -> Bytes -> Either Context (Headed Response) forall e a. (forall s. Parser e s a) -> Bytes -> Either e a Parser.parseBytesEither ((Header -> Response -> Headed Response) -> Parser Context s Header -> Parser Context s Response -> Parser Context s (Headed Response) forall a b c. (a -> b -> c) -> Parser Context s a -> Parser Context s b -> Parser Context s c forall (f :: * -> *) a b c. Applicative f => (a -> b -> c) -> f a -> f b -> f c liftA2 Header -> Response -> Headed Response forall a. Header -> a -> Headed a Header.Headed (Context -> Parser Context s Header forall s. Context -> Parser Context s Header Header.parser Context Ctx.Top) (Context -> Parser Context s Response forall s. Context -> Parser Context s Response parser Context Ctx.Top Parser Context s Response -> Parser Context s () -> Parser Context s Response forall a b. Parser Context s a -> Parser Context s b -> Parser Context s a forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a <* Context -> Parser Context s () forall e s. e -> Parser e s () Parser.endOfInput Context Ctx.End) ) Bytes b decode :: Bytes -> Either Context Response decode :: Bytes -> Either Context Response decode !Bytes b = (forall s. Parser Context s Response) -> Bytes -> Either Context Response forall e a. (forall s. Parser e s a) -> Bytes -> Either e a Parser.parseBytesEither (Context -> Parser Context s Response forall s. Context -> Parser Context s Response parser Context Ctx.Top Parser Context s Response -> Parser Context s () -> Parser Context s Response forall a b. Parser Context s a -> Parser Context s b -> Parser Context s a forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a <* Context -> Parser Context s () forall e s. e -> Parser e s () Parser.endOfInput Context Ctx.End) Bytes b parserMember :: Context -> Parser Context s Member parserMember :: forall s. Context -> Parser Context s Member parserMember Context ctx = do Text memberId <- Context -> Parser Context s Text forall s. Context -> Parser Context s Text Kafka.Parser.compactString (Field -> Context -> Context Ctx.Field Field Ctx.MemberId Context ctx) Text groupInstanceId <- Context -> Parser Context s Text forall s. Context -> Parser Context s Text Kafka.Parser.compactString (Field -> Context -> Context Ctx.Field Field Ctx.GroupInstanceId Context ctx) Bytes metadata <- Context -> Parser Context s Bytes forall s. Context -> Parser Context s Bytes Kafka.Parser.compactBytes (Field -> Context -> Context Ctx.Field Field Ctx.Metadata Context ctx) SmallArray TaggedField taggedFields <- Context -> Parser Context s (SmallArray TaggedField) forall s. Context -> Parser Context s (SmallArray TaggedField) TaggedField.parserMany (Field -> Context -> Context Ctx.Field Field Ctx.TagBuffer Context ctx) Member -> Parser Context s Member forall a. a -> Parser Context s a forall (f :: * -> *) a. Applicative f => a -> f a pure Member{Text $sel:memberId:Member :: Text memberId :: Text memberId,Text $sel:groupInstanceId:Member :: Text groupInstanceId :: Text groupInstanceId,Bytes $sel:metadata:Member :: Bytes metadata :: Bytes metadata,SmallArray TaggedField $sel:taggedFields:Member :: SmallArray TaggedField taggedFields :: SmallArray TaggedField taggedFields} parser :: Context -> Parser Context s Response parser :: forall s. Context -> Parser Context s Response parser Context ctx = do Int32 throttleTimeMilliseconds <- Context -> Parser Context s Int32 forall e s. e -> Parser e s Int32 Kafka.Parser.int32 (Field -> Context -> Context Ctx.Field Field Ctx.ThrottleTimeMilliseconds Context ctx) ErrorCode errorCode <- Context -> Parser Context s ErrorCode forall e s. e -> Parser e s ErrorCode Kafka.Parser.errorCode (Field -> Context -> Context Ctx.Field Field Ctx.ErrorCode Context ctx) Int32 generationId <- Context -> Parser Context s Int32 forall e s. e -> Parser e s Int32 Kafka.Parser.int32 (Field -> Context -> Context Ctx.Field Field Ctx.GenerationId Context ctx) Text protocolType <- Context -> Parser Context s Text forall s. Context -> Parser Context s Text Kafka.Parser.compactString (Field -> Context -> Context Ctx.Field Field Ctx.ProtocolType Context ctx) Text protocolName <- Context -> Parser Context s Text forall s. Context -> Parser Context s Text Kafka.Parser.compactString (Field -> Context -> Context Ctx.Field Field Ctx.ProtocolName Context ctx) Text leader <- Context -> Parser Context s Text forall s. Context -> Parser Context s Text Kafka.Parser.compactString (Field -> Context -> Context Ctx.Field Field Ctx.Leader Context ctx) Bool skipAssignment <- Context -> Parser Context s Bool forall s. Context -> Parser Context s Bool Kafka.Parser.boolean (Field -> Context -> Context Ctx.Field Field Ctx.SkipAssignment Context ctx) Text memberId <- Context -> Parser Context s Text forall s. Context -> Parser Context s Text Kafka.Parser.compactString (Field -> Context -> Context Ctx.Field Field Ctx.MemberId Context ctx) SmallArray Member members <- (Context -> Parser Context s Member) -> Context -> Parser Context s (SmallArray Member) forall s a. (Context -> Parser Context s a) -> Context -> Parser Context s (SmallArray a) Kafka.Parser.compactArray Context -> Parser Context s Member forall s. Context -> Parser Context s Member parserMember (Field -> Context -> Context Ctx.Field Field Ctx.Members Context ctx) SmallArray TaggedField taggedFields <- Context -> Parser Context s (SmallArray TaggedField) forall s. Context -> Parser Context s (SmallArray TaggedField) TaggedField.parserMany (Field -> Context -> Context Ctx.Field Field Ctx.TagBuffer Context ctx) Response -> Parser Context s Response forall a. a -> Parser Context s a forall (f :: * -> *) a. Applicative f => a -> f a pure Response { Int32 $sel:throttleTimeMilliseconds:Response :: Int32 throttleTimeMilliseconds :: Int32 throttleTimeMilliseconds , ErrorCode $sel:errorCode:Response :: ErrorCode errorCode :: ErrorCode errorCode , Int32 $sel:generationId:Response :: Int32 generationId :: Int32 generationId , Text $sel:protocolType:Response :: Text protocolType :: Text protocolType , Text $sel:protocolName:Response :: Text protocolName :: Text protocolName , Text $sel:leader:Response :: Text leader :: Text leader , Bool $sel:skipAssignment:Response :: Bool skipAssignment :: Bool skipAssignment , Text $sel:memberId:Response :: Text memberId :: Text memberId , SmallArray Member $sel:members:Response :: SmallArray Member members :: SmallArray Member members , SmallArray TaggedField $sel:taggedFields:Response :: SmallArray TaggedField taggedFields :: SmallArray TaggedField taggedFields }