diff --git a/algoliasearch/Utils/SearchClientExtensions.cs b/algoliasearch/Utils/SearchClientExtensions.cs index c9ba2b3f..03c2b681 100644 --- a/algoliasearch/Utils/SearchClientExtensions.cs +++ b/algoliasearch/Utils/SearchClientExtensions.cs @@ -176,6 +176,18 @@ public partial interface ISearchClient /// List SaveObjects(string indexName, IEnumerable objects, bool waitForTasks = false, int batchSize = 1000, RequestOptions options = null, CancellationToken cancellationToken = default) where T : class; + /// + /// Helper: Saves the given array of objects in the given index. The `chunkedBatch` helper is used under the hood, which creates a `batch` requests with at most 1000 objects in it. + /// + /// The index in which to perform the request. + /// The list of `objects` to store in the given Algolia `indexName`. + /// Add extra http header or query parameters to Algolia. + /// Cancellation Token to cancel the request. + /// + Task> SaveObjectsAsync(string indexName, IEnumerable objects, RequestOptions options, CancellationToken cancellationToken = default) where T : class; + /// + List SaveObjects(string indexName, IEnumerable objects, RequestOptions options, CancellationToken cancellationToken = default) where T : class; + /// /// Helper: Deletes every records for the given objectIDs. The `chunkedBatch` helper is used under the hood, which creates a `batch` requests with at most 1000 objectIDs in it. /// @@ -598,6 +610,19 @@ public List SaveObjects(string indexName, IEnumerable objec CancellationToken cancellationToken = default) where T : class => AsyncHelper.RunSync(() => SaveObjectsAsync(indexName, objects, waitForTasks, batchSize, options, cancellationToken)); + /// + public async Task> SaveObjectsAsync(string indexName, IEnumerable objects, + RequestOptions options, + CancellationToken cancellationToken = default) where T : class + { + return await SaveObjectsAsync(indexName, objects, false, 1000, options, cancellationToken).ConfigureAwait(false); + } + + /// + public List SaveObjects(string indexName, IEnumerable objects, RequestOptions options, + CancellationToken cancellationToken = default) where T : class => + AsyncHelper.RunSync(() => SaveObjectsAsync(indexName, objects, options, cancellationToken)); + /// public async Task> DeleteObjectsAsync(string indexName, IEnumerable objectIDs, bool waitForTasks = false,