Skip to content

RinseV/plus-wrapper

Repository files navigation

Plus API Wrapper


NPM version NPM license NPM dependencies

npm installnfo

NOTE: This wrapper no longer works as of November 2023 due to API changes by Plus. I will not be updating this wrapper anymore, but feel free to fork it and update it yourself.

Unofficial Node.js API wrapper for the Plus.

Installation

npm install plus-wrapper

or

yarn add plus-wrapper

then

import { Plus } from 'plus-wrapper';

Basic usage

// Creates Plus object, set verbose to true to see all requests
const plus = new Plus({ verbose: true });
// Gets products by name
const products = await plus.product().getProductsFromName('melk');

More information about the functions and parameters can be found on the wiki

Example usage

For all of these examples, please keep in mind that your function in which you request something should be async since the requests return a Promise.

Product

If I want to find all product names that match a given query:

import { Plus } from 'plus-wrapper';

async function findProducts(productName: string) {
    const plus = new Plus();
    const products = await plus.product().getProductsFromName(productName);
    console.log(
        products.items.map((item) => {
            return item.title;
        })
    );
}

findProducts('melk');
[
  'Zuivelmeester Halfvolle melk',
  'PLUS Halfvolle melk',
  'PLUS Halfvolle koffiemelk',
  'Zuivelmeester Halfvolle melk',
  'PLUS Houdbare halfvolle melk',
  'PLUS Houdbare halfvolle melk',
  'Biologisch PLUS Halfvolle melk',
  'Campina Halfvolle melk',
  'Biologisch PLUS Volle melk',
  'Campina Karnemelk',
  'Melkunie Bolletjes vanillevla met crunch',
  'PLUS Houdbare volle melk'
]

Recipe

If I want to find all recipe names that match a given query:

import { Plus } from 'plus-wrapper';

async function findRecipes(recipeName: string) {
    const plus = new Plus();
    const recipes = await plus.recipe().getRecipesFromName(recipeName);
    console.log(
        recipes.elements.map((element) => {
            return element.name;
        })
    );
}

findRecipes('lasagne');
[
  'Open lasagne met paddenstoelen, spinazie en ricotta',
  'Vegetarische groentelasagne met spinazie en prei',
  'Vegetarische groentelasagne met geitenkaas',
  'Vegetarische lasagne met spinazie en kaas',
  'Courgette lasagne met rucola',
  'Lasagne met gegrilde aubergine',
  'Lasagne bolognese',
  'Romige lasagne met kip en champignons',
  'Zalmlasagne met courgette, spinazie en roomkaas',
  'Romige lasagne rolletjes met basilicum',
  'Zoete aardappel lasagne met aubergine'
]

Store

If I want to find the name of a store located in a given city:

import { Plus } from 'plus-wrapper';

async function findStores(cityName: string) {
    const plus = new Plus();
    const stores = await plus.store().getStores();
    console.log(stores.filter((store) => store.city === cityName)[0]?.name);
}

findStores('Druten');
PLUS Lenssen

About

Node.js API wrapper for Plus Supermarkten

Resources

License

Stars

Watchers

Forks

Packages

No packages published