Skip to content

Commit 2a332f0

Browse files
authored
📝 clean up v2 samples (#197)
1 parent 8de16d2 commit 2a332f0

6 files changed

Lines changed: 24 additions & 30 deletions

File tree

docs/code_samples/v2_classification.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
<?php
22

3+
use Mindee\Input\PathInput;
34
use Mindee\V2\Client;
45
use Mindee\V2\Product\Classification\Params\ClassificationParameters;
56
use Mindee\V2\Product\Classification\ClassificationResponse;
6-
use Mindee\Input\PathInput;
77

88
$apiKey = "MY_API_KEY";
9-
$filePath = "/path/to/the/file.ext";
109
$modelId = "MY_MODEL_ID";
10+
$filePath = "/path/to/the/file.ext";
1111

1212
// Init a new client
1313
$mindeeClient = new Client($apiKey);
1414

1515
// Set classification parameters
16-
// Note: modelId is mandatory.
17-
$classificationParams = new ClassificationParameters(
16+
$modelParams = new ClassificationParameters(
1817
// ID of the model, required.
1918
$modelId,
2019
);
@@ -26,7 +25,7 @@ $inputSource = new PathInput($filePath);
2625
$response = $mindeeClient->enqueueAndGetResult(
2726
ClassificationResponse::class,
2827
$inputSource,
29-
$classificationParams
28+
$modelParams
3029
);
3130

3231
// Print a summary of the response

docs/code_samples/v2_crop.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
<?php
22

3+
use Mindee\Input\PathInput;
34
use Mindee\V2\Client;
45
use Mindee\V2\Product\Crop\Params\CropParameters;
56
use Mindee\V2\Product\Crop\CropResponse;
6-
use Mindee\Input\PathInput;
77

88
$apiKey = "MY_API_KEY";
9-
$filePath = "/path/to/the/file.ext";
109
$modelId = "MY_MODEL_ID";
10+
$filePath = "/path/to/the/file.ext";
1111

1212
// Init a new client
1313
$mindeeClient = new Client($apiKey);
1414

1515
// Set crop parameters
16-
// Note: modelId is mandatory.
17-
$cropParams = new CropParameters(
16+
$modelParams = new CropParameters(
1817
// ID of the model, required.
1918
$modelId,
2019
);
@@ -26,7 +25,7 @@ $inputSource = new PathInput($filePath);
2625
$response = $mindeeClient->enqueueAndGetResult(
2726
CropResponse::class,
2827
$inputSource,
29-
$cropParams
28+
$modelParams
3029
);
3130

3231
// Print a summary of the response

docs/code_samples/v2_extraction_polling.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
<?php
22

3+
use Mindee\Input\PathInput;
34
use Mindee\V2\Client;
45
use Mindee\V2\Product\Extraction\Params\ExtractionParameters;
5-
use Mindee\Input\PathInput;
66
use Mindee\V2\Product\Extraction\ExtractionResponse;
77

88
$apiKey = "MY_API_KEY";
9-
$filePath = "/path/to/the/file.ext";
109
$modelId = "MY_MODEL_ID";
10+
$filePath = "/path/to/the/file.ext";
1111

1212
// Init a new client
1313
$mindeeClient = new Client($apiKey);
1414

1515
// Set inference parameters
16-
// Note: modelId is mandatory.
17-
$inferenceParams = new ExtractionParameters(
16+
$modelParams = new ExtractionParameters(
1817
// ID of the model, required.
1918
$modelId,
2019

@@ -38,7 +37,7 @@ $inputSource = new PathInput($filePath);
3837
$response = $mindeeClient->enqueueAndGetResult(
3938
ExtractionResponse::class,
4039
$inputSource,
41-
$inferenceParams
40+
$modelParams
4241
);
4342

4443
// Print a summary of the response

docs/code_samples/v2_extraction_webhook.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
<?php
22

3+
use Mindee\Input\PathInput;
34
use Mindee\V2\Client;
45
use Mindee\V2\Product\Extraction\Params\ExtractionParameters;
5-
use Mindee\Input\PathInput;
66

77
$apiKey = "MY_API_KEY";
8-
$filePath = "/path/to/the/file.ext";
98
$modelId = "MY_MODEL_ID";
9+
$filePath = "/path/to/the/file.ext";
1010

1111
// Init a new client
1212
$mindeeClient = new Client($apiKey);
1313

1414
// Set inference parameters
15-
// Note: modelId is mandatory.
16-
$inferenceParams = new ExtractionParameters(
15+
$modelParams = new ExtractionParameters(
1716
// ID of the model, required.
1817
$modelId,
1918
webhookIds: ["MY_WEBHOOK_ID"],
@@ -37,7 +36,7 @@ $inputSource = new PathInput($filePath);
3736
// Send for processing
3837
$response = $mindeeClient->enqueue(
3938
$inputSource,
40-
$inferenceParams
39+
$modelParams
4140
);
4241

4342
// Print the job ID

docs/code_samples/v2_ocr.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
<?php
22

3+
use Mindee\Input\PathInput;
34
use Mindee\V2\Client;
45
use Mindee\V2\Product\Ocr\Params\OcrParameters;
56
use Mindee\V2\Product\Ocr\OcrResponse;
6-
use Mindee\Input\PathInput;
77

88
$apiKey = "MY_API_KEY";
9-
$filePath = "/path/to/the/file.ext";
109
$modelId = "MY_MODEL_ID";
10+
$filePath = "/path/to/the/file.ext";
1111

1212
// Init a new client
1313
$mindeeClient = new Client($apiKey);
1414

1515
// Set ocr parameters
16-
// Note: modelId is mandatory.
17-
$ocrParams = new OcrParameters(
16+
$modelParams = new OcrParameters(
1817
// ID of the model, required.
1918
$modelId,
2019
);
@@ -26,7 +25,7 @@ $inputSource = new PathInput($filePath);
2625
$response = $mindeeClient->enqueueAndGetResult(
2726
OcrResponse::class,
2827
$inputSource,
29-
$ocrParams
28+
$modelParams
3029
);
3130

3231
// Print a summary of the response

docs/code_samples/v2_split.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
<?php
22

3+
use Mindee\Input\PathInput;
34
use Mindee\V2\Client;
45
use Mindee\V2\Product\Split\Params\SplitParameters;
56
use Mindee\V2\Product\Split\SplitResponse;
6-
use Mindee\Input\PathInput;
77

88
$apiKey = "MY_API_KEY";
9-
$filePath = "/path/to/the/file.ext";
109
$modelId = "MY_MODEL_ID";
10+
$filePath = "/path/to/the/file.ext";
1111

1212
// Init a new client
1313
$mindeeClient = new Client($apiKey);
1414

1515
// Set split parameters
16-
// Note: modelId is mandatory.
17-
$splitParams = new SplitParameters(
16+
$modelParams = new SplitParameters(
1817
// ID of the model, required.
1918
$modelId,
2019
);
@@ -26,7 +25,7 @@ $inputSource = new PathInput($filePath);
2625
$response = $mindeeClient->enqueueAndGetResult(
2726
SplitResponse::class,
2827
$inputSource,
29-
$splitParams
28+
$modelParams
3029
);
3130

3231
// Print a summary of the response

0 commit comments

Comments
 (0)