Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hafas-rest-api-client

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hafas-rest-api-client

An API client for hafas-rest-api endpoints.

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

hafas-rest-api-client

A client for hafas-rest-api endpoints, e.g. for the *.transport.rest APIs.

npm version ISC-licensed minimum Node.js version support me via GitHub Sponsors chat with me on Twitter

Installing

npm install hafas-rest-api-client

Usage

import createClient from 'hafas-rest-api-client'

const vbbClient = createClient('https://v5.vbb.transport.rest', {
	// Please pass in a User-Agent header to let the providers of the API endpoint understand how you're using their API.
	userAgent: 'my awesome project',
})

const res = await vbbClient.journeys('900000003201', '900000024101', {results: 1})

hafas-rest-api-client is a client for hafas-rest-api@3 APIs. Check their individual API docs for all supported parameters.

The response objects have special Symbol fields for meta information:

const {
	RESPONSE, HEADERS,
	SERVER_TIMING, CACHE,
} = require('hafas-rest-api-client')

console.log('response', res[RESPONSE]) // Fetch API Response object
console.log('response headers', res[HEADERS]) // Fetch API Headers object
console.log('server timing', res[SERVER_TIMING]) // value of the Server-Timing response header
console.log('server cache', res[CACHE]) // value of the X-Cache response header

Contributing

If you have a question or have difficulties using hafas-rest-api-client, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to the issues page.

Keywords

FAQs

Package last updated on 28 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc