Skip to content

Commit 3348837

Browse files
algolia-botshortcutsmillotp
committed
fix(specs): ingestion push task payload [skip-bc] (generated)
algolia/api-clients-automation#3607 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]> Co-authored-by: Pierre Millot <[email protected]>
1 parent d7de084 commit 3348837

File tree

3 files changed

+63
-47
lines changed

3 files changed

+63
-47
lines changed

algoliasearch/Clients/IngestionClient.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,27 +1051,27 @@ public interface IIngestionClient
10511051
/// Push a `batch` request payload through the Pipeline. You can check the status of task pushes with the observability endpoints.
10521052
/// </summary>
10531053
/// <param name="taskID">Unique identifier of a task.</param>
1054-
/// <param name="batchWriteParams">Request body of a Search API `batch` request that will be pushed in the Connectors pipeline.</param>
1054+
/// <param name="pushTaskPayload">Request body of a Search API `batch` request that will be pushed in the Connectors pipeline.</param>
10551055
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
10561056
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
10571057
/// <exception cref="ArgumentException">Thrown when arguments are not correct</exception>
10581058
/// <exception cref="Algolia.Search.Exceptions.AlgoliaApiException">Thrown when the API call was rejected by Algolia</exception>
10591059
/// <exception cref="Algolia.Search.Exceptions.AlgoliaUnreachableHostException">Thrown when the client failed to call the endpoint</exception>
10601060
/// <returns>Task of RunResponse</returns>
1061-
Task<RunResponse> PushTaskAsync(string taskID, BatchWriteParams batchWriteParams, RequestOptions options = null, CancellationToken cancellationToken = default);
1061+
Task<RunResponse> PushTaskAsync(string taskID, PushTaskPayload pushTaskPayload, RequestOptions options = null, CancellationToken cancellationToken = default);
10621062

10631063
/// <summary>
10641064
/// Push a `batch` request payload through the Pipeline. You can check the status of task pushes with the observability endpoints. (Synchronous version)
10651065
/// </summary>
10661066
/// <param name="taskID">Unique identifier of a task.</param>
1067-
/// <param name="batchWriteParams">Request body of a Search API `batch` request that will be pushed in the Connectors pipeline.</param>
1067+
/// <param name="pushTaskPayload">Request body of a Search API `batch` request that will be pushed in the Connectors pipeline.</param>
10681068
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
10691069
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
10701070
/// <exception cref="ArgumentException">Thrown when arguments are not correct</exception>
10711071
/// <exception cref="Algolia.Search.Exceptions.AlgoliaApiException">Thrown when the API call was rejected by Algolia</exception>
10721072
/// <exception cref="Algolia.Search.Exceptions.AlgoliaUnreachableHostException">Thrown when the client failed to call the endpoint</exception>
10731073
/// <returns>RunResponse</returns>
1074-
RunResponse PushTask(string taskID, BatchWriteParams batchWriteParams, RequestOptions options = null, CancellationToken cancellationToken = default);
1074+
RunResponse PushTask(string taskID, PushTaskPayload pushTaskPayload, RequestOptions options = null, CancellationToken cancellationToken = default);
10751075

10761076
/// <summary>
10771077
/// Runs all tasks linked to a source, only available for Shopify sources. It will create 1 run per task.
@@ -3510,28 +3510,28 @@ public ListTransformationsResponse ListTransformations(int? itemsPerPage = defau
35103510
/// - deleteIndex
35113511
/// - editSettings
35123512
/// <param name="taskID">Unique identifier of a task.</param>
3513-
/// <param name="batchWriteParams">Request body of a Search API &#x60;batch&#x60; request that will be pushed in the Connectors pipeline.</param>
3513+
/// <param name="pushTaskPayload">Request body of a Search API &#x60;batch&#x60; request that will be pushed in the Connectors pipeline.</param>
35143514
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
35153515
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
35163516
/// <exception cref="ArgumentException">Thrown when arguments are not correct</exception>
35173517
/// <exception cref="Algolia.Search.Exceptions.AlgoliaApiException">Thrown when the API call was rejected by Algolia</exception>
35183518
/// <exception cref="Algolia.Search.Exceptions.AlgoliaUnreachableHostException">Thrown when the client failed to call the endpoint</exception>
35193519
/// <returns>Task of RunResponse</returns>
3520-
public async Task<RunResponse> PushTaskAsync(string taskID, BatchWriteParams batchWriteParams, RequestOptions options = null, CancellationToken cancellationToken = default)
3520+
public async Task<RunResponse> PushTaskAsync(string taskID, PushTaskPayload pushTaskPayload, RequestOptions options = null, CancellationToken cancellationToken = default)
35213521
{
35223522

35233523
if (taskID == null)
35243524
throw new ArgumentException("Parameter `taskID` is required when calling `PushTask`.");
35253525

35263526

3527-
if (batchWriteParams == null)
3528-
throw new ArgumentException("Parameter `batchWriteParams` is required when calling `PushTask`.");
3527+
if (pushTaskPayload == null)
3528+
throw new ArgumentException("Parameter `pushTaskPayload` is required when calling `PushTask`.");
35293529

35303530
var requestOptions = new InternalRequestOptions(options);
35313531

35323532
requestOptions.PathParameters.Add("taskID", QueryStringHelper.ParameterToString(taskID));
35333533

3534-
requestOptions.Data = batchWriteParams;
3534+
requestOptions.Data = pushTaskPayload;
35353535
return await _transport.ExecuteRequestAsync<RunResponse>(new HttpMethod("POST"), "/2/tasks/{taskID}/push", requestOptions, cancellationToken).ConfigureAwait(false);
35363536
}
35373537

@@ -3545,15 +3545,15 @@ public async Task<RunResponse> PushTaskAsync(string taskID, BatchWriteParams bat
35453545
/// - deleteIndex
35463546
/// - editSettings
35473547
/// <param name="taskID">Unique identifier of a task.</param>
3548-
/// <param name="batchWriteParams">Request body of a Search API &#x60;batch&#x60; request that will be pushed in the Connectors pipeline.</param>
3548+
/// <param name="pushTaskPayload">Request body of a Search API &#x60;batch&#x60; request that will be pushed in the Connectors pipeline.</param>
35493549
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
35503550
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
35513551
/// <exception cref="ArgumentException">Thrown when arguments are not correct</exception>
35523552
/// <exception cref="Algolia.Search.Exceptions.AlgoliaApiException">Thrown when the API call was rejected by Algolia</exception>
35533553
/// <exception cref="Algolia.Search.Exceptions.AlgoliaUnreachableHostException">Thrown when the client failed to call the endpoint</exception>
35543554
/// <returns>RunResponse</returns>
3555-
public RunResponse PushTask(string taskID, BatchWriteParams batchWriteParams, RequestOptions options = null, CancellationToken cancellationToken = default) =>
3556-
AsyncHelper.RunSync(() => PushTaskAsync(taskID, batchWriteParams, options, cancellationToken));
3555+
public RunResponse PushTask(string taskID, PushTaskPayload pushTaskPayload, RequestOptions options = null, CancellationToken cancellationToken = default) =>
3556+
AsyncHelper.RunSync(() => PushTaskAsync(taskID, pushTaskPayload, options, cancellationToken));
35573557

35583558

35593559
/// <summary>

algoliasearch/Models/Ingestion/BatchRequest.cs renamed to algoliasearch/Models/Ingestion/PushTaskPayload.cs

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
namespace Algolia.Search.Models.Ingestion;
1313

1414
/// <summary>
15-
/// BatchRequest
15+
/// PushTaskPayload
1616
/// </summary>
17-
public partial class BatchRequest
17+
public partial class PushTaskPayload
1818
{
1919

2020
/// <summary>
@@ -23,27 +23,26 @@ public partial class BatchRequest
2323
[JsonPropertyName("action")]
2424
public Action? Action { get; set; }
2525
/// <summary>
26-
/// Initializes a new instance of the BatchRequest class.
26+
/// Initializes a new instance of the PushTaskPayload class.
2727
/// </summary>
2828
[JsonConstructor]
29-
public BatchRequest() { }
29+
public PushTaskPayload() { }
3030
/// <summary>
31-
/// Initializes a new instance of the BatchRequest class.
31+
/// Initializes a new instance of the PushTaskPayload class.
3232
/// </summary>
3333
/// <param name="action">action (required).</param>
34-
/// <param name="body">Operation arguments (varies with specified &#x60;action&#x60;). (required).</param>
35-
public BatchRequest(Action? action, object body)
34+
/// <param name="records">records (required).</param>
35+
public PushTaskPayload(Action? action, List<PushTaskRecords> records)
3636
{
3737
Action = action;
38-
Body = body ?? throw new ArgumentNullException(nameof(body));
38+
Records = records ?? throw new ArgumentNullException(nameof(records));
3939
}
4040

4141
/// <summary>
42-
/// Operation arguments (varies with specified `action`).
42+
/// Gets or Sets Records
4343
/// </summary>
44-
/// <value>Operation arguments (varies with specified `action`).</value>
45-
[JsonPropertyName("body")]
46-
public object Body { get; set; }
44+
[JsonPropertyName("records")]
45+
public List<PushTaskRecords> Records { get; set; }
4746

4847
/// <summary>
4948
/// Returns the string presentation of the object
@@ -52,9 +51,9 @@ public BatchRequest(Action? action, object body)
5251
public override string ToString()
5352
{
5453
StringBuilder sb = new StringBuilder();
55-
sb.Append("class BatchRequest {\n");
54+
sb.Append("class PushTaskPayload {\n");
5655
sb.Append(" Action: ").Append(Action).Append("\n");
57-
sb.Append(" Body: ").Append(Body).Append("\n");
56+
sb.Append(" Records: ").Append(Records).Append("\n");
5857
sb.Append("}\n");
5958
return sb.ToString();
6059
}
@@ -75,14 +74,14 @@ public virtual string ToJson()
7574
/// <returns>Boolean</returns>
7675
public override bool Equals(object obj)
7776
{
78-
if (obj is not BatchRequest input)
77+
if (obj is not PushTaskPayload input)
7978
{
8079
return false;
8180
}
8281

8382
return
8483
(Action == input.Action || Action.Equals(input.Action)) &&
85-
(Body == input.Body || (Body != null && Body.Equals(input.Body)));
84+
(Records == input.Records || Records != null && input.Records != null && Records.SequenceEqual(input.Records));
8685
}
8786

8887
/// <summary>
@@ -95,9 +94,9 @@ public override int GetHashCode()
9594
{
9695
int hashCode = 41;
9796
hashCode = (hashCode * 59) + Action.GetHashCode();
98-
if (Body != null)
97+
if (Records != null)
9998
{
100-
hashCode = (hashCode * 59) + Body.GetHashCode();
99+
hashCode = (hashCode * 59) + Records.GetHashCode();
101100
}
102101
return hashCode;
103102
}

algoliasearch/Models/Ingestion/BatchWriteParams.cs renamed to algoliasearch/Models/Ingestion/PushTaskRecords.cs

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,40 @@
1212
namespace Algolia.Search.Models.Ingestion;
1313

1414
/// <summary>
15-
/// Batch parameters.
15+
/// PushTaskRecords
1616
/// </summary>
17-
public partial class BatchWriteParams
17+
public partial class PushTaskRecords
1818
{
1919
/// <summary>
20-
/// Initializes a new instance of the BatchWriteParams class.
20+
/// Initializes a new instance of the PushTaskRecords class.
2121
/// </summary>
2222
[JsonConstructor]
23-
public BatchWriteParams() { }
23+
public PushTaskRecords()
24+
{
25+
AdditionalProperties = new Dictionary<string, object>();
26+
}
2427
/// <summary>
25-
/// Initializes a new instance of the BatchWriteParams class.
28+
/// Initializes a new instance of the PushTaskRecords class.
2629
/// </summary>
27-
/// <param name="requests">requests (required).</param>
28-
public BatchWriteParams(List<BatchRequest> requests)
30+
/// <param name="objectID">Unique record identifier. (required).</param>
31+
public PushTaskRecords(string objectID)
2932
{
30-
Requests = requests ?? throw new ArgumentNullException(nameof(requests));
33+
ObjectID = objectID ?? throw new ArgumentNullException(nameof(objectID));
34+
AdditionalProperties = new Dictionary<string, object>();
3135
}
3236

3337
/// <summary>
34-
/// Gets or Sets Requests
38+
/// Unique record identifier.
3539
/// </summary>
36-
[JsonPropertyName("requests")]
37-
public List<BatchRequest> Requests { get; set; }
40+
/// <value>Unique record identifier.</value>
41+
[JsonPropertyName("objectID")]
42+
public string ObjectID { get; set; }
43+
44+
/// <summary>
45+
/// Gets or Sets additional properties
46+
/// </summary>
47+
[JsonExtensionData]
48+
public IDictionary<string, object> AdditionalProperties { get; set; }
3849

3950
/// <summary>
4051
/// Returns the string presentation of the object
@@ -43,8 +54,9 @@ public BatchWriteParams(List<BatchRequest> requests)
4354
public override string ToString()
4455
{
4556
StringBuilder sb = new StringBuilder();
46-
sb.Append("class BatchWriteParams {\n");
47-
sb.Append(" Requests: ").Append(Requests).Append("\n");
57+
sb.Append("class PushTaskRecords {\n");
58+
sb.Append(" ObjectID: ").Append(ObjectID).Append("\n");
59+
sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n");
4860
sb.Append("}\n");
4961
return sb.ToString();
5062
}
@@ -65,13 +77,14 @@ public virtual string ToJson()
6577
/// <returns>Boolean</returns>
6678
public override bool Equals(object obj)
6779
{
68-
if (obj is not BatchWriteParams input)
80+
if (obj is not PushTaskRecords input)
6981
{
7082
return false;
7183
}
7284

7385
return
74-
(Requests == input.Requests || Requests != null && input.Requests != null && Requests.SequenceEqual(input.Requests));
86+
(ObjectID == input.ObjectID || (ObjectID != null && ObjectID.Equals(input.ObjectID)))
87+
&& (AdditionalProperties.Count == input.AdditionalProperties.Count && !AdditionalProperties.Except(input.AdditionalProperties).Any());
7588
}
7689

7790
/// <summary>
@@ -83,9 +96,13 @@ public override int GetHashCode()
8396
unchecked // Overflow is fine, just wrap
8497
{
8598
int hashCode = 41;
86-
if (Requests != null)
99+
if (ObjectID != null)
100+
{
101+
hashCode = (hashCode * 59) + ObjectID.GetHashCode();
102+
}
103+
if (AdditionalProperties != null)
87104
{
88-
hashCode = (hashCode * 59) + Requests.GetHashCode();
105+
hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode();
89106
}
90107
return hashCode;
91108
}

0 commit comments

Comments
 (0)