hass-core/homeassistant/components/picnic/services.yaml
corneyl a848dc1155
Add service for adding products to a Picnic order (#67877)
* Add Picnic services for searching products and adding products to the cart

* Improve the Picnic services implementation and add unit tests

* Fix pre-commit check issues

* Fix comments and example product name

* Remove search service, update add_product service schema

* Fix pylint suggestion

* Add more tests and removed unused code

* Remove code needed for the removed service, clean tests from obvious comments and add type hints

* Remove unused import

* Remove unnecessary comments and simplify getting the config entry id

Co-authored-by: Allen Porter <allen.porter@gmail.com>

* Don't use hass.data in tests, make device id mandatory for service

* Rewrite all service tests so using lru.cache is not needed

* Add test for uncovered line in _product_search()

* Require a config entry id as service parameter instead of device id

* Use explicit check in get_api_client() and raise HomeAssistantError

* Fix HomeAssistantError import, fix services tests

* Change HomeAssistantError to ValueError when config entry is not found

Co-authored-by: Allen Porter <allen.porter@gmail.com>
2022-11-12 20:15:45 -08:00

37 lines
957 B
YAML

add_product:
name: Add a product to the cart
description: >-
Adds a product to the cart based on a search string or product ID.
The search string and product ID are exclusive.
fields:
config_entry_id:
name: Picnic service
description: The product will be added to the selected service.
required: true
selector:
config_entry:
integration: picnic
product_id:
name: Product ID
description: The product ID of a Picnic product.
required: false
example: "10510201"
selector:
text:
product_name:
name: Product name
description: Search for a product and add the first result
required: false
example: "Yoghurt"
selector:
text:
amount:
name: Amount
description: Amount to add of the selected product
required: false
default: 1
selector:
number:
min: 1
max: 50