Documentation

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

$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
throws
MindeeException

Throws if the API key specified is invalid.

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
throws
MindeeException

Throws if the server's response contains an error.

throws
MindeeException

Throws if the inference ID is not provided.

Return values
InferenceResponse

reqGetJob()

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
throws
MindeeException

Throws if the server's response contains an error.

throws
MindeeException

Throws if the inference ID is not provided.

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.

getUserAgent()

Get the User Agent to send for API calls.

private getUserAgent() : string
Return values
string

inferenceGetRequest()

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
throws
MindeeException

Throws if HTTP status indicates an error or deserialization fails.

throws
MindeeV2HttpException

Throws if the HTTP status indicates an error.

Return values
JobResponse|InferenceResponse

The processed response object.

setFromEnv()

Sets values from environment, if needed.

private setFromEnv() : void

        
On this page

Search results