Skip to content

Commit 97f28fd

Browse files
committed
feat(csharp): update SaveObjectsWithTransformation and PartialUpdateObjectsWithTransformation methods to accept IEnumerable<object> for enhanced flexibility
1 parent 54be615 commit 97f28fd

File tree

1 file changed

+24
-32
lines changed

1 file changed

+24
-32
lines changed

clients/algoliasearch-client-csharp/algoliasearch/Utils/SearchClientExtensions.cs

Lines changed: 24 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -434,26 +434,24 @@ List<BatchResponse> PartialUpdateObjects<T>(
434434
/// <param name="batchSize">The size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.</param>
435435
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
436436
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
437-
Task<List<Algolia.Search.Models.Ingestion.WatchResponse>> SaveObjectsWithTransformationAsync<T>(
437+
Task<List<Algolia.Search.Models.Ingestion.WatchResponse>> SaveObjectsWithTransformationAsync(
438438
string indexName,
439-
IEnumerable<T> objects,
439+
IEnumerable<object> objects,
440440
bool waitForTasks = false,
441441
int batchSize = 1000,
442442
RequestOptions options = null,
443443
CancellationToken cancellationToken = default
444-
)
445-
where T : class;
444+
);
446445

447-
/// <inheritdoc cref="SaveObjectsWithTransformationAsync{T}(string, IEnumerable{T}, bool, int, RequestOptions, CancellationToken)"/>
448-
List<Algolia.Search.Models.Ingestion.WatchResponse> SaveObjectsWithTransformation<T>(
446+
/// <inheritdoc cref="SaveObjectsWithTransformationAsync(string, IEnumerable{object}, bool, int, RequestOptions, CancellationToken)"/>
447+
List<Algolia.Search.Models.Ingestion.WatchResponse> SaveObjectsWithTransformation(
449448
string indexName,
450-
IEnumerable<T> objects,
449+
IEnumerable<object> objects,
451450
bool waitForTasks = false,
452451
int batchSize = 1000,
453452
RequestOptions options = null,
454453
CancellationToken cancellationToken = default
455-
)
456-
where T : class;
454+
);
457455

458456
/// <summary>
459457
/// Helper: Similar to the `PartialUpdateObjects` method but requires a Push connector to be created first,
@@ -469,28 +467,26 @@ List<BatchResponse> PartialUpdateObjects<T>(
469467
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
470468
Task<
471469
List<Algolia.Search.Models.Ingestion.WatchResponse>
472-
> PartialUpdateObjectsWithTransformationAsync<T>(
470+
> PartialUpdateObjectsWithTransformationAsync(
473471
string indexName,
474-
IEnumerable<T> objects,
472+
IEnumerable<object> objects,
475473
bool createIfNotExists = true,
476474
bool waitForTasks = false,
477475
int batchSize = 1000,
478476
RequestOptions options = null,
479477
CancellationToken cancellationToken = default
480-
)
481-
where T : class;
478+
);
482479

483-
/// <inheritdoc cref="PartialUpdateObjectsWithTransformationAsync{T}(string, IEnumerable{T}, bool, bool, int, RequestOptions, CancellationToken)"/>
484-
List<Algolia.Search.Models.Ingestion.WatchResponse> PartialUpdateObjectsWithTransformation<T>(
480+
/// <inheritdoc cref="PartialUpdateObjectsWithTransformationAsync(string, IEnumerable{object}, bool, bool, int, RequestOptions, CancellationToken)"/>
481+
List<Algolia.Search.Models.Ingestion.WatchResponse> PartialUpdateObjectsWithTransformation(
485482
string indexName,
486-
IEnumerable<T> objects,
483+
IEnumerable<object> objects,
487484
bool createIfNotExists = true,
488485
bool waitForTasks = false,
489486
int batchSize = 1000,
490487
RequestOptions options = null,
491488
CancellationToken cancellationToken = default
492-
)
493-
where T : class;
489+
);
494490

495491
/// <summary>
496492
/// Helper: Similar to the `ReplaceAllObjects` method but requires a Push connector to be created first,
@@ -1250,15 +1246,14 @@ public bool IndexExists(string indexName, CancellationToken cancellationToken =
12501246
/// <inheritdoc/>
12511247
public async Task<
12521248
List<Algolia.Search.Models.Ingestion.WatchResponse>
1253-
> SaveObjectsWithTransformationAsync<T>(
1249+
> SaveObjectsWithTransformationAsync(
12541250
string indexName,
1255-
IEnumerable<T> objects,
1251+
IEnumerable<object> objects,
12561252
bool waitForTasks = false,
12571253
int batchSize = 1000,
12581254
RequestOptions options = null,
12591255
CancellationToken cancellationToken = default
12601256
)
1261-
where T : class
12621257
{
12631258
if (_ingestionTransporter == null)
12641259
{
@@ -1282,15 +1277,14 @@ public async Task<
12821277
}
12831278

12841279
/// <inheritdoc/>
1285-
public List<Algolia.Search.Models.Ingestion.WatchResponse> SaveObjectsWithTransformation<T>(
1280+
public List<Algolia.Search.Models.Ingestion.WatchResponse> SaveObjectsWithTransformation(
12861281
string indexName,
1287-
IEnumerable<T> objects,
1282+
IEnumerable<object> objects,
12881283
bool waitForTasks = false,
12891284
int batchSize = 1000,
12901285
RequestOptions options = null,
12911286
CancellationToken cancellationToken = default
1292-
)
1293-
where T : class =>
1287+
) =>
12941288
AsyncHelper.RunSync(() =>
12951289
SaveObjectsWithTransformationAsync(
12961290
indexName,
@@ -1307,16 +1301,15 @@ public async Task<
13071301
/// <inheritdoc/>
13081302
public async Task<
13091303
List<Algolia.Search.Models.Ingestion.WatchResponse>
1310-
> PartialUpdateObjectsWithTransformationAsync<T>(
1304+
> PartialUpdateObjectsWithTransformationAsync(
13111305
string indexName,
1312-
IEnumerable<T> objects,
1306+
IEnumerable<object> objects,
13131307
bool createIfNotExists = true,
13141308
bool waitForTasks = false,
13151309
int batchSize = 1000,
13161310
RequestOptions options = null,
13171311
CancellationToken cancellationToken = default
13181312
)
1319-
where T : class
13201313
{
13211314
if (_ingestionTransporter == null)
13221315
{
@@ -1344,16 +1337,15 @@ public async Task<
13441337
}
13451338

13461339
/// <inheritdoc/>
1347-
public List<Algolia.Search.Models.Ingestion.WatchResponse> PartialUpdateObjectsWithTransformation<T>(
1340+
public List<Algolia.Search.Models.Ingestion.WatchResponse> PartialUpdateObjectsWithTransformation(
13481341
string indexName,
1349-
IEnumerable<T> objects,
1342+
IEnumerable<object> objects,
13501343
bool createIfNotExists = true,
13511344
bool waitForTasks = false,
13521345
int batchSize = 1000,
13531346
RequestOptions options = null,
13541347
CancellationToken cancellationToken = default
1355-
)
1356-
where T : class =>
1348+
) =>
13571349
AsyncHelper.RunSync(() =>
13581350
PartialUpdateObjectsWithTransformationAsync(
13591351
indexName,

0 commit comments

Comments
 (0)