GravityDeficient / SwaggerClient-php-Wunderground

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SwaggerClient-php

APIs for Personal Weather Station Contributors. This is an unofficial openAPI document for working with The Weather Company (Weather Underground) API data.

This PHP package is automatically generated by the Swagger Codegen project:

  • API version: 0.1.0
  • Build package: io.swagger.codegen.languages.PhpClientCodegen

Requirements

PHP 5.5 and later

Installation & Usage

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com//.git"
    }
  ],
  "require": {
    "/": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/SwaggerClient-php/vendor/autoload.php');

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: APIKeyQueryParam
$config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('apiKey', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('apiKey', 'Bearer');

$apiInstance = new Swagger\Client\Api\PWSObservationsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
$station_id = "station_id_example"; // string | The PWS station ID
$units = "units_example"; // string | Unit type
$format = "json"; // string | 
$numeric_precision = "numeric_precision_example"; // string | Optional parameter.  Set to ‘decimal’ to ensure data is returned in decimal format when needed. Will return integers if this value is not used.

try {
    $result = $apiInstance->observationsAllOneDay($station_id, $units, $format, $numeric_precision);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling PWSObservationsApi->observationsAllOneDay: ', $e->getMessage(), PHP_EOL;
}

?>

Documentation for API Endpoints

All URIs are relative to https://api.weather.com/v2/pws

Class Method HTTP request Description
PWSObservationsApi observationsAllOneDay GET /observations/all/1day
PWSObservationsApi observationsCurrent GET /observations/current

Documentation For Models

Documentation For Authorization

APIKeyQueryParam

  • Type: API key
  • API key parameter name: apiKey
  • Location: URL query string

Author

About


Languages

Language:PHP 98.5%Language:Shell 1.5%