MindeeApiV2
in package
Data class containing settings for endpoints.
Table of Contents
Properties
- $apiKey : string|null
- $baseUrl : string
- $requestTimeout : int
Methods
- __construct() : void
- reqDeleteExtractionRagDocument() : bool
- Deletes a RAG document from the extraction database.
- reqGetJobById() : JobResponse
- Requests the job of a queued document from the API.
- reqGetJobFromUrl() : JobResponse
- Requests the job of a queued document from the API.
- reqGetRagAnnotation() : T
- Retrieves a RAG document annotation by its ID.
- reqGetResultById() : T
- reqGetResultFromUrl() : T
- reqGetSearch() : T
- Makes a GET call to a search endpoint and returns the deserialized response.
- reqPatchRagAnnotation() : T
- Updates a RAG document annotation using the provided parameters.
- reqPostEnqueue() : JobResponse
- reqPostRagDocument() : T
- Uploads a local document to the RAG database.
- setAPIKey() : void
- Sets the API key.
- setBaseUrl() : void
- Sets the base url.
- checkValidResponse() : void
- deserializeResponse() : T
- Process the HTTP response and return the appropriate response object.
- documentEnqueuePost() : array<string, int|float|string|bool|null|array<string|int, mixed>>
- Starts a CURL session using POST.
- getUserAgent() : string
- Get the User Agent to send for API calls.
- initChannel() : bool|CurlHandle
- Init a CURL channel with common params.
- sendDeleteRequest() : array<string, int|float|string|bool|null|array<string|int, mixed>>
- Makes a DELETE call.
- sendGetRequest() : array<string, int|float|string|bool|null|array<string|int, mixed>>
- Makes a GET call to retrieve a job.
- sendPatchRequest() : array<string, int|float|string|bool|null|array<string|int, mixed>>
- Makes a PATCH call with a JSON body.
- setFromEnv() : void
- Sets values from environment, if needed.
Properties
$apiKey
public
string|null
$apiKey
= null
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
reqDeleteExtractionRagDocument()
Deletes a RAG document from the extraction database.
public
reqDeleteExtractionRagDocument(string $documentId) : bool
Parameters
- $documentId : string
-
Unique identifier of the RAG document to delete.
Return values
bool —True if the deletion was successful (2xx response), false otherwise.
reqGetJobById()
Requests the job of a queued document from the API.
public
reqGetJobById(string $jobId) : JobResponse
Throws an error if the server's response contains one.
Parameters
- $jobId : string
-
UUID of the job.
Tags
Return values
JobResponse —Server response wrapped in a JobResponse object.
reqGetJobFromUrl()
Requests the job of a queued document from the API.
public
reqGetJobFromUrl(string $url) : JobResponse
Throws an error if the server's response contains one.
Parameters
- $url : string
-
URL of the job.
Tags
Return values
JobResponse —Server response wrapped in a JobResponse object.
reqGetRagAnnotation()
Retrieves a RAG document annotation by its ID.
public
reqGetRagAnnotation(string $responseClass, string $documentId) : T
Parameters
- $responseClass : string
-
The response class to construct.
- $documentId : string
-
Unique identifier of the RAG document.
Tags
Return values
TreqGetResultById()
public
reqGetResultById(string $responseClass, string $resultId) : T
Parameters
- $responseClass : string
-
The response class to construct.
- $resultId : string
-
UUID of the result.
Tags
Return values
T —A response containing parsing results.
reqGetResultFromUrl()
public
reqGetResultFromUrl(string $responseClass, string $resultUrl) : T
Parameters
- $responseClass : string
-
The response class to construct.
- $resultUrl : string
-
URL of the result.
Tags
Return values
T —A response containing parsing results.
reqGetSearch()
Makes a GET call to a search endpoint and returns the deserialized response.
public
reqGetSearch(BaseSearchParameters<string|int, T> $params) : T
Parameters
- $params : BaseSearchParameters<string|int, T>
-
Search parameters (slug and query params derived from this).
Tags
Return values
TreqPatchRagAnnotation()
Updates a RAG document annotation using the provided parameters.
public
reqPatchRagAnnotation(BaseAnnotationParameters<string|int, T> $params) : T
Parameters
- $params : BaseAnnotationParameters<string|int, T>
-
Annotation parameters including the document ID and fields to update.
Tags
Return values
TreqPostEnqueue()
public
reqPostEnqueue(InputSource $inputDoc, BaseProductParameters $params) : JobResponse
Parameters
- $inputDoc : InputSource
-
Input document.
- $params : BaseProductParameters
-
Parameters for the inference.
Tags
Return values
JobResponse —Server response wrapped in a JobResponse object.
reqPostRagDocument()
Uploads a local document to the RAG database.
public
reqPostRagDocument(LocalInputSource $inputSource, BaseRagDocumentUploadParameters<string|int, T> $params) : T
Parameters
- $inputSource : LocalInputSource
-
Local file to upload.
- $params : BaseRagDocumentUploadParameters<string|int, T>
-
Upload parameters.
Tags
Return values
TsetAPIKey()
Sets the API key.
protected
setAPIKey([string|null $apiKey = null ]) : void
Parameters
- $apiKey : string|null = null
-
Optional API key.
setBaseUrl()
Sets the base url.
protected
setBaseUrl(string $value) : void
Parameters
- $value : string
-
Value for the base Url.
checkValidResponse()
private
checkValidResponse(array<string, int|float|string|bool|null|array<string|int, mixed>> $result) : void
Parameters
- $result : array<string, int|float|string|bool|null|array<string|int, mixed>>
-
Raw HTTP response array with 'data' and 'code' keys.
Tags
deserializeResponse()
Process the HTTP response and return the appropriate response object.
private
deserializeResponse(string $responseClass, array<string, int|float|string|bool|null|array<string|int, mixed>> $result) : T
Parameters
- $responseClass : string
-
The response class to construct.
- $result : array<string, int|float|string|bool|null|array<string|int, mixed>>
-
Raw HTTP response array with 'data' and 'code' keys.
Tags
Return values
T —A response containing parsing results.
documentEnqueuePost()
Starts a CURL session using POST.
private
documentEnqueuePost(InputSource $inputSource, BaseProductParameters $params) : array<string, int|float|string|bool|null|array<string|int, mixed>>
Parameters
- $inputSource : InputSource
-
File to upload.
- $params : BaseProductParameters
-
Parameters.
Tags
Return values
array<string, int|float|string|bool|null|array<string|int, mixed>> —Server response.
getUserAgent()
Get the User Agent to send for API calls.
private
getUserAgent() : string
Return values
stringinitChannel()
Init a CURL channel with common params.
private
initChannel() : bool|CurlHandle
Return values
bool|CurlHandle —Returns a valid CURL channel.
sendDeleteRequest()
Makes a DELETE call.
private
sendDeleteRequest(string $url) : array<string, int|float|string|bool|null|array<string|int, mixed>>
Parameters
- $url : string
-
URL to send the request to.
Return values
array<string, int|float|string|bool|null|array<string|int, mixed>> —Server response.
sendGetRequest()
Makes a GET call to retrieve a job.
private
sendGetRequest(string $url) : array<string, int|float|string|bool|null|array<string|int, mixed>>
Parameters
- $url : string
-
URL of the job.
Return values
array<string, int|float|string|bool|null|array<string|int, mixed>> —Server response.
sendPatchRequest()
Makes a PATCH call with a JSON body.
private
sendPatchRequest(string $url, array<string, mixed> $body) : array<string, int|float|string|bool|null|array<string|int, mixed>>
Parameters
- $url : string
-
URL to send the request to.
- $body : array<string, mixed>
-
Request body to encode as JSON.
Return values
array<string, int|float|string|bool|null|array<string|int, mixed>> —Server response.
setFromEnv()
Sets values from environment, if needed.
private
setFromEnv() : void