Define reasonable min and max values

This commit is contained in:
Michael 2022-01-16 15:03:01 +00:00
parent 4724000d06
commit a3173ccb50
7 changed files with 22 additions and 22 deletions

View file

@ -41,10 +41,10 @@ class Conversation extends BaseApi
// params // params
$id = $this->parameters['id'] ?? 0; $id = $this->parameters['id'] ?? 0;
$since_id = $this->getRequestValue($request, 'since_id', 0); $since_id = $this->getRequestValue($request, 'since_id', 0, 0);
$max_id = $this->getRequestValue($request, 'max_id', 0); $max_id = $this->getRequestValue($request, 'max_id', 0, 0);
$count = $this->getRequestValue($request, 'count', 20); $count = $this->getRequestValue($request, 'count', 20, 1, 100);
$page = $this->getRequestValue($request, 'page', 1); $page = $this->getRequestValue($request, 'page', 1, 1);
$start = max(0, ($page - 1) * $count); $start = max(0, ($page - 1) * $count);

View file

@ -60,9 +60,9 @@ abstract class DirectMessagesEndpoint extends BaseApi
// params // params
$count = $this->getRequestValue($request, 'count', 20, 1, 100); $count = $this->getRequestValue($request, 'count', 20, 1, 100);
$page = $this->getRequestValue($request, 'page', 1, 1); $page = $this->getRequestValue($request, 'page', 1, 1);
$since_id = $this->getRequestValue($request, 'since_id', 0, 1); $since_id = $this->getRequestValue($request, 'since_id', 0, 0);
$max_id = $this->getRequestValue($request, 'max_id', 0, 1); $max_id = $this->getRequestValue($request, 'max_id', 0, 0);
$min_id = $this->getRequestValue($request, 'min_id', 0, 1); $min_id = $this->getRequestValue($request, 'min_id', 0, 0);
$verbose = $this->getRequestValue($request, 'friendica_verbose', false); $verbose = $this->getRequestValue($request, 'friendica_verbose', false);
// pagination // pagination

View file

@ -47,8 +47,8 @@ class Favorites extends BaseApi
// params // params
$count = $this->getRequestValue($request, 'count', 20, 1, 100); $count = $this->getRequestValue($request, 'count', 20, 1, 100);
$page = $this->getRequestValue($request, 'page', 1, 1); $page = $this->getRequestValue($request, 'page', 1, 1);
$since_id = $this->getRequestValue($request, 'since_id', 0, 1); $since_id = $this->getRequestValue($request, 'since_id', 0, 0);
$max_id = $this->getRequestValue($request, 'max_id', 0, 1); $max_id = $this->getRequestValue($request, 'max_id', 0, 0);
$start = max(0, ($page - 1) * $count); $start = max(0, ($page - 1) * $count);

View file

@ -65,12 +65,12 @@ class Statuses extends BaseApi
} }
// params // params
$count = $this->getRequestValue($request, 'count', 20); $count = $this->getRequestValue($request, 'count', 20, 1, 100);
$page = $this->getRequestValue($request, 'page', 1); $page = $this->getRequestValue($request, 'page', 1, 1);
$since_id = $this->getRequestValue($request, 'since_id', 0); $since_id = $this->getRequestValue($request, 'since_id', 0, 0);
$max_id = $this->getRequestValue($request, 'max_id', 0); $max_id = $this->getRequestValue($request, 'max_id', 0, 0);
$exclude_replies = $this->getRequestValue($request, 'exclude_replies', false); $exclude_replies = $this->getRequestValue($request, 'exclude_replies', false);
$conversation_id = $this->getRequestValue($request, 'conversation_id', 0); $conversation_id = $this->getRequestValue($request, 'conversation_id', 0, 0);
$start = max(0, ($page - 1) * $count); $start = max(0, ($page - 1) * $count);

View file

@ -45,10 +45,10 @@ class HomeTimeline extends BaseApi
// params // params
$count = $this->getRequestValue($request, 'count', 20, 1, 100); $count = $this->getRequestValue($request, 'count', 20, 1, 100);
$page = $this->getRequestValue($request, 'page', 1, 1); $page = $this->getRequestValue($request, 'page', 1, 1);
$since_id = $this->getRequestValue($request, 'since_id', 0, 1); $since_id = $this->getRequestValue($request, 'since_id', 0, 0);
$max_id = $this->getRequestValue($request, 'max_id', 0, 1); $max_id = $this->getRequestValue($request, 'max_id', 0, 0);
$exclude_replies = $this->getRequestValue($request, 'exclude_replies', false); $exclude_replies = $this->getRequestValue($request, 'exclude_replies', false);
$conversation_id = $this->getRequestValue($request, 'conversation_id', 0); $conversation_id = $this->getRequestValue($request, 'conversation_id', 0, 0);
$start = max(0, ($page - 1) * $count); $start = max(0, ($page - 1) * $count);

View file

@ -44,8 +44,8 @@ class Mentions extends BaseApi
// params // params
$count = $this->getRequestValue($request, 'count', 20, 1, 100); $count = $this->getRequestValue($request, 'count', 20, 1, 100);
$page = $this->getRequestValue($request, 'page', 1, 1); $page = $this->getRequestValue($request, 'page', 1, 1);
$since_id = $this->getRequestValue($request, 'since_id', 0, 1); $since_id = $this->getRequestValue($request, 'since_id', 0, 0);
$max_id = $this->getRequestValue($request, 'max_id', 0, 1); $max_id = $this->getRequestValue($request, 'max_id', 0, 0);
$start = max(0, ($page - 1) * $count); $start = max(0, ($page - 1) * $count);

View file

@ -43,10 +43,10 @@ class PublicTimeline extends BaseApi
// params // params
$count = $this->getRequestValue($request, 'count', 20, 1, 100); $count = $this->getRequestValue($request, 'count', 20, 1, 100);
$page = $this->getRequestValue($request, 'page', 1, 1); $page = $this->getRequestValue($request, 'page', 1, 1);
$since_id = $this->getRequestValue($request, 'since_id', 0, 1); $since_id = $this->getRequestValue($request, 'since_id', 0, 0);
$max_id = $this->getRequestValue($request, 'max_id', 0, 1); $max_id = $this->getRequestValue($request, 'max_id', 0, 0);
$exclude_replies = $this->getRequestValue($request, 'exclude_replies', false); $exclude_replies = $this->getRequestValue($request, 'exclude_replies', false);
$conversation_id = $this->getRequestValue($request, 'conversation_id', 0); $conversation_id = $this->getRequestValue($request, 'conversation_id', 0, 0);
$start = max(0, ($page - 1) * $count); $start = max(0, ($page - 1) * $count);