Add Bulk Feed via query parameter (#12384)

* Update feed.js

New Tests for bulk feeding

* Update POST-user_feed_pet_food.test.js

Added test for bulk-feeding

* Update user.js

Added 'query paramter' for bulk feeding

* Update pets.json

Added "tooMuchFood" for bulk feeding pets

* Update feed.js

Added query parameter option for bulk feeding pets.

* Update feed.js

fixing lint
(bulk feeding)

* Update POST-user_feed_pet_food.test.js

adjustments for testing bulk feeding

* Update feed.js

Bulk feeding 
amount as integer

* Update pets.json

added invalidAmount for bulk feeding

* Update feed.js

Bulk feeding  
Error handling

* Update feed.js

Bulk - feed  
no hardcoded values

* Update pets.json

Get rid of my german accent.
This commit is contained in:
PitiTheGrey
2020-07-13 16:04:03 +02:00
committed by GitHub
parent a02c4c1cfd
commit e89ff95a21
5 changed files with 165 additions and 4 deletions

View File

@@ -862,9 +862,14 @@ api.equip = {
*
* @apiParam (Path) {String} pet
* @apiParam (Path) {String} food
* @apiParam (Query) {Number} [amount] The amount of food to feed.
* Note: Pet can eat 50 units.
* Preferred food offers 5 units per food,
* other food 2 units.
*
* @apiParamExample {url} Example-URL
* https://habitica.com/api/v3/user/feed/Armadillo-Shade/Chocolate
* https://habitica.com/api/v3/user/feed/Armadillo-Shade/Chocolate?amount=9
*
* @apiSuccess {Number} data The pet value
* @apiSuccess {String} message Success message
@@ -877,6 +882,8 @@ api.equip = {
* @apiError {BadRequest} InvalidPet Invalid pet name supplied.
* @apiError {NotFound} FoodNotOwned :food not found in user.items.food
* Note: also sent if food name is invalid.
* @apiError {NotAuthorized} notEnoughFood :Not enough food to feed the pet as requested.
* @apiError {NotAuthorized} tooMuchFood :You try to feed too much food. Action ancelled.
*
*
*/