module Blockfrost.Types.Shared.Slot
where
import Data.Aeson (FromJSON, ToJSON)
import GHC.Generics
import Servant.API (Capture, FromHttpApiData (..), ToHttpApiData (..))
import Servant.Docs (DocCapture (..), ToCapture (..), ToSample (..), samples)
newtype Slot = Slot Integer
deriving stock (Slot -> Slot -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Slot -> Slot -> Bool
$c/= :: Slot -> Slot -> Bool
== :: Slot -> Slot -> Bool
$c== :: Slot -> Slot -> Bool
Eq, Eq Slot
Slot -> Slot -> Bool
Slot -> Slot -> Ordering
Slot -> Slot -> Slot
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
min :: Slot -> Slot -> Slot
$cmin :: Slot -> Slot -> Slot
max :: Slot -> Slot -> Slot
$cmax :: Slot -> Slot -> Slot
>= :: Slot -> Slot -> Bool
$c>= :: Slot -> Slot -> Bool
> :: Slot -> Slot -> Bool
$c> :: Slot -> Slot -> Bool
<= :: Slot -> Slot -> Bool
$c<= :: Slot -> Slot -> Bool
< :: Slot -> Slot -> Bool
$c< :: Slot -> Slot -> Bool
compare :: Slot -> Slot -> Ordering
$ccompare :: Slot -> Slot -> Ordering
Ord, Int -> Slot -> ShowS
[Slot] -> ShowS
Slot -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Slot] -> ShowS
$cshowList :: [Slot] -> ShowS
show :: Slot -> String
$cshow :: Slot -> String
showsPrec :: Int -> Slot -> ShowS
$cshowsPrec :: Int -> Slot -> ShowS
Show, forall x. Rep Slot x -> Slot
forall x. Slot -> Rep Slot x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Slot x -> Slot
$cfrom :: forall x. Slot -> Rep Slot x
Generic)
deriving newtype (Integer -> Slot
Slot -> Slot
Slot -> Slot -> Slot
forall a.
(a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a)
-> (a -> a)
-> (a -> a)
-> (Integer -> a)
-> Num a
fromInteger :: Integer -> Slot
$cfromInteger :: Integer -> Slot
signum :: Slot -> Slot
$csignum :: Slot -> Slot
abs :: Slot -> Slot
$cabs :: Slot -> Slot
negate :: Slot -> Slot
$cnegate :: Slot -> Slot
* :: Slot -> Slot -> Slot
$c* :: Slot -> Slot -> Slot
- :: Slot -> Slot -> Slot
$c- :: Slot -> Slot -> Slot
+ :: Slot -> Slot -> Slot
$c+ :: Slot -> Slot -> Slot
Num, Int -> Slot
Slot -> Int
Slot -> [Slot]
Slot -> Slot
Slot -> Slot -> [Slot]
Slot -> Slot -> Slot -> [Slot]
forall a.
(a -> a)
-> (a -> a)
-> (Int -> a)
-> (a -> Int)
-> (a -> [a])
-> (a -> a -> [a])
-> (a -> a -> [a])
-> (a -> a -> a -> [a])
-> Enum a
enumFromThenTo :: Slot -> Slot -> Slot -> [Slot]
$cenumFromThenTo :: Slot -> Slot -> Slot -> [Slot]
enumFromTo :: Slot -> Slot -> [Slot]
$cenumFromTo :: Slot -> Slot -> [Slot]
enumFromThen :: Slot -> Slot -> [Slot]
$cenumFromThen :: Slot -> Slot -> [Slot]
enumFrom :: Slot -> [Slot]
$cenumFrom :: Slot -> [Slot]
fromEnum :: Slot -> Int
$cfromEnum :: Slot -> Int
toEnum :: Int -> Slot
$ctoEnum :: Int -> Slot
pred :: Slot -> Slot
$cpred :: Slot -> Slot
succ :: Slot -> Slot
$csucc :: Slot -> Slot
Enum, Num Slot
Ord Slot
Slot -> Rational
forall a. Num a -> Ord a -> (a -> Rational) -> Real a
toRational :: Slot -> Rational
$ctoRational :: Slot -> Rational
Real, Enum Slot
Real Slot
Slot -> Integer
Slot -> Slot -> (Slot, Slot)
Slot -> Slot -> Slot
forall a.
Real a
-> Enum a
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> a)
-> (a -> a -> (a, a))
-> (a -> a -> (a, a))
-> (a -> Integer)
-> Integral a
toInteger :: Slot -> Integer
$ctoInteger :: Slot -> Integer
divMod :: Slot -> Slot -> (Slot, Slot)
$cdivMod :: Slot -> Slot -> (Slot, Slot)
quotRem :: Slot -> Slot -> (Slot, Slot)
$cquotRem :: Slot -> Slot -> (Slot, Slot)
mod :: Slot -> Slot -> Slot
$cmod :: Slot -> Slot -> Slot
div :: Slot -> Slot -> Slot
$cdiv :: Slot -> Slot -> Slot
rem :: Slot -> Slot -> Slot
$crem :: Slot -> Slot -> Slot
quot :: Slot -> Slot -> Slot
$cquot :: Slot -> Slot -> Slot
Integral, ByteString -> Either Text Slot
Text -> Either Text Slot
forall a.
(Text -> Either Text a)
-> (ByteString -> Either Text a)
-> (Text -> Either Text a)
-> FromHttpApiData a
parseQueryParam :: Text -> Either Text Slot
$cparseQueryParam :: Text -> Either Text Slot
parseHeader :: ByteString -> Either Text Slot
$cparseHeader :: ByteString -> Either Text Slot
parseUrlPiece :: Text -> Either Text Slot
$cparseUrlPiece :: Text -> Either Text Slot
FromHttpApiData, Slot -> Builder
Slot -> ByteString
Slot -> Text
forall a.
(a -> Text)
-> (a -> Builder)
-> (a -> ByteString)
-> (a -> Text)
-> (a -> Builder)
-> ToHttpApiData a
toEncodedQueryParam :: Slot -> Builder
$ctoEncodedQueryParam :: Slot -> Builder
toQueryParam :: Slot -> Text
$ctoQueryParam :: Slot -> Text
toHeader :: Slot -> ByteString
$ctoHeader :: Slot -> ByteString
toEncodedUrlPiece :: Slot -> Builder
$ctoEncodedUrlPiece :: Slot -> Builder
toUrlPiece :: Slot -> Text
$ctoUrlPiece :: Slot -> Text
ToHttpApiData, Maybe Slot
Value -> Parser [Slot]
Value -> Parser Slot
forall a.
(Value -> Parser a)
-> (Value -> Parser [a]) -> Maybe a -> FromJSON a
omittedField :: Maybe Slot
$comittedField :: Maybe Slot
parseJSONList :: Value -> Parser [Slot]
$cparseJSONList :: Value -> Parser [Slot]
parseJSON :: Value -> Parser Slot
$cparseJSON :: Value -> Parser Slot
FromJSON, [Slot] -> Encoding
[Slot] -> Value
Slot -> Bool
Slot -> Encoding
Slot -> Value
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> (a -> Bool)
-> ToJSON a
omitField :: Slot -> Bool
$comitField :: Slot -> Bool
toEncodingList :: [Slot] -> Encoding
$ctoEncodingList :: [Slot] -> Encoding
toJSONList :: [Slot] -> Value
$ctoJSONList :: [Slot] -> Value
toEncoding :: Slot -> Encoding
$ctoEncoding :: Slot -> Encoding
toJSON :: Slot -> Value
$ctoJSON :: Slot -> Value
ToJSON)
unSlot :: Slot -> Integer
unSlot :: Slot -> Integer
unSlot (Slot Integer
i) = Integer
i
instance ToCapture (Capture "slot_number" Slot) where
toCapture :: Proxy (Capture "slot_number" Slot) -> DocCapture
toCapture Proxy (Capture "slot_number" Slot)
_ = String -> String -> DocCapture
DocCapture String
"slot_number" String
"Slot position for requested block."
instance ToSample Slot where
toSamples :: Proxy Slot -> [(Text, Slot)]
toSamples = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall a b. (a -> b) -> a -> b
$ forall a. [a] -> [(Text, a)]
samples [Slot
37040682, Slot
412162133]