Files
remotestorage-module-places/docs/interfaces/PlacesClient.md
2026-03-13 16:39:37 +04:00

274 lines
3.7 KiB
Markdown

[**@remotestorage/module-places**](../README.md)
***
[@remotestorage/module-places](../README.md) / PlacesClient
# Interface: PlacesClient
## Properties
### lists
> **lists**: `object`
#### addPlace()
> **addPlace**(`listId`, `placeId`, `geohash`): `Promise`\<[`List`](../type-aliases/List.md)\>
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`](../type-aliases/List.md)\>
#### create()
> **create**(`id`, `title`, `color?`): `Promise`\<[`List`](../type-aliases/List.md)\>
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`](../type-aliases/List.md)\>
#### 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`](../type-aliases/List.md) \| `null`\>
Get a single list by ID (slug).
##### Parameters
###### id
`string`
The slug ID of the list.
##### Returns
`Promise`\<[`List`](../type-aliases/List.md) \| `null`\>
#### getAll()
> **getAll**(): `Promise`\<[`List`](../type-aliases/List.md)[]\>
Get all lists.
##### Returns
`Promise`\<[`List`](../type-aliases/List.md)[]\>
Array of List objects.
#### removePlace()
> **removePlace**(`listId`, `placeId`): `Promise`\<[`List`](../type-aliases/List.md)\>
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`](../type-aliases/List.md)\>
## 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`](../type-aliases/Place.md)[]\>
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`](../type-aliases/Place.md)[]\>
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`](../type-aliases/Place.md)\>
Store a place.
Generates ID and Geohash if missing.
Path structure: `<geohash-prefix-2>/<geohash-prefix-2>/<id>`
#### Parameters
##### placeData
`Partial`\<[`Place`](../type-aliases/Place.md)\>
The data of the place to store.
#### Returns
`Promise`\<[`Place`](../type-aliases/Place.md)\>
The stored place object.