summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers/item_rest.php
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2010-02-12 09:52:57 -0800
committerTim Almdal <tnalmdal@shaw.ca>2010-02-12 09:52:57 -0800
commit3439671bcfb99c1884285e4b4e53295f044e688f (patch)
treee45cb63c005d673635deed27f59a86f14a25104a /modules/gallery/helpers/item_rest.php
parentcd45c94fe69f24b0f80a79e4b9c402763739ecfc (diff)
1) Add a depth parameter to retrieving an item thru the rest api
2) Standardize the structure of members so that client programs can consistently parse the return information. 3) Added a summary parameter so that client programs can easily determine if the information returned is summary (item type, item title) or the full meal deal
Diffstat (limited to 'modules/gallery/helpers/item_rest.php')
-rw-r--r--modules/gallery/helpers/item_rest.php14
1 files changed, 4 insertions, 10 deletions
diff --git a/modules/gallery/helpers/item_rest.php b/modules/gallery/helpers/item_rest.php
index c0fc422a..72230d8b 100644
--- a/modules/gallery/helpers/item_rest.php
+++ b/modules/gallery/helpers/item_rest.php
@@ -30,6 +30,9 @@ class item_rest_Core {
* name=<substring>
* only return items where the name contains this substring
*
+ * depth=<number>
+ * return the children to the depth specified.
+ *
* random=true
* return a single random item
*
@@ -70,16 +73,7 @@ class item_rest_Core {
$orm->where("type", "IN", explode(",", $p->type));
}
- $members = array();
- foreach ($orm->find_all() as $child) {
- $members[] = rest::url("item", $child);
- }
-
- return array(
- "url" => $request->url,
- "entity" => $item->as_restful_array(),
- "members" => $members,
- "relationships" => rest::relationships("item", $item));
+ return $item->as_restful_array(isset($p->depth) ? $p->depth : 0);
}
static function put($request) {