Easy to use, minimal, and simple implementation of the Transitland v2 REST API for fetching GTFS, GTFS Realtime, GBFS, and MDS data in Javascript and/or Typescript.
Currently, the project only provides types for JSON format responses. The Transitland REST API supports GeoJSON and GeoJSONL formats, thus, this project should supply types suitable for these formats.
To efficiently support these formats, #2 should probably be completed before any effort is made on this issue.
"Feeds" and "Feed versions" support a "Downloading source GTFS" endpoint. This endpoint returns data in a format unlike any other endpoint in the Transitland ecosystem, thus, likely needs its own function within the client.
Currently, types are generated by hitting the REST API pseudo-randomly and using the responses to generate types. This is extremely inefficient (both in time and use of rate limits) and does not cover every response case,
The REST API uses GraphQL internally which means these schemas should be identical to the REST client. Similar to the transitland-gql-client project, this project should automatically derive types on any schema update.
Currently, the design of Client is incredibly basic. This makes usage of this library very easy and straightforward to understand. However, its current implementation constrains too much. For example, fetch only supports JSON-like responses so endpoints like "Downloading source GTFS" (#1) and supporting PNG formats (#4) are impossible.
One potential design would be to make "request functions". For example:
const{ feeds }=awaitclient.fetch(feeds());
This would call exactly to /feeds with no query parameters, and the function would automatically supply (and validate) the response type. That would make calls like this possible assuming an adequate implementation of response handling with these functions: