intercom / intercom-go

Go Bindings For Intercom
https://developers.intercom.io/reference
Other
71 stars 80 forks source link

Wrong Type for intercom.SegmentPersonType #39

Closed f2prateek closed 8 years ago

f2prateek commented 8 years ago

Version info

No Error when retrieving segment information.

Actual behaviour

I'm seeing json: cannot unmarshal string into Go value of type intercom.SegmentPersonType

Steps to reproduce

  1. Call intercomClient.Segments.List()

    Logs

N/A

Verified with curl that the person_type is a string, not int: https://cloudup.com/cP7e52yObYM

josler commented 8 years ago

Hi @f2prateek - I can't reproduce this here on v2/, and added a test in https://github.com/intercom/intercom-go/pull/40

Can you provide more detail/logs with user data elided where this is happening? Or contact our team through Intercom.

f2prateek commented 8 years ago

That's weird I can see it pretty reliably in prod. Maybe I'm on a different version? Here's what I have in my godeps.

{
            "ImportPath": "gopkg.in/intercom/intercom-go.v2",
            "Comment": "v1.0.0-29-g32eaa76",

I've just changed the type to string in our fork for now so I can't provide a test case, sorry.

It does seem to be that what you have shouldn't work, unless you're doing some custom JSON unmarshalling? http://play.golang.org/p/h4709MOTRq

josler commented 8 years ago

Figured it out. The test I added ignored the error being returned and the value defaulted to 0. I've just removed the concrete type and reverted to string. Fixed now, thanks!