From b84010a3321cd031d1ea5595f680e5be24f343d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Sat, 14 Mar 2026 14:50:30 +0400 Subject: [PATCH] Add proper lists documentation to README --- README.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d029443..eaac4f1 100644 --- a/README.md +++ b/README.md @@ -51,12 +51,56 @@ console.log(allPlaces); // List places for specific geohash prefixes (e.g. for a map view) const areaPlaces = await places.getPlaces(['u33d', 'u33e']); console.log(areaPlaces); +``` +## Lists + +### Default lists + +There are currently two default lists, which you can initiate like this: + +```javascript +await places.lists.initDefaults(); +``` + +This will create the lists if they don't exist yet (meaning the user hasn't yet +used an app that integrates this module). + +The default lists are: + +| Path | Default Name | Default Color | +| --- | --- | --- | +| `_lists/to-go` | Want to go | #2e9e4f (green) | +| `_lists/to-do` | To do | #2a7fff (blue) | + +### Custom lists + +```javascript // Create a list -await places.lists.create('favorites', 'My Favorites'); +await places.lists.create('hiking', 'Hiking', '#74d3ba'); +// Delete a list +await places.lists.delete('hiking'); +``` + +### List membership + +```javascript // Add a place to a list (requires list ID, place ID, and place geohash) -await places.lists.addPlace('favorites', 'place-id-123', 'u33dc0'); +await places.lists.addPlace('to-go', 'place-id-123', 'u33dc0'); + +// Remove from list +await places.lists.removePlace('to-go', 'place-id-123'); +``` + +### Reading lists + +```javascript +// Get all lists +await places.lists.getAll(); + +// Get specific list +await places.lists.get('to-do'); ``` ## API Reference