AccountingDocumentService

public final class AccountingDocumentService : AccountingDocumentServiceProtocol

The accounting document service. Interacts with the APIDomain.accounting api.

  • The accounting API domain

    Declaration

    Swift

    public var apiDomain: APIDomain
  • Creates a document from a given image Data

    Declaration

    Swift

    public func createDocument(with data: Data,
                               fileName: String?,
                               docType: Document.DocType?,
                               metadata: Document.Metadata?,
                               completion: @escaping CompletionResult<Document>)

    Parameters

    data

    The image’s data

    fileName

    The document’s filename

    docType

    The document’s docType

    metadata

    The document’s metadata

    completion

    A completion callback, returning the created document on success

  • Deletes a document

    Declaration

    Swift

    public 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

    public 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 a document for a given document id

    Declaration

    Swift

    public 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 extractions for a given document.

    Declaration

    Swift

    public func extractions(for document: Document,
                            cancellationToken: CancellationToken,
                            completion: @escaping CompletionResult<[Extraction]>)

    Parameters

    document

    Document to get the extractions for

    cancellationToken

    Used to stop the analysis when a user cancels it

    completion

    A completion callback, returning the extraction list on success

  • Retrieves the layout of a given document

    Declaration

    Swift

    public 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

    public 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

  • Retrieves the page preview of a document for a given page and size

    Declaration

    Swift

    public func pagePreview(for document: Document,
                            pageNumber: Int,
                            size: Document.Page.Size,
                            completion: @escaping CompletionResult<Data>)

    Parameters

    document

    Document to get the preview for

    pageNumber

    The document’s page number

    size

    The document’s page size

    completion

    A completion callback, returning the requested page preview on success

  • Submits the analysis feedback for a given document.

    Declaration

    Swift

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

    Parameters

    document

    The document for which feedback should be sent

    extractions

    The document’s updated extractions

    completion

    A completion callback