# 🚌 Open Bus API Client

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

## 📢 Get Involved

- 💬 For general help and system updates, join the Hasadna Slack: [#open-bus channel](https://join.slack.com/t/hasadna/shared_invite/zt-167h764cg-J18ZcY1odoitq978IyMMig)
- 🐞 Found a bug or have a feature request? [Open an issue](https://github.com/hasadna/open-bus-map-search/issues/new)
- 🤝 Want to contribute? See our [contributing guidelines](https://github.com/hasadna/open-bus-pipelines/blob/main/CONTRIBUTING.md)

## 🔗 Related Projects

- [🗺️ Open Bus Map Search (Client App)](https://github.com/hasadna/open-bus-map-search) - [Live Website](https://open-bus-map-search.hasadna.org.il/dashboard)
- [📦 Open Bus API Client (API Package Generator)](https://github.com/hasadna/open-bus-api-client)
- [🌐 Open Bus Stride API (REST)](https://github.com/hasadna/open-bus-stride-api) – [API Docs](https://open-bus-stride-api.hasadna.org.il/docs)
- [🌐 Open Bus Backend (REST)](https://github.com/hasadna/open-bus-backend) – [API Docs](https://open-bus-backend.k8s.hasadna.org.il/docs)

## 📦 Installation

```bash
npm install @hasadna/open-bus-api-client
````

## 🔧 Usage

```ts
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);
```