Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explore Alternative Client Designs #5

Open
danthonywalker opened this issue Nov 12, 2023 · 0 comments
Open

Explore Alternative Client Designs #5

danthonywalker opened this issue Nov 12, 2023 · 0 comments

Comments

@danthonywalker
Copy link
Contributor

danthonywalker commented Nov 12, 2023

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 } = await client.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:

const stream = await client.fetch(feeds({ format: "PNG" }));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant