1.0.3 • Published 4 years ago
metoffice-fetch v1.0.3
Met Office Fetch
A simple package to fetch data from the uk met office API library.
installation
Just do
npm install metoffice-fetch
or
yarn add metoffice-fetch
Example
import { FetchDailyData } from "metoffice-fetch";
const fetchData = async (latitude: number, longitude: number) => {
try {
const result = await FetchDailyData(
{
excludeParameterMetadata: true,
includeLocationName: false,
latitude,
longitude,
},
{
clientId: CLIENT_ID,
clientSecret: CLIENT_SECRET,
},
);
console.log(result.features[0].properties.timeSeries);
} catch (error) {
console.err(error);
}
};
References
Function | Return Type | Description |
---|---|---|
FetchHourlyData(params, headers) | Promise<MetOfficeResponse> | Fetches the hourly data |
FetchThreeHourlyData(params, headers) | Promise<MetOfficeResponse> | Fetches the Three Hourly data |
FetchDailyData(params, headers) | Promise<MetOfficeResponse> | Fetches the Daily Data |
The inputs param for all these functions are the same:
params: {
excludeParameterMetadata?: boolean;
includeLocationName?: boolean;
latitude: number;
longitude: number;
},
headers: {
clientId: string;
clientSecret: string;
}
Authors
Ali Rezaee nlndipi@hotmail.com