Documentation ¶
Overview ¶
Package link provides functionality for managing links.
Index ¶
- func DeleteLink(w http.ResponseWriter, r *http.Request)
- func GetAllLinks(w http.ResponseWriter, r *http.Request)
- func GetLink(w http.ResponseWriter, r *http.Request)
- func MakeMuxer(prefix string) http.Handler
- func NewLinkHelper(c appengine.Context, w http.ResponseWriter, r *http.Request, l *Link) bool
- func PostLink(w http.ResponseWriter, r *http.Request)
- func PutLink(w http.ResponseWriter, r *http.Request)
- func PutLinkHelper(c appengine.Context, w http.ResponseWriter, r *http.Request, l *Link) bool
- type Link
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteLink ¶
func DeleteLink(w http.ResponseWriter, r *http.Request)
DeleteLink deletes the link for the given tag. The currently logged in user must own the link. Otherwise, an unauthorized error is returned.
func GetAllLinks ¶
func GetAllLinks(w http.ResponseWriter, r *http.Request)
GetAllLinks fetches all of the links.
func GetLink ¶
func GetLink(w http.ResponseWriter, r *http.Request)
GetLink fetches the link for the given tag.
func MakeMuxer ¶
MakeMuxer creates a http.Handler to manage all link operations. If a prefix is given, that prefix will be the first part of the url. This muxer will provide the following handlers and return a RESTful 404 on all others.
GET prefix + / Get all links. POST prefix + / Create a new link. GET prefix + /{key}/ Get the link for the given key. PUT prefix + /{key}/ Update the link with the given key. DELETE prefix + /{key}/ Delete the link with the given key.
See the functions related to these urls for more details on what each one does and the requirements behind it.
func NewLinkHelper ¶
NewLinkHelper is a helper function that creates a new link in the datastore for the given link. The given link is updated with new keys. If a failure occured, false is returned and a response was returned to the request. This case should be terminal.
func PostLink ¶
func PostLink(w http.ResponseWriter, r *http.Request)
PostLink creates a new link from the POSTed data.
func PutLink ¶
func PutLink(w http.ResponseWriter, r *http.Request)
PutLink saves the link for the given tag.
func PutLinkHelper ¶
PutLinkHelepr saves the link. If the link or any of it's items don't have a key, a key will be made for it.
Types ¶
type Link ¶
type Link struct { // The name of the link. Name string // A URL safe version of the datastores key for this link. It // is not stored in the datastore. Key string `datastore:",noindex"` // The Url is the location of the link. Url string `datastore:",noindex"` // The Icon is the bootstrap icon to display. See: // http://twitter.github.com/bootstrap/base-css.html#icons Icon string `datastore:",noindex"` // The Description is the description of the link Description string `datastore:",noindex"` // Tags are the searchable elements of a link. Tags []string }
Link is the structure used to save, get, and delete links from the datastore.
func GetLinkHelper ¶
func GetLinkHelper(c appengine.Context, w http.ResponseWriter, r *http.Request, key string) (*Link, bool)
GetLinkHelper is a helper function that retrieves a link from the datastore. If a failure occured, false is returned and a response was returned to the request. This case should be terminal.