Copyright | © 2018-2021 IOHK |
---|---|
License | Apache-2.0 |
Safe Haskell | None |
Language | Haskell2010 |
A mock metadata-server for testing, metadata requests. Created using the metadata-server Haskell source code as a reference.
Synopsis
- withMetadataServer :: IO ( Server MetadataQueryApi) -> ( TokenMetadataServer -> IO a) -> IO a
- withMetadataServerOptions :: Middleware -> Maybe Port -> IO ( Server MetadataQueryApi) -> ( TokenMetadataServer -> IO a) -> IO a
- queryServerStatic :: FilePath -> IO ( BatchRequest -> Handler BatchResponse )
- queryServerReloading :: FilePath -> BatchRequest -> Handler BatchResponse
- assetIdFromSubject :: Subject -> AssetId
Documentation
withMetadataServer :: IO ( Server MetadataQueryApi) -> ( TokenMetadataServer -> IO a) -> IO a Source #
Start a metadata server on any random port. See
withMetadataServerOptions
for running a server with middleware and predefined port.
To be used with
queryServerStatic
.
withMetadataServerOptions :: Middleware -> Maybe Port -> IO ( Server MetadataQueryApi) -> ( TokenMetadataServer -> IO a) -> IO a Source #
Start a metadata server.
queryServerStatic :: FilePath -> IO ( BatchRequest -> Handler BatchResponse ) Source #
Serve a json file.
Will filter the json and only serve metadata for the requested subjects.
queryServerReloading :: FilePath -> BatchRequest -> Handler BatchResponse Source #
Like
queryServerStatic
, except that the JSON file will be reloaded before
every request.
Helpers
assetIdFromSubject :: Subject -> AssetId Source #
The reverse of subjectToAssetId
Orphan instances
ToJSON AssetDecimals Source # | |
toJSON :: AssetDecimals -> Value Source # toEncoding :: AssetDecimals -> Encoding Source # toJSONList :: [ AssetDecimals ] -> Value Source # toEncodingList :: [ AssetDecimals ] -> Encoding Source # |
|
ToJSON AssetURL Source # | |
ToJSON AssetLogo Source # | |
ToJSON Signature Source # | |
ToJSON SubjectProperties Source # | |
toJSON :: SubjectProperties -> Value Source # toEncoding :: SubjectProperties -> Encoding Source # toJSONList :: [ SubjectProperties ] -> Value Source # toEncodingList :: [ SubjectProperties ] -> Encoding Source # |
|
ToJSON BatchResponse Source # | |
toJSON :: BatchResponse -> Value Source # toEncoding :: BatchResponse -> Encoding Source # toJSONList :: [ BatchResponse ] -> Value Source # toEncodingList :: [ BatchResponse ] -> Encoding Source # |
|
FromJSON BatchRequest Source # | |
parseJSON :: Value -> Parser BatchRequest Source # parseJSONList :: Value -> Parser [ BatchRequest ] Source # |
|
ToJSON ( PropertyValue name) => ToJSON ( Property name) Source # | |