OCA\OcSms\Controller\ApiController::fetchMessages PHP Method

fetchMessages() public method

public fetchMessages ( $start, $limit ) : OCP\AppFramework\Http\JSONResponse
$start
$limit
return OCP\AppFramework\Http\JSONResponse
    public function fetchMessages($start, $limit)
    {
        if (!is_numeric($start) || !is_numeric($limit) || $start < 0 || $limit <= 0) {
            return new JSONResponse(array("msg" => "Invalid request"), \OCP\AppFramework\Http::STATUS_BAD_REQUEST);
        }
        // Limit messages per fetch to prevent phone garbage collecting due to too many datas
        if ($limit > 500) {
            return new JSONResponse(array("msg" => "Too many messages requested"), 413);
        }
        return new JSONResponse(array("messages" => $this->smsMapper->getMessages($this->userId, $start, $limit)));
    }