mikemiles86 / bazaarvoice-conversations-api
PHP Wrapper for the Bazaarvoice Conversations API
Installs: 52 437
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Open Issues: 1
Requires
- php: >=5.5
- mikemiles86/bazaarvoice-request: ~1.0
Requires (Dev)
- ext-curl: *
- phpunit/phpunit: ^4.0 || ^5.0
This package is auto-updated.
Last update: 2024-11-05 00:31:08 UTC
README
PHP Wrapper for the Bazaarvoice Conversations API
Install
Via Composer
$ composer require mikemiles86/bazaarvoice-conversations-api
Usage
Creating a Conversations Object
$client = new \GuzzleHttp\Client(); $api_key = '12345abcd'; $bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key); $conversations_wrapper = new \BazaarvoiceConversations\BazaarvoiceConversations($bazaarvoice_request);
Content Types
All conversation API content types are supported.
Depending on the specific content type, data can be retrieved and sent to Bazaarvoice.
Get wrapper for Reviews content type.
$client = new \GuzzleHttp\Client(); $api_key = '12345abcd'; $bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key); $conversations_wrapper = new \BazaarvoiceConversations\BazaarvoiceConversations($bazaarvoice_request); $reviews_wrapper = $conversations_wrapper->getContentType('Reviews');
Make a raw request
$client = new \GuzzleHttp\Client(); $api_key = '12345abcd'; $bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key); $conversations_wrapper = new \BazaarvoiceConversations\BazaarvoiceConversations($bazaarvoice_request); $response = $conversations_wrapper->apiRequest('data/reviews');
Retrieve Content
Retrieve content for Content Type by Id.
$client = new \GuzzleHttp\Client(); $api_key = '12345abcd'; $bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key); $conversations_wrapper = new \BazaarvoiceConversations\BazaarvoiceConversations($bazaarvoice_request); $reviews_wrapper = $conversations_wrapper->getContentType('Reviews'); $review = $reviews_wrapper->getResultById('review_1234');
Retrieve content for Content Type by other parameters
$client = new \GuzzleHttp\Client(); $api_key = '12345abcd'; $bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key); $conversations_wrapper = new \BazaarvoiceConversations\BazaarvoiceConversations($bazaarvoice_request); $reviews_wrapper = $conversations_wrapper->getContentType('Reviews'); $configuration = [ 'arguments' => [ 'ProductId' => 'my_product', ], ]; $response = $reviews_wrapper->retrieveRequest($configuration); $product_reviews = $response->getResponse('Results');
Submit Content
Get Submission Form
$client = new \GuzzleHttp\Client(); $api_key = '12345abcd'; $bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key); $conversations_wrapper = new \BazaarvoiceConversations\BazaarvoiceConversations($bazaarvoice_request); $reviews_wrapper = $conversations_wrapper->getContentType('Reviews'); $reviews_submit_form = $reviews_wrapper->getSubmissionForm();
Preview Submission
$client = new \GuzzleHttp\Client(); $api_key = '12345abcd'; $bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key); $conversations_wrapper = new \BazaarvoiceConversations\BazaarvoiceConversations($bazaarvoice_request); $reviews_wrapper = $conversations_wrapper->getContentType('Reviews'); $submission_data = [ 'Rating' => 5, 'ReviewText' => 'This is my Review', ]; $reviews_wrapper->previewSubmission($submission_data);
Submit Submission
$client = new \GuzzleHttp\Client(); $api_key = '12345abcd'; $bazaarvoice_request = new \BazaarvoiceRequest\BazaarvoiceRequest($client, $api_key); $conversations_wrapper = new \BazaarvoiceConversations\BazaarvoiceConversations($bazaarvoice_request); $reviews_wrapper = $conversations_wrapper->getContentType('Reviews'); $submission_data = [ 'Rating' => 5, 'ReviewText' => 'This is my Review', ]; $reviews_wrapper->submitSubmission($submission_data);
Testing
$ composer test
Credits
License
The MIT License (MIT). Please see License File for more information.