From e79eded0fd8969100ad6ffa76b10d17d7ab5640b Mon Sep 17 00:00:00 2001 From: minchao Date: Wed, 22 Jan 2020 23:37:00 +0800 Subject: [PATCH] Add more item functions --- README.md | 4 +- src/Nodes/Item/Item.php | 121 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 123 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 87830ef..c66ebef 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![Latest Unstable Version](https://poser.pugx.org/minchao/shopee-php/v/unstable)](https://packagist.org/packages/minchao/shopee-php) [![composer.lock](https://poser.pugx.org/minchao/shopee-php/composerlock)](https://packagist.org/packages/minchao/shopee-php) -This is a [Shopee Partner API](https://partner.shopeemobile.com/docs/) Client for PHP. +This is a [Shopee Partner API](https://open.shopee.com/documents) Client for PHP. ## Requirements @@ -33,7 +33,7 @@ require_once __DIR__ . '/vendor/autoload.php'; $client = new \Shopee\Client([ 'secret' => SHOPEE_SECRET, 'partner_id' => SHOPEE_PARTNER_ID, - 'shopid' => SHOPEE_SHOP_ID, + 'shopid' => SHOPEE_SHOP_ID, ]); ``` diff --git a/src/Nodes/Item/Item.php b/src/Nodes/Item/Item.php index fd2922b..dc634a9 100644 --- a/src/Nodes/Item/Item.php +++ b/src/Nodes/Item/Item.php @@ -40,6 +40,17 @@ public function addVariations($parameters = []): ResponseData return $this->post('/api/v1/item/add_variations', $parameters); } + /** + * Use this api to boost multiple items at once. + * + * @param array $parameters + * @return ResponseData + */ + public function boostItem($parameters = []): ResponseData + { + return $this->post('/api/v1/items/boost', $parameters); + } + /** * Use this call to delete a product item. * @@ -84,6 +95,17 @@ public function getAttributes($parameters = []): ResponseData return $this->post('/api/v1/item/attributes/get', $parameters); } + /** + * Use this api to get all boosted items. + * + * @param array $parameters + * @return ResponseData + */ + public function getBoostedItems($parameters = []): ResponseData + { + return $this->post('/api/v1/items/get_boosted', $parameters); + } + /** * Use this call to get categories of product item. * @@ -95,6 +117,17 @@ public function getCategories($parameters = []): ResponseData return $this->post('/api/v1/item/categories/get', $parameters); } + /** + * Use this api to get comment by shopid/itemid/comment_id + * + * @param array $parameters + * @return ResponseData + */ + public function getComment($parameters = []): ResponseData + { + return $this->post('/api/v1/items/comments/get', $parameters); + } + /** * Use this call to get detail of item. * @@ -117,6 +150,28 @@ public function getItemsList($parameters = []): ResponseData return $this->post('/api/v1/items/get', $parameters); } + /** + * Use this api to get ongoing and upcoming promotions. + * + * @param array $parameters + * @return ResponseData + */ + public function getPromotionInfo($parameters = []): ResponseData + { + return $this->post('/api/v1/item/promotion/get', $parameters); + } + + /** + * Use this API to get recommended category ids according to item name. + * + * @param array $parameters + * @return ResponseData + */ + public function getRecommendCats($parameters = []): ResponseData + { + return $this->post('/api/v1/item/categories/get_recommend', $parameters); + } + /** * Use this call to add one item image in assigned position. * @@ -128,6 +183,28 @@ public function insertItemImg($parameters = []): ResponseData return $this->post('/api/v1/item/img/insert', $parameters); } + /** + * Use this api to reply comments from buyers in batch. + * + * @param array $parameters + * @return ResponseData + */ + public function replyComments($parameters = []): ResponseData + { + return $this->post('/api/v1/items/comments/reply', $parameters); + } + + /** + * Only for TW whitelisted shop. Use this API to set the installment tenures of items. + * + * @param array $parameters + * @return ResponseData + */ + public function setItemInstallmentTenures($parameters = []): ResponseData + { + return $this->post('/api/v1/item/installment/set', $parameters); + } + /** * Use this call to update a product item. * @@ -161,6 +238,17 @@ public function updatePrice($parameters = []): ResponseData return $this->post('/api/v1/items/update_price', $parameters); } + /** + * Update items price in batch. + * + * @param array $parameters + * @return ResponseData + */ + public function updatePriceBatch($parameters = []): ResponseData + { + return $this->post('/api/v1/items/update/items_price', $parameters); + } + /** * Use this call to update item stock. * @@ -172,6 +260,17 @@ public function updateStock($parameters = []): ResponseData return $this->post('/api/v1/items/update_stock', $parameters); } + /** + * Update items stock in batch. + * + * @param array $parameters + * @return ResponseData + */ + public function updateStockBatch($parameters = []): ResponseData + { + return $this->post('/api/v1/items/update/items_stock', $parameters); + } + /** * Use this call to update item variation price. * @@ -183,6 +282,17 @@ public function updateVariationPrice($parameters = []): ResponseData return $this->post('/api/v1/items/update_variation_price', $parameters); } + /** + * Update variations price in batch. + * + * @param array $parameters + * @return ResponseData + */ + public function updateVariationPriceBatch($parameters = []): ResponseData + { + return $this->post('/api/v1/items/update/vars_price', $parameters); + } + /** * Use this call to update item variation stock. * @@ -194,6 +304,17 @@ public function updateVariationStock($parameters = []): ResponseData return $this->post('/api/v1/items/update_variation_stock', $parameters); } + /** + * Update variations stock in batch. + * + * @param array $parameters + * @return ResponseData + */ + public function updateVariationStockBatch($parameters = []): ResponseData + { + return $this->post('/api/v1/items/update/vars_stock', $parameters); + } + /** * Use this call to unlist or list items in batch. *