Skip to content

Commit

Permalink
feat: update from v1 to v0 and refactor it's use
Browse files Browse the repository at this point in the history
  • Loading branch information
sourabhxyz committed Mar 8, 2024
1 parent c8387d5 commit 370dbdd
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions geniusyield-server-lib/src/GeniusYield/Server/Api.hs
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,18 @@ type TradingFeesAPI =

type AssetsAPI = Summary "Get assets information" :> Description "Get information for a specific asset." :> Capture "asset" GYAssetClass :> Get '[JSON] AssetDetails

type V1API =
type V0API =
"settings" :> SettingsAPI
:<|> "orders" :> DEXPartialOrderAPI
:<|> "markets" :> MarketsAPI
:<|> "tx" :> TxAPI
:<|> "trading_fees" :> TradingFeesAPI
:<|> "assets" :> AssetsAPI

type GeniusYieldAPI = "v1" :> V1API
type V0 Symbol
type V0 = "v0"

type GeniusYieldAPI = V0 :> V0API

geniusYieldAPI Proxy GeniusYieldAPI
geniusYieldAPI = Proxy
Expand All @@ -116,12 +119,12 @@ geniusYieldAPISwagger =
& info
. description
?~ "API to interact with GeniusYield DEX."
& applyTagsFor (subOperations (Proxy Proxy ("v1" :> "tx" :> TxAPI)) (Proxy Proxy GeniusYieldAPI)) ["Transaction" & description ?~ "Endpoints related to transaction hex such as submitting a transaction"]
& applyTagsFor (subOperations (Proxy Proxy ("v1" :> "markets" :> MarketsAPI)) (Proxy Proxy GeniusYieldAPI)) ["Markets" & description ?~ "Endpoints related to accessing markets information"]
& applyTagsFor (subOperations (Proxy Proxy ("v1" :> "orders" :> DEXPartialOrderAPI)) (Proxy Proxy GeniusYieldAPI)) ["Orders" & description ?~ "Endpoints related to interacting with orders"]
& applyTagsFor (subOperations (Proxy Proxy ("v1" :> "settings" :> SettingsAPI)) (Proxy Proxy GeniusYieldAPI)) ["Settings" & description ?~ "Endpoint to get server settings such as network, version, and revision"]
& applyTagsFor (subOperations (Proxy Proxy ("v1" :> "trading_fees" :> TradingFeesAPI)) (Proxy Proxy GeniusYieldAPI)) ["Trading Fees" & description ?~ "Endpoint to get trading fees of DEX."]
& applyTagsFor (subOperations (Proxy Proxy ("v1" :> "assets" :> AssetsAPI)) (Proxy Proxy GeniusYieldAPI)) ["Assets" & description ?~ "Endpoint to fetch asset details."]
& applyTagsFor (subOperations (Proxy Proxy (V0 :> "tx" :> TxAPI)) (Proxy Proxy GeniusYieldAPI)) ["Transaction" & description ?~ "Endpoints related to transaction hex such as submitting a transaction"]
& applyTagsFor (subOperations (Proxy Proxy (V0 :> "markets" :> MarketsAPI)) (Proxy Proxy GeniusYieldAPI)) ["Markets" & description ?~ "Endpoints related to accessing markets information"]
& applyTagsFor (subOperations (Proxy Proxy (V0 :> "orders" :> DEXPartialOrderAPI)) (Proxy Proxy GeniusYieldAPI)) ["Orders" & description ?~ "Endpoints related to interacting with orders"]
& applyTagsFor (subOperations (Proxy Proxy (V0 :> "settings" :> SettingsAPI)) (Proxy Proxy GeniusYieldAPI)) ["Settings" & description ?~ "Endpoint to get server settings such as network, version, and revision"]
& applyTagsFor (subOperations (Proxy Proxy (V0 :> "trading_fees" :> TradingFeesAPI)) (Proxy Proxy GeniusYieldAPI)) ["Trading Fees" & description ?~ "Endpoint to get trading fees of DEX."]
& applyTagsFor (subOperations (Proxy Proxy (V0 :> "assets" :> AssetsAPI)) (Proxy Proxy GeniusYieldAPI)) ["Assets" & description ?~ "Endpoint to fetch asset details."]

geniusYieldServer Ctx ServerT GeniusYieldAPI IO
geniusYieldServer ctx =
Expand Down

0 comments on commit 370dbdd

Please sign in to comment.