gohunter

package module
Version: v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

README

gohunter

Go Report Card GoDoc

Client library for hunter.io

Methods

Supported methods:

  • GET domain-search
  • GET email-finder
  • GET email-verifier
  • GET email-count
  • GET account
  • GET leads (get all leads)
  • GET lead/{number} (get one lead)
  • POST leads (create lead)
  • PUT lead/{number} (update lead)
  • DELETE lead/{number} (delete lead)

Installation

    go get github.com/solar-jsoc/gohunter

Examples

  • client init:

    client := gohunter.NewClient("token", gohunter.WithCustomClient(http.DefaultClient))
    
  • domain-search

    result, err := client.DomainSearch(context.TODO(), "intercom.io", "intercom", 
    	gohunter.WithLimit(20), 
    	gohunter.WithDepartment(DepartmentIT, DepartmentFinance), 
    	gohunter.WithSeniority(SenioritySenior),
    	gohunter.WithEmailType(EmailTypePersonal),
    	gohunter.WithOffset(10))
    if err != nil {
        ...
    }
    
  • email-finder

    result, err := client.FindEmail(context.TODO(), "intercom.io", "intercom", gohunter.UsingFullName("John Doe"))
    if err != nil {
    	...
    }
    
  • email-verifier

    result, err := client.VerifyEmail(context.TODO(), "ciaran@intercom.io")
    if err != nil {
    	...
    }
    
  • email-count

    result, err := client.EmailCount(context.TODO(), "", "intercom", gohunter.EmailTypePersonal)
    if err != nil {
    	...
    }
    
  • account

    result, err := client.AccountInformation(context.TODO())
    if err != nil {
    	...
    }
    

Documentation

Index

Constants

View Source
const (

	// SeniorityJunior is a junior seniority level
	SeniorityJunior seniorityLevel = "junior"
	// SeniorityExecutive is a executive seniority level
	SeniorityExecutive seniorityLevel = "executive"
	// SenioritySenior is a senior seniority level
	SenioritySenior seniorityLevel = "senior"

	// DepartmentExecutive is an executive department
	DepartmentExecutive department = "executive"
	// DepartmentIT is an it department
	DepartmentIT department = "it"
	// DepartmentFinance is a finance department
	DepartmentFinance department = "finance"
	// DepartmentManagement is a management department
	DepartmentManagement department = "management"
	// DepartmentSales is a sales department
	DepartmentSales department = "sales"
	// DepartmentLegal is a legal department
	DepartmentLegal department = "legal"
	// DepartmentSupport is a support department
	DepartmentSupport department = "support"
	// DepartmentHR is a hr department
	DepartmentHR department = "hr"
	// DepartmentMarketing is a marketing department
	DepartmentMarketing department = "marketing"
	// DepartmentCommunication is a communication department
	DepartmentCommunication department = "communication"

	// EmailTypePersonal is a personal emails of specific employees.
	EmailTypePersonal emailType = "personal"
	// EmailTypeGeneric is a generic email addresses.
	EmailTypeGeneric emailType = "generic"
)

Variables

This section is empty.

Functions

func UsingFirstLastName

func UsingFirstLastName(firtsName, lastName string) emailSearchPersonOption

UsingFirstLastName search hunter.io person using first and last name.

func UsingFullName

func UsingFullName(fullName string) emailSearchPersonOption

UsingFullName search hunter.io person using full name separated with space.

func WithCustomClient

func WithCustomClient(client *http.Client) clientOption

WithCustomClient used in NewClient function. It allows use custom http.Client for method calls.

func WithDepartment

func WithDepartment(departments ...department) requestOptionalParam

WithDepartment allows to get only email addresses for people working in the selected department(s). The possible values are executive, it, finance, management, sales, legal, support, hr, marketing or communication. Several departments can be selected (comma-delimited). Please pass exported const for this method as an arguments.

func WithEmailType

func WithEmailType(emailType emailType) requestOptionalParam

WithEmailType allows to get only personal or generic email addresses. Please pass exported const for this method as an arguments.

func WithLimit

func WithLimit(limit int) requestOptionalParam

WithLimit specifies the max number of email addresses to return. The default is 10.

func WithOffset

func WithOffset(offset int) requestOptionalParam

WithOffset specifies the number of email addresses to skip. The default is 0.

func WithSeniority

