Weather Forecast For City

weather/forecast-city@1.0.1
Supported by 1 provider
WI

Get Weather Forecast For City

Get weather forecast for a city in chosen units

Input
City
Units
Result
AverageTemperature
Date
MaxTemperature
MinTemperature

1.Choose a provider

2.Use GetWeatherForecastInCity with mock in your code

npm i @superfaceai/one-sdk
const { SuperfaceClient } = require('@superfaceai/one-sdk');

const sdk = new SuperfaceClient();

async function run() {
  // Load the profile
  const profile = await sdk.getProfile('weather/forecast-city@1.0.1');

  // Use the profile
  const result = await profile
    .getUseCase('GetWeatherForecastInCity')
    .perform({
      city: 'Prague,CZ'
    }, {
      provider: 'mock'
    });

  // Handle the result
  try {
    const data = result.unwrap();
    console.log(data);
  } catch (error) {
    console.error(error);
  }
}

run();

Structure details

Input (object)

city
Name of the city including state and country, e.g.: "Prague, Czech Republic" or "New York City, NY, USA"
units
Units used to represent temperature - Fahrenheit, Celsius, Kelvin; Celsius by default

Example

{
  "city": "Prague,CZ"
}

Result (list of objects)

averageTemperature
Daily average Temperature in specified units
date
Date of the weather forecast
maxTemperature
Daily maximal temperature in specified units
minTemperature
Datily minimal temperature in specified units

Example

[
  {
    "averageTemperature": 6,
    "date": "2021-11-08",
    "maxTemperature": 8,
    "minTemperature": 4
  }
]

Implementation details

Provider
mock
Use case
GetWeatherForecastInCity
Author
@superface
Source
Verified