passport-parking

1.2.0 • Public • Published

passport-parking

npm version

This library provides an unofficial wrapper around Passport's parking APIs. These APIs provide users with the ability to look up parking rules and create & pay for authorized parking sessions in many US cities.

Getting started

You must request access credentials from Passport here. Once registered, you will receive a client_id and a client_secret.

Once you have credentials, install this library into your project with:

npm i passport-parking

To make a simple zone lookup request in your application:

 
import passport from 'passport-parking'
 
const client = new passport.Client();
 
// client.auth() is only required prior to the first request; the access token
// will be cached for future requests.
client.auth({
    client_id: YOUR_CLIENT_ID,
    client_secret: YOUR_CLIENT_SECRET,
}).then(async () => {
    const zones = await client.get_zones({
        zone_number: 39606,
        latitude: 30.283211,
        longitude: -97.743011,
        radius: 25,
    });
 
    // Print all zones within 25m of the specified position with the specified zone number.
    // Zone numbers are typically listed on on-street signage.
    console.log(zones);
});

Full documentation

The following methods are available in this library; documentation is available on Passport's developer portal.

Authorize a client

Documentation: POST /oauth/token

client.auth({
    client_id: YOUR_CLIENT_ID,
    client_secret: YOUR_CLIENT_SECRET,
})

Generate an access token; this operation must be performed prior to making any other requests, and requires access credentials (username and password). Access tokens will be cached with the client once retrieved.

Retrieve zone information

Documentation: GET /zones

authorized_client.get_zones({
    zone_number: 123,
    latitude: 30.283211,
    longitude: -97.743011,
    radius: 25,
})

Retrieves a list of zones that match the provided criteria. Response matches format described in developer portal.

Retrieve rate information

Documentation: GET /rates

authorized_client.get_rates({
    zone_id: '75067b92-eee5-4816-b0e9-444ae00a8bc1',
    start_time: '2020-06-08T14:05:00Z',
    vehicle_plate: 'TEST',
    vehicle_state: 'NC',
    vehicle_country: 'US',
})

Coming soon

  • Create quotes
  • Create sessions
  • Retrieve existing sessions
  • Generate single-use payment tokens

Readme

Keywords

none

Package Sidebar

Install

npm i passport-parking

Weekly Downloads

0

Version

1.2.0

License

ISC

Unpacked Size

18 kB

Total Files

16

Last publish

Collaborators

  • anyweez