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 = forall a. String -> (Object -> Parser a) -> Value -> Parser a withObject String "Stat" \Object obj -> do Either OverflowDetected Bytes blockSize <- Object obj forall a. FromJSON a => Object -> Key -> Parser a .: Key "BlockSize" Either OverflowDetected Bytes cumulativeSize <- Object obj forall a. FromJSON a => Object -> Key -> Parser a .: Key "CumulativeSize" Either OverflowDetected Bytes dataSize <- Object obj forall a. FromJSON a => Object -> Key -> Parser a .: Key "DataSize" Text hash <- Object obj forall a. FromJSON a => Object -> Key -> Parser a .: Key "Hash" Bytes linksSize <- Object obj forall a. FromJSON a => Object -> Key -> Parser a .: Key "LinksSize" Natural numLinks <- Object obj forall a. FromJSON a => Object -> Key -> Parser a .: Key "NumLinks" return 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 ..}