apimatic-open-weather-sdk
v1.0.0
Published
**OpenWeather API** provides current weather data, forecasts, and historical information for any location worldwide.
Readme
Getting Started with OpenWeatherMap
Introduction
Get the current weather, daily forecast for 16 days, and a three-hour-interval forecast for 5 days for your city. Helpful stats, graphics, and this day in history charts are available for your reference. Interactive maps show precipitation, clouds, pressure, wind around your location stations. Data is available in JSON, XML, or HTML format. Note: This sample Swagger file covers the current endpoint only from the OpenWeatherMap API. Note: All parameters are optional, but you must select at least one parameter. Calling the API by city ID (using the id parameter) will provide the most precise location results.
Install the Package
Run the following command from your project directory to install the package from npm:
npm install [email protected]For additional package details, see the Npm page for the [email protected] npm.
Test the SDK
To validate the functionality of this SDK, you can execute all tests located in the test directory. This SDK utilizes Jest as both the testing framework and test runner.
To run the tests, navigate to the root directory of the SDK and execute the following command:
npm run testOr you can also run tests with coverage report:
npm run test:coverageInitialize the API Client
Note: Documentation for the client can be found here.
The following parameters are configurable for the API Client:
| Parameter | Type | Description |
| --- | --- | --- |
| environment | Environment | The API environment. Default: Environment.Production |
| timeout | number | Timeout for API calls.Default: 0 |
| httpClientOptions | Partial<HttpClientOptions> | Stable configurable http client options. |
| unstableHttpClientOptions | any | Unstable configurable http client options. |
The API client can be initialized as follows:
import { Client, Environment } from 'apimatic-open-weather-sdk';
const client = new Client({
timeout: 0,
environment: Environment.Production,
});Environments
The SDK can be configured to use a different environment for making API calls. Available environments are:
Fields
| Name | Description | | --- | --- | | production | Default | | environment2 | - | | environment3 | - |
