;; Market service — inter-service data queries

(defquery marketplaces-for-container (&key type id)
  "Marketplaces attached to a container (page, etc)."
  (service "market" "marketplaces-for-container"
    :container-type type :container-id id))

(defquery products-by-ids (&key ids)
  "Return product details for comma-separated IDs."
  (service "market-data" "products-by-ids"
    :ids (map parse-int (filter (fn (s) (not (empty? s))) (split (str ids) ",")))))

(defquery marketplaces-by-ids (&key ids)
  "Return marketplace data for comma-separated IDs."
  (service "market-data" "marketplaces-by-ids"
    :ids (map parse-int (filter (fn (s) (not (empty? s))) (split (str ids) ",")))))
