clearbit

package module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2016 License: MIT Imports: 6 Imported by: 3

README

clearbit

GoDoc Reference Circle CI

clearbit is a client library and command-line interface for the Clearbit API.

Use it in your project:

import "github.com/thoughtbot/clearbit"

Or from the command-line:

go get -u github.com/thoughtbot/clearbit/cmd/clearbit

Usage from the command line

To use the clearbit command, first store your Clearbit API key in ~/.clearbit_key.

Then use the subcommands to interact with the different Clearbit API endpoints.

Get detailed information about a person from their email address:

$ clearbit enrich b@thoughtbot.com

Get data about a company from its domain:

$ clearbit enrich thoughtbot.com

Get contact details for a company:

$ clearbit prospect -title CEO -title COO thoughtbot.com

Since each command produces JSON as its output, the clearbit command pairs nicely with jq for processing.

Get company copy-pasteable company contacts:

$ clearbit prospect thoughtbot.com |
    jq '.[] | "\(.name.fullName) <\(.email)>"'

Run clearbit help [subcommand] for details on additional options.

Usage from Go

The clearbit package exposes types for interacting with the Clearbit API and the data it returns.

import "github.com/thoughtbot/clearbit"

client, _ := clearbit.NewClient(os.Getenv("CLEARBIT_API_KEY"))

bernerd, _ := client.EnrichPerson("b@thoughtbot.com")
thoughtbot, _ := client.EnrichCompany(bernerd.Employment.Domain)

prospects, _ := client.Prospect(clearbit.ProspectQuery{
  Domain: "thoughtbot.com",
  Titles: []string{"CEO", "CTO", "VP"},
})

for _, prospect := range prospects {
  prospectDetails, _ := client.EnrichPerson(prospect.Email)
}

For detailed API documentation, read the go docs.

Contributing

We love pull requests from everyone. By participating in this project, you agree to abide by the thoughtbot code of conduct.

We expect everyone to follow the code of conduct anywhere in thoughtbot's project codebases, issue trackers, chatrooms, and mailing lists.

License

clearbit is Copyright (c) 2016 thoughtbot, inc. It is free software, and may be redistributed under the terms specified in the LICENSE file.

About

clearbit is maintained by Bernerd Schaefer.

thoughtbot

clearbit is maintained and funded by thoughtbot, inc. The names and logos for thoughtbot are trademarks of thoughtbot, inc.

We love open source software! See our other projects or hire us to help build your product.

Documentation

Index

Constants

View Source
const (
	ProspectURL               = "https://prospector.clearbit.com/v1/people/search"
	EnrichCompanyStreamingURL = "https://company-stream.clearbit.com/v2/companies/find"
	EnrichPersonStreamingURL  = "https://person-stream.clearbit.com/v2/people/find"
)

These are the valid services and resources of the Clearbit API.

Variables

This section is empty.

Functions

This section is empty.

Types

type AboutMeProfile

type AboutMeProfile struct {
	Avatar string `json:"avatar"`
	Bio    string `json:"bio"`
	Handle string `json:"handle"`
}

AboutMeProfile describes a person's About.me profile.

type AngelListProfile

type AngelListProfile struct {
	Avatar    string `json:"avatar"`
	Bio       string `json:"bio"`
	Blog      string `json:"blog"`
	Followers int    `json:"followers"`
	Handle    string `json:"handle"`
	ID        int    `json:"id"`
	Site      string `json:"site"`
}

AngelListProfile describes a person or company's AngelList profile.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client provides access to the Clearbit API.

func NewClient

func NewClient(apiKey string, httpClient *http.Client) *Client

NewClient initializes a Clearbit API client with the provided apiKey.

If httpClient is nil, http.DefaultClient will be used.

func (*Client) EnrichCompany

func (c *Client) EnrichCompany(domain string) (*Company, error)

EnrichCompany finds a company by its domain and returns detailed information about it.

func (*Client) EnrichPerson

func (c *Client) EnrichPerson(email string) (*Person, error)

EnrichPerson finds a person by their email address and returns detailed information about them.

