import { asyncSaveJSON, CardMarketApi } from "../lib";

async function run() {
  if (process.argv.length < 3) {
    console.error("Usage: yarn fetch <uid>");
    process.exit(1);
    return;
  }
  const uid = process.argv[2];
  let api = new CardMarketApi();
  const articles = await api.getAllArticles(uid);
  await asyncSaveJSON(`${uid}-cards.json`, articles);
}

run();
