@singfuse/singapore
v1.0.4
Published
TypeScript SDK for Singapore's open data API
Maintainers
Readme
@singfuse/singapore
A TypeScript SDK for Singapore's Open Data and LTA Data Mall APIs.
Installation
npm install @singfuse/singapore
# or
yarn add @singfuse/singapore
# or
pnpm add @singfuse/singaporeUsage
Open Data API
Access real-time datasets from Singapore's open data portal (data.gov.sg), including weather and air quality.
import { OpenData } from '@singfuse/singapore'
// Initialize the client (API key is optional for public endpoints)
const openData = new OpenData()
// Fetch Air Quality data (PSI, PM2.5)
const psiData = await openData.airQuality().psi()
const pm25Data = await openData.airQuality().pm25()
// Fetch Weather data
const weather = openData.weather()
const rainfall = await weather.rainfall()
const temperature = await weather.airTemperature()
const forecast = await weather.twoHourForecast()LTA Data Mall API
Access transport-related datasets from the Land Transport Authority (LTA) Data Mall.
import { LtaDataMall } from '@singfuse/singapore'
// Initialize the client with your LTA Data Mall API key
const ltaData = new LtaDataMall('YOUR_API_KEY')
// Use the client to make requests to the LTA Data Mall API
// const response = await ltaData.client().get('/BusArrivalv2', { BusStopCode: '83139' })Development Setup
To contribute or run the project locally:
Clone the repository:
git clone https://github.com/singfuse/singapore.git cd singaporeInstall dependencies:
pnpm installBuild the package:
pnpm run buildRun tests:
pnpm test
Available Scripts
pnpm run build- Build the project usingtsup.pnpm test- Run tests usingvitest.pnpm run format- Format code usingprettier.pnpm run typecheck- Run TypeScript type checking without emitting files.
License
This project is licensed under the MIT License.
