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

Add if-match (and other optional headers) to create object #40

Open
emmaling27 opened this issue Oct 15, 2020 · 4 comments
Open

Add if-match (and other optional headers) to create object #40

emmaling27 opened this issue Oct 15, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@emmaling27
Copy link
Contributor

It would be useful for optional headers (especially if-match) to be implemented so that logic can be on the server-side. Ideally, all optional headers should be accessible in this library to support full functionality of Google Cloud's JSON API. I just happen to need if-match and if-none-match for my use case.

@ThouCheese ThouCheese added the enhancement New feature or request label Oct 16, 2020
@ThouCheese
Copy link
Owner

Sure this seems like a reasonable enhancement. Two issues come to mind about implementing this, namely that it requires a breaking change to almost every function in the library if we want to do something like Bucket::read("mybucket", hdrs). Secondly, to make this safe to use for the end user, it requires that for each function that accepts headers, a struct is defined that contains the headers (and query parameters) that are applicable to that endpoint.

@rrooij
Copy link

rrooij commented Apr 7, 2021

I would love this as well as I need if-match.

@ThouCheese It won't have to be a breaking change. We can also provide new functions like Bucket::read_with_headers and the like. We don't have to break the existing API for this.

@ThouCheese
Copy link
Owner

Sure but the downside would then be that we have to duplicate almost all functions: Bucket::create_with_headers, Bucket::update_with_headers, ... Maybe that we can create a function like Client::set_headers, with the new 0.9 release however.

@pjenvey
Copy link

pjenvey commented Feb 9, 2022

If you're breaking the API at some point I recommend using the builder pattern for calls. It takes more effort to implement but is more resilient in the long term, allowing the API to expand in the future without breaking the contract.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants