From 33488379d486af6aa1443ab34413f4cf105f57c6 Mon Sep 17 00:00:00 2001 From: algolia-bot Date: Thu, 29 Aug 2024 14:07:54 +0000 Subject: [PATCH] fix(specs): ingestion push task payload [skip-bc] (generated) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/algolia/api-clients-automation/pull/3607 Co-authored-by: algolia-bot Co-authored-by: Clément Vannicatte Co-authored-by: Pierre Millot --- algoliasearch/Clients/IngestionClient.cs | 24 ++++----- .../{BatchRequest.cs => PushTaskPayload.cs} | 35 +++++++------ ...BatchWriteParams.cs => PushTaskRecords.cs} | 51 ++++++++++++------- 3 files changed, 63 insertions(+), 47 deletions(-) rename algoliasearch/Models/Ingestion/{BatchRequest.cs => PushTaskPayload.cs} (68%) rename algoliasearch/Models/Ingestion/{BatchWriteParams.cs => PushTaskRecords.cs} (51%) diff --git a/algoliasearch/Clients/IngestionClient.cs b/algoliasearch/Clients/IngestionClient.cs index 4075b6501..220c334a6 100644 --- a/algoliasearch/Clients/IngestionClient.cs +++ b/algoliasearch/Clients/IngestionClient.cs @@ -1051,27 +1051,27 @@ public interface IIngestionClient /// Push a `batch` request payload through the Pipeline. You can check the status of task pushes with the observability endpoints. /// /// Unique identifier of a task. - /// Request body of a Search API `batch` request that will be pushed in the Connectors pipeline. + /// Request body of a Search API `batch` request that will be pushed in the Connectors pipeline. /// Add extra http header or query parameters to Algolia. /// Cancellation Token to cancel the request. /// Thrown when arguments are not correct /// Thrown when the API call was rejected by Algolia /// Thrown when the client failed to call the endpoint /// Task of RunResponse - Task PushTaskAsync(string taskID, BatchWriteParams batchWriteParams, RequestOptions options = null, CancellationToken cancellationToken = default); + Task PushTaskAsync(string taskID, PushTaskPayload pushTaskPayload, RequestOptions options = null, CancellationToken cancellationToken = default); /// /// Push a `batch` request payload through the Pipeline. You can check the status of task pushes with the observability endpoints. (Synchronous version) /// /// Unique identifier of a task. - /// Request body of a Search API `batch` request that will be pushed in the Connectors pipeline. + /// Request body of a Search API `batch` request that will be pushed in the Connectors pipeline. /// Add extra http header or query parameters to Algolia. /// Cancellation Token to cancel the request. /// Thrown when arguments are not correct /// Thrown when the API call was rejected by Algolia /// Thrown when the client failed to call the endpoint /// RunResponse - RunResponse PushTask(string taskID, BatchWriteParams batchWriteParams, RequestOptions options = null, CancellationToken cancellationToken = default); + RunResponse PushTask(string taskID, PushTaskPayload pushTaskPayload, RequestOptions options = null, CancellationToken cancellationToken = default); /// /// 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 /// - deleteIndex /// - editSettings /// Unique identifier of a task. - /// Request body of a Search API `batch` request that will be pushed in the Connectors pipeline. + /// Request body of a Search API `batch` request that will be pushed in the Connectors pipeline. /// Add extra http header or query parameters to Algolia. /// Cancellation Token to cancel the request. /// Thrown when arguments are not correct /// Thrown when the API call was rejected by Algolia /// Thrown when the client failed to call the endpoint /// Task of RunResponse - public async Task PushTaskAsync(string taskID, BatchWriteParams batchWriteParams, RequestOptions options = null, CancellationToken cancellationToken = default) + public async Task PushTaskAsync(string taskID, PushTaskPayload pushTaskPayload, RequestOptions options = null, CancellationToken cancellationToken = default) { if (taskID == null) throw new ArgumentException("Parameter `taskID` is required when calling `PushTask`."); - if (batchWriteParams == null) - throw new ArgumentException("Parameter `batchWriteParams` is required when calling `PushTask`."); + if (pushTaskPayload == null) + throw new ArgumentException("Parameter `pushTaskPayload` is required when calling `PushTask`."); var requestOptions = new InternalRequestOptions(options); requestOptions.PathParameters.Add("taskID", QueryStringHelper.ParameterToString(taskID)); - requestOptions.Data = batchWriteParams; + requestOptions.Data = pushTaskPayload; return await _transport.ExecuteRequestAsync(new HttpMethod("POST"), "/2/tasks/{taskID}/push", requestOptions, cancellationToken).ConfigureAwait(false); } @@ -3545,15 +3545,15 @@ public async Task PushTaskAsync(string taskID, BatchWriteParams bat /// - deleteIndex /// - editSettings /// Unique identifier of a task. - /// Request body of a Search API `batch` request that will be pushed in the Connectors pipeline. + /// Request body of a Search API `batch` request that will be pushed in the Connectors pipeline. /// Add extra http header or query parameters to Algolia. /// Cancellation Token to cancel the request. /// Thrown when arguments are not correct /// Thrown when the API call was rejected by Algolia /// Thrown when the client failed to call the endpoint /// RunResponse - public RunResponse PushTask(string taskID, BatchWriteParams batchWriteParams, RequestOptions options = null, CancellationToken cancellationToken = default) => - AsyncHelper.RunSync(() => PushTaskAsync(taskID, batchWriteParams, options, cancellationToken)); + public RunResponse PushTask(string taskID, PushTaskPayload pushTaskPayload, RequestOptions options = null, CancellationToken cancellationToken = default) => + AsyncHelper.RunSync(() => PushTaskAsync(taskID, pushTaskPayload, options, cancellationToken)); /// diff --git a/algoliasearch/Models/Ingestion/BatchRequest.cs b/algoliasearch/Models/Ingestion/PushTaskPayload.cs similarity index 68% rename from algoliasearch/Models/Ingestion/BatchRequest.cs rename to algoliasearch/Models/Ingestion/PushTaskPayload.cs index 661b72d28..10e81bee2 100644 --- a/algoliasearch/Models/Ingestion/BatchRequest.cs +++ b/algoliasearch/Models/Ingestion/PushTaskPayload.cs @@ -12,9 +12,9 @@ namespace Algolia.Search.Models.Ingestion; /// -/// BatchRequest +/// PushTaskPayload /// -public partial class BatchRequest +public partial class PushTaskPayload { /// @@ -23,27 +23,26 @@ public partial class BatchRequest [JsonPropertyName("action")] public Action? Action { get; set; } /// - /// Initializes a new instance of the BatchRequest class. + /// Initializes a new instance of the PushTaskPayload class. /// [JsonConstructor] - public BatchRequest() { } + public PushTaskPayload() { } /// - /// Initializes a new instance of the BatchRequest class. + /// Initializes a new instance of the PushTaskPayload class. /// /// action (required). - /// Operation arguments (varies with specified `action`). (required). - public BatchRequest(Action? action, object body) + /// records (required). + public PushTaskPayload(Action? action, List records) { Action = action; - Body = body ?? throw new ArgumentNullException(nameof(body)); + Records = records ?? throw new ArgumentNullException(nameof(records)); } /// - /// Operation arguments (varies with specified `action`). + /// Gets or Sets Records /// - /// Operation arguments (varies with specified `action`). - [JsonPropertyName("body")] - public object Body { get; set; } + [JsonPropertyName("records")] + public List Records { get; set; } /// /// Returns the string presentation of the object @@ -52,9 +51,9 @@ public BatchRequest(Action? action, object body) public override string ToString() { StringBuilder sb = new StringBuilder(); - sb.Append("class BatchRequest {\n"); + sb.Append("class PushTaskPayload {\n"); sb.Append(" Action: ").Append(Action).Append("\n"); - sb.Append(" Body: ").Append(Body).Append("\n"); + sb.Append(" Records: ").Append(Records).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -75,14 +74,14 @@ public virtual string ToJson() /// Boolean public override bool Equals(object obj) { - if (obj is not BatchRequest input) + if (obj is not PushTaskPayload input) { return false; } return (Action == input.Action || Action.Equals(input.Action)) && - (Body == input.Body || (Body != null && Body.Equals(input.Body))); + (Records == input.Records || Records != null && input.Records != null && Records.SequenceEqual(input.Records)); } /// @@ -95,9 +94,9 @@ public override int GetHashCode() { int hashCode = 41; hashCode = (hashCode * 59) + Action.GetHashCode(); - if (Body != null) + if (Records != null) { - hashCode = (hashCode * 59) + Body.GetHashCode(); + hashCode = (hashCode * 59) + Records.GetHashCode(); } return hashCode; } diff --git a/algoliasearch/Models/Ingestion/BatchWriteParams.cs b/algoliasearch/Models/Ingestion/PushTaskRecords.cs similarity index 51% rename from algoliasearch/Models/Ingestion/BatchWriteParams.cs rename to algoliasearch/Models/Ingestion/PushTaskRecords.cs index b0ae03338..0d051895a 100644 --- a/algoliasearch/Models/Ingestion/BatchWriteParams.cs +++ b/algoliasearch/Models/Ingestion/PushTaskRecords.cs @@ -12,29 +12,40 @@ namespace Algolia.Search.Models.Ingestion; /// -/// Batch parameters. +/// PushTaskRecords /// -public partial class BatchWriteParams +public partial class PushTaskRecords { /// - /// Initializes a new instance of the BatchWriteParams class. + /// Initializes a new instance of the PushTaskRecords class. /// [JsonConstructor] - public BatchWriteParams() { } + public PushTaskRecords() + { + AdditionalProperties = new Dictionary(); + } /// - /// Initializes a new instance of the BatchWriteParams class. + /// Initializes a new instance of the PushTaskRecords class. /// - /// requests (required). - public BatchWriteParams(List requests) + /// Unique record identifier. (required). + public PushTaskRecords(string objectID) { - Requests = requests ?? throw new ArgumentNullException(nameof(requests)); + ObjectID = objectID ?? throw new ArgumentNullException(nameof(objectID)); + AdditionalProperties = new Dictionary(); } /// - /// Gets or Sets Requests + /// Unique record identifier. /// - [JsonPropertyName("requests")] - public List Requests { get; set; } + /// Unique record identifier. + [JsonPropertyName("objectID")] + public string ObjectID { get; set; } + + /// + /// Gets or Sets additional properties + /// + [JsonExtensionData] + public IDictionary AdditionalProperties { get; set; } /// /// Returns the string presentation of the object @@ -43,8 +54,9 @@ public BatchWriteParams(List requests) public override string ToString() { StringBuilder sb = new StringBuilder(); - sb.Append("class BatchWriteParams {\n"); - sb.Append(" Requests: ").Append(Requests).Append("\n"); + sb.Append("class PushTaskRecords {\n"); + sb.Append(" ObjectID: ").Append(ObjectID).Append("\n"); + sb.Append(" AdditionalProperties: ").Append(AdditionalProperties).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -65,13 +77,14 @@ public virtual string ToJson() /// Boolean public override bool Equals(object obj) { - if (obj is not BatchWriteParams input) + if (obj is not PushTaskRecords input) { return false; } return - (Requests == input.Requests || Requests != null && input.Requests != null && Requests.SequenceEqual(input.Requests)); + (ObjectID == input.ObjectID || (ObjectID != null && ObjectID.Equals(input.ObjectID))) + && (AdditionalProperties.Count == input.AdditionalProperties.Count && !AdditionalProperties.Except(input.AdditionalProperties).Any()); } /// @@ -83,9 +96,13 @@ public override int GetHashCode() unchecked // Overflow is fine, just wrap { int hashCode = 41; - if (Requests != null) + if (ObjectID != null) + { + hashCode = (hashCode * 59) + ObjectID.GetHashCode(); + } + if (AdditionalProperties != null) { - hashCode = (hashCode * 59) + Requests.GetHashCode(); + hashCode = (hashCode * 59) + AdditionalProperties.GetHashCode(); } return hashCode; }