-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhunter_response.go
48 lines (43 loc) · 1.43 KB
/
hunter_response.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package emailvalidator
// HunterRespData defines data in email verify API response
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"`
}
// HunterRespMeta defines meta data in email verify API response
type HunterRespMeta struct {
Params struct {
Email string `json:"email"`
} `json:"params"`
}
// HunterValidateEmailResp is returned by hunter's email verify API
type HunterValidateEmailResp struct {
Data HunterRespData `json:"data"`
Meta HunterRespMeta `json:"meta"`
}
// IsValid checks if email is valid
func (resp *HunterValidateEmailResp) IsValid() bool {
return resp.Data.Status == "valid"
}
// IsDeliverable checks if email is deliverable
func (resp *HunterValidateEmailResp) IsDeliverable() bool {
return resp.Data.Result == "deliverable"
}