Skip to content

Commit

Permalink
Create Custom Node (#23)
Browse files Browse the repository at this point in the history
* Custom node for consume Custom API on Shopee API v1

* Get merchant connected to partner id

* !Fix PSR-12 Style & add nodes to Client Constructor

Co-authored-by: Indra <[email protected]>
  • Loading branch information
igun997 and Indra authored Oct 30, 2020
1 parent 0ef6406 commit 3314cd5
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public function __construct(array $config = [])
$this->nodes['returns'] = new Nodes\Returns\Returns($this);
$this->nodes['shop'] = new Nodes\Shop\Shop($this);
$this->nodes['shopCategory'] = new Nodes\ShopCategory\ShopCategory($this);
$this->nodes['custom'] = new Nodes\Custom\Custom($this);
$this->nodes['discount'] = new Nodes\Discount\Discount($this);
}

Expand Down
23 changes: 23 additions & 0 deletions src/Nodes/Custom/Custom.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace Shopee\Nodes\Custom;

use Shopee\Nodes\NodeAbstract;
use Shopee\RequestParametersInterface;
use Shopee\ResponseData;

class Custom extends NodeAbstract
{
/**
* Use this call for get custom API v1
* Formatted like it : '/api/v1/shop/get'
*
* @param $url
* @param array|RequestParametersInterface $parameters
* @return ResponseData
*/
public function request($url, $parameters = []): ResponseData
{
return $this->post($url, $parameters);
}
}
11 changes: 11 additions & 0 deletions src/Nodes/Shop/Shop.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,15 @@ public function updateShopInfo($parameters = []): ResponseData
{
return $this->post('/api/v1/shop/update', $parameters);
}

/**
* Use this call to get basic info of shops which have authorized to the partner.
*
* @param array|RequestParametersInterface $parameters
* @return ResponseData
*/
public function getShopsByPartner($parameters = []): ResponseData
{
return $this->post('/api/v1/shop/get_partner_shop', $parameters);
}
}

0 comments on commit 3314cd5

Please sign in to comment.