DocumentService

public protocol DocumentService : AnyObject

Undocumented

  • Undocumented

    Declaration

    Swift

    var apiDomain: APIDomain { get }
  • Deletes a document

    Declaration

    Swift

    func delete(_ document: Document,
                completion: @escaping CompletionResult<String>)

    Parameters

    document

    Document to be deleted

    completion

    A completion callback

  • Fetches the user documents, with the possibility to retrieve them paginated

    Declaration

    Swift

    func documents(limit: Int?,
                   offset: Int?,
                   completion: @escaping CompletionResult<[Document]>)

    Parameters

    limit

    Limit of documents to retrieve

    offset

    Document’s offset

    completion

    A completion callback, returning the document list on success

  • Retrieves the extractions for a given document.

    Declaration

    Swift

    func extractions(for document: Document,
                     cancellationToken: CancellationToken,
                     completion: @escaping CompletionResult<ExtractionResult>)

    Parameters

    document

    Document to get the extractions for

    cancellationToken

    Token use to stopped the analysis when a user cancels it

    completion

    A completion callback, returning the extraction list on success

  • Retrieves a document for a given document id

    Declaration

    Swift

    func fetchDocument(with id: String,
                       completion: @escaping CompletionResult<Document>)

    Parameters

    id

    The document’s unique identifier

    completion

    A completion callback, returning the requested document on success

  • Retrieves the layout of a given document

    Declaration

    Swift

    func layout(for document: Document,
                completion: @escaping CompletionResult<Document.Layout>)

    Parameters

    id

    The document’s unique identifier

    completion

    A completion callback, returning the requested document layout on success

  • Retrieves the pages of a given document

    Declaration

    Swift

    func pages(in document: Document,
               completion: @escaping CompletionResult<[Document.Page]>)

    Parameters

    id

    The document’s unique identifier

    completion

    A completion callback, returning the requested document layout on success

  • Submits the analysis feedback for a given document.

    Declaration

    Swift

    func submitFeedback(for document: Document,
                        with extractions: [Extraction],
                        completion: @escaping CompletionResult<Void>)

    Parameters

    document

    The document which the feedback will be updated to

    extractions

    The document’s updated extractions

    completion

    A completion callback

  • Returns the data from the downloaded file via url

    Declaration

    Swift

    func file(urlString: String, completion: @escaping CompletionResult<Data>)

    Parameters

    urlString

    The url of the file

    completion

    A completion callback with data