spamcheck

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2020 License: MIT Imports: 4 Imported by: 0

README

spamcheck

spamcheck uses Postmark's spam API. The API is free to use. No API key is required. For more information visit https://spamcheck.postmarkapp.com/.

package main

import (
	"fmt"
	"log"

	"github.com/golevi/spamcheck"
)

const msg string = `hello i give you money`

func main() {
	req := &spamcheck.Request{
		Email:   msg,
		Options: spamcheck.Long,
		// Options: spamcheck.Short,
	}

	resp, err := req.Process()
	if err != nil {
		log.Println(err)
	}
	fmt.Println(resp)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options string

Options are either long or short

const (
	// Short gets the score
	Short Options = "short"
	// Long gets a full report
	Long Options = "long"
)

type Request

type Request struct {
	Email   string  `json:"email"`
	Options Options `json:"options"`
}

Request is the email and options

func (*Request) Process added in v0.2.0

func (r *Request) Process() (*Response, error)

Process the request

type Response

type Response struct {
	Score  string  `json:"score"`
	Report string  `json:"report"`
	Rules  []rules `json:"rules"`
}

Response is what is received from the api

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL