@wral/sdk-geo
v0.0.1
Published
A Software Development Kit for working with the geo API
Keywords
Readme
@wral/sdk-geo
lightweight JavaScript client for WRAL Geo Data API
This SDK is intentionally small and opinionated. It provides a clean interface to the weather API with sensible defaults and minimal configuration.
Installation
npm install @wral/sdk-geoUsage
import { createClient } from '@wral/sdk-geo/v1';
const geo = createClient({
baseUrl: 'https://api.wral.com/geo',
apiKey: process.env.WRAL_API_KEY, // optional
});
const cityId = '1234567890';
const city = await geo.getCity(cityId);
API
createClient(config)
Creates a client instance bound to a base API URL.
Config Options:
baseUrl(string, required) - The base URL for the APIapiKey(string, optional) - Bearer token used for authenticated requests
Returns an object exposing:
getCity(cityId)- gets a city by IDapi(path, options)- low-level escape hatch for direct API calls
Error Handling
Non-OK HTTP responses throw a structured Error with additional metadata:
statusstatusTexturlheadersbody(when available)
This makes failures easier to inspect and log upstream.
Design Notes
- ES module–first
- No runtime dependencies
- Client-side normalization keeps the API simple and cache-friendly
- Additional tuning and controls may be exposed in future versions
