Skip to content

Commit

Permalink
fix #59
Browse files Browse the repository at this point in the history
  • Loading branch information
gam6itko committed Sep 22, 2022
1 parent 9e8fc02 commit c4f2f70
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/Service/V2/CategoryService.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,17 @@ public function attributeValueByOption(string $language = 'RU', array $options =
/**
* @see https://api-seller.ozon.ru/v2/category/tree
*/
public function tree(int $categoryId, string $language = 'DEFAULT')
public function tree(?int $categoryId = null, string $language = 'DEFAULT')
{
return $this->request(
'POST',
"{$this->path}/tree",
[
'category_id' => $categoryId,
'language' => $language,
]
);
$body = [
'language' => $language,
];

if ($categoryId) {
assert($categoryId > 0);
$body['category_id'] = $categoryId;
}

return $this->request('POST', "{$this->path}/tree", $body);
}
}

0 comments on commit c4f2f70

Please sign in to comment.