blue-energy / trustpilot-invitation-api
一个用于访问Trustpilot邀请API和获取收到的产品评价的PHP库
2.0.1
2021-01-22 12:08 UTC
Requires
- php: >=5.6.0
- apache/log4php: ^2.3.0
- guzzlehttp/guzzle: ~7.0
- itspirit/trustpilot-authenticator: ^v1.0.0
Requires (Dev)
- codeception/codeception: ^2.2
This package is not auto-updated.
Last update: 2024-09-29 05:22:33 UTC
README
这是对https://github.com/ITspirit/TrustpilotInvitationApi的分支。
一个用于访问Trustpilot邀请API的PHP库。
安装
使用composer安装
composer install itspirit/trustpilot-invitation-api
使用邀请
use Trustpilot\Api\Authenticator\Authenticator; use Trustpilot\Api\Invitation\Client; use Trustpilot\Api\Invitation\Recipient; use Trustpilot\Api\Invitation\Sender; use Trustpilot\Api\Invitation\Context; $authenticator = new Authenticator($apiKey, $apiToken, $username, $password); $accessToken = $authenticator->getAccessToken(); $client = new Client($accessToken); $context = new Context($businessUnitId, $templateId, $redirectUri); // The last two arguments to the Context constructor ($tags and $locale) are optional // $context = new Context($templateId, $redirectUri, $tags = array(), $locale = 'en-US'); $recipient = new Recipient($recipientEmail, $recipientName); $sender = new Sender($senderEmail, $senderName, $replyTo); $client->invite($context, $recipient, $sender, $reference) /* : array */
获取产品评价的使用方法
use Trustpilot\Api\Authenticator\Authenticator; use Trustpilot\Api\Invitation\Client; $authenticator = new Authenticator($apiKey, $apiToken, $username, $password); $accessToken = $authenticator->getAccessToken(); $client = new Client($accessToken); $reviews = $client->getProductReviews(TRUSTPILOT_BUSINESS_UNIT_ID, null, ['published', 'unpublished', 'underModeration', 'archived'], 'de', $page, 100)