Skip to content

feat: add createList, deleteList, and List.rename methods#1

Open
asachs01 wants to merge 1 commit intobobby060:masterfrom
asachs01:feature/create-delete-list
Open

feat: add createList, deleteList, and List.rename methods#1
asachs01 wants to merge 1 commit intobobby060:masterfrom
asachs01:feature/create-delete-list

Conversation

@asachs01
Copy link
Copy Markdown

Summary

Adds three new methods for managing shopping lists:

createList(name)

Creates a new shopping list. Uses PBListOperation with the new-shopping-list handler, which is the same mechanism the AnyList web app uses internally.

const anylist = new AnyList({ email, password });
await anylist.login();
const newList = await anylist.createList('My New List');
console.log(newList.name); // 'My New List'

deleteList(list)

Deletes a shopping list by removing it from its parent folder via PBListFolderOperation with the delete-folder-items handler. Automatically determines the correct parent folder.

const list = anylist.getListByName('Old List');
await anylist.deleteList(list);

List.rename(newName)

Renames an existing list via PBListOperation with the rename-list handler.

const list = anylist.getListByName('Groceries');
await list.rename('Weekly Groceries');

Other changes

  • Extracts uid from the JWT access token during login() so that operation metadata includes the correct userId. This was previously undefined for all operations.

How this was discovered

Reverse-engineered from the AnyList web app (app.min.js) by extracting handler ID strings and tracing the protobuf operation patterns. All three operations were tested end-to-end against the live API (create → rename → delete).

- createList(name): Creates a new shopping list via PBListOperation with 'new-shopping-list' handler. Returns the created List instance.
- deleteList(list): Deletes a shopping list by removing it from its parent folder via PBListFolderOperation with 'delete-folder-items' handler.
- List.rename(newName): Renames a list via PBListOperation with 'rename-list' handler.
- Extract uid from JWT token during login() so operations include the correct userId in operation metadata.
@bobby060
Copy link
Copy Markdown
Owner

@asachs01 Just a heads up that this repo is a fork of the real anylist-js repo (I just had to remove stdout prints to make it work with mcp). I will try to merge this here shortly, but the upstream repo might benefit from it too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants