3.7 KiB
@remotestorage/module-places / PlacesClient
Interface: PlacesClient
Properties
lists
lists:
object
addPlace()
addPlace(
listId,placeId,geohash):Promise<List>
Add a place to a list.
Parameters
listId
string
The slug ID of the list.
placeId
string
The ID of the place.
geohash
string
The geohash of the place.
Returns
Promise<List>
create()
create(
id,title,color?):Promise<List>
Create or update a list.
Parameters
id
string
The slug ID (e.g., "to-go").
title
string
Human readable title.
color?
string
Optional hex color code.
Returns
Promise<List>
delete()
delete(
id):Promise<void>
Delete a list.
Parameters
id
string
The slug ID of the list.
Returns
Promise<void>
get()
get(
id):Promise<List|null>
Get a single list by ID (slug).
Parameters
id
string
The slug ID of the list.
Returns
Promise<List | null>
getAll()
getAll():
Promise<List[]>
Get all lists.
Returns
Promise<List[]>
Array of List objects.
removePlace()
removePlace(
listId,placeId):Promise<List>
Remove a place from a list.
Parameters
listId
string
The slug ID of the list.
placeId
string
The ID of the place.
Returns
Promise<List>
Methods
get()
get(
id,geohash):Promise<unknown>
Get a single place. Requires geohash to locate the folder.
Parameters
id
string
The ID of the place to retrieve.
geohash
string
The geohash of the place.
Returns
Promise<unknown>
The place object.
getPlaces()
getPlaces(
prefixes?):Promise<Place[]>
Get places from specific prefixes.
Parameters
prefixes?
string[]
Optional array of 4-character geohash prefixes to load (e.g. ['w1q7', 'w1q8']). If not provided, it will attempt to scan ALL prefixes (recursive).
Returns
Promise<Place[]>
An array of places.
listByPrefix()
listByPrefix(
prefix):Promise<unknown>
List places matching a geohash prefix. Supports 2-char ("ab") or 4-char ("abcd") prefixes. If 2-char, it returns the sub-folders (prefixes), not places. If 4-char, it returns the places in that sector.
Parameters
prefix
string
The geohash prefix to filter by.
Returns
Promise<unknown>
A map of objects found at the prefix.
remove()
remove(
id,geohash):Promise<unknown>
Remove a place. Requires geohash to locate the folder.
Parameters
id
string
The ID of the place to remove.
geohash
string
The geohash of the place.
Returns
Promise<unknown>
store()
store(
placeData):Promise<Place>
Store a place.
Generates ID and Geohash if missing.
Path structure: <geohash-prefix-2>/<geohash-prefix-2>/<id>
Parameters
placeData
Partial<Place>
The data of the place to store.
Returns
Promise<Place>
The stored place object.