/** * @return string * @since 8.1.0 */ public function render() { $r = new \OC_OCS_Result($this->data, $this->statuscode, $this->message); $r->setTotalItems($this->itemscount); $r->setItemsPerPage($this->itemsperpage); return \OC_API::renderResult($this->format, $r->getMeta(), $r->getData()); }
/** * Testable search function that does not need globals * * @param string $search * @param string $itemType * @param array $shareTypes * @param int $page * @param int $perPage * @return \OC_OCS_Result */ protected function searchSharees($search, $itemType, array $shareTypes, $page, $perPage) { // Verify arguments if ($itemType === null) { return new \OC_OCS_Result(null, Http::STATUS_BAD_REQUEST, 'Missing itemType'); } // Get users if (in_array(Share::SHARE_TYPE_USER, $shareTypes)) { $this->getUsers($search); } // Get groups if (in_array(Share::SHARE_TYPE_GROUP, $shareTypes)) { $this->getGroups($search); } // Get remote if (in_array(Share::SHARE_TYPE_REMOTE, $shareTypes)) { $this->getRemote($search); } $response = new \OC_OCS_Result($this->result); $response->setItemsPerPage($perPage); if (sizeof($this->reachedEndFor) < 3) { $response->addHeader('Link', $this->getPaginationLink($page, ['search' => $search, 'itemType' => $itemType, 'shareType' => $shareTypes, 'perPage' => $perPage])); } return $response; }