clearbit / clearbit-go

Go bindings for Clearbit
MIT License
12 stars 11 forks source link

Enrichment failing #9

Closed philipithomas closed 7 years ago

philipithomas commented 7 years ago

Getting this error in production:

json: cannot unmarshal number into Go struct field .id of type string,

It's stopping this library from completing enrichment.

philipithomas commented 7 years ago

Github ID appears to be an integer from your API, but it is a string in the user struct

philipithomas commented 7 years ago

Oddly, the user twitter ID is an integer, and the company twitter ID is a string. That doesn't make sense @maccman :-P

harlow commented 7 years ago

@philipithomas nice catch. Agree those should def be consistent.

The integer representation of the unique identifier for this Tweet. This number is greater than 53 bits and some programming languages may have difficulty/silent defects in interpreting it. Using a signed 64 bit integer for storing this identifier is safe. Use id_str for fetching the identifier to stay on the safe side. See Twitter IDs, JSON and Snowflake .

maccman commented 7 years ago

Oops - should def be using strings for both.

philipithomas commented 7 years ago

For the future, the is the best way I've seen for turning JSON into Go structs:

https://mholt.github.io/json-to-go/

philipithomas commented 7 years ago

Might be good to set up some basic integration testing on this library because Go is tricky with JSON integrations. Basically, have it query API and assert no error. It would be best to run this daily or so (which TravisCI could do)

philipithomas commented 7 years ago

following and followers for Twitter also incorrect type - fix incoming

philipithomas commented 7 years ago

Does Company no longer return a URL?