Add README and API docs
This commit is contained in:
135
docs/interfaces/PlacesClient.md
Normal file
135
docs/interfaces/PlacesClient.md
Normal file
@@ -0,0 +1,135 @@
|
||||
[**@remotestorage/module-places**](../README.md)
|
||||
|
||||
***
|
||||
|
||||
[@remotestorage/module-places](../README.md) / 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`](../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.
|
||||
Reference in New Issue
Block a user