content

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, BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Song

type Song struct {
	item.Item

	Title      string `json:"title"`
	Artist     string `json:"artist"`
	Rating     int    `json:"rating"`
	Opinion    string `json:"opinion"`
	SpotifyURL string `json:"spotify_url"`
}

func (*Song) AfterAPICreate

func (s *Song) AfterAPICreate(res http.ResponseWriter, req *http.Request) error

AfterAPICreate is called after Create, and is useful for logging or triggering notifications, etc. after the data is saved to the database, etc. The request has a context containing the databse 'target' affected by the request. Ex. Song__pending:3 or Song:8 depending if Song implements api.Trustable

func (*Song) Approve

func (s *Song) Approve(res http.ResponseWriter, req *http.Request) error

Approve implements editor.Mergeable, which enables content supplied by external clients to be approved and thus added to the public content API. Before content is approved, it is waiting in the Pending bucket, and can only be approved in the CMS if the Mergeable interface is satisfied. If not, you will not see this content show up in the CMS.

func (*Song) AutoApprove

func (s *Song) AutoApprove(res http.ResponseWriter, req *http.Request) error

AutoApprove implements api.Trustable, and will automatically approve content that has been submitted by an external client via api.Createable. Be careful when using AutoApprove, because content will immediately be available through your public content API. If the Trustable interface is satisfied, the AfterApprove method is bypassed. The

func (*Song) BeforeAPICreate

func (s *Song) BeforeAPICreate(res http.ResponseWriter, req *http.Request) error

BeforeAPICreate is only called if the Song type implements api.Createable It is called before Create, and returning an error will cancel the request causing the system to reject the data sent in the POST

func (*Song) Create

func (s *Song) Create(res http.ResponseWriter, req *http.Request) error

Create implements api.Createable, and allows external POST requests from clients to add content as long as the request contains the json tag names of the Song struct fields, and is multipart encoded

func (*Song) MarshalEditor

func (s *Song) MarshalEditor() ([]byte, error)

MarshalEditor writes a buffer of html to edit a Song within the CMS and implements editor.Editable

func (*Song) String

func (s *Song) String() string

String defines the display name of a Song in the CMS list-view

Jump to

Keyboard shortcuts

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