fix: change return type to generic

Signed-off-by: Varun Patil <varunpatil@ucla.edu>
pull/504/head
Varun Patil 2023-03-18 20:38:37 -07:00
parent d1720e8006
commit e207d3a8c5
12 changed files with 24 additions and 22 deletions

View File

@ -34,7 +34,7 @@ class AlbumsController extends ApiBase
*
* Get list of albums with counts of images
*/
public function albums(int $t = 0): JSONResponse
public function albums(int $t = 0): Http\Response
{
$user = $this->userSession->getUser();
if (null === $user) {
@ -75,7 +75,7 @@ class AlbumsController extends ApiBase
*
* Download an album as a zip file
*/
public function download(string $name = ''): JSONResponse
public function download(string $name = ''): Http\Response
{
$user = $this->userSession->getUser();
if (null === $user) {

View File

@ -325,7 +325,7 @@ class ApiBase extends Controller
/**
* Given a list of file ids, return the first preview image possible.
*/
protected function getPreviewFromImageList(array $list, int $quality = 512)
protected function getPreviewFromImageList(array $list, int $quality = 512): Http\Response
{
// Get preview manager
$previewManager = \OC::$server->get(\OCP\IPreview::class);

View File

@ -38,7 +38,7 @@ class ArchiveController extends ApiBase
*
* @param string fileid
*/
public function archive(string $id): JSONResponse
public function archive(string $id): Http\Response
{
$user = $this->userSession->getUser();
if (null === $user) {

View File

@ -37,7 +37,7 @@ class DaysController extends ApiBase
*
* @PublicPage
*/
public function days(): JSONResponse
public function days(): Http\Response
{
// Get the folder to show
try {
@ -94,7 +94,7 @@ class DaysController extends ApiBase
*
* @PublicPage
*/
public function day(string $id): JSONResponse
public function day(string $id): Http\Response
{
// Get user
$uid = $this->getUID();
@ -163,7 +163,7 @@ class DaysController extends ApiBase
*
* @PublicPage
*/
public function dayPost(): JSONResponse
public function dayPost(): Http\Response
{
$id = $this->request->getParam('body_ids');
if (null === $id) {

View File

@ -42,7 +42,7 @@ class DownloadController extends ApiBase
*
* Request to download one or more files
*/
public function request(): JSONResponse
public function request(): Http\Response
{
// Get ids from body
$files = $this->request->getParam('files');

View File

@ -181,7 +181,7 @@ class ImageController extends ApiBase
bool $basic = false,
bool $current = false,
bool $tags = false
): JSONResponse {
): Http\Response {
$file = $this->getUserFile((int) $id);
if (!$file) {
return Errors::NotFoundFile($id);
@ -222,7 +222,7 @@ class ImageController extends ApiBase
* @param string fileid
* @param array raw exif data
*/
public function setExif(string $id, array $raw): JSONResponse
public function setExif(string $id, array $raw): Http\Response
{
$file = $this->getUserFile((int) $id);
if (!$file) {
@ -267,7 +267,7 @@ class ImageController extends ApiBase
* The returned image may be png / webp / jpeg / gif.
* These formats are supported by all browsers.
*/
public function decodable(string $id)
public function decodable(string $id): Http\Response
{
$file = $this->getUserFile((int) $id);
if (!$file) {

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace OCA\Memories\Controller;
use OCA\Memories\Errors;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\JSONResponse;
class MapController extends ApiBase
@ -31,7 +32,7 @@ class MapController extends ApiBase
/**
* @NoAdminRequired
*/
public function clusters(): JSONResponse
public function clusters(): Http\Response
{
// Get the folder to show
$root = null;

View File

@ -41,7 +41,7 @@ class OtherController extends ApiBase
*
* @return JSONResponse an empty JSONResponse with respective http status code
*/
public function setUserConfig(string $key, string $value): JSONResponse
public function setUserConfig(string $key, string $value): Http\Response
{
$user = $this->userSession->getUser();
if (null === $user) {

View File

@ -37,7 +37,7 @@ class PeopleController extends ApiBase
*
* Get list of faces with counts of images
*/
public function recognizePeople(): JSONResponse
public function recognizePeople(): Http\Response
{
try {
$uid = $this->getUID();
@ -58,7 +58,8 @@ class PeopleController extends ApiBase
// Run actual query
$list = $this->timelineQuery->getPeopleRecognize(
$root, $uid
$root,
$uid
);
return new JSONResponse($list, Http::STATUS_OK);
@ -107,7 +108,7 @@ class PeopleController extends ApiBase
*
* Get list of faces with counts of images
*/
public function facerecognitionPeople(): JSONResponse
public function facerecognitionPeople(): Http\Response
{
$user = $this->userSession->getUser();
if (null === $user) {

View File

@ -34,7 +34,7 @@ class PlacesController extends ApiBase
*
* Get list of places with counts of images
*/
public function places(): JSONResponse
public function places(): Http\Response
{
$user = $this->userSession->getUser();
if (null === $user) {

View File

@ -37,7 +37,7 @@ class ShareController extends ApiBase
* @param mixed $id
* @param mixed $path
*/
public function links($id, $path)
public function links($id, $path): Http\Response
{
$file = $this->getNodeByIdOrPath($id, $path);
if (!$file) {
@ -65,7 +65,7 @@ class ShareController extends ApiBase
* @param mixed $id
* @param mixed $path
*/
public function createNode($id, $path)
public function createNode($id, $path): Http\Response
{
$file = $this->getNodeByIdOrPath($id, $path);
if (!$file) {
@ -92,7 +92,7 @@ class ShareController extends ApiBase
*
* Delete an external link share
*/
public function deleteShare(string $id)
public function deleteShare(string $id): Http\Response
{
$uid = $this->getUID();
if (!$uid) {

View File

@ -34,7 +34,7 @@ class TagsController extends ApiBase
*
* Get list of tags with counts of images
*/
public function tags(): JSONResponse
public function tags(): Http\Response
{
$user = $this->userSession->getUser();
if (null === $user) {
@ -103,7 +103,7 @@ class TagsController extends ApiBase
*
* Set tags for a file
*/
public function set(int $id, array $add, array $remove): JSONResponse
public function set(int $id, array $add, array $remove): Http\Response
{
// Check tags enabled for this user
if (!$this->tagsIsEnabled()) {