Просмотр исходного кода

make ombi api endpoint cleaner

CauseFX 5 лет назад
Родитель
Сommit
9b908b0d68
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      api/v2/routes/homepage.php

+ 4 - 2
api/v2/routes/homepage.php

@@ -364,9 +364,11 @@ $app->get('/homepage/healthchecks/{tags}', function ($request, $response, $args)
 		->withStatus($GLOBALS['responseCode']);
 	
 });
-$app->get('/homepage/ombi/requests', function ($request, $response, $args) {
+$app->get('/homepage/ombi/requests[/{type}[/{limit}]]', function ($request, $response, $args) {
 	$Organizr = ($request->getAttribute('Organizr')) ?? new Organizr();
-	$Organizr->getOmbiRequests('both', $Organizr->config['ombiLimit']);
+	$args['type'] = $args['type'] ?? 'both';
+	$args['limit'] = $args['limit'] ?? $Organizr->config['ombiLimit'];
+	$Organizr->getOmbiRequests($args['type'], $args['limit']);
 	$response->getBody()->write(jsonE($GLOBALS['api']));
 	return $response
 		->withHeader('Content-Type', 'application/json;charset=UTF-8')