Add shopping list manipulation

This commit is contained in:
Tim
2021-10-05 01:14:57 +02:00
parent 5a65036620
commit 1795efbaf7
6 changed files with 232 additions and 5 deletions

View File

@ -8,6 +8,7 @@ use Ardent\GrocyApi\Objects\AbstractApiObject;
use Ardent\GrocyApi\Objects\ObjectTransformer;
use Ardent\GrocyApi\Objects\ProductsObject;
use Ardent\GrocyApi\Objects\QuantityUnitsObject;
use Ardent\GrocyApi\Objects\ShoppingListObject;
class GrocyClient
{
@ -46,6 +47,14 @@ class GrocyClient
return $this->getObjects('quantity_units');
}
/**
* @return ShoppingListObject[]
*/
public function getShoppingListProducts(): array
{
return $this->getObjects('shopping_list');
}
public function getProduct(int $id): ProductsObject
{
return $this->getObject('products', $id);
@ -78,6 +87,11 @@ class GrocyClient
]);
}
public function getStockClient(): StockClient
{
return new StockClient($this->client);
}
/**
* @return AbstractApiObject[]
*/