Current Weather In City

weather/current-city@1.0.3
Supported by 2 providers
O
WI

Get Current Weather In City

Get current weather in a city in chosen units

Input
city
units
Result
temperature
feelsLike
description

1.Choose a provider

2.Use GetCurrentWeatherInCity 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/current-city@1.0.3');

  // Use the profile
  const result = await profile
    .getUseCase('GetCurrentWeatherInCity')
    .perform({
      city: 'Prague, Czech Republic',
      units: 'C'
    }, {
      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, Czech Republic",
  "units": "C"
}

Result (object)

temperature
Temperature in specified units
feelsLike
Subjective temperature in specified units
description
Text description of weather, e.g. "Partly cloudy"

Example

{
  "temperature": 9,
  "feelsLike": 8,
  "description": "Partly cloudy"
}

Implementation details

Provider
mock
Use case
GetCurrentWeatherInCity
Author
@superface
Source
Verified