Skip to content

Commit cec9569

Browse files
committed
Update to latest version API definition
1 parent 04c7ad5 commit cec9569

23 files changed

+1000
-127
lines changed

src/Client.php

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,30 @@ public function getCommission(string $ean, float $unitPrice, ?Enum\GetCommission
6565
return $this->request('GET', $url, $options, $responseTypes);
6666
}
6767

68+
/**
69+
* Gets a list of all commissions using EAN.
70+
* @param Model\Ean[] $products
71+
* @return Model\BulkCommissionRatesMultiStatusResponse
72+
* @throws Exception\ConnectException when an error occurred in the HTTP connection.
73+
* @throws Exception\ResponseException when an unexpected response was received.
74+
* @throws Exception\UnauthorizedException when the request was unauthorized.
75+
* @throws Exception\RateLimitException when the throttling limit has been reached for the API user.
76+
* @throws Exception\Exception when something unexpected went wrong.
77+
*/
78+
public function getCommissionRates(array $products): Model\BulkCommissionRatesMultiStatusResponse
79+
{
80+
$url = "retailer/commissions";
81+
$options = [
82+
'body' => Model\CommissionProducts::constructFromArray(['products' => $products]),
83+
'produces' => 'application/vnd.retailer.v10+json',
84+
'consumes' => 'application/vnd.retailer.v10+json',
85+
];
86+
$responseTypes = [
87+
];
88+
89+
return $this->request('POST', $url, $options, $responseTypes);
90+
}
91+
6892
/**
6993
* Gets the details of a catalog product by means of its EAN.
7094
* @param string $ean The EAN number associated with this product.
@@ -229,6 +253,41 @@ public function getPerformanceIndicators(Enum\GetPerformanceIndicatorsName $name
229253
return $this->request('GET', $url, $options, $responseTypes)->performanceIndicators;
230254
}
231255

256+
/**
257+
* Gets a list of product ranks.
258+
* @param string $ean The EAN number associated with this product.
259+
* @param string $date Filters search results to a specific date. The date must be in the past, no more than three
260+
* months back, and up to yesterday.
261+
* @param Enum\GetProductRanksType|null $type Determines the search type, either 'SEARCH' for specific queries or
262+
* 'BROWSE' for broader category searches. In order to retrieve all results, it can be sent as "null".
263+
* @param int|null $page The requested page number with a page size of 50 items.
264+
* @param string|null $AcceptLanguage The language to search for.
265+
* @return Model\ProductRanks
266+
* @throws Exception\ConnectException when an error occurred in the HTTP connection.
267+
* @throws Exception\ResponseException when an unexpected response was received.
268+
* @throws Exception\UnauthorizedException when the request was unauthorized.
269+
* @throws Exception\RateLimitException when the throttling limit has been reached for the API user.
270+
* @throws Exception\Exception when something unexpected went wrong.
271+
*/
272+
public function getProductRanks(string $ean, string $date, ?Enum\GetProductRanksType $type = null, ?int $page = 1, ?string $AcceptLanguage = null): Model\ProductRanks
273+
{
274+
$url = "retailer/insights/product-ranks";
275+
$options = [
276+
'query' => [
277+
'ean' => $ean,
278+
'date' => $date,
279+
'type' => $type?->value,
280+
'page' => $page,
281+
],
282+
'produces' => 'application/vnd.retailer.v10+json',
283+
];
284+
$responseTypes = [
285+
'200' => Model\ProductRanks::class,
286+
];
287+
288+
return $this->request('GET', $url, $options, $responseTypes);
289+
}
290+
232291
/**
233292
* Get sales forecast to estimate the sales expectations on the total bol.com platform for the requested number of
234293
* weeks ahead.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace Picqer\BolRetailerV10\Enum;
4+
5+
// This class is auto generated by OpenApi\ModelGenerator
6+
enum GetProductRanksAcceptLanguage: string
7+
{
8+
case NL_NL = 'nl-NL';
9+
case NL = 'nl';
10+
case NL_BE = 'nl-BE';
11+
case FR = 'fr';
12+
case FR_BE = 'fr-BE';
13+
}

src/Enum/GetProductRanksType.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace Picqer\BolRetailerV10\Enum;
4+
5+
// This class is auto generated by OpenApi\ModelGenerator
6+
enum GetProductRanksType: string
7+
{
8+
case SEARCH = 'SEARCH';
9+
case BROWSE = 'BROWSE';
10+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace Picqer\BolRetailerV10\Model;
4+
5+
use Picqer\BolRetailerV10\Enum;
6+
7+
// This class is auto generated by OpenApi\ModelGenerator
8+
class BulkCommissionRatesMultiStatusResponse extends AbstractModel
9+
{
10+
/**
11+
* Returns the definition of the model: an associative array with field names as key and
12+
* field definition as value. The field definition contains of
13+
* model: Model class or null if it is a scalar type
14+
* array: Boolean whether it is an array
15+
* @return array The model definition
16+
*/
17+
public function getModelDefinition(): array
18+
{
19+
return [
20+
'successfulQueries' => [ 'model' => CommissionSuccessfulQuery::class, 'enum' => null, 'array' => true ],
21+
'failedQueries' => [ 'model' => CommissionFailedQuery::class, 'enum' => null, 'array' => true ],
22+
];
23+
}
24+
25+
/**
26+
* @var CommissionSuccessfulQuery[]
27+
*/
28+
public $successfulQueries = [];
29+
30+
/**
31+
* @var CommissionFailedQuery[]
32+
*/
33+
public $failedQueries = [];
34+
}

