lajosbencz/here-php

本文档描述了地理编码和搜索API。

v0.2.2 2021-02-18 15:00 UTC

This package is auto-updated.

Last update: 2024-09-18 23:11:29 UTC


README

本文档描述了地理编码和搜索API。

安装和用法

需求

PHP 7.2及以后版本。

Composer

要使用Composer安装绑定,请在composer.json中添加以下内容:

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

然后运行composer install

手动安装

下载文件并包含autoload.php

<?php
require_once('/path/to/here-php/vendor/autoload.php');

入门指南

请按照安装过程进行操作,然后运行以下命令

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



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

// Configure Bearer (JWT) authorization: bearerAuth
$config = Here\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN');


$apiInstance = new Here\Api\DefaultApi(
    // 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
);
$q = Berlin Pariser 20; // string | Enter a free-text query  Examples:  * `ber`, `berl`, `berli`, ...  * `berlin+p`, `berlin+paris`, `berlin+parise`, ...  * `berlin+pariser+20`   _Note: Whitespace, urls, email addresses, or other out-of-scope queries will yield no results._
$at = 'at_example'; // string | Specify the center of the search context expressed as coordinates.  Format: `{latitude},{longitude}`  Type: `{decimal},{decimal}`  Example: `-13.163068,-72.545128` (Machu Picchu Mountain, Peru)
$in = 'in_example'; // string | Search within a geographic area. This is a hard filter. Results will be returned if they are located within the specified area.  A geographic area can be   * a country (or multiple countries), provided as comma-separated [ISO 3166-1 alpha-3](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) country codes     The country codes are to be provided in all uppercase.     Format: `countryCode:{countryCode}[,{countryCode}]*`     Examples:     * `countryCode:USA`     * `countryCode:CAN,MEX,USA`
$limit = 5; // int | Maximum number of results to be returned.
$types = array('types_example'); // string[] | BETA: Limit the result items to the specified types. Currently supported values of the type filter for Autocomplete:       | * `city` - restricting results to result type `locality` and locality type `city`       | * `postalCode` - restricting results to result type `locality` and locality type `postalCode`,       | * `area` - restricting results to result types: `locality` or `administrativeArea` including all the sub-types       |       |Provide one of the supported values or a comma separated list.       |       |
$lang = 'lang_example'; // string | Select the preferred response language for result rendering from a list of BCP47 compliant Language Codes. The autocomplete endpoint tries to detect the query language based on matching name variants and then chooses the same language for the response.  Therefore the end-user can see and recognize all the entered terms in the same language as in the query. The specified preferred language is used only for not matched address tokens and for matched address tokens in case of ambiguity
$x_request_id = 'x_request_id_example'; // string | Used to correlate requests with their responses within a customer's application, for logging and error reporting.  Format: Free string, but a valid UUIDv4 is recommended.

try {
    $result = $apiInstance->autocompleteGet($q, $at, $in, $limit, $types, $lang, $x_request_id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->autocompleteGet: ', $e->getMessage(), PHP_EOL;
}

API端点

所有URI都是相对于https://

模型

授权

apiKey

  • 类型: API密钥
  • API密钥参数名: apiKey
  • 位置: URL查询字符串

bearerAuth

  • 类型: Bearer身份验证(JWT)

测试

要运行测试,请使用

composer install
vendor/bin/phpunit

作者

关于此包

此PHP包是由OpenAPI Generator项目自动生成的

  • API版本: 1.59
  • 构建包: org.openapitools.codegen.languages.PhpClientCodegen