Skip to content

Commit

Permalink
Merge pull request #66 from bookboon/feature/rec-versioning
Browse files Browse the repository at this point in the history
feat: added flag for recommendation version to book API
  • Loading branch information
lkm committed Aug 3, 2021
2 parents 5138a84 + fc5cc70 commit 5257027
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/Entity/Book.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,16 @@ abstract class Book extends Entity
* @param Bookboon $bookboon
* @param string $bookId
* @param bool $extendedMetadata
* @param array $params
* @return BookboonResponse<Book>
* @throws \Bookboon\Api\Exception\UsageException
* @throws UsageException
* @throws \Bookboon\Api\Exception\ApiDecodeException
*/
public static function get(Bookboon $bookboon, string $bookId, bool $extendedMetadata = false) : BookboonResponse
public static function get(Bookboon $bookboon, string $bookId, bool $extendedMetadata = false, array $params = []) : BookboonResponse
{
$bResponse = $bookboon->rawRequest(
"/v1/books/$bookId",
['extendedMetadata' => $extendedMetadata ? 'true' : 'false'],
array_merge($params, ['extendedMetadata' => $extendedMetadata ? 'true' : 'false']),
ClientInterface::HTTP_GET,
true,
Book::class
Expand Down Expand Up @@ -228,18 +230,24 @@ public static function search(
* @param array $bookTypes
* @param array $bookIds array of book ids to base recommendations on, can be empty
* @param int $limit
* @param array $params
* @return BookboonResponse<Book>
* @throws \Bookboon\Api\Exception\UsageException
*/
public static function recommendations(
Bookboon $bookboon,
array $bookIds = [],
int $limit = 5,
array $bookTypes = ['professional']
array $bookTypes = ['professional'],
array $params = []
) : BookboonResponse {
$bResponse = $bookboon->rawRequest(
'/v1/recommendations',
['limit' => $limit, 'books' => $bookIds, 'bookType' => join(',', $bookTypes)],
array_merge($params, [
'limit' => $limit,
'books' => $bookIds,
'bookType' => join(',', $bookTypes)
]),
ClientInterface::HTTP_GET,
true,
Book::class
Expand Down

0 comments on commit 5257027

Please sign in to comment.