-
Notifications
You must be signed in to change notification settings - Fork 88
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
Support for idempotent requests. #129
Comments
Up to this point the library has used the Also see the comment I added #130. |
Hi, in a downstream repo (the async stripe) I've provided an implementation for this by forcing all post requests to take an optional value. That way you can determine if you want this particular header or not per request. This is a significant API change, and it does require changing the generation code. I know this is a wanted feature. I can not actively support both the non-async code and the async code, but I am willing to discuss this and figure out a common interface and make the changes as necessary. The biggest problem with adding this to the header struct is that it kind of forces this to be decided per Stripe connection, which means one Stripe connection per API request for different Idempotency calls. That is...a bad idea in my humble opinion. Adding on an optional idempotency request is another way to go about it, but requires a lot of changes. Alternatively, we could add a new method to all post requests that had an Idempotent string. So instead of just create and update you would have create, create_with_idempotent_key and update and update_with_idempotent_key. That would be backward compatible. I should also note that we made some changes to the downstream code generation, so if you haven't absorbed them, I can only get you halfway there with the changes. Mostly just looking for the conversation around this feature so that we could start discussing this feature in earnest. I am using this feature right now and will support. |
Per the docs here https://stripe.com/docs/api/idempotent_requests, it would be quite nice if the various API interaction methods supported a way to set this header. There are a few different ways this value could be set. Method param. Constructor pattern for the requests. We should be able to find a solid path forward.
Hard requirements:
Idempotency-Key
must be controlled/set by the user.The text was updated successfully, but these errors were encountered: