api

package
v0.0.0-...-bf2171b Latest Latest
Warning

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

Go to latest
Published: May 31, 2015 License: MIT Imports: 19 Imported by: 2

Documentation

Index

Constants

View Source
const (
	SHOPPING_LIST_SUBJECT = "My Items"
	SHOPPING_LIST_MESSAGE = `` /* 141-byte string literal not displayed */

)
View Source
const (
	SERVER_SENDER = "openproductdata@saruzai.com" // used by other email notifications

	VERIFY_SUBJECT = "Please verify your email address"
	VERIFY_MESSAGE = `` /* 290-byte string literal not displayed */

)

Variables

View Source
var (
	Srv                      *Server
	DefaultServerReadTimeout = 30 // in seconds
	DefaultServerTransport   = "tcp"
)
View Source
var TEMPLATE_FUNCTIONS = template.FuncMap{

	"plus1": func(x int) int {
		return x + 1
	},
}

Functions

func ContributeData

func ContributeData(r *http.Request, db DBConnection) string

func EmailSelectedItems

func EmailSelectedItems(r *http.Request, db DBConnection) string

func GetAccountStatus

func GetAccountStatus(r *http.Request, db DBConnection) string

func LookupBarcode

func LookupBarcode(r *http.Request, db DBConnection) string

Lookup the barcode, using both the barcodes database, and the Amazon API

func NewAPIServer

func NewAPIServer(host, transport string, port, timeout int, handlers map[string]func(http.ResponseWriter, *http.Request))

NewAPIServer uses the map of handlers to respond to incoming FastCGI requests on the specific host, port, and transport

func RegisterAccount

func RegisterAccount(r *http.Request, db DBConnection, serverLink string) string

func Respond

func Respond(mediaType string, charset string, fn func(w http.ResponseWriter, r *http.Request) string) http.HandlerFunc

func SendEmailedItems

func SendEmailedItems(context EmailedItems) error

func SendVerificationEmail

func SendVerificationEmail(serverLink, email, code string) error

func VerifyAccount

func VerifyAccount(r *http.Request, db DBConnection) string

func WithServerDatabase

func WithServerDatabase(dbCoords DBConnection, fn func(map[string]*sql.Stmt))

Types

type DBConnection

type DBConnection struct {
	Host string
	User string
	Pass string
	Port int
}

type EmailedItems

type EmailedItems struct {
	Items []string
	Email string
}
type RegistrationLink struct {
	APIServer string
	APICode   string
}

type Server

type Server struct {
	Logger    *log.Logger
	Transport string
	// contains filtered or unexported fields
}

type SimpleMessage

type SimpleMessage struct {
	Ack string
	Err error
}

Jump to

Keyboard shortcuts

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