From 409fa45b1da993ec8178d6cb53977aa92cd4c3cc Mon Sep 17 00:00:00 2001 From: algolia-bot Date: Wed, 22 Jan 2025 09:52:37 +0000 Subject: [PATCH] docs: lot of guides (generated) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/algolia/api-clients-automation/pull/4355 Co-authored-by: algolia-bot Co-authored-by: Clément Vannicatte Co-authored-by: Morgan Leroi Co-authored-by: Pierre Millot Co-authored-by: Thomas Raffray --- algoliasearch/Utils/SearchClientExtensions.cs | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) 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,