Documentation ¶
Index ¶
- type API
- type Object
- func (h Object) DeleteModel(r *http.Request) error
- func (h Object) IndexWithRelations(r *http.Request) ([]*object.Object, database.Paginator, error)
- func (h Object) ShowWithRelations(r *http.Request) (*object.Object, error)
- func (h Object) StoreModel(w http.ResponseWriter, r *http.Request) (*object.Object, object.Form, error)
- type UI
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct { Object // Prefix is the part of the URL under which the API is being served, for // example "/api". Prefix string }
API is the handler for handling API requests made for object creation, and management.
func (API) Destroy ¶
func (h API) Destroy(w http.ResponseWriter, r *http.Request)
Destroy removes the object in the given request context from the database and underlying block store. This serves no content in the response body.
func (API) Index ¶
func (h API) Index(w http.ResponseWriter, r *http.Request)
Index serves the JSON encoded list of objects for the given request. If multiple pages of objects are returned then the database.Paginator is encoded in the Link response header.
func (API) Show ¶
func (h API) Show(w http.ResponseWriter, r *http.Request)
Show serves up the JSON response for the object in the given request. If the Accept header in the request matches the MIME type of the object then the content of the object itself is sent in the response. If the base request URL path is "/builds" then a list of the builds that the object was placed on will be returned. If there are multiple pages of builds then the paginator is encoded into the Link response header.
type Object ¶
Object is the base handler that provides shared logic for the UI and API handlers for object creation, and management.
func (Object) DeleteModel ¶
DeleteModel removes the object in the given request context from the database and the underlying block store.
func (Object) IndexWithRelations ¶
IndexWithRelations retrieves a slice of *object.Object models for the user in the given request context. All of the relations for each object will be loaded into each model we have. If any of the objects have a bound namespace, then the namespace's user will be loaded too. A database.Paginator will also be returned if there are multiple pages of objects.
func (Object) ShowWithRelations ¶
ShowWithRelations retrieves the *object.Object model from the context of the given request. All of the relations for the object will be loaded into the model we have. If the object has a namespace bound to it, then the namespace's user will be loaded to the namespace.
func (Object) StoreModel ¶
func (h Object) StoreModel(w http.ResponseWriter, r *http.Request) (*object.Object, object.Form, error)
StoreModel unmarshals the request's data into an object, validates it and stores it in the database. Upon success this will return the newly created object. This also returns the form for creating an object.
type UI ¶
type UI struct {
Object
}
UI is the handler for handling UI requests made for object creation, and management.
func (UI) Create ¶
func (h UI) Create(w http.ResponseWriter, r *http.Request)
Create serves the HTML response for creating and uploading objects via the web frontend.
func (UI) Destroy ¶
func (h UI) Destroy(w http.ResponseWriter, r *http.Request)
Destroy removes the object in the given request context from the database. This redirects back to the object index if this was done from an individual object view, otherwise it redirects back to the request's referer.
func (UI) Index ¶
func (h UI) Index(w http.ResponseWriter, r *http.Request)
Index serves the HTML response detailing the list of objects.