callStreamAPI :: EnumResponseHandler
              -> Method -> Token
              -> String             -- ^ path component of target API
              -> [(String, String)] -- ^ query parameters
              -> IO (Result ())
callStreamAPI iter m tok path query = do
    resp <- callAPI' tok req $ EnumHttpClientWithIter $ \s hs -> do
        resp <- iter s hs
        -- to always return JSNull
        return $ resp { responseBody = "null" }

    debug resp

    case resp of
        Ok JSNull -> return $ Ok ()
        Error e   -> return $ Error e
  where
    req = mkStreamAPIRequest m (path ++ ".json") query
callStreamAPI :: EnumResponseHandler
              -> Method -> Token
              -> String             -- ^ path component of target API
              -> [(String, String)] -- ^ query parameters
              -> IO (Result ())
callStreamAPI iter m tok path query = do
    resp <- callAPI' tok req $ EnumHttpClientWithIter $ \s hs -> do
        resp <- iter s hs
        -- to always return JSNull
        return $ resp { responseBody = "null" }

    debug resp

    case resp of
        Ok JSNull -> return $ Ok ()
        Error e   -> return $ Error e
  where
    req = mkStreamAPIRequest m (path ++ ".json") query
callStreamAPI iter m tok path query = do
    resp <- callAPI' tok req $ EnumHttpClientWithIter $ \s hs -> do
        resp <- iter s hs
        -- to always return JSNull
        return $ resp { responseBody = "null" }

    debug resp

    case resp of
        Ok JSNull -> return $ Ok ()
        Error e   -> return $ Error e
  where
    req = mkStreamAPIRequest m (path ++ ".json") query