Class Client

Mindee Client class that centralizes most basic operations.

Hierarchy

  • Client

Constructors

  • Parameters

    • options: ClientOptions = ...

      options for the initialization of a client.

    Returns Client

Properties

apiKey: string

Key of the API.

Asynchronous Methods

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

    Returns

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

    Type Parameters

    Parameters

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

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

    • queueId: string

      id of the queue to poll.

    • params: PredictOptions = {}

      parameters relating to prediction options.

    Returns Promise<AsyncPredictResponse<T>>

Other Methods

  • Builds a product endpoint.

    Returns

    a custom Endpoint object.

    Parameters

    • endpointName: string

      name of the endpoint.

    • accountName: string

      name of the endpoint's owner.

    • endpointVersion: string

      version of the endpoint.

    Returns Endpoint

  • Checks that an account name is provided for custom builds, and sets the default one otherwise.

    Returns

    the name of the account. Sends an error if one isn't provided for a custom build.

    Type Parameters

    Parameters

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

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

    • Optional accountName: string

      name of the account's holder. Only required on custom builds.

    Returns string

  • Get the name and version of an OTS endpoint.

    Returns

    an endpoint's name and version.

    Type Parameters

    Parameters

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

      product class to use for calling the API and parsing the response. Mandatory to retrieve default OTS endpoint data.

    Returns [string, string]

  • Checks the values for asynchronous parsing. Returns their corrected value if they are undefined.

    Returns

    A valid AsyncOptions.

    Parameters

    • asyncParams: OptionalAsyncOptions

      parameters related to asynchronous parsing

    Returns AsyncOptions

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

    Returns

    Endpoint a new product endpoint

    Parameters

    • endpointName: string

      Name of the custom Endpoint.

    • accountName: string

      Name of the account tied to the Endpoint.

    • Optional endpointVersion: string

      Version of the custom Endpoint.

    Returns 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 a bytes string.

    Parameters

    • inputBytes: string

      input content, as readable bytes.

    • 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.

    Returns

    a strict boolean value.

    Parameters

    • Optional param: boolean

      input parameter to check.

    Returns boolean

Synchronous Methods

  • 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.

    Returns

    a Promise containing parsing results.

    Type Parameters

    Parameters

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

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

    • inputSource: InputSource

      document to parse.

    • asyncParams: OptionalAsyncOptions = ...

      parameters relating to prediction options.

    Returns Promise<AsyncPredictResponse<T>>

  • Fetch prediction results from a document already processed.

    Returns

    a Promise containing parsing results.

    Type Parameters

    Parameters

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

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

    • documentId: string

      id of the document to fetch.

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

      optional parameters.

      • Optional endpoint?: Endpoint

        Endpoint, only specify if using a custom product.

    Returns Promise<PredictResponse<T>>

  • Send a feedback for a document.

    Returns

    a Promise containing feedback results.

    Type Parameters

    Parameters

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

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

    • documentId: string

      id of the document to send feedback for.

    • feedback: StringDict

      the feedback to send.

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

      optional parameters.

      • Optional endpoint?: Endpoint

        Endpoint, only specify if using a custom product.

    Returns Promise<FeedbackResponse>

Generated using TypeDoc