Skip to content

Commit

Permalink
Merge pull request #41 from marcum8er/master
Browse files Browse the repository at this point in the history
Add AffiliatePartner API
  • Loading branch information
nVuln authored Jul 25, 2024
2 parents 1cd3ff5 + 8793b2f commit 9f15681
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

use EcomPHP\TiktokShop\Errors\ResponseException;
use EcomPHP\TiktokShop\Resources\AffiliateCreator;
use EcomPHP\TiktokShop\Resources\AffiliatePartner;
use EcomPHP\TiktokShop\Resources\AffiliateSeller;
use EcomPHP\TiktokShop\Resources\CustomerService;
use GuzzleHttp\Exception\GuzzleException;
Expand Down Expand Up @@ -50,6 +51,7 @@
* @property-read CustomerService $CustomerService
* @property-read AffiliateSeller $AffiliateSeller
* @property-read AffiliateCreator $AffiliateCreator
* @property-read AffiliatePartner $AffiliatePartner
*/
class Client
{
Expand Down Expand Up @@ -88,6 +90,7 @@ class Client
CustomerService::class,
AffiliateSeller::class,
AffiliateCreator::class,
AffiliatePartner::class,
];

public function __construct($app_key, $app_secret, $options = [])
Expand Down
45 changes: 45 additions & 0 deletions src/Resources/AffiliatePartner.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,49 @@ public function getAffiliatePartnerCampaignProductList($campaign_id, $query)
RequestOptions::QUERY => $query,
]);
}

public function getAffiliatePartnerCampaignDetail($campaign_id, $query)
{
return $this->call('GET', 'campaigns/'.$campaign_id, [
RequestOptions::QUERY => $query,
]);
}

public function reviewAffiliatePartnerCampaignProduct($campaign_id, $product_id, $query, $body)
{
return $this->call('POST', 'campaigns/'.$campaign_id.'/products/'.$product_id.'/review', [
RequestOptions::QUERY => $query,
RequestOptions::JSON => $body,
]);
}

public function editAffiliatePartnerCampaign($campaign_id, $query, $body)
{
return $this->call('POST', 'campaigns/'.$campaign_id.'/partial_edit', [
RequestOptions::QUERY => $query,
RequestOptions::JSON => $body,
]);
}

public function getAffiliatePartnerCampaignList($query)
{
return $this->call('GET', 'campaigns', [
RequestOptions::QUERY => $query,
]);
}

public function publishAffiliatePartnerCampaign($campaign_id, $query)
{
return $this->call('POST', 'campaigns/'.$campaign_id.'/publish', [
RequestOptions::QUERY => $query,
]);
}

public function generateAffiliatePartnerCampaignProductLink($campaign_id, $product_id, $query, $body)
{
return $this->call('POST', 'campaigns/'.$campaign_id.'/products/'.$product_id.'/promotion_link/generate', [
RequestOptions::QUERY => $query,
RequestOptions::JSON => $body,
]);
}
}

0 comments on commit 9f15681

Please sign in to comment.