module Network.IPFS.Stat.Types ( Stat (..) , module Network.IPFS.Stat.Error ) where import Network.IPFS.Bytes.Types import Network.IPFS.Stat.Error import Network.IPFS.Prelude data Stat = Stat { Stat -> Either OverflowDetected Bytes blockSize :: Either OverflowDetected Bytes , Stat -> Either OverflowDetected Bytes cumulativeSize :: Either OverflowDetected Bytes , Stat -> Either OverflowDetected Bytes dataSize :: Either OverflowDetected Bytes , Stat -> Text hash :: Text , Stat -> Bytes linksSize :: Bytes , Stat -> Natural numLinks :: Natural } instance FromJSON Stat where parseJSON :: Value -> Parser Stat parseJSON = String -> (Object -> Parser Stat) -> Value -> Parser Stat forall a. String -> (Object -> Parser a) -> Value -> Parser a withObject String "Stat" \Object obj -> do Either OverflowDetected Bytes blockSize <- Object obj Object -> Text -> Parser (Either OverflowDetected Bytes) forall a. FromJSON a => Object -> Text -> Parser a .: Text "BlockSize" Either OverflowDetected Bytes cumulativeSize <- Object obj Object -> Text -> Parser (Either OverflowDetected Bytes) forall a. FromJSON a => Object -> Text -> Parser a .: Text "CumulativeSize" Either OverflowDetected Bytes dataSize <- Object obj Object -> Text -> Parser (Either OverflowDetected Bytes) forall a. FromJSON a => Object -> Text -> Parser a .: Text "DataSize" Text hash <- Object obj Object -> Text -> Parser Text forall a. FromJSON a => Object -> Text -> Parser a .: Text "Hash" Bytes linksSize <- Object obj Object -> Text -> Parser Bytes forall a. FromJSON a => Object -> Text -> Parser a .: Text "LinksSize" Natural numLinks <- Object obj Object -> Text -> Parser Natural forall a. FromJSON a => Object -> Text -> Parser a .: Text "NumLinks" return Stat :: Either OverflowDetected Bytes -> Either OverflowDetected Bytes -> Either OverflowDetected Bytes -> Text -> Bytes -> Natural -> Stat Stat {Natural Either OverflowDetected Bytes Text Bytes numLinks :: Natural linksSize :: Bytes hash :: Text dataSize :: Either OverflowDetected Bytes cumulativeSize :: Either OverflowDetected Bytes blockSize :: Either OverflowDetected Bytes $sel:numLinks:Stat :: Natural $sel:linksSize:Stat :: Bytes $sel:hash:Stat :: Text $sel:dataSize:Stat :: Either OverflowDetected Bytes $sel:cumulativeSize:Stat :: Either OverflowDetected Bytes $sel:blockSize:Stat :: Either OverflowDetected Bytes ..}