Skip to content
← Public packages

@oerd/yr-weather

Ask MET Norway / yr.no for now-and-tomorrow weather at saved cities.

src/register-location.ts

21 lines · 699 B · TypeScript
import { registerSavedLocation, type SavedLocation } from './lib.ts'

/**
 * Geocode a city (if needed) and store it in the package lookup map.
 * Use to pin coordinates ahead of a weather question, or to refresh an existing entry.
 *
 * @param input - Place name; optional latitude/longitude (4 decimals)
 * @returns The stored location with rounded coordinates
 *
 * @example
 * import registerLocation from 'kody:@oerd-at-gripable/yr-weather/registerLocation'
 *
 * await registerLocation({ name: 'Tirana' })
 */
export default async function registerLocation(input: {
	name: string
	latitude?: number
	longitude?: number
}): Promise<SavedLocation> {
	return await registerSavedLocation(input)
}