Skip to content

Commit

Permalink
Furture cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedmaazin committed Mar 9, 2023
1 parent 5db4b25 commit 23622c5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ try {

```php
try {
$prediction = $this->replicate->prediction('prediction-id');
$prediction = $this->replicate->prediction(predictionId: 'prediction-id');

echo $prediction->id;
} catch (ReplicateException|ResponseException $e) {
Expand All @@ -67,7 +67,8 @@ try {
parse_str($query, $params);
$cursor = $params['cursor'];

$predictions = $this->replicate->predictions($cursor);
$predictions = $this->replicate->predictions(cursor: $cursor);
// $predictions->results;
}

// take a look at the Predictions data class for available fields.
Expand All @@ -80,7 +81,7 @@ try {

```php
try {
$response = $this->replicate->cancelPrediction('prediction-id');
$response = $this->replicate->cancelPrediction(predictionId: 'prediction-id');

echo $response->status;
} catch (ReplicateException|ResponseException $e) {
Expand Down
9 changes: 5 additions & 4 deletions examples/ExampleService.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ExampleService

public function __construct()
{
$this->replicate = new Replicate('token');
$this->replicate = new Replicate(apiToken: 'api-token');
}

public function exampleCreateAPrediction(): void
Expand All @@ -32,7 +32,7 @@ public function exampleCreateAPrediction(): void
public function exampleGetAPrediction(): void
{
try {
$prediction = $this->replicate->prediction('prediction-id');
$prediction = $this->replicate->prediction(predictionId: 'prediction-id');

echo $prediction->id;
} catch (ReplicateException|ResponseException $e) {
Expand All @@ -50,7 +50,8 @@ public function examplePredictions(): void
$query = parse_url($nextUrl, PHP_URL_QUERY);
parse_str($query, $params);
$cursor = $params['cursor'];
$predictions = $this->replicate->predictions($cursor);
$predictions = $this->replicate->predictions(cursor: $cursor);
// $predictions->results;
}
} catch (ReplicateException|ResponseException $e) {
}
Expand All @@ -59,7 +60,7 @@ public function examplePredictions(): void
public function exampleCancelAPrediction(): void
{
try {
$response = $this->replicate->cancelPrediction('prediction-id');
$response = $this->replicate->cancelPrediction(predictionId: 'prediction-id');

echo $response->status;
} catch (ReplicateException|ResponseException $e) {
Expand Down

0 comments on commit 23622c5

Please sign in to comment.