Coder Social home page Coder Social logo

clearbit-go's People

Contributors

davidlumley avatar dcadenas avatar ddollar avatar deankarn avatar gregors avatar harlow avatar heyweswu avatar maccman avatar mattatcha avatar ofpiyush avatar philipithomas avatar rebeccaryang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

clearbit-go's Issues

Enrichment API support

I was looking to leverage the enrichment API but it looks like you don't support it through the golang API?

Add logging

Maybe something like

clearbit.NewClient(clearbit.WithLogging(logger))

Set user agent string

You might find it helpful to set (or allow to be set) a user agent for each version of the library, besides the default ("Go-http-client/1.1")

Company.marketCap casting int to string field

I'm getting this error in production:

screen shot 2017-12-12 at 11 07 14 am

Simple fix would be converting the marketCap string field to an int. However, I'm concerned that the API isn't returning a consistent type.

@davidlumley @mattatcha - can you confirm the API return type? Until this is fixed, enrichment is erroring in our app while chewing through our quota . . .

Support per-request timeout

At the moment it's difficult to configure the timeout for each request. Ideally we could pass a context.Context to the request which would allow us to cancel a request when it is made.

Add mocks for backend or demo API

I can't check the test results without a clearbit key. There should be either:

  • a demo API the clients can call and receive useless data, with the right structure though.
    or
  • a mock backend in the tests

PersonCompany unmarshalling error

I'm getting this error while unmarshalling a company right now:

json: cannot unmarshal string into Go struct field .estimatedAnnualRevenue of type int

Add response code to errors

Debugging clearbit errors in our code has become a nightmare. This is what it looks like in our logs:

ERROR: clearbit:

Manually debugging, I've realized that this is because the API is returning codes like 404 or 422.

Internally, we end up wrapping the errors with github.com/pkg/errors and having to return different types of errors:

	res, resp, err := s.ClearbitClient.Person.FindCombined(clearbit.PersonFindParams{
		Email: r.Email,
	})

	if resp.StatusCode == 202 {
		// Deferred
		return r, errTryAgainLater
	} else if resp.StatusCode == 404 {
		return r, errEmailNotFound
	} else if resp.StatusCode == 422 {
		return r, errInvalid
	} else if err != nil {
		return r, errors.Wrap(err, fmt.Sprintf("code %d", r.StatusCode))
	}

I propose that this package either (1) has named error types that it returns (e.g. ErrNotFound), or that it at least wraps all errs with the API response status code.

Enrichment failing

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.