Skip to content

hasadna/open-bus-api-client

Repository files navigation

🚌 Open Bus API Client

A TypeScript client library for interacting with the Open-Bus API.

📢 Get Involved

🔗 Related Projects

📦 Installation

# Instal Genetae Depencdy
npm install

# Instal NPM Package
npm install @hasadna/open-bus-api-client

🚀 How to Generate & Publish the Client

Before publishing, ensure the NODE_AUTH_TOKEN environment variable is set. This is required to authenticate with the npm registry.

✅ Steps

# 1. Download the latest OpenAPI schema
npm run download

# 2. Generate the client code from OpenAPI spec
npm run generate

# 3. Publish the package to npm
npm run publish

⚠️ NODE_AUTH_TOKEN must be available in your environment (e.g., .env, terminal, or CI/CD pipeline).

🛠️ Usage Example

import {
  AggregationsApi,
  ComplaintsApi,
  GovernmentTransportationApi,
  GtfsApi,
  HealthApi,
  IssuesApi,
  SiriApi,
} from "@hasadna/open-bus-api-client";

// URL: https://open-bus-stride-api.hasadna.org.il
const Aggregations = AggregationsApi("URL");
const Gtfs = GtfsApi("URL");
const Siri = SiriApi("URL");

// URL: https://open-bus-backend.k8s.hasadna.org.il
const Health = HealthApi("URL");
const Issues = IssuesApi("URL");
const Complaints = ComplaintsApi("URL");
const GovernmentTransportation = GovernmentTransportationApi("URL");

const stops = await Gtfs.getBusStops();

console.log(stops);

📂 Project Structure

.
├── client/                # Generated client code
├── openapi-templates/     # README templets
├── scripts/               # Custom JS scripts
├── config.json            # Open-API generator config
├── openapi-merge.json     # Open-API merge cli config
├── openapitools.json      # Open-API generator cli config
└── package.json           # NPM config

Contributors 3

  •  
  •  
  •