Skip to content

πŸ“‹ a wrapper for AnyList's API (unoffical, reverse engineered)

Notifications You must be signed in to change notification settings

brianespinoza/anylist

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

24 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“‹ AnyList

node-current

a wrapper for AnyList's API (unofficial, reverse engineered)

Install

npm i anylist

Getting Started

Here's an example script (replace email and password with your credentials):

const AnyList = require('anylist');

const any = new AnyList({email: 'hi@here.com', password: 'password'});

any.on('lists-update', lists => {
  console.log('Lists were updated!');
});

any.login().then(async () => {
  await any.getLists();

  // Add new item to the Walmart list
  const walmart = any.getListByName('Walmart');

  let chips = any.createItem({name: 'Chips'});

  chips = await walmart.addItem(chips)

  // Check off added item
  chips.checked = true;
  // And change the quantity
  chips.quantity = '2';
  // Save updated item
  await chips.save();

  // Delete item
  await walmart.removeItem(chips);

  any.teardown();
});

Getting Started with Recipes

const AnyList = require('anylist');

const any = new AnyList({email: 'hi@here.com', password: 'password'});

any.login().then(async () => {
    const recipeName = 'Congee recipe';
    const testRecipe = await any.createRecipe(
        {
            name: recipeName,
            note: 'this is a test note',
            preparationSteps: ['# heading 1', 'this is preparation step 1'],
            servings: '2 servings as main dish',
            sourceName: 'serious eats',
            sourceUrl: 'https://seriouseats.com',
            scaleFactor: 1,
            rating: 5,
            ingredients: [{
                rawIngredient: '1 garlic, chopped',
                name: 'garlic',
                quantity: '1',
                note: 'chopped'
            }],
            nutritionalInfo: 'this is nutritional info',
            cookTime: 5 * 60, // seconds
            prepTime: 5 * 60, // seconds
            creationTimestamp: Date.now() / 1000,
            timestamp: Date.now() / 1000
        }
    );


    // Save test recipe
    await testRecipe.save();
    
    const collection = any.createRecipeCollection({ name: 'ONLINE RECIPES' })

    await collection.save();
    
    await collection.addRecipe(testRecipe.identifier);

    await collection.removeRecipe(testRecipe.identifier);
    
    // clean up / delete test recipe collection
    await collection.delete();

    // cleanup / delete test recipe
    await testRecipe.delete(); 


    any.teardown();
});

Notes/Tips

  • There is much more functionality in the AnyList API that is not captured in this package, I just implemented the functions that I would be using. If there is functionality missing that you want, please open a PR and I'm happy to merge it in.
    • (This means that you can't currently add/remove/update lists.)
  • When adding new items, you should reuse existing, checked-off items if possible like the official clients do. Search the list by the item name with list.getItemByName('item-name') to see if it exists before adding a new instance.

πŸ“– Docs

Documentation

About

πŸ“‹ a wrapper for AnyList's API (unoffical, reverse engineered)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%