]> source.dussan.org Git - nextcloud-server.git/commitdiff
API: Include totalitems and itemsperpage meta data when needed.
authorTom Needham <needham.thomas@gmail.com>
Wed, 12 Dec 2012 20:58:40 +0000 (20:58 +0000)
committerTom Needham <needham.thomas@gmail.com>
Wed, 12 Dec 2012 20:58:40 +0000 (20:58 +0000)
lib/ocs/result.php

index a7199cb5ac750ff05fdeccea8e18a9fca7451343..24029051da5dfa8bca9d806f8c8ad65ed63537ea 100644 (file)
@@ -26,7 +26,7 @@ class OC_OCS_Result{
         * optionally set the total number of items available
         * @param $items int
         */
-       public function setItems(int $items){
+       public function setTotalItems(int $items){
                $this->items = $items;
        }
        
@@ -56,6 +56,12 @@ class OC_OCS_Result{
                $return['meta']['status'] = ($this->statuscode === 100) ? 'ok' : 'failure';
                $return['meta']['statuscode'] = $this->statuscode;
                $return['meta']['message'] = $this->message;
+               if(isset($this->items)){
+                       $return['meta']['totalitems'] = $this->items;
+               }
+               if(isset($this->perpage)){
+                       $return['meta']['itemsperpage'] = $this->perpage;
+               }
                $return['data'] = $this->data;
                // Return the result data.
                return $return;