src/Model/ChangeTransportRequest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ class ChangeTransportRequest extends AbstractModel
1717
public function getModelDefinition(): array
1818
{
1919
return [
20-
'transporterCode' => [ 'model' => null, 'enum' => Enum\ChangeTransportRequestTransporterCode::class, 'array' => false ],
20+
'transporterCode' => [ 'model' => null, 'enum' => null, 'array' => false ],
2121
'trackAndTrace' => [ 'model' => null, 'enum' => null, 'array' => false ],
2222
];
2323
}
2424

2525
/**
26-
* @var Enum\ChangeTransportRequestTransporterCode
26+
* @var string Specify the transporter that carries out the shipment.
2727
*/
2828
public $transporterCode;
2929

src/Model/CommissionDateRange.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
namespace Picqer\BolRetailerV10\Model;
4+
5+
use Picqer\BolRetailerV10\Enum;
6+
7+
// This class is auto generated by OpenApi\ModelGenerator
8+
class CommissionDateRange extends AbstractModel
9+
{
10+
/**
11+
* Returns the definition of the model: an associative array with field names as key and
12+
* field definition as value. The field definition contains of
13+
* model: Model class or null if it is a scalar type
14+
* array: Boolean whether it is an array
15+
* @return array The model definition
16+
*/
17+
public function getModelDefinition(): array
18+
{
19+
return [
20+
'startDate' => [ 'model' => null, 'enum' => null, 'array' => false ],
21+
'endDate' => [ 'model' => null, 'enum' => null, 'array' => false ],
22+
'rates' => [ 'model' => CommissionDateRate::class, 'enum' => null, 'array' => true ],
23+
];
24+
}
25+
26+
/**
27+
* @var string The inclusive start date (in ISO 8601 format) from which the commission applies
28+
*/
29+
public $startDate;
30+
31+
/**
32+
* @var string The exclusive end date (in ISO 8601 format) after which the commission no longer applies.
33+
*/
34+
public $endDate;
35+
36+
/**
37+
* @var CommissionDateRate[] An array of objects, each describing commission rates for a specific condition.
38+
*/
39+
public $rates = [];
40+
}

