mindee
    Preparing search index...

    Class LocalResponse

    Local response loaded from a file. Note: Has to be initialized through init() before use.

    Hierarchy

    • LocalResponseBase
      • LocalResponse
    Index

    Constructors

    Properties

    initialized: boolean = false

    Methods

    • Deserialize the loaded local response into a product response class.

      Typically used when dealing with V2 webhook callbacks to parse the raw JSON payload pushed to your endpoint into a typed response object.

      Pass the response class that matches the product you used when enqueuing the document. All product response classes are exported from the mindee package and can be used here:

      • mindee.product.ExtractionResponse
      • mindee.product.ClassificationResponse
      • mindee.product.OcrResponse
      • mindee.product.CropResponse
      • mindee.product.SplitResponse

      Type Parameters

      • ResponseT extends BaseResponse

        A class that extends BaseResponse.

      Parameters

      • responseClass: new (serverResponse: StringDict) => ResponseT

        The constructor of the product response class into which the payload should be deserialized.

      Returns Promise<ResponseT>

      An instance of responseClass populated with the webhook payload.

      MindeeError If the provided class cannot be instantiated.

    • Returns the HMAC signature of the local response from the secret key provided.

      Parameters

      • secretKey: string | Buffer<ArrayBufferLike> | Uint8Array<ArrayBufferLike>

        Secret key, either a string or a byte/byte array.

      Returns string

      The HMAC signature of the local response.

    • Checks if the HMAC signature of the local response is valid.

      Parameters

      • secretKey: string | Buffer<ArrayBufferLike> | Uint8Array<ArrayBufferLike>

        Secret key, either a string or a byte/byte array.

      • signature: string

        The signature to be compared with.

      Returns boolean

      True if the HMAC signature is valid.