func (*Client) Prospect

func (c *Client) Prospect(q ProspectQuery) ([]*Prospect, error)

Prospect finds a company by its domain name and returns basic information about the people working there.

type Company

type Company struct {
	Description   string         `json:"description"`
	Domain        string         `json:"domain"`
	DomainAliases []string       `json:"domainAliases"`
	EmailProvider bool           `json:"emailProvider"`
	FoundedDate   string         `json:"foundedDate"`
	Geo           Geo            `json:"geo"`
	ID            string         `json:"id"`
	LegalName     string         `json:"legalName"`
	Location      string         `json:"location"`
	Metrics       CompanyMetrics `json:"metrics"`
	Name          string         `json:"name"`
	Phone         string         `json:"phone"`
	Site          CompanySite    `json:"site"`
	Tags          []string       `json:"tags"`
	Tech          []string       `json:"tech"`
	TimeZone      string         `json:"timeZone"`
	Type          string         `json:"type"`
	URL           string         `json:"url"`
	UTCOffset     int            `json:"utcOffset"`

	AngelList  AngelListProfile  `json:"angellist"`
	CrunchBase CrunchBaseProfile `json:"crunchbase"`
	Facebook   FacebookProfile   `json:"facebook"`
	LinkedIn   LinkedInProfile   `json:"linkedin"`
	Twitter    TwitterProfile    `json:"twitter"`
}

Company describes company data known to Clearbit.

https://clearbit.com/docs#enrichment-api-company-api-attributes

type CompanyMetrics

type CompanyMetrics struct {
	AlexaGlobalRank int `json:"alexaGlobalRank"`
	AlexaUsRank     int `json:"alexaUsRank"`
	AnnualRevenue   int `json:"annualRevenue"`
	Employees       int `json:"employees"`
	GoogleRank      int `json:"googleRank"`
	MarketCap       int `json:"marketCap"`
	Raised          int `json:"raised"`
}

CompanyMetrics describes a company's metrics across different sites, services, and other metrics.

type CompanySite

type CompanySite struct {
	EmailAddresses  []string `json:"emailAddresses"`
	H1              string   `json:"h1"`
	MetaAuthor      string   `json:"metaAuthor"`
	MetaDescription string   `json:"metaDescription"`
	PhoneNumbers    []string `json:"phoneNumbers"`
	Title           string   `json:"title"`
	URL             string   `json:"url"`
}

CompanySite describes information about and from a company's site.

type CrunchBaseProfile

type CrunchBaseProfile struct {
	Handle string `json:"handle"`
}

CrunchBaseProfile describes a company's CrunchBase profile.

type Employment

type Employment struct {
	Domain    string `json:"domain"`
	Name      string `json:"name"`
	Role      string `json:"role"`
	Seniority string `json:"seniority"`
	Title     string `json:"title"`
}

Employment describes a person's current employment status.

type Error

type Error struct {
	Type    string `json:"type"`
	Message string `json:"message"`
}

Error describes an error returned by Clearbit's API.

For a list of error types, see https://clearbit.com/docs#errors-error-types.

type ErrorResponse

type ErrorResponse struct {
	Error `json:"error"`
}

ErrorResponse describes the structure of non-successful responses from the Clearbit API.

type FacebookProfile

type FacebookProfile struct {
	Handle string `json:"handle"`
}

FacebookProfile describes a person or company's Facebook profile.

type Geo

type Geo struct {
	City         string  `json:"city"`
	Country      string  `json:"country"`
	CountryCode  string  `json:"countryCode"`
	Lat          float64 `json:"lat"`
	Lng          float64 `json:"lng"`
	PostalCode   string  `json:"postalCode"`
	State        string  `json:"state"`
	StateCode    string  `json:"stateCode"`
	StreetName   string  `json:"streetName"`
	StreetNumber string  `json:"streetNumber"`
	SubPremise   string  `json:"subPremise"`
}

Geo represents a person or comapny's location.

Some fields are only available for companies.

type GitHubProfile