src/Model/CommissionDateRate.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
namespace Picqer\BolRetailerV10\Model;
4+
5+
use Picqer\BolRetailerV10\Enum;
6+
7+
// This class is auto generated by OpenApi\ModelGenerator
8+
class CommissionDateRate extends AbstractModel
9+
{
10+
/**
11+
* Returns the definition of the model: an associative array with field names as key and
12+
* field definition as value. The field definition contains of
13+
* model: Model class or null if it is a scalar type
14+
* array: Boolean whether it is an array
15+
* @return array The model definition
16+
*/
17+
public function getModelDefinition(): array
18+
{
19+
return [
20+
'condition' => [ 'model' => null, 'enum' => null, 'array' => false ],
21+
'priceRanges' => [ 'model' => CommissionPriceRange::class, 'enum' => null, 'array' => true ],
22+
];
23+
}
24+
25+
/**
26+
* @var string Condition of the product.
27+
*/
28+
public $condition;
29+
30+
/**
31+
* @var CommissionPriceRange[]
32+
*/
33+
public $priceRanges = [];
34+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
namespace Picqer\BolRetailerV10\Model;
4+
5+
use Picqer\BolRetailerV10\Enum;
6+
7+
// This class is auto generated by OpenApi\ModelGenerator
8+
class CommissionFailedQuery extends AbstractModel
9+
{
10+
/**
11+
* Returns the definition of the model: an associative array with field names as key and
12+
* field definition as value. The field definition contains of
13+
* model: Model class or null if it is a scalar type
14+
* array: Boolean whether it is an array
15+
* @return array The model definition
16+
*/
17+
public function getModelDefinition(): array
18+
{
19+
return [
20+
'index' => [ 'model' => null, 'enum' => null, 'array' => false ],
21+
'status' => [ 'model' => null, 'enum' => null, 'array' => false ],
22+
'violations' => [ 'model' => Violation::class, 'enum' => null, 'array' => true ],
23+
];
24+
}
25+
26+
/**
27+
* @var float This provides the location of the entity where it was provided in the original response body.
28+
*/
29+
public $index;
30+
31+
/**
32+
* @var int HTTP status code for individual entity operation.
33+
*/
34+
public $status;
35+
36+
/**
37+
* @var Violation[] Outlines the list of violations encountered in the API for the specific index detailing the
38+
* nature and reason for the issue.
39+
*/
40+
public $violations = [];
41+
}

src/Model/CommissionPriceRange.php

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<?php
2+
3+
namespace Picqer\BolRetailerV10\Model;
4+
5+
use Picqer\BolRetailerV10\Enum;
6+
7+
// This class is auto generated by OpenApi\ModelGenerator
8+
class CommissionPriceRange extends AbstractModel
9+
{
10+
/**
11+
* Returns the definition of the model: an associative array with field names as key and
12+
* field definition as value. The field definition contains of
13+
* model: Model class or null if it is a scalar type
14+
* array: Boolean whether it is an array
15+
* @return array The model definition
16+
*/
17+
public function getModelDefinition(): array
18+
{
19+
return [
20+
'range' => [ 'model' => CommissionRange::class, 'enum' => null, 'array' => false ],
21+
'fixedAmount' => [ 'model' => null, 'enum' => null, 'array' => false ],
22+
'percentage' => [ 'model' => null, 'enum' => null, 'array' => false ],
23+
'reductionApplied' => [ 'model' => null, 'enum' => null, 'array' => false ],
24+
];
25+
}
26+
27+
/**
28+
* @var CommissionRange Defines a specific price range for which the commission rates apply including VAT.
29+
*/
30+
public $range;
31+
32+
/**
33+
* @var float The fixed commission amount excluding VAT.
34+
*/
35+
public $fixedAmount;
36+
37+
/**
38+
* @var float A percentage of commission, based on the intended selling price per unit, excluding VAT.
39+
*/
40+
public $percentage;
41+
42+
/**
43+
* @var bool A boolean flag indicating whether a reduction is applied to the commission or not.
44+
*/
45+
public $reductionApplied;
46+
}

src/Model/CommissionProducts.php

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?php
2+
3+
namespace Picqer\BolRetailerV10\Model;
4+
5+
use Picqer\BolRetailerV10\Enum;
6+
7+
// This class is auto generated by OpenApi\ModelGenerator
8+
class CommissionProducts extends AbstractModel
9+
{
10+
/**
11+
* Returns the definition of the model: an associative array with field names as key and
12+
* field definition as value. The field definition contains of
13+
* model: Model class or null if it is a scalar type
14+
* array: Boolean whether it is an array
15+
* @return array The model definition
16+
*/
17+
public function getModelDefinition(): array
18+
{
19+
return [
20+
'products' => [ 'model' => Ean::class, 'enum' => null, 'array' => true ],
21+
];
22+
}
23+
24+
/**
25+
* @var Ean[]
26+
*/
27+
public $products = [];
28+
29+
/**
30+
* Returns an array with the eans from products.
31+
* @return string[] Eans from products.
32+
*/
33+
public function getProductsEans(): array
34+
{
35+
return array_map(function ($model) {
36+
return $model->ean;
37+
}, $this->products);
38+
}
39+
40+
/**
41+
* Sets products by an array of eans.
42+
* @param string[] $eans Eans for products.
43+
*/
44+
public function setProductsEans(array $eans): void
45+
{
46+
$this->products = array_map(function ($ean) {
47+
return Ean::constructFromArray(['ean' => $ean]);
48+
}, $eans);
49+
}
50+
51+
/**
52+
* Adds a new Ean to products by ean.
53+
* @param string $ean Ean for the Ean to add.
54+
*/
55+
public function addProductsEan(string $ean): void
56+
{
57+
$this->products[] = Ean::constructFromArray(['ean' => $ean]);
58+
}
59+
}

0 commit comments

Comments
 (0)