-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathanalysis.go
77 lines (65 loc) · 2.38 KB
/
analysis.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package mailosaur
type AnalysisService struct {
client *MailosaurClient
}
type SpamAssassinRule struct {
Score float64 `json:"score"`
Rule string `json:"rule"`
Description string `json:"description"`
}
type SpamFilterResults struct {
SpamAssassin []*SpamAssassinRule `json:"spamAssassin"`
}
type SpamAnalysisResult struct {
SpamFilterResults *SpamFilterResults `json:"spamFilterResults"`
Score float64 `json:"score"`
}
type EmailAuthenticationResult struct {
Result string `json:"result"`
Description string `json:"description"`
RawValue string `json:"rawValue"`
Tags map[string]string `json:"tags"`
}
type BlockListResult struct {
Id string `json:"id"`
Name string `json:"name"`
Result string `json:"result"`
}
type Content struct {
Embed bool `json:"embed"`
Iframe bool `json:"iframe"`
Object bool `json:"object"`
Script bool `json:"script"`
ShortUrls bool `json:"shortUrls"`
TextSize int `json:"textSize"`
TotalSize int `json:"totalSize"`
MissingAlt bool `json:"missingAlt"`
MissingListUnsubscribe bool `json:"missingListUnsubscribe"`
}
type DnsRecords struct {
A []string `json:"a"`
Mx []string `json:"mx"`
Ptr []string `json:"ptr"`
}
type SpamAssassinResult struct {
Score int `json:"score"`
Result string `json:"result"`
Rules []*SpamAssassinRule `json:"rules"`
}
type DeliverabilityReport struct {
Spf *EmailAuthenticationResult `json:"spf"`
Dkim []*EmailAuthenticationResult `json:"dkim"`
Dmarc *EmailAuthenticationResult `json:"dmarc"`
BlockLists []*BlockListResult `json:"blockLists"`
Content *Content `json:"content"`
DnsRecords *DnsRecords `json:"dnsRecords"`
SpamAssassin *SpamAssassinResult `json:"spamAssassin"`
}
func (s *AnalysisService) Spam(id string) (*SpamAnalysisResult, error) {
result, err := s.client.HttpGet(&SpamAnalysisResult{}, "api/analysis/spam/"+id)
return result.(*SpamAnalysisResult), err
}
func (s *AnalysisService) Deliverability(id string) (*DeliverabilityReport, error) {
result, err := s.client.HttpGet(&DeliverabilityReport{}, "api/analysis/deliverability/"+id)
return result.(*DeliverabilityReport), err
}