Version 4.3.0
This commit is contained in:
1 parent
96997ddd8e
commit
fe1acf984a
1349 files changed
+116159
-67711
No files matched your search
@@ -27,11 +27,13 @@ class _albums extends \IPS\Api\Controller
|
||||
* GET /gallery/albums
|
||||
* Get list of albums
|
||||
*
|
||||
* @note For requests using an OAuth Access Token for a particular member, only albums the authorized user can view will be included
|
||||
* @apiparam string categories Comma-delimited list of categiry IDs - if provided, only albums in those categories are returned
|
||||
* @apiparam string owners Comma-delimited list of member IDs - if provided, only albums owned by those members are returned
|
||||
* @apiparam string sortBy What to sort by. Can be 'name', 'count_images' for number of images, or do not specify for ID
|
||||
* @apiparam string sortDir Sort direction. Can be 'asc' or 'desc' - defaults to 'asc'
|
||||
* @apiparam int page Page number
|
||||
* @apiparam int perPage Number of results per page - defaults to 25
|
||||
* @return \IPS\Api\PaginatedResponse<IPS\gallery\Album>
|
||||
*/
|
||||
public function GETindex()
|
||||
@@ -85,13 +87,22 @@ class _albums extends \IPS\Api\Controller
|
||||
}
|
||||
$sortDir = ( isset( \IPS\Request::i()->sortDir ) and in_array( mb_strtolower( \IPS\Request::i()->sortDir ), array( 'asc', 'desc' ) ) ) ? \IPS\Request::i()->sortDir : 'asc';
|
||||
|
||||
/* Get results */
|
||||
if ( $this->member )
|
||||
{
|
||||
$joins = array();
|
||||
$where[] = \IPS\gallery\Album\Item::getItemsWithPermissionWhere( $where, $this->member, $joins );
|
||||
}
|
||||
|
||||
/* Return */
|
||||
return new \IPS\Api\PaginatedResponse(
|
||||
200,
|
||||
\IPS\Db::i()->select( '*', 'gallery_albums', $where, "{$sortBy} {$sortDir}" ),
|
||||
isset( \IPS\Request::i()->page ) ? \IPS\Request::i()->page : 1,
|
||||
'IPS\gallery\Album',
|
||||
\IPS\Db::i()->select( 'COUNT(*)', 'gallery_albums', $where )->first()
|
||||
\IPS\Db::i()->select( 'COUNT(*)', 'gallery_albums', $where )->first(),
|
||||
$this->member,
|
||||
isset( \IPS\Request::i()->perPage ) ? \IPS\Request::i()->perPage : NULL
|
||||
);
|
||||
}
|
||||
|
||||
@@ -100,14 +111,15 @@ class _albums extends \IPS\Api\Controller
|
||||
* Get information about a specific album
|
||||
*
|
||||
* @param int $id ID Number
|
||||
* @throws 2G315/1 INVALID_ID The album ID does not exist
|
||||
* @throws 2G315/1 INVALID_ID The album ID does not exist or the authorized user does not have permisison to view it
|
||||
* @return \IPS\gallery\Album
|
||||
*/
|
||||
public function GETitem( $id )
|
||||
{
|
||||
try
|
||||
{
|
||||
return new \IPS\Api\Response( 200, \IPS\gallery\Album::load( $id )->apiOutput() );
|
||||
{
|
||||
$album = $this->member ? \IPS\gallery\Album::loadAndCheckPerms( $id, 'view', $this->member ) : \IPS\gallery\Album::load( $id );
|
||||
return new \IPS\Api\Response( 200, $album->apiOutput( $this->member ) );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user