Skip to content

Commit 409fa45

Browse files
algolia-botshortcutsmorganleroimillotpFluf22
committed
docs: lot of guides (generated)
algolia/api-clients-automation#4355 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]> Co-authored-by: Morgan Leroi <[email protected]> Co-authored-by: Pierre Millot <[email protected]> Co-authored-by: Thomas Raffray <[email protected]>
1 parent 917f215 commit 409fa45

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

algoliasearch/Utils/SearchClientExtensions.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,18 @@ public partial interface ISearchClient
176176
/// <inheritdoc cref="SaveObjectsAsync{T}(string, IEnumerable{T}, RequestOptions, CancellationToken)"/>
177177
List<BatchResponse> SaveObjects<T>(string indexName, IEnumerable<T> objects, bool waitForTasks = false, int batchSize = 1000, RequestOptions options = null, CancellationToken cancellationToken = default) where T : class;
178178

179+
/// <summary>
180+
/// 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.
181+
/// </summary>
182+
/// <param name="indexName">The index in which to perform the request.</param>
183+
/// <param name="objects">The list of `objects` to store in the given Algolia `indexName`.</param>
184+
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
185+
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
186+
/// <typeparam name="T"></typeparam>
187+
Task<List<BatchResponse>> SaveObjectsAsync<T>(string indexName, IEnumerable<T> objects, RequestOptions options, CancellationToken cancellationToken = default) where T : class;
188+
/// <inheritdoc cref="SaveObjectsAsync{T}(string, IEnumerable{T}, RequestOptions, CancellationToken)"/>
189+
List<BatchResponse> SaveObjects<T>(string indexName, IEnumerable<T> objects, RequestOptions options, CancellationToken cancellationToken = default) where T : class;
190+
179191
/// <summary>
180192
/// 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.
181193
/// </summary>
@@ -598,6 +610,19 @@ public List<BatchResponse> SaveObjects<T>(string indexName, IEnumerable<T> objec
598610
CancellationToken cancellationToken = default) where T : class =>
599611
AsyncHelper.RunSync(() => SaveObjectsAsync(indexName, objects, waitForTasks, batchSize, options, cancellationToken));
600612

613+
/// <inheritdoc/>
614+
public async Task<List<BatchResponse>> SaveObjectsAsync<T>(string indexName, IEnumerable<T> objects,
615+
RequestOptions options,
616+
CancellationToken cancellationToken = default) where T : class
617+
{
618+
return await SaveObjectsAsync(indexName, objects, false, 1000, options, cancellationToken).ConfigureAwait(false);
619+
}
620+
621+
/// <inheritdoc/>
622+
public List<BatchResponse> SaveObjects<T>(string indexName, IEnumerable<T> objects, RequestOptions options,
623+
CancellationToken cancellationToken = default) where T : class =>
624+
AsyncHelper.RunSync(() => SaveObjectsAsync(indexName, objects, options, cancellationToken));
625+
601626
/// <inheritdoc/>
602627
public async Task<List<BatchResponse>> DeleteObjectsAsync(string indexName, IEnumerable<String> objectIDs,
603628
bool waitForTasks = false,

0 commit comments

Comments
 (0)