Add README and API docs

This commit is contained in:
2026-01-26 19:20:54 +07:00
parent 713efb81b5
commit bc5eea7841
9 changed files with 510 additions and 3 deletions

17
docs/README.md Normal file
View File

@@ -0,0 +1,17 @@
**@remotestorage/module-places**
***
# @remotestorage/module-places
## Interfaces
- [PlacesClient](interfaces/PlacesClient.md)
## Type Aliases
- [Place](type-aliases/Place.md)
## Variables
- [default](variables/default.md)

View 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.

View File

@@ -0,0 +1,27 @@
[**@remotestorage/module-places**](../README.md)
***
[@remotestorage/module-places](../README.md) / Place
# Type Alias: Place
> **Place** = `FromSchema`\<*typeof* `placeSchema`\> & `object`
Represents a Place object.
Core properties enforced by schema:
- `id`: Unique identifier (ULID)
- `title`: Name of the place
- `lat`: Latitude
- `lon`: Longitude
- `geohash`: Geohash for indexing
- `createdAt`: ISO date string
Optional properties:
- `description`: Text description
- `zoom`: Map zoom level
- `url`: Related URL
- `osmId`, `osmType`, `osmTags`: OpenStreetMap data
- `tags`: Array of string tags
- `updatedAt`: ISO date string

33
docs/variables/default.md Normal file
View File

@@ -0,0 +1,33 @@
[**@remotestorage/module-places**](../README.md)
***
[@remotestorage/module-places](../README.md) / default
# Variable: default
> **default**: `object`
## Type Declaration
### builder()
> **builder**: (`privateClient`) => `object` = `Places`
#### Parameters
##### privateClient
`BaseClient`
#### Returns
`object`
##### exports
> **exports**: [`PlacesClient`](../interfaces/PlacesClient.md)
### name
> **name**: `string` = `'places'`