@selinac887/weather-sdk 1.0.1 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,7 +11,7 @@ providing access to current weather and forecast data.
11
11
  ## Installation
12
12
 
13
13
  ```bash
14
- npm install @yourname/weather-sdk
14
+ npm install @selinac887/weather-sdk
15
15
  ```
16
16
 
17
17
  ## Usage
@@ -19,7 +19,7 @@ npm install @yourname/weather-sdk
19
19
  ### Get current weather
20
20
 
21
21
  ```ts
22
- import { getCurrentWeather } from "@yourname/weather-sdk";
22
+ import { getCurrentWeather } from "@selinac887/weather-sdk";
23
23
 
24
24
  const data = await getCurrentWeather({
25
25
  latitude: -36.85,
@@ -37,7 +37,7 @@ console.log(data.current.temperature_2m);
37
37
  ### Get forecast weather
38
38
 
39
39
  ```ts
40
- import { getForecast } from "@yourname/weather-sdk";
40
+ import { getForecast } from "@selinac887/weather-sdk";
41
41
 
42
42
  const forecast = await getForecast({
43
43
  latitude: -36.85,
package/dist/index.d.ts CHANGED
@@ -8,11 +8,17 @@ export interface CurrentWeather {
8
8
  interval: number;
9
9
  [key: string]: number | string;
10
10
  }
11
+ export interface CurrentWeatherUnits {
12
+ time: string;
13
+ interval: string;
14
+ [key: string]: string;
15
+ }
11
16
  export interface GetCurrentWeatherInput extends BaseLocationInput {
12
17
  current: string[];
13
18
  }
14
19
  export interface GetCurrentWeatherResponse {
15
20
  current: CurrentWeather;
21
+ current_units: CurrentWeatherUnits;
16
22
  }
17
23
  export declare function getCurrentWeather(input: GetCurrentWeatherInput): Promise<GetCurrentWeatherResponse>;
18
24
  export interface HourlyForecast {
package/dist/index.js CHANGED
@@ -12,7 +12,11 @@ export async function getCurrentWeather(input) {
12
12
  if (!res.ok) {
13
13
  throw new Error(`Open-Meteo API error: ${res.status}`);
14
14
  }
15
- return res.json();
15
+ const raw = await res.json();
16
+ return {
17
+ current: raw.current,
18
+ current_units: raw.current_units, // include units exactly as API returns
19
+ };
16
20
  }
17
21
  export async function getForecast(input) {
18
22
  const { latitude, longitude, timezone = "auto", hourly, daily, forecastHours, forecastDays, } = input;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@selinac887/weather-sdk",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -18,12 +18,19 @@ export interface CurrentWeather {
18
18
  [key: string]: number | string;
19
19
  }
20
20
 
21
+ export interface CurrentWeatherUnits {
22
+ time: string;
23
+ interval: string;
24
+ [key: string]: string;
25
+ }
26
+
21
27
  export interface GetCurrentWeatherInput extends BaseLocationInput {
22
28
  current: string[];
23
29
  }
24
30
 
25
31
  export interface GetCurrentWeatherResponse {
26
32
  current: CurrentWeather;
33
+ current_units: CurrentWeatherUnits;
27
34
  }
28
35
 
29
36
  export async function getCurrentWeather(
@@ -47,7 +54,12 @@ export async function getCurrentWeather(
47
54
  throw new Error(`Open-Meteo API error: ${res.status}`);
48
55
  }
49
56
 
50
- return res.json();
57
+ const raw: any = await res.json();
58
+
59
+ return {
60
+ current: raw.current,
61
+ current_units: raw.current_units, // include units exactly as API returns
62
+ };
51
63
  }
52
64
 
53
65
  /*