2026-01-26 19:40:38 +07:00

2.0 KiB

@remotestorage/module-places


@remotestorage/module-places / PlacesClient

Interface: PlacesClient

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.