Add latest_first parameter to photo gallery listing Friendica API endpoint
This commit is contained in:
parent
4fc01c93ce
commit
991c5fa6de
1 changed files with 3 additions and 1 deletions
|
@ -60,15 +60,17 @@ class Show extends BaseApi
|
||||||
'album' => '', // Get pictures in this album
|
'album' => '', // Get pictures in this album
|
||||||
'offset' => 0, // Return results offset by this value
|
'offset' => 0, // Return results offset by this value
|
||||||
'limit' => 50, // Maximum number of results to return. Defaults to 50. Max 500
|
'limit' => 50, // Maximum number of results to return. Defaults to 50. Max 500
|
||||||
|
'latest_first' => false, // Whether to reverse the order so newest are first
|
||||||
], $request);
|
], $request);
|
||||||
if (empty($request['album'])) {
|
if (empty($request['album'])) {
|
||||||
throw new HTTPException\BadRequestException('No album name specified.');
|
throw new HTTPException\BadRequestException('No album name specified.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$orderDescending = $request['latest_first'];
|
||||||
$album = $request['album'];
|
$album = $request['album'];
|
||||||
$condition = ["`uid` = ? AND `album` = ?", $uid, $album];
|
$condition = ["`uid` = ? AND `album` = ?", $uid, $album];
|
||||||
$params = ['order' => ['id'], 'group_by' => ['resource-id']];
|
$params = ['order' => ['id' => $orderDescending], 'group_by' => ['resource-id']];
|
||||||
|
|
||||||
//'limit' => [$request['offset'], $request['limit']]
|
//'limit' => [$request['offset'], $request['limit']]
|
||||||
$limit = $request['limit'];
|
$limit = $request['limit'];
|
||||||
|
|
Loading…
Reference in a new issue