ponzu: github.com/ponzu-cms/ponzu/system/api Index | Files | Directories

package api

import "github.com/ponzu-cms/ponzu/system/api"

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

Package Files

cors.go create.go delete.go gzip.go handlers.go hide.go json.go omit.go push.go record.go search.go server.go update.go

Variables

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

ErrNoAuth should be used to report failed auth requests

func CORS Uses

func CORS(next http.HandlerFunc) http.HandlerFunc

CORS wraps a HandlerFunc to respond to OPTIONS requests properly

func Gzip Uses

func Gzip(next http.HandlerFunc) http.HandlerFunc

Gzip wraps a HandlerFunc to compress responses when possible

func Record Uses

func Record(next http.HandlerFunc) http.HandlerFunc

Record wraps a HandlerFunc to record API requests for analytical purposes

func Run Uses

func Run()

Run adds Handlers to default http listener for API

type Createable Uses

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 Uses

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 Uses

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 Uses

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

PathSynopsis
analyticsPackage 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 api imports 20 packages (graph) and is imported by 4 packages. Updated 2018-05-11. Refresh now. Tools for package owners.