api

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2019 License: BSD-3-Clause Imports: 20 Imported by: 127

Documentation

Overview

Package api sets the various API handlers which provide an HTTP interface to Ponzu content, and include the types and interfaces to enable client-side interactivity with the system.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoAuth = errors.New("Auth failed for request")

ErrNoAuth should be used to report failed auth requests

Functions

func CORS

func CORS(next http.HandlerFunc) http.HandlerFunc

CORS wraps a HandlerFunc to respond to OPTIONS requests properly

func Gzip

func Gzip(next http.HandlerFunc) http.HandlerFunc

Gzip wraps a HandlerFunc to compress responses when possible

func Record

func Record(next http.HandlerFunc) http.HandlerFunc

Record wraps a HandlerFunc to record API requests for analytical purposes

func Run

func Run()

Run adds Handlers to default http listener for API

Types

type Createable

type Createable interface {
	// Create enables external clients to submit content of a specific type
	Create(http.ResponseWriter, *http.Request) error
}

Createable accepts or rejects external POST requests to endpoints such as: /api/content/create?type=Review

type Deleteable

type Deleteable interface {
	// Delete enables external clients to delete content of a specific type
	Delete(http.ResponseWriter, *http.Request) error
}

Deleteable accepts or rejects update POST requests to endpoints such as: /api/content/delete?type=Review&id=1

type Trustable

type Trustable interface {
	AutoApprove(http.ResponseWriter, *http.Request) error
}

Trustable allows external content to be auto-approved, meaning content sent as an Createable will be stored in the public content bucket

type Updateable

type Updateable interface {
	// Update enabled external clients to update content of a specific type
	Update(http.ResponseWriter, *http.Request) error
}

Updateable accepts or rejects update POST requests to endpoints such as: /api/content/update?type=Review&id=1

Directories

Path Synopsis
Package analytics provides the methods to run an analytics reporting system for API requests which may be useful to users for measuring access and possibly identifying bad actors abusing requests.
Package analytics provides the methods to run an analytics reporting system for API requests which may be useful to users for measuring access and possibly identifying bad actors abusing requests.

Jump to

Keyboard shortcuts

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