forked from adtac/go-akismet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc.go
33 lines (28 loc) · 1.21 KB
/
doc.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
/*
Package akismet provides a client for using the Akismet API.
Usage:
import "github.com/writefreely/go-akismet"
Here's an example if you want to check whether a particular comment is spam or
not using the akismet.Check method:
akismetKey := os.Getenv("AKISMET_KEY")
isSpam, err := akismet.Check(&akismet.Comment{
Blog: "https://example.com", // required
UserIP: "8.8.8.8", // required
UserAgent: "...", // required
CommentType: "comment",
CommentAuthor: "Billie Joe",
CommentAuthorEmail: "[email protected]",
CommentContent: "Something's on my mind",
CommentDate: time.Now(),
}, akismetKey)
if err != nil {
// There was some issue with the API request. Most probable cause is
// missing required fields.
}
You can also submit false positives (comments that were wrongly marked as spam)
with the akismet.SubmitHam method. Or you can submit false negatives (comments
that should be marked as spam, but weren't) with the akismet.SubmitSpam method.
Both methods have the same method signature as the akismet.Check function: an
akismet.Comment structure as the first argument followed by your API key.
*/
package akismet