intercom / intercom-go

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

Users.FindByEmail > unmarshallTouser() method error. #125

Closed msueiro closed 3 years ago

msueiro commented 4 years ago

There is a bug when Users.FindByEmail method response unmarshall is called .

Version info

Expected behavior

I'm expecting to receive a User{} initialized with all the data collected from api.httpClient.Get("/users", params) (user_api.go line 55)

Actual behavior

In this case when I find by email the api response is a UserList{} instead a User{}. The unmarshallToUser() method is expecting a []byte that represents the User{} struct but the input in this case is an UserList{}

The result is that a receive a User{} empty struct.

Steps to reproduce

  1. Call Users.FindByEmail method with a valid email
  2. The response will be an empty User{} struct
  3. If you debug the method the []byte response will be an UserList{}
lloydliyu commented 3 years ago

Hey @msueiro :wave:

The GO SDK is currently only compatible with version 1.0 of the Intercom API. Since version 1.1 of the API, the API will return a list of users who match that email address, which the SDK isn't expecting.

This should however still work if the App is set to use version 1.0 of the API. If you need any help adjusting the version within the developer hub, I'd recommend reaching out to the support team using the Messenger at https://intercom.com.

Closing this out as a duplicate to https://github.com/intercom/intercom-go/issues/130