UNPKG

@hasadna/open-bus-api-client

Version:

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

433 lines (346 loc) 17.7 kB
/* tslint:disable */ /* eslint-disable */ /** * Open Bus Stride API * ### Follow planned and real-time bus statistics 🚌 Welcome to The Public Knowledge Workshop\'s Stride project. We provide usable and accurate data about the Israeli public transportation system. For background on the project and some more detailed documentation and usage guides, see [STRIDE.md](https://github.com/hasadna/open-bus-pipelines/blob/main/STRIDE.md). Looking for a specific use-case? * Take a look at the **user cases** APIs below. * Try one of our existing [jupyter notebooks](https://github.com/hasadna/open-bus-stride-client/blob/main/README.md#using-the-interactive-jupyter-notebooks). * Don\'t see your use-case covered here? Please [open us a ticket](https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fhasadna%2Fopen-bus%2Fissues%2Fnew)! Queries are by default limited to 100 results per query, this limit can be increased up to 500,000 results. Please try to set appropriate query parameters to limit the results to reduce load on our DB. If you do need to get large number of results (up to 500,000) it\'s recommended to use one of these methods: 1. Use HTTP streaming and JSON streaming decoder, this method is most efficient and provide accurate results. Our [Stride Python Client iterate method](https://github.com/hasadna/open-bus-stride-client#usage) uses this method. 2. Use combination of limit / offset parameters to get results by page. This method may be less accurate because it depends on data remaining unchanged between requests. For more advanced usage- * Use **gtfs** for data about the planned lines timetables. * Use **siri** for data about lines real-time * See [Open Bus Stride Data Model](https://github.com/hasadna/open-bus-stride-db/blob/main/DATA_MODEL.md) for description of field and table names. * See [Open Bus Stride ETL Processes](https://github.com/hasadna/open-bus-pipelines/blob/main/STRIDE_ETL_PROCESSES.md) for description of the ETL processes which fetch and aggregate the data. * See [MOT Developer Information](https://www.gov.il/BlobFolder/generalpage/gtfs_general_transit_feed_specifications/he/GTFS%20-%20Developer%20Information.pdf) for description of the source fields as published by the Israel Ministry of Transportation. * * The version of the OpenAPI document: 6909b3db7b8bfa5ac3f3c4aeb3de80d2a2c75810 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import * as runtime from '../runtime'; import type { ErrorResponseModel, GovCitiesGet200Response, GovLinesByLinePostRequest, GovLinesByStationPost200Response, GovLinesByStationPostRequest, GovNotRealNumbersGet200Response, GovOperatorsGet200Response, GovPniyaGet200Response, GovStationsByLinePost200Response, GovStationsByLinePostRequest, GovSubjectsGet200Response, GovTimeGet200Response, GovTrainStationsPostRequest, } from '../models/index'; import { ErrorResponseModelFromJSON, ErrorResponseModelToJSON, GovCitiesGet200ResponseFromJSON, GovCitiesGet200ResponseToJSON, GovLinesByLinePostRequestFromJSON, GovLinesByLinePostRequestToJSON, GovLinesByStationPost200ResponseFromJSON, GovLinesByStationPost200ResponseToJSON, GovLinesByStationPostRequestFromJSON, GovLinesByStationPostRequestToJSON, GovNotRealNumbersGet200ResponseFromJSON, GovNotRealNumbersGet200ResponseToJSON, GovOperatorsGet200ResponseFromJSON, GovOperatorsGet200ResponseToJSON, GovPniyaGet200ResponseFromJSON, GovPniyaGet200ResponseToJSON, GovStationsByLinePost200ResponseFromJSON, GovStationsByLinePost200ResponseToJSON, GovStationsByLinePostRequestFromJSON, GovStationsByLinePostRequestToJSON, GovSubjectsGet200ResponseFromJSON, GovSubjectsGet200ResponseToJSON, GovTimeGet200ResponseFromJSON, GovTimeGet200ResponseToJSON, GovTrainStationsPostRequestFromJSON, GovTrainStationsPostRequestToJSON, } from '../models/index'; export interface GovLinesByLinePostOperationRequest { govLinesByLinePostRequest: GovLinesByLinePostRequest; } export interface GovLinesByStationPostOperationRequest { govLinesByStationPostRequest: GovLinesByStationPostRequest; } export interface GovStationsByLinePostOperationRequest { govStationsByLinePostRequest: GovStationsByLinePostRequest; } export interface GovTrainStationsPostOperationRequest { govTrainStationsPostRequest: GovTrainStationsPostRequest; } /** * */ export class GovernmentTransportationApi extends runtime.BaseAPI { /** * Retrieve list of cities * Get cities */ async govCitiesGetRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GovCitiesGet200Response>> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; let urlPath = `/gov/cities`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => GovCitiesGet200ResponseFromJSON(jsonValue)); } /** * Retrieve list of cities * Get cities */ async govCitiesGet(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GovCitiesGet200Response> { const response = await this.govCitiesGetRaw(initOverrides); return await response.value(); } /** * Retrieve bus lines by specific line ID * Get lines by line ID */ async govLinesByLinePostRaw(requestParameters: GovLinesByLinePostOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GovLinesByStationPost200Response>> { if (requestParameters['govLinesByLinePostRequest'] == null) { throw new runtime.RequiredError( 'govLinesByLinePostRequest', 'Required parameter "govLinesByLinePostRequest" was null or undefined when calling govLinesByLinePost().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; let urlPath = `/gov/lines-by-line`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: GovLinesByLinePostRequestToJSON(requestParameters['govLinesByLinePostRequest']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => GovLinesByStationPost200ResponseFromJSON(jsonValue)); } /** * Retrieve bus lines by specific line ID * Get lines by line ID */ async govLinesByLinePost(requestParameters: GovLinesByLinePostOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GovLinesByStationPost200Response> { const response = await this.govLinesByLinePostRaw(requestParameters, initOverrides); return await response.value(); } /** * Retrieve bus lines available at a specific station * Get bus lines by station */ async govLinesByStationPostRaw(requestParameters: GovLinesByStationPostOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GovLinesByStationPost200Response>> { if (requestParameters['govLinesByStationPostRequest'] == null) { throw new runtime.RequiredError( 'govLinesByStationPostRequest', 'Required parameter "govLinesByStationPostRequest" was null or undefined when calling govLinesByStationPost().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; let urlPath = `/gov/lines-by-station`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: GovLinesByStationPostRequestToJSON(requestParameters['govLinesByStationPostRequest']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => GovLinesByStationPost200ResponseFromJSON(jsonValue)); } /** * Retrieve bus lines available at a specific station * Get bus lines by station */ async govLinesByStationPost(requestParameters: GovLinesByStationPostOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GovLinesByStationPost200Response> { const response = await this.govLinesByStationPostRaw(requestParameters, initOverrides); return await response.value(); } /** * Retrieve not real numbers list for testing * Get not real numbers (Testing) */ async govNotRealNumbersGetRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GovNotRealNumbersGet200Response>> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; let urlPath = `/gov/not-real-numbers`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => GovNotRealNumbersGet200ResponseFromJSON(jsonValue)); } /** * Retrieve not real numbers list for testing * Get not real numbers (Testing) */ async govNotRealNumbersGet(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GovNotRealNumbersGet200Response> { const response = await this.govNotRealNumbersGetRaw(initOverrides); return await response.value(); } /** * Retrieve list of operators * Get operators */ async govOperatorsGetRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GovOperatorsGet200Response>> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; let urlPath = `/gov/operators`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => GovOperatorsGet200ResponseFromJSON(jsonValue)); } /** * Retrieve list of operators * Get operators */ async govOperatorsGet(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GovOperatorsGet200Response> { const response = await this.govOperatorsGetRaw(initOverrides); return await response.value(); } /** * Retrieve pniya list for vehicles * Get Pniya (Vehicles type) */ async govPniyaGetRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GovPniyaGet200Response>> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; let urlPath = `/gov/pniya`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => GovPniyaGet200ResponseFromJSON(jsonValue)); } /** * Retrieve pniya list for vehicles * Get Pniya (Vehicles type) */ async govPniyaGet(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GovPniyaGet200Response> { const response = await this.govPniyaGetRaw(initOverrides); return await response.value(); } /** * Retrieve stations for a specific bus line * Get stations by line */ async govStationsByLinePostRaw(requestParameters: GovStationsByLinePostOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GovStationsByLinePost200Response>> { if (requestParameters['govStationsByLinePostRequest'] == null) { throw new runtime.RequiredError( 'govStationsByLinePostRequest', 'Required parameter "govStationsByLinePostRequest" was null or undefined when calling govStationsByLinePost().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; let urlPath = `/gov/stations-by-line`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: GovStationsByLinePostRequestToJSON(requestParameters['govStationsByLinePostRequest']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => GovStationsByLinePost200ResponseFromJSON(jsonValue)); } /** * Retrieve stations for a specific bus line * Get stations by line */ async govStationsByLinePost(requestParameters: GovStationsByLinePostOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GovStationsByLinePost200Response> { const response = await this.govStationsByLinePostRaw(requestParameters, initOverrides); return await response.value(); } /** * Retrieve subject types for vehicles from the government list * Get subject types for vehicles */ async govSubjectsGetRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GovSubjectsGet200Response>> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; let urlPath = `/gov/subjects`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => GovSubjectsGet200ResponseFromJSON(jsonValue)); } /** * Retrieve subject types for vehicles from the government list * Get subject types for vehicles */ async govSubjectsGet(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GovSubjectsGet200Response> { const response = await this.govSubjectsGetRaw(initOverrides); return await response.value(); } /** * Retrieve current server time * Get current time */ async govTimeGetRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GovTimeGet200Response>> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; let urlPath = `/gov/time`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => GovTimeGet200ResponseFromJSON(jsonValue)); } /** * Retrieve current server time * Get current time */ async govTimeGet(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GovTimeGet200Response> { const response = await this.govTimeGetRaw(initOverrides); return await response.value(); } /** * Retrieve train stations by station type 7 - Israel Train 4 - Kfir Light Train 13 - Tevel Ligh Train * Get train stations */ async govTrainStationsPostRaw(requestParameters: GovTrainStationsPostOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<GovStationsByLinePost200Response>> { if (requestParameters['govTrainStationsPostRequest'] == null) { throw new runtime.RequiredError( 'govTrainStationsPostRequest', 'Required parameter "govTrainStationsPostRequest" was null or undefined when calling govTrainStationsPost().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; let urlPath = `/gov/train-stations`; const response = await this.request({ path: urlPath, method: 'POST', headers: headerParameters, query: queryParameters, body: GovTrainStationsPostRequestToJSON(requestParameters['govTrainStationsPostRequest']), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => GovStationsByLinePost200ResponseFromJSON(jsonValue)); } /** * Retrieve train stations by station type 7 - Israel Train 4 - Kfir Light Train 13 - Tevel Ligh Train * Get train stations */ async govTrainStationsPost(requestParameters: GovTrainStationsPostOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<GovStationsByLinePost200Response> { const response = await this.govTrainStationsPostRaw(requestParameters, initOverrides); return await response.value(); } }