-
Notifications
You must be signed in to change notification settings - Fork 460
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
Event.GetObjValue cannot handle arrays #503
Comments
Hi @timendez! I haven't had time to dig properly, but from a quick glance at the code I think that you're correct and the cc @brandur-stripe to take a look and maybe open a quick PR if it's easy to implement :) |
Hm, the implementation would be easy, but a potential problem is that |
can you implement it where |
Modifies `event.GetObjValue` so that when specifying additional keys to descend into, it's now possible to specify integer keys if the target object is a slice of type `[]interface{}` (which should be what anything coming out of event data deserializes to). I initially expressed some concern about expanding this interface, but given that the previous behavior would have been an outright panic, I changed my mind and don't think it's too bad to add support for this given that it's been requested by a user. Fixes #503.
Awesome, thank you man 👍 |
Hi, I've spoken with Stripe support and the IRC channel over the course of a couple days, and we've come to the conclusion that it's not a bug, just not implemented yet. If that's not the case please let me know otherwise!
On the invoice created event, I'm trying to access the plan ID, but am having trouble because I'm not sure how to drill down into an array with
GetObjValue
.planID := event.GetObjValue("lines", "data[0]", "plan", "id")
would be great, or"data", "0"
. Upon more research I've found that not every object indata
will have aplan
key, but I think this is a useful feature regardless.Let me know if you have any plans to implement this, or if there is a better way to go about dealing with arrays located within events.
Thanks!
The text was updated successfully, but these errors were encountered: