mikemiles86/bazaarvoice-conversations-api 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mikemiles86/bazaarvoice-conversations-api

最新稳定版本:1.0.3

Composer 安装命令:

composer require mikemiles86/bazaarvoice-conversations-api

包简介

PHP Wrapper for the Bazaarvoice Conversations API

关键字:

README 文档

README

Latest Version on Packagist Software License Total Downloads

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.

统计信息

  • 总下载量: 59.34k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-05-18