Method ImportAsync
ImportAsync(Attachment, string, string, CancellationToken)
Asynchronously imports content from a single Attachment into a DataSource by creating a new section.
public Task<DataSource> ImportAsync(Attachment attachment, string dataSourceIdentifier, string sectionIdentifier, CancellationToken cancellationToken = default)
Parameters
attachment
AttachmentThe attachment containing the content to import.
dataSourceIdentifier
stringThe unique identifier for the target DataSource. If a matching data source exists, the content is added as a new section; otherwise, a new data source is created.
sectionIdentifier
stringThe identifier for the new section created from the attachment's content.
cancellationToken
CancellationTokenAn optional cancellation token to cancel the operation.
Returns
- Task<DataSource>
A task that resolves to the DataSource containing the imported content.
ImportAsync(Attachment, TextChunking, string, string, CancellationToken)
Asynchronously imports content from a single Attachment into a DataSource by creating a new section.
public Task<DataSource> ImportAsync(Attachment attachment, TextChunking textChunking, string dataSourceIdentifier, string sectionIdentifier, CancellationToken cancellationToken = default)
Parameters
attachment
AttachmentThe attachment containing the content to import.
textChunking
TextChunkingSpecifies how to split the extracted text into chunks.
dataSourceIdentifier
stringThe unique identifier for the target DataSource. If a matching data source exists, the content is added as a new section; otherwise, a new data source is created.
sectionIdentifier
stringThe identifier for the new section created from the attachment's content.
cancellationToken
CancellationTokenAn optional cancellation token to cancel the operation.
Returns
- Task<DataSource>
A task that resolves to the DataSource containing the imported content.
ImportAsync(Attachment, string, string, MetadataCollection, CancellationToken)
Asynchronously imports content from a single Attachment into a DataSource by creating a new section and attaching additional metadata.
public Task<DataSource> ImportAsync(Attachment attachment, string dataSourceIdentifier, string sectionIdentifier, MetadataCollection additionalMetadata, CancellationToken cancellationToken = default)
Parameters
attachment
AttachmentThe attachment containing the content to import.
dataSourceIdentifier
stringThe unique identifier for the target DataSource. If a matching data source exists, the content is added as a new section; otherwise, a new data source is created.
sectionIdentifier
stringThe identifier for the new section created from the attachment's content.
additionalMetadata
MetadataCollectionAdditional metadata to associate with the imported section.
cancellationToken
CancellationTokenAn optional cancellation token to cancel the operation.
Returns
- Task<DataSource>
A task that resolves to the DataSource containing the imported content.
ImportAsync(Attachment, TextChunking, string, string, MetadataCollection, CancellationToken)
Asynchronously imports content from a single Attachment into a DataSource by creating a new section and attaching additional metadata.
public Task<DataSource> ImportAsync(Attachment attachment, TextChunking textChunking, string dataSourceIdentifier, string sectionIdentifier, MetadataCollection additionalMetadata, CancellationToken cancellationToken = default)
Parameters
attachment
AttachmentThe attachment containing the content to import.
textChunking
TextChunkingSpecifies how to split the extracted text into chunks.
dataSourceIdentifier
stringThe unique identifier for the target DataSource. If a matching data source exists, the content is added as a new section; otherwise, a new data source is created.
sectionIdentifier
stringThe identifier for the new section created from the attachment's content.
additionalMetadata
MetadataCollectionAdditional metadata to associate with the imported section.
cancellationToken
CancellationTokenAn optional cancellation token to cancel the operation.
Returns
- Task<DataSource>
A task that resolves to the DataSource containing the imported content.
ImportAsync(IList<Attachment>, string, IList<string>, IList<MetadataCollection>, CancellationToken)
Asynchronously imports content from multiple Attachment instances into a DataSource, creating a new section for each attachment.
public Task<DataSource> ImportAsync(IList<Attachment> attachments, string dataSourceIdentifier, IList<string> sectionIdentifiers, IList<MetadataCollection> metadataCollections = null, CancellationToken cancellationToken = default)
Parameters
attachments
IList<Attachment>A list of attachments containing the content to import.
dataSourceIdentifier
stringThe unique identifier for the target DataSource. If a matching data source exists, the content is added as new sections; otherwise, a new data source is created.
sectionIdentifiers
IList<string>A list of unique identifiers for the sections corresponding to each attachment. The number of identifiers must match the number of attachments.
metadataCollections
IList<MetadataCollection>An optional list of metadata collections to associate with each imported section. If provided, its count must match the number of attachments.
cancellationToken
CancellationTokenAn optional cancellation token to cancel the operation.
Returns
- Task<DataSource>
A task that resolves to the DataSource containing the imported content.
Exceptions
- ArgumentNullException
Thrown if
attachments
,dataSourceIdentifier
, orsectionIdentifiers
is null or empty.- ArgumentOutOfRangeException
Thrown if the count of
sectionIdentifiers
(ormetadataCollections
, if provided) does not match the number of attachments.
ImportAsync(IList<Attachment>, TextChunking, string, IList<string>, IList<MetadataCollection>, CancellationToken)
Asynchronously imports content from multiple Attachment instances into a DataSource, creating a new section for each attachment.
public Task<DataSource> ImportAsync(IList<Attachment> attachments, TextChunking textChunking, string dataSourceIdentifier, IList<string> sectionIdentifiers, IList<MetadataCollection> metadataCollections = null, CancellationToken cancellationToken = default)
Parameters
attachments
IList<Attachment>A list of attachments containing the content to import.
textChunking
TextChunkingSpecifies how to split the extracted text into chunks.
dataSourceIdentifier
stringThe unique identifier for the target DataSource. If a matching data source exists, the content is added as new sections; otherwise, a new data source is created.
sectionIdentifiers
IList<string>A list of unique identifiers for the sections corresponding to each attachment. The number of identifiers must match the number of attachments.
metadataCollections
IList<MetadataCollection>An optional list of metadata collections to associate with each imported section. If provided, its count must match the number of attachments.
cancellationToken
CancellationTokenAn optional cancellation token to cancel the operation.
Returns
- Task<DataSource>
A task that resolves to the DataSource containing the imported content.
Exceptions
- ArgumentNullException
Thrown if
attachments
,dataSourceIdentifier
, orsectionIdentifiers
is null or empty.- ArgumentOutOfRangeException
Thrown if the count of
sectionIdentifiers
(ormetadataCollections
, if provided) does not match the number of attachments.