Documentation ¶
Index ¶
- type API
- type Cron
- func (h Cron) DeleteModel(r *http.Request) error
- func (h Cron) IndexWithRelations(s *cron.Store, vals url.Values) ([]*cron.Cron, database.Paginator, error)
- func (h Cron) ShowWithRelations(r *http.Request) (*cron.Cron, error)
- func (h Cron) StoreModel(r *http.Request) (*cron.Cron, cron.Form, error)
- func (h Cron) UpdateModel(r *http.Request) (*cron.Cron, *cron.Form, error)
- type UI
- func (h UI) Create(w http.ResponseWriter, r *http.Request)
- func (h UI) Destroy(w http.ResponseWriter, r *http.Request)
- func (h UI) Edit(w http.ResponseWriter, r *http.Request)
- func (h UI) Index(w http.ResponseWriter, r *http.Request)
- func (h UI) Show(w http.ResponseWriter, r *http.Request)
- func (h UI) Store(w http.ResponseWriter, r *http.Request)
- func (h UI) Update(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct { Cron // 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 cron job creation, and management.
func (API) Destroy ¶
func (h API) Destroy(w http.ResponseWriter, r *http.Request)
Destroy removes the cron job in the given request context from the database. 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 cron jobs for the given request. If multiple pages of cron jobs 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 cron job in the given request. If the base path of the URL is "/builds" then the builds submitted via the cron will be served up in the JSON response.
func (API) Store ¶
func (h API) Store(w http.ResponseWriter, r *http.Request)
Store stores and submits the cron job from the given request body. If any validation errors occur then these will be sent back in the JSON response. On success the cron job is sent in the JSON response.
func (API) Update ¶
func (h API) Update(w http.ResponseWriter, r *http.Request)
Update applies the changes in the given request body to the existing cron job in the database. If any validation errors occur then these will be sent back in the JSON response. On success the updated cron job is sent in the JSON response.
type Cron ¶
Cron is the base handler that provides shared logic for the UI and API handlers for cron job creation, and management.
func (Cron) DeleteModel ¶
DeleteModel removes the cron in the given request context from the database.
func (Cron) IndexWithRelations ¶
func (h Cron) IndexWithRelations(s *cron.Store, vals url.Values) ([]*cron.Cron, database.Paginator, error)
IndexWithRelations retrieves a slice of *cron.Cron models for the user in the given request context. All of the relations for each cron will be loaded into each model we have. If any of the crons 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 cron jobs.
func (Cron) ShowWithRelations ¶
ShowWithRelations retrieves the *cron.Cron model from the context of the given request. All of the relations for the cron will be loaded into the model we have. If the cron has a namespace bound to it, then the namespace's user will be loaded to the namespace.
func (Cron) StoreModel ¶
StoreModel unmarshals the request's data into a cron job, validates it and stores it in the database. Upon success this will return the newly created cron. This also returns the form for creating a cron job.
func (Cron) UpdateModel ¶
UpdateModel unmarshals the request's data into a cron job, validates it and updates the existing cron job in the database with the content in the form. Upon success the updated cron job is returned. This also returns the form for modifying a cron job.
type UI ¶
type UI struct {
Cron
}
UI is the handler for handling UI requests made for cron job creation, and management.
func (UI) Create ¶
func (h UI) Create(w http.ResponseWriter, r *http.Request)
Create serves the HTML response for creating cron jobs via the web frontend.
func (UI) Destroy ¶
func (h UI) Destroy(w http.ResponseWriter, r *http.Request)
Destroy removes the cron job in the given request context from the database. This redirects back to the cron index if this was done from an individual cron view, otherwise it redirects back to the request's referer.
func (UI) Edit ¶
func (h UI) Edit(w http.ResponseWriter, r *http.Request)
Edit serves the HTML response for editing the cron job in the given request context.
func (UI) Index ¶
func (h UI) Index(w http.ResponseWriter, r *http.Request)
Index serves the HTML response detailing the list of cron jobs.
func (UI) Show ¶
func (h UI) Show(w http.ResponseWriter, r *http.Request)
Show serves the HTML response for viewing an individual cron job in the given request.