Skip to content

Latest commit

 

History

History
145 lines (95 loc) · 5.52 KB

README.md

File metadata and controls

145 lines (95 loc) · 5.52 KB


use-here-api

made-for-react code style: prettier GitHub release GitHub contributors PRs Welcome License: MIT

Collection of convenient React Hooks which lets you easily use HERE RESTful API services.


npm i use-here-api
or
yarn add use-here-api


Table of Contents

Overview

use-here-api exposes convenient hooks which lets you easily integrate HERE RESTful API services in your React.js projects.


Documentation

Usage

Prior using any of the exposed hook you should provide credentials to authenticate your requests.

As noted in the Authentication and Authorization Developer Guide there are three supported authentication credential types:

  • API Key Credentials

    import { configureAuthentication } from '@cloudpower97/use-here-api';
    
    configureAuthentication({
      apiKey: '...'
    });
  • OAuth 2.0 Token Credentials

    import { configureAuthentication } from '@cloudpower97/use-here-api';
    
    configureAuthentication({
      token: '...'
    });
  • APP CODE Credentials

    import { configureAuthentication } from '@cloudpower97/use-here-api';
    
    configureAuthentication({
      app_id: '...',
      app_code: '...',
    });

With the introduction of OAuth 2.0 Token and API Key authentication types there are also new domain names for HERE services.

The domain names used with APPCODE Credentials and the new domain names to be used with either OAuth 2.0 Token or API Key Credentials are different.

However, once configured properly, use-here-api will automatically use the correct domain name to be used for the respective HERE services.

Available Hooks

At the moment the following hooks are available:

  • Geocoding and Search

    • useForwardGeocoding - Submit an address to request the corresponding geocoordinates. Addresses may use structured input or free-form search strings with complete or partial address information. The more detailed the address you submit, the higher the potential match accuracy.
    • useReverseGeocoding - Submit a geocoordinate and an optional radius to request the corresponding address.
    • useAutocomplete - Get better search suggestions for your addresses with fewer keystrokes.
  • useWeather - Give insights into real-time weather forecasts, alerts, and astronomical info for any location.

  • Places

    • usePlacesAutosuggest - Provides you a lists of suggested search terms, instants results and refined search links related to a given (partial) search term and location context. This is used to help users save time, iterate on their searches, and get the results.

Contributing

Yes please!

Pull requests and reporting an issue are always welcome :D

Development

Fork and clone the repo:

git clone [email protected]:your-username/use-here-api.git

Create a branch for the feature/fix:

git checkout -b feat:new-great-idea

Once you are done, push to your fork and submit a pull request.

And remember,

Commit Guidelines

We follow the Angular Commit Guidelines.

Refer to their documentation for more information.

Note: If you DON'T follow the Angular Commit Guidelines you will not be able to commit your changes.