{"modulePath":"github.com/onxcld/testcms3.github.io","version":"v0.0.0-20210408213137-0a44b19ed593","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package api\n\nPackage 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.\n\n## Variables\n\n```go\nvar ErrNoAuth = errors.New(\"Auth failed for request\")\n```\nErrNoAuth should be used to report failed auth requests\n\n## Functions\n\n```go\nfunc CORS(next http.HandlerFunc) http.HandlerFunc\n```\nCORS wraps a HandlerFunc to respond to OPTIONS requests properly\n\n```go\nfunc Gzip(next http.HandlerFunc) http.HandlerFunc\n```\nGzip wraps a HandlerFunc to compress responses when possible\n\n```go\nfunc Record(next http.HandlerFunc) http.HandlerFunc\n```\nRecord wraps a HandlerFunc to record API requests for analytical purposes\n\n```go\nfunc Run()\n```\nRun adds Handlers to default http listener for API\n\n## Types\n\n```go\ntype Createable interface {\n\t// Create enables external clients to submit content of a specific type\n\tCreate(http.ResponseWriter, *http.Request) error\n}\n```\nCreateable accepts or rejects external POST requests to endpoints such as: /api/content/create?type=Review\n\n```go\ntype Deleteable interface {\n\t// Delete enables external clients to delete content of a specific type\n\tDelete(http.ResponseWriter, *http.Request) error\n}\n```\nDeleteable accepts or rejects update POST requests to endpoints such as: /api/content/delete?type=Review\u0026id=1\n\n```go\ntype Trustable interface {\n\tAutoApprove(http.ResponseWriter, *http.Request) error\n}\n```\nTrustable allows external content to be auto-approved, meaning content sent as an Createable will be stored in the public content bucket\n\n```go\ntype Updateable interface {\n\t// Update enabled external clients to update content of a specific type\n\tUpdate(http.ResponseWriter, *http.Request) error\n}\n```\nUpdateable accepts or rejects update POST requests to endpoints such as: /api/content/update?type=Review\u0026id=1\n\n","path":"github.com/onxcld/testcms3.github.io/system/api","name":"api","synopsis":"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.","isRedistributable":true}
