# mashape-weather-apitest

> Browser and node module for making API requests against [Mashape Weather API](https://simple-weather.p.mashape.com).

Latest version **0.0.0** (published 2017-03-07) · Apache 2.0 license · 0 weekly downloads

## Install

```sh
npm install mashape-weather-apitest
pnpm add mashape-weather-apitest
yarn add mashape-weather-apitest
bun add mashape-weather-apitest
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.0 |
| Published | 2017-03-07 |
| First published | 2017-03-07 |
| Weekly downloads | 0 |
| License | Apache 2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | MuleSoft, Inc. |
| Maintainers | s2tu |
| Keywords | raml-api |

## Links

- npm: https://www.npmjs.com/package/mashape-weather-apitest
- Repository: https://github.com/mulesoft/raml-javascript-generator
- Issues: https://github.com/mulesoft/raml-javascript-generator/issues
- npm.io page: https://npm.io/package/mashape-weather-apitest

## Dependencies (1)

- [popsicle](https://npm.io/package/popsicle.md) ^0.5.6

## Recent versions

- 0.0.0 (latest) — 2017-03-07

## README

# Mashape Weather API

Browser and node module for making API requests against [Mashape Weather API](https://simple-weather.p.mashape.com).

**Please note: This module uses [Popsicle](https://github.com/blakeembrey/popsicle) to make API requests. Promises must be supported or polyfilled on all target environments.**

## Installation

```
npm install mashape-weather-api --save
bower install mashape-weather-api --save
```

## Usage

### Node

```javascript
var MashapeWeatherApi = require('mashape-weather-api');

var client = new MashapeWeatherApi();
```

### Browsers

```html
<script src="mashape-weather-api/index.js"></script>

<script>
  var client = new MashapeWeatherApi();
</script>
```

### Options

You can set options when you initialize a client or at any time with the `options` property. You may also override options for a single request by passing an object as the second argument of any request method. For example:

```javascript
var client = new MashapeWeatherApi({ ... });

client.options = { ... };

client.resource('/').get(null, {
  baseUri: 'http://example.com',
  headers: {
    'Content-Type': 'application/json'
  }
});
```

#### Base URI

You can override the base URI by setting the `baseUri` property, or initializing a client with a base URI. For example:

```javascript
new MashapeWeatherApi({
  baseUri: 'https://example.com'
});
```

#### Base URI Parameters

If the base URI has parameters inline, you can set them by updating the `baseUriParameters` property. For example:

```javascript
client.options.baseUriParameters.version = 'v1';
```

### Resources

All methods return a HTTP request instance of [Popsicle](https://github.com/blakeembrey/popsicle), which allows the use of promises (and streaming in node).

#### resources.aqi

```js
var resource = client.resources.aqi;
```

##### GET

Get the air quality index (AQI). The AQI number indicates the level of pollution in the air. **Higher** numbers are worse.

```js
resource.get().then(function (res) { ... });
```

##### Query Parameters

```javascript
resource.get({ ... });
```

* **Latitude** _number_

The latitude coordinate

* **lng** _number_

The longitude coordinate

##### Headers

```javascript
resource.get(null, {
  headers: { ... }
});
```

* **Mashape key** _string_

This header is used to send data that contains your mashape API key

#### resources.weather

```js
var resource = client.resources.weather;
```

##### GET

Gets the weather forecast for the current day

```js
resource.get().then(function (res) { ... });
```

##### Query Parameters

```javascript
resource.get({ ... });
```

* **Latitude** _number_

The latitude coordinate

* **lng** _number_

The longitude coordinate

##### Headers

```javascript
resource.get(null, {
  headers: { ... }
});
```

* **Mashape key** _string_

This header is used to send data that contains your mashape API key

#### resources.weatherdata

```js
var resource = client.resources.weatherdata;
```

##### GET

Gets a detailed weather object containing a lot of different weather information in a JSON object.

```js
resource.get().then(function (res) { ... });
```

##### Query Parameters

```javascript
resource.get({ ... });
```

* **Latitude** _number_

The latitude coordinate

* **lng** _number_

The longitude coordinate

##### Headers

```javascript
resource.get(null, {
  headers: { ... }
});
```

* **Mashape key** _string_

This header is used to send data that contains your mashape API key



### Custom Resources

You can make requests to a custom path in the API using the `#resource(path)` method.

```javascript
client.resource('/example/path').get();
```

## License

Apache 2.0

---
_Source: https://npm.io/package/mashape-weather-apitest · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
