Skip to content

Commit

Permalink
New client update
Browse files Browse the repository at this point in the history
  • Loading branch information
casperbakker committed Sep 18, 2024
1 parent 3d5c48c commit 5501bbd
Show file tree
Hide file tree
Showing 3 changed files with 141 additions and 16 deletions.
24 changes: 24 additions & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,30 @@ public function getOrder(string $orderId): ?Model\Order
return $this->request('GET', $url, $options, $responseTypes);
}

/**
* Get a list of available categories and its subcategories.
* @param string|null $AcceptLanguage The language in which the product categories will be retrieved.
* @return Model\ProductCategory[]
* @throws Exception\ConnectException when an error occurred in the HTTP connection.
* @throws Exception\ResponseException when an unexpected response was received.
* @throws Exception\UnauthorizedException when the request was unauthorized.
* @throws Exception\RateLimitException when the throttling limit has been reached for the API user.
* @throws Exception\Exception when something unexpected went wrong.
*/
public function getProductCategories(?string $AcceptLanguage = 'nl'): array
{
$url = "retailer/products/categories";
$options = [
'produces' => 'application/vnd.retailer.v10+json',
'language' => $AcceptLanguage,
];
$responseTypes = [
'200' => Model\ProductCategoriesResponse::class,
];

return $this->request('GET', $url, $options, $responseTypes)->categories;
}

/**
* Gets the list of products based on category, search term or filters.
* @param Model\ProductListRequest $productListRequest
Expand Down
128 changes: 117 additions & 11 deletions src/OpenApi/retailer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
"altText": "bol.com logo"
}
},
"servers": [
{
"url": "https://api.bol.com"
}
],
"security": [
{
"OAuth2": []
Expand Down Expand Up @@ -1781,6 +1776,67 @@
}
}
},
"/retailer/products/categories": {
"get": {
"tags": [
"Products"
],
"summary": "Get product categories",
"description": "Get a list of available categories and its subcategories.",
"operationId": "get-product-categories",
"parameters": [
{
"name": "Accept-Language",
"in": "header",
"description": "The language in which the product categories will be retrieved.",
"required": false,
"schema": {
"type": "string",
"default": "nl",
"enum": [
"nl",
"nl-BE",
"nl-NL",
"fr-BE"
]
},
"example": "nl"
}
],
"responses": {
"200": {
"description": "Ok: Successfully processed the request.",
"content": {
"application/vnd.retailer.v10+json": {
"schema": {
"$ref": "#/components/schemas/ProductCategoriesResponse"
}
}
}
},
"400": {
"description": "Bad request: The sent request does not meet the API specification. Please check the error message(s) for more information.",
"content": {
"application/vnd.retailer.v10+json": {
"schema": {
"$ref": "#/components/schemas/Problem"
}
}
}
},
"406": {
"description": "Not acceptable: The sent request header does not meet the API specification. Please check the error message(s) for more information.",
"content": {
"application/vnd.retailer.v10+json": {
"schema": {
"$ref": "#/components/schemas/Problem"
}
}
}
}
}
}
},
"/retailer/products/list": {
"post": {
"tags": [
Expand Down Expand Up @@ -4676,10 +4732,10 @@
"type": "object",
"properties": {
"reference": {
"maxLength": 20,
"maxLength": 100,
"minLength": 0,
"type": "string",
"description": "A user-defined reference that helps you identify this particular offer when receiving data from us. This element can optionally be left empty and has a maximum amount of 20 characters.",
"description": "A user-defined reference that helps you identify this particular offer when receiving data from us. This element can optionally be left empty and has a maximum amount of 100 characters.",
"example": "REF12345"
},
"onHoldByRetailer": {
Expand Down Expand Up @@ -5662,10 +5718,10 @@
"$ref": "#/components/schemas/Condition"
},
"reference": {
"maxLength": 20,
"maxLength": 100,
"minLength": 0,
"type": "string",
"description": "A user-defined reference that helps you identify this particular offer when receiving data from us. This element can optionally be left empty and has a maximum amount of 20 characters.",
"description": "A user-defined reference that helps you identify this particular offer when receiving data from us. This element can optionally be left empty and has a maximum amount of 100 characters.",
"example": "REF12345"
},
"onHoldByRetailer": {
Expand Down Expand Up @@ -5979,6 +6035,8 @@
"type": "object",
"properties": {
"products": {
"maxItems": 100,
"minItems": 1,
"type": "array",
"items": {
"$ref": "#/components/schemas/Ean"
Expand Down Expand Up @@ -6650,7 +6708,7 @@
},
"reference": {
"type": "string",
"description": "A user-defined reference tied to the offer upon creating the offer.",
"description": "A user-defined reference that helps you identify this particular offer when receiving data from us. This element can optionally be left empty and has a maximum amount of 100 characters.",
"example": "BOLCOM00123"
}
}
Expand Down Expand Up @@ -9055,6 +9113,54 @@
}
}
},
"ProductCategoriesResponse": {
"required": [
"categories"
],
"type": "object",
"properties": {
"categories": {
"type": "array",
"description": "A list of product categories and its children.",
"items": {
"$ref": "#/components/schemas/ProductCategory"
}
}
}
},
"ProductCategory": {
"required": [
"categoryId",
"categoryName"
],
"type": "object",
"properties": {
"categoryId": {
"type": "string",
"description": "The id of the category.",
"example": "43646"
},
"categoryName": {
"type": "string",
"description": "The name of the category.",
"example": "Auto & Motor"
},
"order": {
"type": "integer",
"description": "The order of the category in the tree.",
"format": "int32",
"example": 1
},
"subcategories": {
"type": "array",
"description": "A list of product subcategories and its children.",
"items": {
"$ref": "#/components/schemas/ProductCategory"
}
}
},
"description": "A list of product categories and its children."
},
"ReducedOrder": {
"required": [
"orderId",
Expand Down Expand Up @@ -9411,7 +9517,7 @@
},
"reference": {
"type": "string",
"description": "A user-defined reference that helps you identify this particular offer when receiving data from us. This element can optionally be left empty and has a maximum amount of 20 characters.",
"description": "A user-defined reference that helps you identify this particular offer when receiving data from us. This element can optionally be left empty and has a maximum amount of 100 characters.",
"example": "REF12345"
},
"onHoldByRetailer": {
Expand Down
5 changes: 0 additions & 5 deletions src/OpenApi/shared.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
"altText": "bol.com logo"
}
},
"servers": [
{
"url": "https://api.bol.com"
}
],
"security": [
{
"OAuth2": []
Expand Down

0 comments on commit 5501bbd

Please sign in to comment.