Class Client

Mindee Client class that centralizes most basic operations.

Asynchronous

  • Polls a queue and returns its status as well as the prediction results if the parsing is done.

    Type Parameters

    Parameters

    • productClass: (new (httpResponse: StringDict) => T)

      product class to use for calling the API and parsing the response.

        • new (httpResponse): T
        • Parameters

          Returns T

    • queueId: string

      id of the queue to poll.

    • params: PredictOptions = {}

      parameters relating to prediction options.

    Returns Promise<AsyncPredictResponse<T>>

    a Promise containing a Job, which also contains a Document if the parsing is complete.

Other

  • Parameters

    • options: ClientOptions = ...

      options for the initialization of a client.

    Returns Client

apiKey: string

Key of the API.

  • Creates a custom endpoint with the given values. Raises an error if the endpoint is invalid.

    Parameters

    • endpointName: string

      Name of the custom Endpoint.

    • accountName: string

      Name of the account tied to the Endpoint.

    • OptionalendpointVersion: string

      Version of the custom Endpoint.

    Returns Endpoint

    Endpoint a new product endpoint

  • Load an input document from a base64 encoded string.

    Parameters

    • inputString: string

      input content, as a string.

    • filename: string

      file name.

    Returns Base64Input

  • Load an input document from a Buffer.

    Parameters

    • buffer: Buffer

      input content, as a buffer.

    • filename: string

      file name.

    Returns BufferInput

  • Load an input document from bytes.

    Parameters

    • inputBytes: Uint8Array

      input content, as a Uint8Array or Buffer.

    • filename: string

      file name.

    Returns BytesInput

  • Load an input document from a stream.Readable object.

    Parameters

    • inputStream: Readable

      input content, as a readable stream.

    • filename: string

      file name.

    Returns StreamInput

  • Forces boolean coercion on truthy/falsy parameters.

    Parameters

    • Optionalparam: boolean

      input parameter to check.

    Returns boolean

    a strict boolean value.

Synchronous

  • Send a document to an asynchronous endpoint and poll the server until the result is sent or until the maximum amount of tries is reached.

    Type Parameters

    Parameters

    • productClass: (new (httpResponse: StringDict) => T)

      product class to use for calling the API and parsing the response.

        • new (httpResponse): T
        • Parameters

          Returns T

    • inputSource: InputSource

      document to parse.

    • asyncParams: OptionalAsyncOptions = ...

      parameters relating to prediction options.

    Returns Promise<AsyncPredictResponse<T>>

    a Promise containing parsing results.

  • Fetch prediction results from a document already processed.

    Type Parameters

    Parameters

    • productClass: (new (httpResponse: StringDict) => T)

      product class to use for calling the API and parsing the response.

        • new (httpResponse): T
        • Parameters

          Returns T

    • documentId: string

      id of the document to fetch.

    • params: {
          endpoint?: Endpoint;
      } = {}

      optional parameters.

      • Optionalendpoint?: Endpoint

        Endpoint, only specify if using a custom product.

    Returns Promise<PredictResponse<T>>

    a Promise containing parsing results.

  • Send a document to a synchronous endpoint and parse the predictions.

    Type Parameters

    Parameters

    • productClass: (new (httpResponse: StringDict) => T)

      product class to use for calling the API and parsing the response.

        • new (httpResponse): T
        • Parameters

          Returns T

    • inputSource: InputSource

      file to parse.

    • params: PredictOptions = ...

      parameters relating to prediction options.

    Returns Promise<PredictResponse<T>>

    a Promise containing parsing results.

  • Send a feedback for a document.

    Type Parameters

    Parameters

    • productClass: (new (httpResponse: StringDict) => T)

      product class to use for calling the API and parsing the response.

        • new (httpResponse): T
        • Parameters

          Returns T

    • documentId: string

      id of the document to send feedback for.

    • feedback: StringDict

      the feedback to send.

    • params: {
          endpoint?: Endpoint;
      } = {}

      optional parameters.

      • Optionalendpoint?: Endpoint

        Endpoint, only specify if using a custom product.

    Returns Promise<FeedbackResponse>

    a Promise containing feedback results.

Workflow

  • Send the document to an asynchronous endpoint and return its ID in the queue.

    Parameters

    • inputSource: InputSource

      file to send to the API.

    • workflowId: string

      ID of the workflow.

    • params: WorkflowOptions = {}

      parameters relating to prediction options.

    Returns Promise<WorkflowResponse<GeneratedV1>>

    a Promise containing the job (queue) corresponding to a document.