/node-toogoodtogo

An API wrapper for the anti-waste app TooGoodToGo

Primary LanguageJavaScript

node-tgtg

An API wrapper for the anti-waste app TooGoodToGo

Installation

yarn add node-tgtg

Usage

const Tgtg = require("node-tgtg");
const tgtg = new Tgtg({
  email: "",
  password: "",
});

Methods

Login

await tgtg.login();

Get profile

await tgtg.getProfile();

Discover nearby offers

await tgtg.discoverNearby({ latitude, longitude }, (tags = DEFAULT_TAGS));
const DEFAULT_TAGS = [
  "Favorites",
  "LastToday",
  "Tomorrow",
  "NearBy",
  "CollectNow",
  "Meals",
  "BakedGoods",
  "Groceries",
  "Recommended",
  "Breakfast",
  "Lunch",
  "Dinner",
  "TooGoodToGoStore",
  "EverythingElse",
  "SoldOut",
  "NothingToSave",
  "Vegetarian",
  "Unlocked",
  "EssentialBags",
];

Get store

await tgtg.getStore(storeId, { latitude, longitude });