Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // AbstractAPIFree represents API Rate limit under free plan AbstractAPIFree = AARate{Interval: time.Second, Limit: 1} // AbstractAPIStarter represents API Rate limit under starter plan AbstractAPIStarter = AARate{Interval: time.Second, Limit: 3} // AbstractAPIStandard represents API Rate limit under standard plan AbstractAPIStandard = AARate{Interval: time.Second, Limit: 10} // AbstractAPIBusiness represents API Rate limit under business plan AbstractAPIBusiness = AARate{Interval: time.Second, Limit: 25} // AbstractAPIProfessional represents API Rate limit under professional plan AbstractAPIProfessional = AARate{Interval: time.Second, Limit: 50} // AbstractAPIGrowth represents API Rate limit under growth plan AbstractAPIGrowth = AARate{Interval: time.Second, Limit: 100} )
var ( // ErrEmptyAPIKey is returned when api key is empty. ErrEmptyAPIKey = errors.New("empty api key provided") // ErrEmptyBaseURL is returned when baseURL is empty. ErrEmptyBaseURL = errors.New("empty baseURL") // ErrEmptyAPIVersion is returned when api version is empty. ErrEmptyAPIVersion = errors.New("empty api version") // ErrEmptyAPISubPath is returned when API sub path is empty in the case of hunter.io APIs. ErrEmptyAPISubPath = errors.New("empty api sub-path") )
var ( // HunterAPIRate represents API Rate limit for email verify API HunterAPIRate = HunterRate{Interval: time.Second, Limit: 10} )
Functions ¶
This section is empty.
Types ¶
type AAValidateEmailResp ¶
type AAValidateEmailResp struct { Email string `json:"email"` Autocorrect string `json:"autocorrect"` Deliverability string `json:"deliverability"` QualityScore string `json:"quality_score"` IsValidFormat struct { Value bool `json:"value"` Text string `json:"text"` } `json:"is_valid_format"` IsFreeEmail struct { Value bool `json:"value"` Text string `json:"text"` } `json:"is_free_email"` IsDisposableEmail struct { Value bool `json:"value"` Text string `json:"text"` } `json:"is_disposable_email"` IsRoleEmail struct { Value bool `json:"value"` Text string `json:"text"` } `json:"is_role_email"` IsCatchallEmail struct { Value bool `json:"value"` Text string `json:"text"` } `json:"is_catchall_email"` IsMxFound struct { Value bool `json:"value"` Text string `json:"text"` } `json:"is_mx_found"` IsSMTPValid struct { Value bool `json:"value"` Text string `json:"text"` } `json:"is_smtp_valid"` }
AAValidateEmailResp is returned by Abstract API's email verify API
func (*AAValidateEmailResp) IsDeliverable ¶
func (resp *AAValidateEmailResp) IsDeliverable() bool
IsDeliverable checks if email is deliverable
func (*AAValidateEmailResp) IsValid ¶
func (resp *AAValidateEmailResp) IsValid() bool
IsValid checks if email is valid
type AbstractAPIClient ¶
type AbstractAPIClient struct {
// contains filtered or unexported fields
}
AbstractAPIClient defines http client for making AbstractAPI's REST calls
func NewAbstractAPIClient ¶
func NewAbstractAPIClient(apiKey string, options ...AbstractAPIOptionFunc) (*AbstractAPIClient, error)
NewAbstractAPIClient creates new AbstractAPI client for calling email validation REST API
func (*AbstractAPIClient) Validate ¶
func (ac *AbstractAPIClient) Validate(email string) (*AAValidateEmailResp, error)
Validate validates email address and returns abstract API's response
type AbstractAPIOption ¶
type AbstractAPIOption struct {
// contains filtered or unexported fields
}
AbstractAPIOption specifies options for AbstractAPI client
type AbstractAPIOptionFunc ¶
type AbstractAPIOptionFunc func(*AbstractAPIOption) error
AbstractAPIOptionFunc is a function type for setting AbstractAPI client options
func WithAbstractAPIBaseURL ¶
func WithAbstractAPIBaseURL(url *url.URL) AbstractAPIOptionFunc
WithAbstractAPIBaseURL is used to set base url of abstract api service
func WithAbstractAPIBlocking ¶
func WithAbstractAPIBlocking() AbstractAPIOptionFunc
WithAbstractAPIBlocking is used to direct rateLimiter to wait until rate limit interval ends, if rate limit is reached.
func WithAbstractAPIRate ¶
func WithAbstractAPIRate(rate AARate) AbstractAPIOptionFunc
WithAbstractAPIRate is used to specific rate limit on http client
func WithAbstractAPIVersion ¶
func WithAbstractAPIVersion(version string) AbstractAPIOptionFunc
WithAbstractAPIVersion is used to set API version of abstract api
type HunterAPIClient ¶
type HunterAPIClient struct {
// contains filtered or unexported fields
}
HunterAPIClient defines http client for making Hunter's REST calls
func NewHunterAPIClient ¶
func NewHunterAPIClient(apiKey string, options ...HunterAPIOptionFunc) (*HunterAPIClient, error)
NewHunterAPIClient creates new Hunter API client for calling Hunter's REST APIs
func (*HunterAPIClient) Validate ¶
func (hc *HunterAPIClient) Validate(email string) (*HunterValidateEmailResp, error)
Validate validates email address and returns hunter api's response
type HunterAPIOption ¶
type HunterAPIOption struct {
// contains filtered or unexported fields
}
HunterAPIOption specifies options for Hunter.io API client
type HunterAPIOptionFunc ¶
type HunterAPIOptionFunc func(*HunterAPIOption) error
HunterAPIOptionFunc is a function type for setting Hunter.io API client options
func WithHunterAPIBaseURL ¶
func WithHunterAPIBaseURL(url *url.URL) HunterAPIOptionFunc
WithHunterAPIBaseURL is used to set base url of hunter api service
func WithHunterAPIBlocking ¶
func WithHunterAPIBlocking() HunterAPIOptionFunc
WithHunterAPIBlocking is used to direct rateLimiter to wait until rate limit interval ends, if rate limit is reached.
func WithHunterAPIRate ¶
func WithHunterAPIRate(rate HunterRate) HunterAPIOptionFunc
WithHunterAPIRate is used to specific rate limit on http client
func WithHunterAPIVersion ¶
func WithHunterAPIVersion(version string) HunterAPIOptionFunc
WithHunterAPIVersion is used to set API version of abstract api
type HunterRate ¶
type HunterRate apiRate
HunterRate is a type alias for Hunter API rate limit configuration
type HunterRespData ¶
type HunterRespData struct { Status string `json:"status"` 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 []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"` } `json:"sources"` }
HunterRespData defines data in email verify API response
type HunterRespMeta ¶
type HunterRespMeta struct { Params struct { Email string `json:"email"` } `json:"params"` }
HunterRespMeta defines meta data in email verify API response
type HunterValidateEmailResp ¶
type HunterValidateEmailResp struct { Data HunterRespData `json:"data"` Meta HunterRespMeta `json:"meta"` }
HunterValidateEmailResp is returned by hunter's email verify API
func (*HunterValidateEmailResp) IsDeliverable ¶
func (resp *HunterValidateEmailResp) IsDeliverable() bool
IsDeliverable checks if email is deliverable
func (*HunterValidateEmailResp) IsValid ¶
func (resp *HunterValidateEmailResp) IsValid() bool
IsValid checks if email is valid