func WithSeniority(levels ...seniorityLevel) requestOptionalParam

WithSeniority allows to get only email addresses for people with the selected seniority level. The possible values are junior, senior or executive. Several seniority levels can be selected (delimited by a comma). Please pass exported const for this method as an arguments.

Types

type AccountInformationCalls

type AccountInformationCalls struct {
	Used      int `json:"used"`
	Available int `json:"available"`
}

AccountInformationCalls contain information about used and available calls.

type AccountInformationData

type AccountInformationData struct {
	FirstName string                  `json:"first_name"`
	LastName  string                  `json:"last_name"`
	Email     string                  `json:"email"`
	PlanName  string                  `json:"plan_name"`
	PlanLevel int                     `json:"plan_level"`
	ResetDate string                  `json:"reset_date"`
	TeamID    int                     `json:"team_id"`
	Calls     AccountInformationCalls `json:"calls"`
}

AccountInformationData contains account information data.

type AccountInformationResponse

type AccountInformationResponse struct {
	Data AccountInformationData `json:"data"`
}

AccountInformationResponse response from "account" method.

type Client

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

Client is an API client

func NewClient

func NewClient(token string, opts ...clientOption) *Client

NewClient returns a pointer to a client To call API methods you must first create a client. You could use your custom http.Client using WithCustomClient option.

func (*Client) AccountInformation

func (c *Client) AccountInformation(ctx context.Context) (*AccountInformationResponse, error)

AccountInformation implements "account" hunter.io method. For more information: https://hunter.io/api-documentation/v2#account

func (*Client) DomainSearch

func (c *Client) DomainSearch(ctx context.Context, domain, companyName string, params ...requestOptionalParam) (*DomainSearchResponse, error)

DomainSearch implements "domain-search" hunter.io method. for "params" use exported functions that returns optionalParam type. You need to specify at least domain or companyName for this call. method docs: https://hunter.io/api-documentation/v2#domain-search

func (*Client) EmailCount

func (c *Client) EmailCount(ctx context.Context, domain, companyName string, emailType requestOptionalParam) (*EmailCountResponse, error)

EmailCount implements "email-count" hunter.io method. You need to specify at least domain or companyName for this call. emailType is not required for this call, just pass nil if it doesn't needed! method docs: https://hunter.io/api-documentation/v2#email-count

func (*Client) FindEmail

func (c *Client) FindEmail(ctx context.Context, domain, companyName string, withNameParam emailSearchPersonOption) (*EmailFinderReponse, error)

FindEmail implements "email-finder" hunter.io method. You need to specify at least domain or companyName for this call. method docs: https://hunter.io/api-documentation/v2#email-finder

func (*Client) VerifyEmail

func (c *Client) VerifyEmail(ctx context.Context, email string) (*EmailVerifierResponse, error)

VerifyEmail implements email-verifier hunter.io method. method docs: https://hunter.io/api-documentation/v2#email-verifier

type DomainSearchData

type DomainSearchData struct {
	Domain       string              `json:"domain"`
	Disposable   bool                `json:"disposable"`
	Webmail      bool                `json:"webmail"`
	AcceptAll    bool                `json:"accept_all"`
	Pattern      string              `json:"pattern"`
	Organization string              `json:"organization"`
	Country      string              `json:"country"`
	State        string              `json:"state"`
	Emails       []DomainSearchEmail `json:"emails"`
}

DomainSearchData contains data from domain-search method response.

type DomainSearchEmail

type DomainSearchEmail struct {
	Value       string        `json:"value"`
	Type        string        `json:"type"`
	Confidence  int           `json:"confidence"`
	Sources     []EmailSource `json:"sources"`
	FirstName   string        `json:"first_name"`
	LastName    string        `json:"last_name"`
	Position    string        `json:"position"`
	Seniority   string        `json:"seniority"`
	Department  string        `json:"department"`
	Linkedin    string        `json:"linkedin"`
	Twitter     string        `json:"twitter"`
	PhoneNumber string        `json:"phone_number"`
}

DomainSearchEmail contains data about specific email.

type DomainSearchResponse

type DomainSearchResponse struct {
	Data DomainSearchData `json:"data"`
	Meta Meta             `json:"meta"`
}

DomainSearchResponse is a response from domain-search method call.

type EmailCountData

type EmailCountData struct {
	Total          int                  `json:"total"`
	PersonalEmails int                  `json:"personal_emails"`
	GenericEmails  int                  `json:"generic_emails"`
	Department     EmailCountDepartment `json:"department"`
	Seniority      EmailCountSeniority  `json:"seniority"`
}

EmailCountData contains data from email-count method response.

type EmailCountDepartment

type EmailCountDepartment struct {
	Executive     int `json:"executive"`
	It            int `json:"it"`
	Finance       int `json:"finance"`
	Management    int `json:"management"`
	Sales         int `json:"sales"`
	Legal         int `json:"legal"`
	Support       int `json:"support"`
	Hr            int `json:"hr"`
	Marketing     int `json:"marketing"`
	Communication int `json:"communication"`
}

EmailCountDepartment contains information about how many mails of employees of each department are in hunter.io.

type EmailCountResponse

type EmailCountResponse struct {
	Data EmailCountData `json:"data"`
	Meta Meta           `json:"meta"`
}

EmailCountResponse response from email-count method.

type EmailCountSeniority

type EmailCountSeniority struct {
	Junior    int `json:"junior"`
	Senior    int `json:"senior"`
	Executive int `json:"executive"`
}

EmailCountSeniority contains information about how many mails of each seniority level are in hunter.io.

type EmailFinderData

type EmailFinderData struct {
	FirstName   string        `json:"first_name"`
	LastName    string        `json:"last_name"`
	Email       string        `json:"email"`
	Score       int           `json:"score"`
	Domain      string        `json:"domain"`
	AcceptAll   bool          `json:"accept_all"`
	Position    string        `json:"position"`
	Twitter     string        `json:"twitter"`
	LinkedinURL string        `json:"linkedin_url"`
	PhoneNumber string        `json:"phone_number"`
	Company     string        `json:"company"`
	Sources     []EmailSource `json:"sources"`
}

EmailFinderData contains data from email-finder method response

type EmailFinderReponse

type EmailFinderReponse struct {
	EmailFinderData EmailFinderData `json:"data"`
	Meta            Meta            `json:"meta"`
}

EmailFinderReponse is a response from email-verifier method call

type EmailSource

type EmailSource struct {
	Domain      string `json:"domain"`
	URI         string `json:"uri"`
	ExtractedOn string `json:"extracted_on"`
	LastSeenOn  string `json:"last_seen_on"`
	StillOnPage bool   `json:"still_on_page"`
}

EmailSource contains data about email source. It's common and embedded in some other structs.

type EmailVerifierData

type EmailVerifierData struct {
	Result     string        `json:"result"`
	Score      int           `json:"score"`
	Email      string        `json:"email"`
	Regexp     bool          `json:"regexp"`
	Gibberish  bool          `json:"gibberish"`
	Disposable bool          `json:"disposable"`
	Webmail    bool          `json:"webmail"`
	MxRecords  bool          `json:"mx_records"`
	SMTPServer bool          `json:"smtp_server"`
	SMTPCheck  bool          `json:"smtp_check"`
	AcceptAll  bool          `json:"accept_all"`
	Block      bool          `json:"block"`
	Sources    []EmailSource `json:"sources"`
}

EmailVerifierData contains data from email-verifier method response.

type EmailVerifierResponse

type EmailVerifierResponse struct {
	Data EmailVerifierData `json:"data"`
	Meta Meta              `json:"meta"`
}

EmailVerifierResponse is a response from email-verifier method call.

type HunterError

type HunterError struct {
	ID      string `json:"id"`
	Code    int    `json:"code"`
	Details string `json:"details"`
}

HunterError implements any hunter.io API returned error.

func (HunterError) Error

func (e HunterError) Error() string

type HunterErrors

type HunterErrors struct {
	Errors []HunterError `json:"errors"`
}

HunterErrors implements hunter.io errors response

type Meta

type Meta struct {
	Results int        `json:"results"`
	Limit   int        `json:"limit"`
	Offset  int        `json:"offset"`
	Params  MetaParams `json:"params"`
}

Meta contains meta information about response and request.

type MetaParams

type MetaParams struct {
	Domain     string `json:"domain"`
	Company    string `json:"company"`
	Type       string `json:"type"`
	Seniority  string `json:"seniority"`
	Department string `json:"department"`
}

MetaParams meta params.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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