-
Notifications
You must be signed in to change notification settings - Fork 0
/
aapi_response.go
47 lines (44 loc) · 1.32 KB
/
aapi_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
package emailvalidator
// AAValidateEmailResp is returned by Abstract API's email verify API
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"`
}
// IsValid checks if email is valid
func (resp *AAValidateEmailResp) IsValid() bool {
return resp.IsValidFormat.Value
}
// IsDeliverable checks if email is deliverable
func (resp *AAValidateEmailResp) IsDeliverable() bool {
return resp.Deliverability == "DELIVERABLE"
}