type GitHubProfile struct {
	Avatar    string `json:"avatar"`
	Blog      string `json:"blog"`
	Company   string `json:"company"`
	Followers int    `json:"followers"`
	Following int    `json:"following"`
	Handle    string `json:"handle"`
}

GitHubProfile describes a person's GitHub profile.

type GooglePlusProfile

type GooglePlusProfile struct {
	Handle string `json:"handle"`
}

GooglePlusProfile describes a person's Google+ profile.

type GravatarAvatar

type GravatarAvatar struct {
	Type string `json:"type"`
	URL  string `json:"url"`
}

GravatarAvatar describes an avatar associated with a person's Gravatar profile. For example, the type may be "thumbnail" and the URL to view it.

type GravatarProfile

type GravatarProfile struct {
	DefaultAvatarURL string           `json:"avatar"`
	Avatars          []GravatarAvatar `json:"avatars"`
	Handle           string           `json:"handle"`
	URLs             []GravatarURL    `json:"urls"`
}

GravatarProfile describes a person's public Gravatar profile.

type GravatarURL

type GravatarURL struct {
	Title string `json:"title"`
	Value string `json:"value"`
}

GravatarURL describes a URL associated with a person's Gravatar profile, like a link to their blog.

type LinkedInProfile

type LinkedInProfile struct {
	Handle string `json:"handle"`
}

LinkedInProfile describes a person or company's public LinkedIn profile.

type Name

type Name struct {
	FamilyName string `json:"familyName"`
	FullName   string `json:"fullName"`
	GivenName  string `json:"givenName"`
}

Name describes a person's name.

type Person

type Person struct {
	Avatar     string     `json:"avatar"`
	Bio        string     `json:"bio"`
	Email      string     `json:"email"`
	Employment Employment `json:"employment"`
	Fuzzy      bool       `json:"fuzzy"`
	Gender     string     `json:"gender"`
	Geo        Geo        `json:"geo"`
	ID         string     `json:"id"`
	Location   string     `json:"location"`
	Name       Name       `json:"name"`
	Site       string     `json:"site"`
	TimeZone   string     `json:"timeZone"`
	UTCOffset  int        `json:"utcOffset"`

	AboutMe    AboutMeProfile    `json:"aboutme"`
	AngelList  AngelListProfile  `json:"angellist"`
	Facebook   FacebookProfile   `json:"facebook"`
	GitHub     GitHubProfile     `json:"github"`
	GooglePlus GooglePlusProfile `json:"googleplus"`
	Gravatar   GravatarProfile   `json:"gravatar"`
	Twitter    TwitterProfile    `json:"twitter"`
	LinkedIn   LinkedInProfile   `json:"linkedin"`
}

Person describes person data known to Clearbit.

https://clearbit.com/docs#enrichment-api-person-api-attributes

type Prospect

type Prospect struct {
	ID    string `json:"id"`
	Name  Name   `json:"name"`
	Title string `json:"title"`
	Email string `json:"email"`
}

Prospect describes the basic contact information for a person found through the Prospector API.

https://clearbit.com/docs#prospector-api-person-search-response-body

type ProspectQuery

type ProspectQuery struct {
	// Company's domain name to look up (required).
	Domain string

	// Filters results by first or last name (case-insensitive).
	Name string

	// Filters results by one or more titles.
	Titles []string
}

ProspectQuery defines the available options for querying the Prospector API.

type TwitterID

type TwitterID string

TwitterID is a person or company's Twitter profile ID.

It is stored as a string, though it can be also be an integer in Clearbit API responses.

func (*TwitterID) UnmarshalJSON

func (id *TwitterID) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type TwitterProfile

type TwitterProfile struct {
	Avatar    string    `json:"avatar"`
	Bio       string    `json:"bio"`
	Followers int       `json:"followers"`
	Following int       `json:"following"`
	Handle    string    `json:"handle"`
	ID        TwitterID `json:"id"`
	Location  string    `json:"location"`
	Site      string    `json:"site"`
}

TwitterProfile describes a person or company's public Twitter profile.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL