Skip to content

Commit

Permalink
Merge branch 'main' into fix/push-specs-ingestion (generated)
Browse files Browse the repository at this point in the history
Co-authored-by: Pierre Millot <pierre.millot@algolia.com>
  • Loading branch information
algolia-bot and millotp committed Aug 29, 2024
1 parent 6068fe1 commit 1164667
Show file tree
Hide file tree
Showing 66 changed files with 1,085 additions and 896 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
/// </summary>
/// <param name="taskID">Unique identifier of a task.</param>
/// <param name="batchWriteParams">Request body of a Search API `batch` request that will be pushed in the Connectors pipeline.</param>
/// <param name="pushTaskPayload">Request body of a Search API `batch` request that will be pushed in the Connectors pipeline.</param>
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <exception cref="ArgumentException">Thrown when arguments are not correct</exception>
/// <exception cref="Algolia.Search.Exceptions.AlgoliaApiException">Thrown when the API call was rejected by Algolia</exception>
/// <exception cref="Algolia.Search.Exceptions.AlgoliaUnreachableHostException">Thrown when the client failed to call the endpoint</exception>
/// <returns>Task of RunResponse</returns>
Task<RunResponse> PushTaskAsync(string taskID, BatchWriteParams batchWriteParams, RequestOptions options = null, CancellationToken cancellationToken = default);
Task<RunResponse> PushTaskAsync(string taskID, PushTaskPayload pushTaskPayload, RequestOptions options = null, CancellationToken cancellationToken = default);

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

/// <summary>
/// Runs all tasks linked to a source, only available for Shopify sources. It will create 1 run per task.
Expand Down Expand Up @@ -3510,28 +3510,28 @@ public ListTransformationsResponse ListTransformations(int? itemsPerPage = defau
/// - deleteIndex
/// - editSettings
/// <param name="taskID">Unique identifier of a task.</param>
/// <param name="batchWriteParams">Request body of a Search API &#x60;batch&#x60; request that will be pushed in the Connectors pipeline.</param>
/// <param name="pushTaskPayload">Request body of a Search API &#x60;batch&#x60; request that will be pushed in the Connectors pipeline.</param>
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <exception cref="ArgumentException">Thrown when arguments are not correct</exception>
/// <exception cref="Algolia.Search.Exceptions.AlgoliaApiException">Thrown when the API call was rejected by Algolia</exception>
/// <exception cref="Algolia.Search.Exceptions.AlgoliaUnreachableHostException">Thrown when the client failed to call the endpoint</exception>
/// <returns>Task of RunResponse</returns>
public async Task<RunResponse> PushTaskAsync(string taskID, BatchWriteParams batchWriteParams, RequestOptions options = null, CancellationToken cancellationToken = default)
public async Task<RunResponse> 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<RunResponse>(new HttpMethod("POST"), "/2/tasks/{taskID}/push", requestOptions, cancellationToken).ConfigureAwait(false);
}

Expand All @@ -3545,15 +3545,15 @@ public async Task<RunResponse> PushTaskAsync(string taskID, BatchWriteParams bat
/// - deleteIndex
/// - editSettings
/// <param name="taskID">Unique identifier of a task.</param>
/// <param name="batchWriteParams">Request body of a Search API &#x60;batch&#x60; request that will be pushed in the Connectors pipeline.</param>
/// <param name="pushTaskPayload">Request body of a Search API &#x60;batch&#x60; request that will be pushed in the Connectors pipeline.</param>
/// <param name="options">Add extra http header or query parameters to Algolia.</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <exception cref="ArgumentException">Thrown when arguments are not correct</exception>
/// <exception cref="Algolia.Search.Exceptions.AlgoliaApiException">Thrown when the API call was rejected by Algolia</exception>
/// <exception cref="Algolia.Search.Exceptions.AlgoliaUnreachableHostException">Thrown when the client failed to call the endpoint</exception>
/// <returns>RunResponse</returns>
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));


