Skip to content

Commit 47f97bc

Browse files
committed
content updates
1 parent f815bf4 commit 47f97bc

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changelog
22

3-
- v1.0.0 deployment
3+
- v1.0.2 initial release
44

55
All notable changes to `sharpapi-php-client` will be documented in this file.

README.md

+14-12
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,16 @@ Please refer to the official:
4747
## Installation
4848

4949
1. You can install the package via composer:
50-
51-
```bash
52-
composer require sharpapi/sharpapi-php-client
53-
```
54-
50+
```bash
51+
composer require sharpapi/sharpapi-php-client
52+
```
5553
2. Register at [SharpApi.com](https://sharpapi.com/) and get the API key.
56-
5754
**That's it!**
5855
5956
## Usage
6057
6158
### Simple example
59+
6260
```php
6361
$sharpApi = new \SharpAPI\SharpApiService\SharpApiService('8bKzQl3cwckfVsnsN8T8p4BsACkziEQJ72U4pXpQ');
6462
@@ -68,11 +66,12 @@ $resultSharpApiJob = $sharpApi->pollJobStatusAndFetchResults($statusUrl);
6866
6967
var_dump($resultSharpApiJob->getResultJson());
7068
```
69+
7170
Typical use case require these steps:
7271
7372
1. Dispatch one of the available AI processing methods (this will return job processing status URL)
7473
2. Run `pollJobStatusAndFetchResults($statusUrl)` method which operates in polling mode, sending underneath
75-
requests every 10 seconds for 180 seconds (these values can be customized,
74+
requests every 10 seconds for 180 seconds (these values can be customized,
7675
check `SharpApiService` source code).
7776
3. `SharpApiJob` object will be returned.
7877
4. For a job finished with `success` return status you can obtain the results with one
@@ -95,6 +94,7 @@ As long as the job is still being processed by our engine it will keep
9594
returning `pending` status.
9695
9796
### Guzzle Exceptions
97+
9898
Underlying HTTP requests are powered with Guzzle,
9999
so it's a good idea to check for
100100
typical [Guzzle Exceptions](https://docs.guzzlephp.org/en/stable/quickstart.html#exceptions):
@@ -105,7 +105,7 @@ use GuzzleHttp\Exception\ClientException;
105105
// Step 1: dispatch the job to the API with one of the methods, for example:
106106
try {
107107
$statusUrl = \SharpApiService::summarizeText($text, 'German');
108-
// $statusUrl example value: 'http://sharpapi.com/api/v1/job/status/75acb6dc-a975-4969-9ef1-c62cebc511cb'
108+
// $statusUrl example value: 'https://sharpapi.com/api/v1/job/status/75acb6dc-a975-4969-9ef1-c62cebc511cb'
109109
} catch (ClientException $e) {
110110
// $e->getResponse()
111111
}
@@ -121,7 +121,6 @@ $jobResultArray = $jobResult->getResultArray();
121121
$jobResultObject = $jobResult->getResultObject();
122122
```
123123
124-
125124
### Framework Controller usage example
126125
127126
```php
@@ -173,7 +172,10 @@ Each method always returns `SharpApiJob` object, where its
173172
`getResultJson / getResultArray / getResultObject`
174173
methods will return different data structure.
175174
Please refer to the detailed examples provided
176-
at [SharpAPI.com](https://sharpapi.com/)
175+
at [SharpAPI.com](https://sharpapi.com/).
176+
177+
For methods that have language parameter you can also
178+
use `SharpApiLanguages` Enum values to make your code more readable.
177179
178180
### HR
179181
@@ -241,7 +243,7 @@ Parses the customer's product review and provides its sentiment (POSITIVE/NEGATI
241243
with a score between 0-100%. Great for sentiment report processing for any online store.
242244
243245
```php
244-
$statusUrl = \SharpApiService::productReviewSentiment('review contents', 'English');
246+
$statusUrl = \SharpApiService::productReviewSentiment('review contents');
245247
```
246248
247249
#### Product Categories
@@ -347,7 +349,7 @@ Parses the Travel/Hospitality product review and provides its sentiment
347349
Great for sentiment report processing for any online store.
348350
349351
```php
350-
$statusUrl = \SharpApiService::travelReviewSentiment($text, 'English');
352+
$statusUrl = \SharpApiService::travelReviewSentiment($text);
351353
```
352354
353355
#### Tours & Activities Product Categories

src/SharpApiService.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -302,12 +302,11 @@ public function relatedJobPositions(string $jobPositionName, string $language =
302302
*
303303
* @api
304304
*/
305-
public function productReviewSentiment(string $review, string $language = 'English'): string
305+
public function productReviewSentiment(string $review): string
306306
{
307307
$url = $this->apiBaseUrl . '/ecommerce/review_sentiment';
308308
$response = $this->makeRequest('POST', $url, [
309309
'content' => $review,
310-
'language' => $language,
311310
]);
312311

313312
return $this->parseStatusUrl($response);
@@ -495,12 +494,11 @@ public function generateSeoTags(string $text, string $language = 'English'): str
495494
*
496495
* @api
497496
*/
498-
public function travelReviewSentiment(string $text, string $language = 'English'): string
497+
public function travelReviewSentiment(string $text): string
499498
{
500499
$url = $this->apiBaseUrl . '/tth/review_sentiment';
501500
$response = $this->makeRequest('POST', $url, [
502501
'content' => $text,
503-
'language' => $language,
504502
]);
505503

506504
return $this->parseStatusUrl($response);

0 commit comments

Comments
 (0)