MindeeApiV2
in package
Data class containing settings for endpoints.
Table of Contents
Properties
- $apiKey : string|null
- $baseUrl : string
- $requestTimeout : int
Methods
- __construct() : void
- reqGetInference() : InferenceResponse
- Requests the job of a queued document from the API.
- reqGetJob() : JobResponse
- Requests the job of a queued document from the API.
- reqPostInferenceEnqueue() : JobResponse
- setApiKey() : void
- Sets the API key.
- documentEnqueuePost() : array<string|int, mixed>
- Starts a CURL session using POST.
- getUserAgent() : string
- Get the User Agent to send for API calls.
- inferenceGetRequest() : array<string|int, mixed>
- Makes a GET call to retrieve an inference.
- initChannel() : false|resource
- Init a CURL channel with common params.
- jobGetRequest() : array<string|int, mixed>
- Makes a GET call to retrieve a job.
- processResponse() : JobResponse|InferenceResponse
- Process the HTTP response and return the appropriate response object.
- setFromEnv() : void
- Sets values from environment, if needed.
Properties
$apiKey
public
string|null
$apiKey
API key.
$baseUrl
public
string
$baseUrl
Base for the root url. Used for testing purposes.
$requestTimeout
public
int
$requestTimeout
Timeout for the request, in ms.
Methods
__construct()
public
__construct(string|null $apiKey) : void
Parameters
- $apiKey : string|null
-
API key.
Tags
reqGetInference()
Requests the job of a queued document from the API.
public
reqGetInference(string $inferenceId) : InferenceResponse
Throws an error if the server's response contains one.
Parameters
- $inferenceId : string
-
ID of the inference.
Tags
Return values
InferenceResponsereqGetJob()
Requests the job of a queued document from the API.
public
reqGetJob(string $jobId) : JobResponse
Throws an error if the server's response contains one.
Parameters
- $jobId : string
-
ID of the inference.
Tags
Return values
JobResponse —Server response wrapped in a JobResponse object.
reqPostInferenceEnqueue()
public
reqPostInferenceEnqueue(InputSource $inputDoc, InferenceParameters $params) : JobResponse
Parameters
- $inputDoc : InputSource
-
Input document.
- $params : InferenceParameters
-
Parameters for the inference.
Tags
Return values
JobResponse —Server response wrapped in a JobResponse object.
setApiKey()
Sets the API key.
protected
setApiKey([string|null $apiKey = null ]) : void
Parameters
- $apiKey : string|null = null
-
Optional API key.
documentEnqueuePost()
Starts a CURL session using POST.
private
documentEnqueuePost(InputSource $inputSource, InferenceParameters $params) : array<string|int, mixed>
Parameters
- $inputSource : InputSource
-
File to upload.
- $params : InferenceParameters
-
Inference parameters.
Return values
array<string|int, mixed>getUserAgent()
Get the User Agent to send for API calls.
private
getUserAgent() : string
Return values
stringinferenceGetRequest()
Makes a GET call to retrieve an inference.
private
inferenceGetRequest(string $inferenceId) : array<string|int, mixed>
Parameters
- $inferenceId : string
-
ID of the inference.
Return values
array<string|int, mixed> —Server response.
initChannel()
Init a CURL channel with common params.
private
initChannel() : false|resource
Return values
false|resource —Returns a valid CURL channel.
jobGetRequest()
Makes a GET call to retrieve a job.
private
jobGetRequest(string $jobId) : array<string|int, mixed>
Parameters
- $jobId : string
-
ID of the job.
Return values
array<string|int, mixed> —Server response.
processResponse()
Process the HTTP response and return the appropriate response object.
private
processResponse(array<string|int, mixed> $result, string $responseType) : JobResponse|InferenceResponse
Parameters
- $result : array<string|int, mixed>
-
Raw HTTP response array with 'data' and 'code' keys.
- $responseType : string
-
Class name of the response type to instantiate.
Tags
Return values
JobResponse|InferenceResponse —The processed response object.
setFromEnv()
Sets values from environment, if needed.
private
setFromEnv() : void