Interface
IDocumentRepository

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:

cs-api-definition
public interface IDocumentRepository

Derived Classes: SingleWorkbookRepositoryInMemoryFixedDocumentRepositoryInMemoryFlowDocumentRepositoryInMemoryWorkbookRepository

Properties

DocumentType

Gets the type of the document represented by this instance.

Declaration

cs-api-definition
DocumentType DocumentType { get; }

Property Value

DocumentType

SupportsCreation

Gets a value indicating whether this provider supports creating new documents. Single-document providers typically return false.

Declaration

cs-api-definition
bool SupportsCreation { get; }

Property Value

bool

SupportsMultipleDocuments

Gets a value indicating whether this provider supports managing multiple documents. Single-document providers return false.

Declaration

cs-api-definition
bool SupportsMultipleDocuments { get; }

Property Value

bool

Methods

CreateDocument(string, string[])

Creates a document using the specified document identifier and arguments.

Declaration

cs-api-definition
string CreateDocument(string documentId, string[] args)

Parameters

documentId

string

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

string

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

cs-api-definition
void Export(string documentId, DocumentFormat format, Stream destinationStream)

Parameters

documentId

string

The document identifier to export. If null, exports the default/current document.

format

DocumentFormat

The target format for export.

destinationStream

Stream

The stream to which the document will be exported.

Exceptions

NotSupportedException

Thrown when the specified format is not supported.

KeyNotFoundException

Thrown when the specified document ID does not exist.

GetDocumentAsObject(string)

Gets a document by its identifier.

Declaration

cs-api-definition
object GetDocumentAsObject(string documentId = null)

Parameters

documentId

string

The document identifier. If null, returns the default/current document. In single-document mode, this parameter is ignored.

Returns

object

The requested document instance.

Exceptions

KeyNotFoundException

Thrown when the specified document ID does not exist.

InvalidOperationException

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

cs-api-definition
string Import(Stream data, DocumentFormat format, string documentName = null)

Parameters

data

Stream

The document content as a byte array.

format

DocumentFormat

The format of the document being imported.

documentName

string

Optional name for the imported document.

Returns

string

The document ID assigned to the imported document.

Exceptions

NotSupportedException

Thrown when the provider does not support creation or the format is not supported.

ListDocuments()

Lists all documents currently managed by this provider.

Declaration

cs-api-definition
IEnumerable<DocumentInfo> ListDocuments()

Returns

IEnumerable<DocumentInfo>

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

cs-api-definition
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

Stream

The stream to which the merged document will be written. Must be writable and remain open for the duration of the operation.

exportFormat

DocumentFormat

The format in which to export the merged document.