/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
namespace Algolia.Search.Models.Ingestion;

/// <summary>
/// BatchRequest
/// PushTaskPayload
/// </summary>
public partial class BatchRequest
public partial class PushTaskPayload
{

/// <summary>
Expand All @@ -23,27 +23,26 @@ public partial class BatchRequest
[JsonPropertyName("action")]
public Action? Action { get; set; }
/// <summary>
/// Initializes a new instance of the BatchRequest class.
/// Initializes a new instance of the PushTaskPayload class.
/// </summary>
[JsonConstructor]
public BatchRequest() { }
public PushTaskPayload() { }
/// <summary>
/// Initializes a new instance of the BatchRequest class.
/// Initializes a new instance of the PushTaskPayload class.
/// </summary>
/// <param name="action">action (required).</param>
/// <param name="body">Operation arguments (varies with specified &#x60;action&#x60;). (required).</param>
public BatchRequest(Action? action, object body)
/// <param name="records">records (required).</param>
public PushTaskPayload(Action? action, List<PushTaskRecords> records)
{
Action = action;
Body = body ?? throw new ArgumentNullException(nameof(body));
Records = records ?? throw new ArgumentNullException(nameof(records));
}

/// <summary>
/// Operation arguments (varies with specified `action`).
/// Gets or Sets Records
/// </summary>
/// <value>Operation arguments (varies with specified `action`).</value>
[JsonPropertyName("body")]
public object Body { get; set; }
[JsonPropertyName("records")]
public List<PushTaskRecords> Records { get; set; }

/// <summary>
/// Returns the string presentation of the object
Expand All @@ -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();
}
Expand All @@ -75,14 +74,14 @@ public virtual string ToJson()
/// <returns>Boolean</returns>
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));
}

/// <summary>
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,40 @@
namespace Algolia.Search.Models.Ingestion;

/// <summary>
/// Batch parameters.
/// PushTaskRecords
/// </summary>
public partial class BatchWriteParams
public partial class PushTaskRecords
{
/// <summary>
/// Initializes a new instance of the BatchWriteParams class.
/// Initializes a new instance of the PushTaskRecords class.
/// </summary>
[JsonConstructor]
public BatchWriteParams() { }
public PushTaskRecords()
{
AdditionalProperties = new Dictionary<string, object>();
}
/// <summary>
/// Initializes a new instance of the BatchWriteParams class.
/// Initializes a new instance of the PushTaskRecords class.
/// </summary>
/// <param name="requests">requests (required).</param>
public BatchWriteParams(List<BatchRequest> requests)
/// <param name="objectID">Unique record identifier. (required).</param>
public PushTaskRecords(string objectID)
{
Requests = requests ?? throw new ArgumentNullException(nameof(requests));
ObjectID = objectID ?? throw new ArgumentNullException(nameof(objectID));
AdditionalProperties = new Dictionary<string, object>();
}

/// <summary>
/// Gets or Sets Requests
/// Unique record identifier.
/// </summary>
[JsonPropertyName("requests")]
public List<BatchRequest> Requests { get; set; }
/// <value>Unique record identifier.</value>
[JsonPropertyName("objectID")]
public string ObjectID { get; set; }

/// <summary>
/// Gets or Sets additional properties
/// </summary>
[JsonExtensionData]
public IDictionary<string, object> AdditionalProperties { get; set; }

/// <summary>
/// Returns the string presentation of the object
Expand All @@ -43,8 +54,9 @@ public BatchWriteParams(List<BatchRequest> 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();
}
Expand All @@ -65,13 +77,14 @@ public virtual string ToJson()
/// <returns>Boolean</returns>
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());
}

/// <summary>
Expand All @@ -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;
}
Expand Down
32 changes: 16 additions & 16 deletions clients/algoliasearch-client-go/algolia/ingestion/api_ingestion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1164667

Please sign in to comment.