🚌 Open Bus API Client

October 27, 2025 Β· View on GitHub

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

πŸ“’ Get Involved

πŸ“¦ 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,
  Configuration,
  GovernmentTransportationApi,
  GtfsApi,
  HealthApi,
  IssuesApi,
  SiriApi,
  UserCasesApi,
} from '@hasadna/open-bus-api-client'

// URL: https://open-bus-stride-api.hasadna.org.il
export const STRIDE_API_BASE_PATH = process.env.VITE_STRIDE_API
const STRIDE_API_CONFIG = new Configuration({ basePath: STRIDE_API_BASE_PATH })

export const AGGREGATIONS_API = new AggregationsApi(STRIDE_API_CONFIG)
export const GTFS_API = new GtfsApi(STRIDE_API_CONFIG)
export const SIRI_API = new SiriApi(STRIDE_API_CONFIG)
export const USER_CASE_API = new UserCasesApi(STRIDE_API_CONFIG)

// URL: https://open-bus-backend.k8s.hasadna.org.il
const BACKEND_API_BASE_PATH = process.env.VITE_BACKEND_API
const BACKEND_API_CONFIG = new Configuration({ basePath: BACKEND_API_BASE_PATH })

export const HEALTH_API = new HealthApi(BACKEND_API_CONFIG)
export const ISSUES_API = new IssuesApi(BACKEND_API_CONFIG)
export const COMPLAINTS_API = new ComplaintsApi(BACKEND_API_CONFIG)
export const GOVERNMENT_TRANSPORTATION_API = new GovernmentTransportationApi(BACKEND_API_CONFIG)

const stops = await GTFS_API.gtfsRideStopsListGet(...)

console.log(stops);

πŸ“‚ Project Structure

.
β”œβ”€β”€ 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