Skip to content

Commit dbeb284

Browse files
committed
Release: v5.0.0
- Support new Recommend Items to Item Segment endpoint - Series API improvements: - Add Series endpoint creates associated Item for the Series automatically (based on the cascadeCreate parameter) - Breaking change: Remove From Series no longer requires the time parameter - Removed deprecated Groups endpoints
1 parent 4709132 commit dbeb284

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+497
-746
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ or
1717
```
1818
{
1919
"require": {
20-
"recombee/php-api-client": "^4.1.2"
20+
"recombee/php-api-client": "^5.0.0"
2121
}
2222
}
2323
```

composer.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
}
1111
],
1212
"require": {
13-
"php": ">=7.2.0",
14-
"guzzlehttp/guzzle": "^6.0.0 || ^7.0.0"
13+
"php": ">=7.2 || ^8.0",
14+
"guzzlehttp/guzzle": "^6.0.0 || ^7.0.0"
1515
},
1616
"require-dev": {
17-
"phpunit/phpunit": "^9.2.2",
18-
"phpdocumentor/phpdocumentor": "2.*"
17+
"phpunit/phpunit": "^9.5",
18+
"phpdocumentor/phpdocumentor": "^3.0"
1919
},
2020
"autoload": {
2121
"psr-4": {

phpdoc.dist.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
<files>
1414
<directory>src</directory>
1515
</files>
16-
</phpdocumentor>
16+
</phpdocumentor>

src/RecommApi/Client.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ protected function getBaseUri() {
8686
}
8787

8888
protected function getUserAgent() {
89-
$user_agent = 'recombee-php-api-client/4.1.2';
89+
$user_agent = 'recombee-php-api-client/5.0.0';
9090
if (isset($this->options['serviceName']))
9191
$user_agent .= ' '.($this->options['serviceName']);
9292
return $user_agent;

src/RecommApi/Exceptions/ResponseException.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class ResponseException extends ApiException{
2525
*/
2626
public $description;
2727

28-
public function __construct($request, $status_code, $description, \Exception $previous = null) {
28+
public function __construct($request, $status_code, $description, ?\Exception $previous = null) {
2929
$this->request = $request;
3030
$this->status_code = $status_code;
3131
$this->description = $description;

src/RecommApi/Requests/AddBookmark.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function __construct($user_id, $item_id, $optional = array()) {
7777
if (!in_array($key, $existing_optional))
7878
throw new UnknownOptionalParameterException($key);
7979
}
80-
$this->timeout = 1000;
80+
$this->timeout = 3000;
8181
$this->ensure_https = false;
8282
}
8383

src/RecommApi/Requests/AddCartAddition.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function __construct($user_id, $item_id, $optional = array()) {
9393
if (!in_array($key, $existing_optional))
9494
throw new UnknownOptionalParameterException($key);
9595
}
96-
$this->timeout = 1000;
96+
$this->timeout = 3000;
9797
$this->ensure_https = false;
9898
}
9999

src/RecommApi/Requests/AddDetailView.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function __construct($user_id, $item_id, $optional = array()) {
8585
if (!in_array($key, $existing_optional))
8686
throw new UnknownOptionalParameterException($key);
8787
}
88-
$this->timeout = 1000;
88+
$this->timeout = 3000;
8989
$this->ensure_https = false;
9090
}
9191

src/RecommApi/Requests/AddGroup.php

-66
This file was deleted.

src/RecommApi/Requests/AddItem.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class AddItem extends Request {
2626
*/
2727
public function __construct($item_id) {
2828
$this->item_id = $item_id;
29-
$this->timeout = 1000;
29+
$this->timeout = 3000;
3030
$this->ensure_https = false;
3131
}
3232

src/RecommApi/Requests/AddItemProperty.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Recombee\RecommApi\Exceptions\UnknownOptionalParameterException;
1111

1212
/**
13-
* Adding an item property is somehow equivalent to adding a column to the table of items. The items may be characterized by various properties of different types.
13+
* Adding an item property is somewhat equivalent to adding a column to the table of items. The items may be characterized by various properties of different types.
1414
*/
1515
class AddItemProperty extends Request {
1616

src/RecommApi/Requests/AddPurchase.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function __construct($user_id, $item_id, $optional = array()) {
101101
if (!in_array($key, $existing_optional))
102102
throw new UnknownOptionalParameterException($key);
103103
}
104-
$this->timeout = 1000;
104+
$this->timeout = 3000;
105105
$this->ensure_https = false;
106106
}
107107

src/RecommApi/Requests/AddRating.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function __construct($user_id, $item_id, $rating, $optional = array()) {
8383
if (!in_array($key, $existing_optional))
8484
throw new UnknownOptionalParameterException($key);
8585
}
86-
$this->timeout = 1000;
86+
$this->timeout = 3000;
8787
$this->ensure_https = false;
8888
}
8989

src/RecommApi/Requests/AddSeries.php

+26-2
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,36 @@ class AddSeries extends Request {
1818
* @var string $series_id ID of the series to be created.
1919
*/
2020
protected $series_id;
21+
/**
22+
* @var bool $cascade_create If set to `true`, the item will be created with the same ID as the series. Default is `true`.
23+
*/
24+
protected $cascade_create;
25+
/**
26+
* @var array Array containing values of optional parameters
27+
*/
28+
protected $optional;
2129

2230
/**
2331
* Construct the request
2432
* @param string $series_id ID of the series to be created.
33+
* @param array $optional Optional parameters given as an array containing pairs name of the parameter => value
34+
* - Allowed parameters:
35+
* - *cascadeCreate*
36+
* - Type: bool
37+
* - Description: If set to `true`, the item will be created with the same ID as the series. Default is `true`.
38+
* @throws Exceptions\UnknownOptionalParameterException UnknownOptionalParameterException if an unknown optional parameter is given in $optional
2539
*/
26-
public function __construct($series_id) {
40+
public function __construct($series_id, $optional = array()) {
2741
$this->series_id = $series_id;
28-
$this->timeout = 1000;
42+
$this->cascade_create = isset($optional['cascadeCreate']) ? $optional['cascadeCreate'] : null;
43+
$this->optional = $optional;
44+
45+
$existing_optional = array('cascadeCreate');
46+
foreach ($this->optional as $key => $value) {
47+
if (!in_array($key, $existing_optional))
48+
throw new UnknownOptionalParameterException($key);
49+
}
50+
$this->timeout = 3000;
2951
$this->ensure_https = false;
3052
}
3153

@@ -60,6 +82,8 @@ public function getQueryParameters() {
6082
*/
6183
public function getBodyParameters() {
6284
$p = array();
85+
if (isset($this->optional['cascadeCreate']))
86+
$p['cascadeCreate'] = $this-> optional['cascadeCreate'];
6387
return $p;
6488
}
6589

src/RecommApi/Requests/AddUser.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class AddUser extends Request {
2525
*/
2626
public function __construct($user_id) {
2727
$this->user_id = $user_id;
28-
$this->timeout = 1000;
28+
$this->timeout = 3000;
2929
$this->ensure_https = false;
3030
}
3131

src/RecommApi/Requests/AddUserProperty.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Recombee\RecommApi\Exceptions\UnknownOptionalParameterException;
1111

1212
/**
13-
* Adding a user property is somehow equivalent to adding a column to the table of users. The users may be characterized by various properties of different types.
13+
* Adding a user property is somewhat equivalent to adding a column to the table of users. The users may be characterized by various properties of different types.
1414
*/
1515
class AddUserProperty extends Request {
1616

src/RecommApi/Requests/DeleteBookmark.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function __construct($user_id, $item_id, $optional = array()) {
5353
if (!in_array($key, $existing_optional))
5454
throw new UnknownOptionalParameterException($key);
5555
}
56-
$this->timeout = 1000;
56+
$this->timeout = 3000;
5757
$this->ensure_https = false;
5858
}
5959

src/RecommApi/Requests/DeleteCartAddition.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function __construct($user_id, $item_id, $optional = array()) {
5353
if (!in_array($key, $existing_optional))
5454
throw new UnknownOptionalParameterException($key);
5555
}
56-
$this->timeout = 1000;
56+
$this->timeout = 3000;
5757
$this->ensure_https = false;
5858
}
5959

src/RecommApi/Requests/DeleteDetailView.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function __construct($user_id, $item_id, $optional = array()) {
5353
if (!in_array($key, $existing_optional))
5454
throw new UnknownOptionalParameterException($key);
5555
}
56-
$this->timeout = 1000;
56+
$this->timeout = 3000;
5757
$this->ensure_https = false;
5858
}
5959

src/RecommApi/Requests/DeleteGroup.php

-67
This file was deleted.

src/RecommApi/Requests/DeleteItem.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class DeleteItem extends Request {
2727
*/
2828
public function __construct($item_id) {
2929
$this->item_id = $item_id;
30-
$this->timeout = 1000;
30+
$this->timeout = 3000;
3131
$this->ensure_https = false;
3232
}
3333

src/RecommApi/Requests/DeletePurchase.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function __construct($user_id, $item_id, $optional = array()) {
5353
if (!in_array($key, $existing_optional))
5454
throw new UnknownOptionalParameterException($key);
5555
}
56-
$this->timeout = 1000;
56+
$this->timeout = 3000;
5757
$this->ensure_https = false;
5858
}
5959

src/RecommApi/Requests/DeleteRating.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function __construct($user_id, $item_id, $optional = array()) {
5353
if (!in_array($key, $existing_optional))
5454
throw new UnknownOptionalParameterException($key);
5555
}
56-
$this->timeout = 1000;
56+
$this->timeout = 3000;
5757
$this->ensure_https = false;
5858
}
5959

0 commit comments

Comments
 (0)