DefaultDocumentService
public final class DefaultDocumentService
The default document service. By default interacts with the APIDomain.default api.
-
Creates a partial document from a given image
Dataor a composite document for given partial documents.Declaration
Swift
public func createDocument(fileName: String?, docType: Document.DocType?, type: Document.TypeV2, metadata: Document.Metadata?, completion: @escaping CompletionResult<Document>)Parameters
fileNameThe document’s filename
docTypeThe document’s docType
typeThe V2 document’s type. It could be either partial or composite type.
metadataThe document’s metadata
completionA completion callback, returning the created document on success
-
Deletes a document
Declaration
Swift
public func delete(_ document: Document, completion: @escaping CompletionResult<String>)Parameters
documentDocument to be deleted
completionA 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
limitLimit of documents to retrieve
offsetDocument’s offset
completionA 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
idThe document’s unique identifier
completionA 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<ExtractionResult>)Parameters
documentDocument to get the extractions for
cancellationTokenToken use to stopped the analysis when a user cancels it
completionA 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
idThe document’s unique identifier
completionA 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
idThe document’s unique identifier
completionA completion callback, returning the requested document layout 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
documentThe document for which feedback should be sent.
extractionsThe document’s updated extractions.
completionA completion callback.
-
Submits the analysis feedback with compound extractions (e.g., “line items”) for a given document.
Declaration
Swift
public func submitFeedback(for document: Document, with extractions: [Extraction], and compoundExtractions: [String: [[Extraction]]], completion: @escaping CompletionResult<Void>)Parameters
documentThe document for which feedback should be sent.
extractionsThe document’s updated extractions.
compoundExtractionsThe document’s updated compound extractions.
completionA completion callback.
-
Submits the analysis feedback for a document using only its ID.
Declaration
Swift
public func submitFeedback(for documentId: String, with extractions: [Extraction], completion: @escaping CompletionResult<Void>)Parameters
documentIdThe ID of the document for which feedback should be sent.
extractionsThe document’s updated extractions.
completionA completion callback.
-
Submits the analysis feedback with compound extractions for a document using only its ID.
Declaration
Swift
public func submitFeedback(for documentId: String, with extractions: [Extraction], and compoundExtractions: [String: [[Extraction]]], completion: @escaping CompletionResult<Void>)Parameters
documentIdThe ID of the document for which feedback should be sent.
extractionsThe document’s updated extractions.
compoundExtractionsThe document’s updated compound extractions.
completionA completion callback.
-
Retrieves the page preview of a document for a given page
Declaration
Swift
public func preview(for documentId: String, pageNumber: Int, completion: @escaping CompletionResult<Data>)Parameters
documentIdDocument id to get the preview for
pageNumberThe document’s page number starting from 1
completionA completion callback, returning the requested page preview as Data on success
-
Undocumented
Declaration
Swift
public func file(urlString: String, completion: @escaping CompletionResult<Data>)
View on GitHub
DefaultDocumentService Class Reference