InterfaceIDocumentRepository
Defines a contract for managing, importing, exporting, and retrieving documents of a specific type within a repository.
Definition
Namespace:Telerik.Documents.AI.Tools.Core
Assembly:Telerik.Documents.AI.Tools.Core.dll
Syntax:
public interface IDocumentRepository
Derived Classes:
Properties
DocumentType
Gets the type of the document represented by this instance.
SupportsCreation
Gets a value indicating whether this provider supports creating new documents. Single-document providers typically return false.
SupportsMultipleDocuments
Gets a value indicating whether this provider supports managing multiple documents. Single-document providers return false.
Methods
CreateDocument(string, string[])
Creates a document using the specified document identifier and arguments.
Declaration
string CreateDocument(string documentId, string[] args)
Parameters
documentId
The unique identifier for the document to be created. Cannot be null or empty.
args
string[]
An array of arguments used to populate or configure the document. Cannot be null.
Returns
A string containing the contents of the created document.
Export(string, DocumentFormat, Stream)
Exports a document to a byte array in the specified format.
Declaration
void Export(string documentId, DocumentFormat format, Stream destinationStream)
Parameters
documentId
The document identifier to export. If null, exports the default/current document.
format
The target format for export.
destinationStream
The stream to which the document will be exported.
Exceptions
Thrown when the specified format is not supported.
Thrown when the specified document ID does not exist.
GetDocumentAsObject(string)
Gets a document by its identifier.
Declaration
object GetDocumentAsObject(string documentId = null)
Parameters
documentId
The document identifier. If null, returns the default/current document. In single-document mode, this parameter is ignored.
Returns
The requested document instance.
Exceptions
Thrown when the specified document ID does not exist.
Thrown when no documents are available and documentId is null.
Import(Stream, DocumentFormat, string)
Imports a document from a byte array and adds it to the provider.
Declaration
string Import(Stream data, DocumentFormat format, string documentName = null)
Parameters
data
The document content as a byte array.
format
The format of the document being imported.
documentName
Optional name for the imported document.
Returns
The document ID assigned to the imported document.
Exceptions
Thrown when the provider does not support creation or the format is not supported.
ListDocuments()
Lists all documents currently managed by this provider.
Declaration
IEnumerable<DocumentInfo> ListDocuments()
Returns
Collection of document metadata.
MergeAndExport(string[], Stream, DocumentFormat)
Merges the specified source documents and exports the combined result to the provided stream in the specified format.
Declaration
void MergeAndExport(string[] sourceFileIds, Stream stream, DocumentFormat exportFormat)
Parameters
sourceFileIds
string[]
An array of identifiers for the source documents to merge. The order of identifiers determines the order in which documents are merged. Cannot be null or empty.
stream
The stream to which the merged document will be written. Must be writable and remain open for the duration of the operation.
exportFormat
The format in which to export the merged document.