controllers

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2017 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	*revel.Controller
}

func (Base) HasAccess

func (c Base) HasAccess(jToken string, actionMethod string) error

func (Base) RenderContent

func (c Base) RenderContent(cnt kek.Doc) revel.Result

renderContent runs through a switch case to parse and return the content format filled in with the desired data. Parameter @cnt is a map[string]map[string]interface{} which will get parsed into the desired response. Param @resType is a string that tells us what type of response format that we need. @todo may need to refactor this out as response format types get larger and move to a more polymorphic approach instead of a switch case @todo need to add more response formats.

Available resFormats at the moment: json, xml

type Delete

type Delete struct {
	*revel.Controller
	Base
}

func (Delete) DeleteCollectionResource

func (c Delete) DeleteCollectionResource(collection string, resource string) revel.Result

func (Delete) DeleteResource

func (c Delete) DeleteResource(resource string) revel.Result

type Get

type Get struct {
	*revel.Controller
	Base
}

func (Get) GetResource

func (c Get) GetResource(resource string) revel.Result

GetResource returns a valid kekdoc, kekcollection or kekmedia item according to the resource string. The resource string can be the id of the resource item or a slug representing collections. Slugs aren't guaranteed unique and you could have numerous collections having the same slug.

func (Get) Search

func (c Get) Search() revel.Result

type Options

type Options struct {
	*revel.Controller
	Base
}

func (Options) Options

func (c Options) Options() revel.Result

Options provides a route request for OPTIONS based routes. It is generally useful for preflight requests from browsers. Returns a success message in the revel render result.

type Patch

type Patch struct {
	*revel.Controller
	Base
}

func (Patch) PatchResource

func (c Patch) PatchResource(resource string) revel.Result

Patch handles an HTTP Patch request method. It will patch a resource item for an individual content type if the request matches the appropriate authorization and access. @param resource is a string that tells us the resource identifier that we are patching. Patch will return back a success method with data on success. It will return an appropriate HTTP error code and message on failuare. TODO(miracle) Patch should follow some standard that also has description. Needs more research to determine how to handle standardization without overcomplicating it. TODO(miracle) Patching collections should be dynamic enough to know based on the id whether its a collection. Also, if it is a slug then we know its a collection.

type Post

type Post struct {
	*revel.Controller
	Base
}

func (Post) PostCollectionResource

func (c Post) PostCollectionResource(collectionResource string) revel.Result

func (Post) PostResource

func (c Post) PostResource() revel.Result

PostResource handles an HTTP POST request from the server by creating a brand new content resource. The @contentType parameter tells us the type of content that we are creating. It returns back a json array with a succes message and the data when a new item is created. It will return an appropriate error code and message when the user either didn't have enough access or the system couldn't create the new content resource.

type Put

type Put struct {
	*revel.Controller
	Base
}

func (Put) PutCollectionResource

func (c Put) PutCollectionResource(collection string, resource string) revel.Result

func (Put) PutResource

func (c Put) PutResource(resource string) revel.Result

Jump to

Keyboard shortcuts

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