Documentation ¶
Index ¶
- type Song
- func (s *Song) AfterAPICreate(res http.ResponseWriter, req *http.Request) error
- func (s *Song) Approve(res http.ResponseWriter, req *http.Request) error
- func (s *Song) AutoApprove(res http.ResponseWriter, req *http.Request) error
- func (s *Song) BeforeAPICreate(res http.ResponseWriter, req *http.Request) error
- func (s *Song) Create(res http.ResponseWriter, req *http.Request) error
- func (s *Song) MarshalEditor() ([]byte, error)
- func (s *Song) String() string
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
MarshalEditor writes a buffer of html to edit a Song within the CMS and implements editor.Editable