FilesApiController

Extends \OCP\AppFramework\ApiController

Class FilesApiController

package

OCA\Gallery\Controller

Methods

Constructor

__construct(string $appName, \OCP\IRequest $request, \OCP\IURLGenerator $urlGenerator, \OCA\Gallery\Service\SearchFolderService $searchFolderService, \OCA\Gallery\Service\ConfigService $configService, \OCA\Gallery\Service\SearchMediaService $searchMediaService, \OCA\Gallery\Service\DownloadService $downloadService, \OCP\ILogger $logger) 

Arguments

$appName

string

$request

\OCP\IRequest

$urlGenerator

\OCP\IURLGenerator

$logger

\OCP\ILogger

download

download(integer $fileId, string|null $filename = null) : \OCA\Gallery\Http\ImageResponse
NoAdminRequired
NoCSRFRequired
CORS

Sends the file matching the fileId

In case of error we send an HTML error page We need to keep the session open in order to be able to send the error message to the error page

Arguments

$fileId

integer

the ID of the file we want to download

$filename

string|null

Response

\OCA\Gallery\Http\ImageResponse

Generates shortened paths to the media files

fixPaths(array $files, string $folderPathFromRoot) : array
inherited

We only want to keep one folder between the current folder and the found media file /root/folder/sub1/sub2/file.ext becomes /root/folder/file.ext

Arguments

$files

array

$folderPathFromRoot

string

Response

array

Generates the download data

getDownload(integer $fileId, string|null $filename) : array|false
inherited

Arguments

$fileId

integer

the ID of the file of which we need a large preview of

$filename

string|null

Response

array|false

getFilesAndAlbums

getFilesAndAlbums(string $location, array $features, string $etag, array $mediatypes) : array
inherited
NoAdminRequired

Returns a list of all media files and albums available to the authenticated user

  • Authentication can be via a login/password or a token/(password)
  • For private galleries, it returns all media files, with the full path from the root folder For public galleries, the path starts from the folder the link gives access to (virtual root)
  • An exception is only caught in case something really wrong happens. As we don't test files before including them in the list, we may return some bad apples

Arguments

$location

string

a path representing the current album in the app

$features

array

the list of supported features

$etag

string

the last known etag in the client

$mediatypes

array

the list of supported media types

Response

array

<string,array<string,string|int>>|Http\JSONResponse

Returns an error array

getHttpStatusCode( $exception) : \OCA\Gallery\Controller\array<null|integer|\OCA\Gallery\Controller\string>
inherited

Arguments

$exception

Response

\OCA\Gallery\Controller\array

getList

getList(string $location, string $features, string $etag, string $mediatypes) : array
NoAdminRequired
NoCSRFRequired
CORS

Returns a list of all media files available to the authenticated user

see \OCA\Gallery\Controller\FilesController::getList()

Arguments

$location

string

a path representing the current album in the app

$features

string

the list of supported features

$etag

string

the last known etag in the client

$mediatypes

string

the list of supported media types

Response

array

<string,array<string,string|int>>|Http\JSONResponse

htmlError

htmlError(\OCP\IURLGenerator $urlGenerator, string $appName, \Exception $exception) : \OCP\AppFramework\Http\RedirectResponse
inherited

Arguments

$urlGenerator

\OCP\IURLGenerator

$appName

string

$exception

\Exception

Response

\OCP\AppFramework\Http\RedirectResponse

jsonError

jsonError(\Exception $exception) : \OCP\AppFramework\Http\JSONResponse
inherited

Arguments

$exception

\Exception

Response

\OCP\AppFramework\Http\JSONResponse

Properties

urlGenerator

urlGenerator : \OCP\IURLGenerator
var

Type(s)

\OCP\IURLGenerator

searchFolderService

searchFolderService : \OCA\Gallery\Service\SearchFolderService
inherited

configService

configService : \OCA\Gallery\Service\ConfigService
inherited

searchMediaService

searchMediaService : \OCA\Gallery\Service\SearchMediaService
inherited

downloadService

downloadService : \OCA\Gallery\Service\DownloadService
inherited

logger

logger : \OCP\ILogger
inherited
var

Type(s)

\OCP\ILogger