From caf72faccc04e647c27e1b5eef85c515949d8210 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Thu, 20 Feb 2025 12:29:35 +0100 Subject: consolidate `backend, cli, common` -> `acms` --- backend/lib/ACMS/API/REST.hs | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 backend/lib/ACMS/API/REST.hs (limited to 'backend/lib/ACMS/API/REST.hs') diff --git a/backend/lib/ACMS/API/REST.hs b/backend/lib/ACMS/API/REST.hs deleted file mode 100644 index 6cd2982..0000000 --- a/backend/lib/ACMS/API/REST.hs +++ /dev/null @@ -1,33 +0,0 @@ -{-# LANGUAGE OverloadedStrings #-} - -module ACMS.API.REST where - -import ACMS.API.Fetch -import Data.Aeson qualified as A -import Data.Function ((&)) -import Data.String (IsString (fromString)) -import Miso.String (MisoString) - -restRequest :: String -> Request -restRequest endpoint = - fromString ("http://localhost:8081/api/rest" <> endpoint) - -schemaVersion :: (APIMonad m, A.FromJSON a) => m a -schemaVersion = - restRequest "/schemaVersion" - & fetch - >>= A.throwDecode - -listCollections :: (APIMonad m) => m [MisoString] -listCollections = - restRequest "/collection" - & fetch - >>= A.throwDecode - -createCollection :: (APIMonad m) => MisoString -> m () -createCollection collection = - restRequest "/collections" - & setRequestMethod "POST" - & setRequestBodyLBS (A.encode (A.toJSON collection)) - & fetch - >>= A.throwDecode -- cgit v1.2.3