Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>tags/v26.0.0beta1
@@ -92,7 +92,7 @@ abstract class BaseResponse extends Response { | |||
} | |||
/** | |||
* @param string[] $meta | |||
* @param array<string,string|int> $meta | |||
* @return string | |||
*/ | |||
protected function renderResult(array $meta): string { |
@@ -28,7 +28,6 @@ use OCP\AppFramework\Http; | |||
use OCP\AppFramework\OCSController; | |||
class V1Response extends BaseResponse { | |||
/** | |||
* The V1 endpoint has very limited http status codes basically everything | |||
* is status 200 except 401 | |||
@@ -68,7 +67,7 @@ class V1Response extends BaseResponse { | |||
public function render() { | |||
$meta = [ | |||
'status' => $this->getOCSStatus() === 100 ? 'ok' : 'failure', | |||
'statuscode' => (string)$this->getOCSStatus(), | |||
'statuscode' => $this->getOCSStatus(), | |||
'message' => $this->getOCSStatus() === 100 ? 'OK' : $this->statusMessage ?? '', | |||
'totalitems' => (string)($this->itemsCount ?? ''), | |||
'itemsperpage' => (string)($this->itemsPerPage ?? ''), |
@@ -27,7 +27,6 @@ use OCP\AppFramework\Http; | |||
use OCP\AppFramework\OCSController; | |||
class V2Response extends BaseResponse { | |||
/** | |||
* The V2 endpoint just passes on status codes. | |||
* Of course we have to map the OCS specific codes to proper HTTP status codes | |||
@@ -61,7 +60,7 @@ class V2Response extends BaseResponse { | |||
$meta = [ | |||
'status' => $status >= 200 && $status < 300 ? 'ok' : 'failure', | |||
'statuscode' => $this->getOCSStatus(), | |||
'message' => $status >= 200 && $status < 300 ? 'OK' : $this->statusMessage, | |||
'message' => $status >= 200 && $status < 300 ? 'OK' : $this->statusMessage ?? '', | |||
]; | |||
if ($this->itemsCount !== null) { |