diff --git a/src/Service/AlmaApi.php b/src/Service/AlmaApi.php index 94e578c..7010752 100644 --- a/src/Service/AlmaApi.php +++ b/src/Service/AlmaApi.php @@ -1183,7 +1183,7 @@ public function getBookLoansJsonDataByPerson(Person $person): ?array try { $resultList = []; $loopCount = 0; - $limit = 1000; + $limit = 100; $offset = 0; // do as many requests as necessary to get all loans by the user diff --git a/src/Service/AlmaUrlApi.php b/src/Service/AlmaUrlApi.php index 19b1f75..a8e210f 100644 --- a/src/Service/AlmaUrlApi.php +++ b/src/Service/AlmaUrlApi.php @@ -150,8 +150,12 @@ public function getBookOfferLoansUrl(string $identifier): string /** * @throws UriException */ - public function getLoansByUserIdUrl(string $userId, int $limit = 1000, int $offset = 0): string + public function getLoansByUserIdUrl(string $userId, int $limit = 100, int $offset = 0): string { + if ($limit < 0 || $limit > 100) { + throw new \RuntimeException('Valid values are 0-100'); + } + // see: https://developers.exlibrisgroup.com/alma/apis/docs/users/R0VUIC9hbG1hd3MvdjEvdXNlcnMve3VzZXJfaWR9L2xvYW5z/ $uriTemplate = new UriTemplate('users/{userId}/loans{?limit,offset}'); diff --git a/tests/AlmaApiUrlTest.php b/tests/AlmaApiUrlTest.php index 348e2cc..5f7f63b 100644 --- a/tests/AlmaApiUrlTest.php +++ b/tests/AlmaApiUrlTest.php @@ -71,7 +71,7 @@ public function testGetBookOfferLoansUrl() public function testGetLoansByUserIdUrl() { $this->assertEquals( - 'users/bla%3F/loans?limit=1000&offset=0', + 'users/bla%3F/loans?limit=100&offset=0', $this->urls->getLoansByUserIdUrl('bla?')); $this->assertEquals( 'users/bla%3F/loans?limit=20&offset=0',