summaryrefslogtreecommitdiff
path: root/system/item
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2017-03-15 11:01:28 -0700
committerSteve Manuel <nilslice@gmail.com>2017-03-15 11:01:28 -0700
commit07fe1b15899fa6439e587984d6183371f9a6877c (patch)
treef1191c86ce03fbc36ea03539e9fbd27d143ec72d /system/item
parent0eaddb8ae0b29937f7514cc83c63e0aa3c377850 (diff)
changing API for external client interaction. Externalable -> Createable, +Deleteable, changing Hookable interface methods to conform to pattern: BeforeAPI$ACTION, etc.
Diffstat (limited to 'system/item')
-rw-r--r--system/item/item.go37
1 files changed, 25 insertions, 12 deletions
diff --git a/system/item/item.go b/system/item/item.go
index 286842b..f6e8f99 100644
--- a/system/item/item.go
+++ b/system/item/item.go
@@ -42,11 +42,14 @@ type Sortable interface {
// to the different lifecycles/events a struct may encounter. Item implements
// Hookable with no-ops so our user can override only whichever ones necessary.
type Hookable interface {
- BeforeAcceptUpdate(http.ResponseWriter, *http.Request) error
- AfterAcceptUpdate(http.ResponseWriter, *http.Request) error
+ BeforeAPICreate(http.ResponseWriter, *http.Request) error
+ AfterAPICreate(http.ResponseWriter, *http.Request) error
- BeforeAccept(http.ResponseWriter, *http.Request) error
- AfterAccept(http.ResponseWriter, *http.Request) error
+ BeforeAPIUpdate(http.ResponseWriter, *http.Request) error
+ AfterAPIUpdate(http.ResponseWriter, *http.Request) error
+
+ BeforeAPIDelete(http.ResponseWriter, *http.Request) error
+ AfterAPIDelete(http.ResponseWriter, *http.Request) error
BeforeSave(http.ResponseWriter, *http.Request) error
AfterSave(http.ResponseWriter, *http.Request) error
@@ -135,23 +138,33 @@ func (i Item) String() string {
return fmt.Sprintf("Item ID: %s", i.UniqueID())
}
-// BeforeAcceptUpdate is a no-op to ensure structs which embed Item implement Hookable
-func (i Item) BeforeAcceptUpdate(res http.ResponseWriter, req *http.Request) error {
+// BeforeAPICreate is a no-op to ensure structs which embed Item implement Hookable
+func (i Item) BeforeAPICreate(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+
+// AfterAPICreate is a no-op to ensure structs which embed Item implement Hookable
+func (i Item) AfterAPICreate(res http.ResponseWriter, req *http.Request) error {
+ return nil
+}
+
+// BeforeAPIUpdate is a no-op to ensure structs which embed Item implement Hookable
+func (i Item) BeforeAPIUpdate(res http.ResponseWriter, req *http.Request) error {
return nil
}
-// AfterAcceptUpdate is a no-op to ensure structs which embed Item implement Hookable
-func (i Item) AfterAcceptUpdate(res http.ResponseWriter, req *http.Request) error {
+// AfterAPIUpdate is a no-op to ensure structs which embed Item implement Hookable
+func (i Item) AfterAPIUpdate(res http.ResponseWriter, req *http.Request) error {
return nil
}
-// BeforeAccept is a no-op to ensure structs which embed Item implement Hookable
-func (i Item) BeforeAccept(res http.ResponseWriter, req *http.Request) error {
+// BeforeAPIDelete is a no-op to ensure structs which embed Item implement Hookable
+func (i Item) BeforeAPIDelete(res http.ResponseWriter, req *http.Request) error {
return nil
}
-// AfterAccept is a no-op to ensure structs which embed Item implement Hookable
-func (i Item) AfterAccept(res http.ResponseWriter, req *http.Request) error {
+// AfterAPIDelete is a no-op to ensure structs which embed Item implement Hookable
+func (i Item) AfterAPIDelete(res http.ResponseWriter, req *http.Request) error {
return nil
}