# ptv-api-signature

> Assist with PTV Api path signature generation

Latest version **1.0.7** (published 2019-03-25) · ISC license · 0 weekly downloads

## Install

```sh
npm install ptv-api-signature
pnpm add ptv-api-signature
yarn add ptv-api-signature
bun add ptv-api-signature
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2019-03-25 |
| First published | 2019-03-02 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | gkweb |
| Maintainers | gkweb |
| Keywords | PTV, myki, metro, melbourne, metro, Public, transport, PT, Melbourne, Tram |

## Links

- npm: https://www.npmjs.com/package/ptv-api-signature
- Repository: https://github.com/gkweb/ptv-api-signature
- Homepage: https://github.com/gkweb/ptv-api-signature#readme
- Issues: https://github.com/gkweb/ptv-api-signature/issues
- npm.io page: https://npm.io/package/ptv-api-signature

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 1.0.7 (latest) — 2019-03-25
- 1.0.6 — 2019-03-03
- 1.0.4 — 2019-03-03
- 1.0.3 — 2019-03-03
- 1.0.2 — 2019-03-03
- 1.0.1 — 2019-03-02
- 1.0.0 — 2019-03-02

## README

![Build](https://travis-ci.org/gkweb/ptv-api-signature.svg?branch=master "Logo Title Text 1")

# PTV API signature generator

Hacked together a method for the API signature generation only

If you are after a full fledged swagger client implementation see [ptv-api npm](https://www.npmjs.com/package/ptv-api)

## Requirements

First obtain a dev id and key from PTV [here](https://www.ptv.vic.gov.au/footer/data-and-reporting/datasets/ptv-timetable-api/)

If using in the browser - Please consider that you will need to support the crypto nodejs module. A polyfil exists [here](https://www.npmjs.com/package/webcrypto)

## Example usage

```javascript
const ptvSig = require ('ptv-api-signature')
const BASE_URL = 'http://timetableapi.ptv.vic.gov.au'
const DEV_ID  =  'REPLACE'
const DEV_KEY =  'REPLACE1-1111-1111-1111-111111111111'

/**
* Search for stops based on search term
* @param {String} search_term
*/
const getStopsBySearchTerm = (search_term)  =>  {
return fetch(`${BASE_URL}${ptvSig.pathWithSig(`/v3/search/${search_term.toLowerCase()}`,  [{ name:  'route_types', value:  '0'  }], DEV_ID, DEV_KEY)}`).then(res  =>  res.json())
}

getStopsBySearchTerm('Balaclava').then(d => {
  console.log(d)
})

```

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